changeset 4464:f372807e122b

Merge
author lana
date Wed, 17 Aug 2011 22:47:49 -0700
parents 6664b47ddfd9 (current diff) 2cdbbc4a6359 (diff)
children 4a6dac089eac fbfd97a14af1
files src/share/native/java/lang/fdlibm/src/e_acosh.c src/share/native/java/lang/fdlibm/src/e_gamma.c src/share/native/java/lang/fdlibm/src/e_gamma_r.c src/share/native/java/lang/fdlibm/src/e_j0.c src/share/native/java/lang/fdlibm/src/e_j1.c src/share/native/java/lang/fdlibm/src/e_jn.c src/share/native/java/lang/fdlibm/src/e_lgamma.c src/share/native/java/lang/fdlibm/src/e_lgamma_r.c src/share/native/java/lang/fdlibm/src/s_asinh.c src/share/native/java/lang/fdlibm/src/s_erf.c src/share/native/java/lang/fdlibm/src/w_acosh.c src/share/native/java/lang/fdlibm/src/w_gamma.c src/share/native/java/lang/fdlibm/src/w_gamma_r.c src/share/native/java/lang/fdlibm/src/w_j0.c src/share/native/java/lang/fdlibm/src/w_j1.c src/share/native/java/lang/fdlibm/src/w_jn.c src/share/native/java/lang/fdlibm/src/w_lgamma.c src/share/native/java/lang/fdlibm/src/w_lgamma_r.c
diffstat 191 files changed, 3035 insertions(+), 5152 deletions(-) [+]
line wrap: on
line diff
--- a/make/com/sun/java/pack/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/com/sun/java/pack/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -32,6 +32,8 @@
 LIBRARY = unpack
 PRODUCT = sun
 PGRM = unpack200
+JAVAC_MAX_WARNINGS=true
+JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
 CPLUSPLUSLIBRARY=true
--- a/make/com/sun/nio/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/com/sun/nio/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #
 
 BUILDDIR = ../../..
+SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
+SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
 SUBDIRS = sctp
--- a/make/com/sun/nio/sctp/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/com/sun/nio/sctp/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -31,7 +31,6 @@
 PACKAGE = com.sun.nio.sctp
 LIBRARY = sctp
 PRODUCT = sun
-#OTHER_JAVACFLAGS += -Xmaxwarns 1000 -Xlint
 include $(BUILDDIR)/common/Defs.gmk
 
 #
--- a/make/common/shared/Defs-java.gmk	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/common/shared/Defs-java.gmk	Wed Aug 17 22:47:49 2011 -0700
@@ -116,12 +116,17 @@
   JAVACFLAGS += -g
 endif
 ifeq ($(JAVAC_MAX_WARNINGS), true)
-  JAVACFLAGS  += -Xlint:all
+  JAVAC_LINT_OPTIONS += -Xlint:all
 endif
 ifeq ($(JAVAC_WARNINGS_FATAL), true)
   JAVACFLAGS  += -Werror
 endif
 
+# TODO: Workaround for CR 7063027. Remove -path eventually.
+JAVAC_LINT_OPTIONS += -Xlint:-path
+
+JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
+
 #
 # Some licensees do not get the Security Source bundles.  We will
 # fall back on the prebuilt jce.jar so that we can do a best
@@ -211,16 +216,12 @@
 # The javac options supplied to the boot javac is limited. This compiler
 #   should only be used to build the 'make/tools' sources, which are not
 #   class files that end up in the classes directory.
-ifeq ($(JAVAC_MAX_WARNINGS), true)
-  BOOT_JAVACFLAGS  += -Xlint:all
-endif
+BOOT_JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
 ifeq ($(JAVAC_WARNINGS_FATAL), true)
   BOOT_JAVACFLAGS  += -Werror
 endif
 
-BOOT_SOURCE_LANGUAGE_VERSION = 6
-BOOT_TARGET_CLASS_VERSION = 6
-BOOT_JAVACFLAGS  += -encoding ascii -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
+BOOT_JAVACFLAGS  += -encoding ascii
 BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
 
 BOOT_JAVACFLAGS  += $(NO_PROPRIETARY_API_WARNINGS)
--- a/make/common/shared/Defs-versions.gmk	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/common/shared/Defs-versions.gmk	Wed Aug 17 22:47:49 2011 -0700
@@ -191,7 +191,7 @@
 
 # Generic
 REQUIRED_ANT_VER          = 1.7.1
-REQUIRED_BOOT_VER         = 1.6
+REQUIRED_BOOT_VER         = 1.7
 REQUIRED_FREETYPE_VERSION = 2.3.0
 REQUIRED_MAKE_VER         = 3.81
 REQUIRED_UNZIP_VER        = 5.12
--- a/make/java/fdlibm/FILES_c.gmk	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/java/fdlibm/FILES_c.gmk	Wed Aug 17 22:47:49 2011 -0700
@@ -30,21 +30,13 @@
 	k_sin.c \
 	k_tan.c \
 	e_acos.c \
-	e_acosh.c \
 	e_asin.c \
 	e_atan2.c \
 	e_atanh.c \
 	e_cosh.c \
 	e_exp.c \
 	e_fmod.c \
-	e_gamma.c \
-	e_gamma_r.c \
 	e_hypot.c \
-	e_j0.c \
-	e_j1.c \
-	e_jn.c \
-	e_lgamma.c \
-	e_lgamma_r.c \
 	e_log.c \
 	e_log10.c \
 	e_pow.c \
@@ -54,21 +46,13 @@
 	e_sinh.c \
 	e_sqrt.c \
 	w_acos.c \
-	w_acosh.c \
 	w_asin.c \
 	w_atan2.c \
 	w_atanh.c \
 	w_cosh.c \
 	w_exp.c \
 	w_fmod.c \
-	w_gamma.c \
-	w_gamma_r.c \
 	w_hypot.c \
-	w_j0.c \
-	w_j1.c \
-	w_jn.c \
-	w_lgamma.c \
-	w_lgamma_r.c \
 	w_log.c \
 	w_log10.c \
 	w_pow.c \
@@ -76,13 +60,11 @@
 	w_scalb.c \
 	w_sinh.c \
 	w_sqrt.c \
-	s_asinh.c \
 	s_atan.c \
 	s_cbrt.c \
 	s_ceil.c \
 	s_copysign.c \
 	s_cos.c \
-	s_erf.c \
 	s_expm1.c \
 	s_fabs.c \
 	s_finite.c \
--- a/make/java/java/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/java/java/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -32,6 +32,8 @@
 PACKAGE = java.lang
 LIBRARY = java
 PRODUCT = java
+SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
+SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
 # windows compiler flags
--- a/make/java/math/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/java/math/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 
 PACKAGE = java.math
 PRODUCT = sun
+JAVAC_MAX_WARNINGS = true
+JAVAC_WARNINGS_FATAL = true
 include $(BUILDDIR)/common/Defs.gmk
 
 #
--- a/make/java/nio/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/java/nio/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -31,7 +31,8 @@
 PACKAGE = java.nio
 LIBRARY = nio
 PRODUCT = java
-OTHER_JAVACFLAGS += -Xmaxwarns 1000 -Xlint:serial -Werror
+JAVAC_MAX_WARNINGS = true
+JAVAC_WARNINGS_FATAL = true
 include $(BUILDDIR)/common/Defs.gmk
 
 NIO_SRC = $(SHARE_SRC)/classes/java/nio
--- a/make/java/sun_nio/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/java/sun_nio/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,9 @@
 PACKAGE = sun.nio
 PRODUCT = sun
 
-OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
+JAVAC_MAX_WARNINGS = false
+JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
+JAVAC_WARNINGS_FATAL = true
 include $(BUILDDIR)/common/Defs.gmk
 
 #
--- a/make/jprt.properties	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/jprt.properties	Wed Aug 17 22:47:49 2011 -0700
@@ -25,22 +25,12 @@
 
 # Properties for jprt
 
-# At submit time, the release supplied will be in jprt.submit.release
-#    and will be one of the official release names defined in jprt.
-#    jprt supports property value expansion using ${property.name} syntax.
-
-# This tells jprt what default release we want to build
-jprt.tools.default.release=${jprt.submit.release}
+# Release to build for
+jprt.tools.default.release=jdk8
 
 # The different build flavors we want, we override here so we just get these 2
 jprt.build.flavors=product,fastdebug
 
-# Define the Windows we want (temporary)
-jprt.my.windows.i586.jdk7b107=windows_i586_5.0
-jprt.my.windows.i586.jdk7temp=windows_i586_5.0
-jprt.my.windows.i586.jdk7=windows_i586_5.1
-jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
-
 # Standard list of jprt build targets for this source tree
 jprt.build.targets= 						\
     solaris_sparc_5.10-{product|fastdebug}, 			\
@@ -49,7 +39,7 @@
     solaris_x64_5.10-{product|fastdebug}, 			\
     linux_i586_2.6-{product|fastdebug}, 			\
     linux_x64_2.6-{product|fastdebug}, 				\
-    ${jprt.my.windows.i586}-{product|fastdebug}, 		\
+    windows_i586_5.1-{product|fastdebug}, 			\
     windows_x64_5.2-{product|fastdebug}
 
 # User can select the test set with jprt submit "-testset name" option
@@ -63,7 +53,7 @@
     solaris_x64_5.10-product-c2-jvm98, 				\
     linux_i586_2.6-product-{c1|c2}-jvm98, 			\
     linux_x64_2.6-product-c2-jvm98, 				\
-    ${jprt.my.windows.i586}-product-c1-jvm98, 			\
+    windows_i586_5.1-product-c1-jvm98, 				\
     windows_x64_5.2-product-c2-jvm98
 
 # Select vm testlist to use (allow for testset to be empty too)
@@ -80,7 +70,7 @@
     solaris_x64_5.10-product-c2-jdk_beans1, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_beans1, 			\
     linux_x64_2.6-product-c2-jdk_beans1, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_beans1, 		\
+    windows_i586_5.1-product-c1-jdk_beans1, 			\
     windows_x64_5.2-product-c2-jdk_beans1, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_io, 			\
@@ -89,7 +79,7 @@
     solaris_x64_5.10-product-c2-jdk_io, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_io, 			\
     linux_x64_2.6-product-c2-jdk_io, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_io, 			\
+    windows_i586_5.1-product-c1-jdk_io, 			\
     windows_x64_5.2-product-c2-jdk_io, 				\
     								\
     solaris_sparc_5.10-product-c1-jdk_lang, 			\
@@ -98,7 +88,7 @@
     solaris_x64_5.10-product-c2-jdk_lang, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_lang, 			\
     linux_x64_2.6-product-c2-jdk_lang, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_lang, 		\
+    windows_i586_5.1-product-c1-jdk_lang, 			\
     windows_x64_5.2-product-c2-jdk_lang, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_math, 			\
@@ -107,7 +97,7 @@
     solaris_x64_5.10-product-c2-jdk_math, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_math, 			\
     linux_x64_2.6-product-c2-jdk_math, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_math, 		\
+    windows_i586_5.1-product-c1-jdk_math, 			\
     windows_x64_5.2-product-c2-jdk_math, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_misc, 			\
@@ -116,7 +106,7 @@
     solaris_x64_5.10-product-c2-jdk_misc, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_misc, 			\
     linux_x64_2.6-product-c2-jdk_misc, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_misc, 		\
+    windows_i586_5.1-product-c1-jdk_misc, 			\
     windows_x64_5.2-product-c2-jdk_misc, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_net, 			\
@@ -125,7 +115,7 @@
     solaris_x64_5.10-product-c2-jdk_net, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_net, 			\
     linux_x64_2.6-product-c2-jdk_net, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_net, 		\
+    windows_i586_5.1-product-c1-jdk_net, 			\
     windows_x64_5.2-product-c2-jdk_net, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_nio1, 			\
@@ -134,7 +124,7 @@
     solaris_x64_5.10-product-c2-jdk_nio1, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_nio1, 			\
     linux_x64_2.6-product-c2-jdk_nio1, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_nio1, 		\
+    windows_i586_5.1-product-c1-jdk_nio1, 			\
     windows_x64_5.2-product-c2-jdk_nio1, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_nio2, 			\
@@ -143,7 +133,7 @@
     solaris_x64_5.10-product-c2-jdk_nio2, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_nio2, 			\
     linux_x64_2.6-product-c2-jdk_nio2, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_nio2, 		\
+    windows_i586_5.1-product-c1-jdk_nio2, 			\
     windows_x64_5.2-product-c2-jdk_nio2, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_nio3, 			\
@@ -152,7 +142,7 @@
     solaris_x64_5.10-product-c2-jdk_nio3, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_nio3, 			\
     linux_x64_2.6-product-c2-jdk_nio3, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_nio3, 		\
+    windows_i586_5.1-product-c1-jdk_nio3, 			\
     windows_x64_5.2-product-c2-jdk_nio3, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_security1, 		\
@@ -161,7 +151,7 @@
     solaris_x64_5.10-product-c2-jdk_security1, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_security1, 		\
     linux_x64_2.6-product-c2-jdk_security1, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_security1, 		\
+    windows_i586_5.1-product-c1-jdk_security1, 			\
     windows_x64_5.2-product-c2-jdk_security1, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_text, 			\
@@ -170,7 +160,7 @@
     solaris_x64_5.10-product-c2-jdk_text, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_text, 			\
     linux_x64_2.6-product-c2-jdk_text, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_text, 		\
+    windows_i586_5.1-product-c1-jdk_text, 			\
     windows_x64_5.2-product-c2-jdk_text, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_tools1, 			\
@@ -179,7 +169,7 @@
     solaris_x64_5.10-product-c2-jdk_tools1, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_tools1, 			\
     linux_x64_2.6-product-c2-jdk_tools1, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_tools1, 		\
+    windows_i586_5.1-product-c1-jdk_tools1, 			\
     windows_x64_5.2-product-c2-jdk_tools1, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_util, 			\
@@ -188,7 +178,7 @@
     solaris_x64_5.10-product-c2-jdk_util, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_util, 			\
     linux_x64_2.6-product-c2-jdk_util, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_util, 		\
+    windows_i586_5.1-product-c1-jdk_util, 			\
     windows_x64_5.2-product-c2-jdk_util
 
 # All jdk test targets in test/Makefile (still no fastdebug & limited c2)
@@ -202,7 +192,7 @@
     solaris_x64_5.10-product-c2-jdk_awt, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_awt, 			\
     linux_x64_2.6-product-c2-jdk_awt, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_awt, 		\
+    windows_i586_5.1-product-c1-jdk_awt, 			\
     windows_x64_5.2-product-c2-jdk_awt, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_beans2, 			\
@@ -211,7 +201,7 @@
     solaris_x64_5.10-product-c2-jdk_beans2, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_beans2, 			\
     linux_x64_2.6-product-c2-jdk_beans2, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_beans2, 		\
+    windows_i586_5.1-product-c1-jdk_beans2, 			\
     windows_x64_5.2-product-c2-jdk_beans2, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_beans3, 			\
@@ -220,7 +210,7 @@
     solaris_x64_5.10-product-c2-jdk_beans3, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_beans3, 			\
     linux_x64_2.6-product-c2-jdk_beans3, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_beans3, 		\
+    windows_i586_5.1-product-c1-jdk_beans3, 			\
     windows_x64_5.2-product-c2-jdk_beans3, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_management1, 		\
@@ -229,7 +219,7 @@
     solaris_x64_5.10-product-c2-jdk_management1, 		\
     linux_i586_2.6-product-{c1|c2}-jdk_management1, 		\
     linux_x64_2.6-product-c2-jdk_management1, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_management1, 	\
+    windows_i586_5.1-product-c1-jdk_management1, 		\
     windows_x64_5.2-product-c2-jdk_management1, 		\
     								\
     solaris_sparc_5.10-product-c1-jdk_management2, 		\
@@ -238,7 +228,7 @@
     solaris_x64_5.10-product-c2-jdk_management2, 		\
     linux_i586_2.6-product-{c1|c2}-jdk_management2, 		\
     linux_x64_2.6-product-c2-jdk_management2, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_management2, 	\
+    windows_i586_5.1-product-c1-jdk_management2, 		\
     windows_x64_5.2-product-c2-jdk_management2, 		\
     								\
     solaris_sparc_5.10-product-c1-jdk_rmi, 			\
@@ -247,7 +237,7 @@
     solaris_x64_5.10-product-c2-jdk_rmi, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_rmi, 			\
     linux_x64_2.6-product-c2-jdk_rmi, 				\
-    ${jprt.my.windows.i586}-product-c1-jdk_rmi, 		\
+    windows_i586_5.1-product-c1-jdk_rmi, 			\
     windows_x64_5.2-product-c2-jdk_rmi, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_security2, 		\
@@ -256,7 +246,7 @@
     solaris_x64_5.10-product-c2-jdk_security2, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_security2, 		\
     linux_x64_2.6-product-c2-jdk_security2, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_security2, 		\
+    windows_i586_5.1-product-c1-jdk_security2, 			\
     windows_x64_5.2-product-c2-jdk_security2, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_security3, 		\
@@ -265,7 +255,7 @@
     solaris_x64_5.10-product-c2-jdk_security3, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_security3, 		\
     linux_x64_2.6-product-c2-jdk_security3, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_security3, 		\
+    windows_i586_5.1-product-c1-jdk_security3, 			\
     windows_x64_5.2-product-c2-jdk_security3, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_swing, 			\
@@ -274,7 +264,7 @@
     solaris_x64_5.10-product-c2-jdk_swing, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_swing, 			\
     linux_x64_2.6-product-c2-jdk_swing, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_swing, 		\
+    windows_i586_5.1-product-c1-jdk_swing, 			\
     windows_x64_5.2-product-c2-jdk_swing, 			\
     								\
     solaris_sparc_5.10-product-c1-jdk_tools2, 			\
@@ -283,7 +273,7 @@
     solaris_x64_5.10-product-c2-jdk_tools2, 			\
     linux_i586_2.6-product-{c1|c2}-jdk_tools2, 			\
     linux_x64_2.6-product-c2-jdk_tools2, 			\
-    ${jprt.my.windows.i586}-product-c1-jdk_tools2, 		\
+    windows_i586_5.1-product-c1-jdk_tools2, 			\
     windows_x64_5.2-product-c2-jdk_tools2
 
 # JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
--- a/make/sun/nio/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/sun/nio/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
 BUILDDIR = ../..
 PACKAGE = sun.nio
 PRODUCT = sun
+SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
+SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
 SUBDIRS = cs
--- a/make/sun/nio/cs/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/sun/nio/cs/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -36,7 +36,9 @@
 # This re-directs all the class files to a separate location
 CLASSDESTDIR = $(TEMPDIR)/classes
 
-OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
+JAVAC_MAX_WARNINGS = false
+JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
+JAVAC_WARNINGS_FATAL = true
 include $(BUILDDIR)/common/Defs.gmk
 
 #
--- a/make/sun/security/ec/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/sun/security/ec/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -156,7 +156,7 @@
       $(PKGDIR)/ECDSASignature.java \
       $(PKGDIR)/ECKeyPairGenerator.java
 
-  JAVAHFLAGS += -classpath $(CLASSDESTDIR)
+  JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
 
   #
   # C and C++ files
--- a/make/sun/security/mscapi/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/sun/security/mscapi/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -149,7 +149,7 @@
 # Rules
 #
 CLASSDESTDIR = $(TEMPDIR)/classes
-JAVAHFLAGS += -classpath $(CLASSDESTDIR)
+JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
 
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 
--- a/make/tools/Makefile	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/Makefile	Wed Aug 17 22:47:49 2011 -0700
@@ -28,6 +28,8 @@
 #
 
 BUILDDIR = ..
+
+SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
 # Note: freetypecheck is built by Sanity.gmk if needed
--- a/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,8 +114,8 @@
                  */
 
                 out.println(jmi.getJarFileKind().getMarkerChar() + " " + filename);
-                for (Iterator<String> iter = index.iterator(); iter.hasNext(); ) {
-                    out.println(iter.next());
+                for (String entry : index) {
+                    out.println(entry);
                 }
 
             }
@@ -171,8 +171,7 @@
      * A hashmap contains a mapping from the prefix string to
      * a hashset which contains a set of the second level of prefix string.
      */
-    private HashMap<String, HashSet<String>> knownPrefixMap = new
-        HashMap<String, HashSet<String>>();
+    private HashMap<String, HashSet<String>> knownPrefixMap = new HashMap<>();
 
     /*
      * We add maximum 5 second level entries to "sun", "java" and
@@ -195,12 +194,12 @@
         if (indexSet == null) {
             synchronized(this) {
                 if (indexSet == null) {
-                    indexSet = new HashSet<String>();
-                    Enumeration entries = jar.entries();
+                    indexSet = new HashSet<>();
+                    Enumeration<JarEntry> entries = jar.entries();
                     boolean containsOnlyClass = true;
                     boolean containsOnlyResource = true;
                     while (entries.hasMoreElements()) {
-                        JarEntry entry = (JarEntry) entries.nextElement();
+                        JarEntry entry = entries.nextElement();
                         String name = entry.getName();
                         /* We only look at the non-directory entry.
                            MANIFEST file is also skipped. */
@@ -338,9 +337,7 @@
         /* Iterate through the hash map, add the second level package names
          * to the indexSet if has any.
          */
-        for (Iterator<String> keysIterator = knownPrefixMap.keySet().iterator();
-             keysIterator.hasNext();) {
-            String key = keysIterator.next();
+        for (String key : knownPrefixMap.keySet()) {
             HashSet<String> pkgSetStartsWithKey = knownPrefixMap.get(key);
             int setSize = pkgSetStartsWithKey.size();
 
@@ -353,9 +350,8 @@
                 /* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add
                  * them to the indexSet of the MetaIndex object.
                  */
-                for (Iterator<String> secondPkgElements = pkgSetStartsWithKey.iterator();
-                     secondPkgElements.hasNext();) {
-                    indexSet.add(key + "/" + secondPkgElements.next());
+                for (String secondPkgElement : pkgSetStartsWithKey) {
+                    indexSet.add(key + "/" + secondPkgElement);
                 }
             }
         } // end the outer "for"
--- a/make/tools/src/build/tools/compileproperties/CompileProperties.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/compileproperties/CompileProperties.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 
@@ -223,18 +222,16 @@
         if ( ok ) {
             String packageName = inferPackageName(propertiesPath, outputPath);
             System.out.println("inferred package name: " + packageName);
-            List<String> sortedKeys = new ArrayList<String>();
+            List<String> sortedKeys = new ArrayList<>();
             for ( Object key : p.keySet() ) {
                 sortedKeys.add((String)key);
             }
             Collections.sort(sortedKeys);
-            Iterator keys = sortedKeys.iterator();
 
             StringBuffer data = new StringBuffer();
 
-            while (keys.hasNext()) {
-                Object key = keys.next();
-                data.append("            { \"" + escape((String)key) + "\", \"" +
+            for (String key : sortedKeys) {
+                data.append("            { \"" + escape(key) + "\", \"" +
                         escape((String)p.get(key)) + "\" },\n");
             }
 
--- a/make/tools/src/build/tools/dirdiff/DirDiff.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/dirdiff/DirDiff.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -164,7 +164,7 @@
       }
 
       File[] currentGoldenDirs = null;
-      TreeSet goldDirSet = new TreeSet();
+      TreeSet<String> goldDirSet = new TreeSet<>();
       if (goldenDir != null) {
           currentGoldenDirs = goldenDir.listFiles();
           for (int i=0; i<currentGoldenDirs.length; i++) {
--- a/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,9 +63,9 @@
     static PublicMapping mapping = null;
 
     // Hash from name to Integer
-    private Hashtable namesHash = new Hashtable();
+    private Hashtable<String, Integer> namesHash = new Hashtable<>();
     // Vector of all names
-    private Vector namesVector = new Vector();
+    private Vector<String> namesVector = new Vector<>();
 
     /**
      * Create a new DTD.
@@ -87,15 +87,15 @@
         int numNames = namesVector.size();
         out.writeShort((short) (namesVector.size()));
         for (int i = 0; i < namesVector.size(); i++) {
-            String nm = (String) namesVector.elementAt(i);
+            String nm = namesVector.elementAt(i);
             out.writeUTF(nm);
         }
 
         saveEntities(out);
 
         out.writeShort((short) (elements.size()));
-        for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) {
-            saveElement(out, (Element)e.nextElement());
+        for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
+            saveElement(out, e.nextElement());
         }
 
         if (namesVector.size() != numNames) {
@@ -106,21 +106,21 @@
     }
 
     private void buildNamesTable() {
-        for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
-            Entity ent = (Entity) e.nextElement();
+        for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
+            Entity ent = e.nextElement();
             // Do even if not isGeneral().  That way, exclusions and inclusions
             // will definitely have their element.
             getNameId(ent.getName());
         }
-        for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) {
-            Element el = (Element) e.nextElement();
+        for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
+            Element el = e.nextElement();
             getNameId(el.getName());
             for (AttributeList atts = el.getAttributes() ; atts != null ; atts = atts.getNext()) {
                 getNameId(atts.getName());
                 if (atts.getValue() != null) {
                     getNameId(atts.getValue());
                 }
-                Enumeration vals = atts.getValues();
+                Enumeration<?> vals = atts.getValues();
                 while (vals != null && vals.hasMoreElements()) {
                     String s = (String) vals.nextElement();
                     getNameId(s);
@@ -133,9 +133,9 @@
     // The the id of a name from the list of names
     //
     private short getNameId(String name)  {
-        Object o = namesHash.get(name);
+        Integer o = namesHash.get(name);
         if (o != null) {
-            return (short) ((Integer) o).intValue();
+            return (short) o.intValue();
         }
         int i = namesVector.size();
         namesVector.addElement(name);
@@ -149,16 +149,16 @@
      */
     void saveEntities(DataOutputStream out) throws IOException {
         int num = 0;
-        for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
-            Entity ent = (Entity) e.nextElement();
+        for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
+            Entity ent = e.nextElement();
             if (ent.isGeneral()) {
                 num++;
             }
         }
 
         out.writeShort((short) num);
-        for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
-            Entity ent = (Entity) e.nextElement();
+        for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
+            Entity ent = e.nextElement();
             if (ent.isGeneral()) {
                 out.writeShort(getNameId(ent.getName()));
                 out.writeByte(ent.getType() & ~GENERAL);
--- a/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
 public final
 class DTDInputStream extends FilterReader implements DTDConstants {
     public DTD dtd;
-    public Stack stack = new Stack();
+    public Stack<Object> stack = new Stack<>();
     public char str[] = new char[64];
     public int replace = 0;
     public int ln = 1;
@@ -105,6 +105,7 @@
      * parameter entities.
      * [60] 350:22
      */
+    @SuppressWarnings("fallthrough")
     public int read() throws IOException {
         switch (ch) {
           case '%': {
@@ -134,6 +135,7 @@
             switch (ch) {
               case '\r':
                 ln++;
+                /* fall through */
               case ';':
                 ch = in.read();
                 break;
--- a/make/tools/src/build/tools/dtdbuilder/DTDParser.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/dtdbuilder/DTDParser.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
             return null;
         }
 
-        return MessageFormat.format(prop, args);
+        return MessageFormat.format(prop, (Object[])args);
     }
 
     /**
@@ -201,6 +201,7 @@
      * Parse identifier. Uppercase characters are automatically
      * folded to lowercase. Returns falsed if no identifier is found.
      */
+    @SuppressWarnings("fallthrough")
     boolean parseIdentifier(boolean lower) throws IOException {
         switch (ch) {
           case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
@@ -211,6 +212,7 @@
             if (lower) {
                 ch = 'a' + (ch - 'A');
             }
+            /* fall through */
 
           case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
           case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -233,6 +235,7 @@
      * Parses name token. If <code>lower</code> is true, upper case letters
      * are folded to lower case. Returns falsed if no token is found.
      */
+    @SuppressWarnings("fallthrough")
     boolean parseNameToken(boolean lower) throws IOException {
         boolean first = true;
 
@@ -246,6 +249,7 @@
                 if (lower) {
                     ch = 'a' + (ch - 'A');
                 }
+                /* fall through */
 
               case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
               case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -271,8 +275,8 @@
     /**
      * Parse a list of identifiers.
      */
-    Vector parseIdentifierList(boolean lower) throws IOException {
-        Vector elems = new Vector();
+    Vector<String> parseIdentifierList(boolean lower) throws IOException {
+        Vector<String> elems = new Vector<>();
         skipSpace();
         switch (ch) {
           case '(':
@@ -507,7 +511,7 @@
      * [116] 405:6
      */
     void parseElementDeclaration() throws IOException {
-        Vector elems = parseIdentifierList(true);
+        Vector<String> elems = parseIdentifierList(true);
         BitSet inclusions = null;
         BitSet exclusions = null;
         boolean omitStart = false;
@@ -544,26 +548,26 @@
         if ((type == MODEL) || (type == ANY)) {
             if (ch == '-') {
                 ch = in.read();
-                Vector v = parseIdentifierList(true);
+                Vector<String> v = parseIdentifierList(true);
                 exclusions = new BitSet();
-                for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
-                    exclusions.set(dtd.getElement((String)e.nextElement()).getIndex());
+                for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
+                    exclusions.set(dtd.getElement(e.nextElement()).getIndex());
                 }
             }
             if (ch == '+') {
                 ch = in.read();
-                Vector v = parseIdentifierList(true);
+                Vector<String> v = parseIdentifierList(true);
                 inclusions = new BitSet();
-                for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
-                    inclusions.set(dtd.getElement((String)e.nextElement()).getIndex());
+                for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
+                    inclusions.set(dtd.getElement(e.nextElement()).getIndex());
                 }
             }
         }
         expect('>');
 
         if (in.replace == 0) {
-            for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) {
-                dtd.defineElement((String)e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
+            for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
+                dtd.defineElement(e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
             }
         }
     }
@@ -582,7 +586,7 @@
             error("invalid", "attribute value");
             return;
         }
-        atts.type = atts.name2type(getString(0));
+        atts.type = AttributeList.name2type(getString(0));
         skipParameterSpace();
         if (atts.type == NOTATION) {
             atts.values = parseIdentifierList(true);
@@ -593,6 +597,7 @@
      * Parse an attribute value specification.
      * [33] 331:1
      */
+    @SuppressWarnings("fallthrough")
     String parseAttributeValueSpecification() throws IOException {
         int delim = -1;
         switch (ch) {
@@ -627,6 +632,7 @@
                     ch = in.read();
                     return getString(0);
                 }
+                /* fall through */
 
               default:
                 addString(ch & 0xFF);
@@ -648,7 +654,7 @@
                 return;
             }
             skipParameterSpace();
-            atts.modifier = atts.name2type(getString(0));
+            atts.modifier = AttributeList.name2type(getString(0));
             if (atts.modifier != FIXED) {
                 return;
             }
@@ -663,7 +669,7 @@
      * REMIND: associated notation name
      */
     void parseAttlistDeclaration() throws IOException {
-        Vector elems = parseIdentifierList(true);
+        Vector<String> elems = parseIdentifierList(true);
         AttributeList attlist = null, atts = null;
 
         while (parseIdentifier(true)) {
@@ -685,8 +691,8 @@
         expect('>');
 
         if (in.replace == 0) {
-            for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) {
-                dtd.defineAttributes((String)e.nextElement(), attlist);
+            for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
+                dtd.defineAttributes(e.nextElement(), attlist);
             }
         }
     }
@@ -810,6 +816,7 @@
     /**
      * Parse a section of the input upto EOF or ']'.
      */
+    @SuppressWarnings("fallthrough")
     void parseSection() throws IOException {
         while (true) {
             switch (ch) {
@@ -883,6 +890,7 @@
               default:
                 char str[] = {(char)ch};
                 error("invalid.arg", "character", "'" + new String(str) + "' / " + ch);
+                /* fall through */
 
               case ' ':
               case '\t':
--- a/make/tools/src/build/tools/dtdbuilder/PublicMapping.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/dtdbuilder/PublicMapping.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
 final class PublicMapping {
 
     String baseStr;
-    Hashtable tab = new Hashtable();
+    Hashtable<String, String> tab = new Hashtable<>();
 
     /**
      * Create a mapping.
@@ -103,6 +103,6 @@
      */
     public String get(String id) {
         // System.err.println(" id = "+id);
-        return (String) tab.get(id);
+        return tab.get(id);
     }
 }
--- a/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
      * A cache which is used to speed up parseString() whenever it is
      * used to parse a description that has been parsed before
      */
-    private static Hashtable expressionCache = null;
+    private static Hashtable<String, CharSet> expressionCache = null;
 
     /**
      * Builds a CharSet based on a textual description.  For the syntax of
@@ -79,7 +79,7 @@
         // if "s" is in the expression cache, pull the result out
         // of the expresison cache
         if (expressionCache != null) {
-            result = (CharSet)expressionCache.get(s);
+            result = expressionCache.get(s);
         }
 
         // otherwise, use doParseString() to actually parse the string,
@@ -87,7 +87,7 @@
         if (result == null) {
             result = doParseString(s);
             if (expressionCache == null) {
-                expressionCache = new Hashtable();
+                expressionCache = new Hashtable<>();
             }
             expressionCache.put(s, result);
         }
@@ -336,8 +336,8 @@
      * Returns a copy of CharSet's expression cache and sets CharSet's
      * expression cache to empty.
      */
-    public static Hashtable releaseExpressionCache() {
-        Hashtable result = expressionCache;
+    public static Hashtable<String, CharSet> releaseExpressionCache() {
+        Hashtable<String, CharSet> result = expressionCache;
         expressionCache = null;
         return result;
     }
@@ -778,7 +778,7 @@
      * An Enumeration that can be used to extract the character ranges
      * from a CharSet one at a time
      */
-    public class Enumeration implements java.util.Enumeration {
+    public class Enumeration implements java.util.Enumeration<int[]> {
         /**
          * Initializes a CharSet.Enumeration
          */
@@ -798,7 +798,7 @@
         /**
          * Returns the next range in the CarSet
          */
-        public Object nextElement() {
+        public int[] nextElement() {
             int[] result = new int[2];
             result[0] = chars[p++];
             result[1] = chars[p++];
--- a/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,12 +78,12 @@
      * contains "true" for every character category that includes a dictionary
      * character.
      */
-    protected void buildCharCategories(Vector tempRuleList) {
+    protected void buildCharCategories(Vector<String> tempRuleList) {
         super.buildCharCategories(tempRuleList);
 
         categoryFlags = new boolean[categories.size()];
         for (int i = 0; i < categories.size(); i++) {
-            CharSet cs = (CharSet)categories.elementAt(i);
+            CharSet cs = categories.elementAt(i);
             if (!(cs.intersection(dictionaryChars).empty())) {
                 categoryFlags[i] = true;
             }
@@ -95,7 +95,7 @@
     // the function above. This gives us a way to create a separate character
     // category for the dictionary characters even when
     // RuleBasedBreakIteratorBuilder isn't making a distinction.
-    protected void mungeExpressionList(Hashtable expressions) {
+    protected void mungeExpressionList(Hashtable<String, Object> expressions) {
         expressions.put(dictionaryExpression, dictionaryChars);
     }
 
--- a/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,9 +91,9 @@
         try {
             info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
 
-            Enumeration keys = info.getKeys();
+            Enumeration<String> keys = info.getKeys();
             while (keys.hasMoreElements()) {
-                String key = (String)keys.nextElement();
+                String key = keys.nextElement();
 
                 if (key.equals("CharacterData")) {
                     generateDataFile(info.getString(key),
--- a/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,13 +110,13 @@
      * A temporary holding place used for calculating the character categories.
      * This object contains CharSet objects.
      */
-    protected Vector categories = null;
+    protected Vector<CharSet> categories = null;
 
     /**
      * A table used to map parts of regexp text to lists of character
      * categories, rather than having to figure them out from scratch each time
      */
-    protected Hashtable expressions = null;
+    protected Hashtable<String, Object> expressions = null;
 
     /**
      * A temporary holding place for the list of ignore characters
@@ -126,32 +126,32 @@
     /**
      * A temporary holding place where the forward state table is built
      */
-    protected Vector tempStateTable = null;
+    protected Vector<short[]> tempStateTable = null;
 
     /**
      * A list of all the states that have to be filled in with transitions to
      * the next state that is created.  Used when building the state table from
      * the regular expressions.
      */
-    protected Vector decisionPointList = null;
+    protected Vector<Integer> decisionPointList = null;
 
     /**
      * A stack for holding decision point lists.  This is used to handle nested
      * parentheses and braces in regexps.
      */
-    protected Stack decisionPointStack = null;
+    protected Stack<Vector<Integer>> decisionPointStack = null;
 
     /**
      * A list of states that loop back on themselves.  Used to handle .*?
      */
-    protected Vector loopingStates = null;
+    protected Vector<Integer> loopingStates = null;
 
     /**
      * Looping states actually have to be backfilled later in the process
      * than everything else.  This is where a the list of states to backfill
      * is accumulated.  This is also used to handle .*?
      */
-    protected Vector statesToBackfill = null;
+    protected Vector<Integer> statesToBackfill = null;
 
     /**
      * A list mapping pairs of state numbers for states that are to be combined
@@ -159,7 +159,7 @@
      * in the process of making the state table deterministic to prevent
      * infinite recursion.
      */
-    protected Vector mergeList = null;
+    protected Vector<int[]> mergeList = null;
 
     /**
      * A flag that is used to indicate when the list of looping states can
@@ -198,7 +198,7 @@
      * just vectors different parts of the job off to other functions.
      */
     public RuleBasedBreakIteratorBuilder(String description) {
-        Vector tempRuleList = buildRuleList(description);
+        Vector<String> tempRuleList = buildRuleList(description);
         buildCharCategories(tempRuleList);
         buildStateTable(tempRuleList);
         buildBackwardsStateTable(tempRuleList);
@@ -213,7 +213,7 @@
      * variable names)
      * </ul>
      */
-    private Vector buildRuleList(String description) {
+    private Vector<String> buildRuleList(String description) {
         // invariants:
         // - parentheses must be balanced: ()[]{}<>
         // - nothing can be nested inside <>
@@ -240,8 +240,8 @@
         // set up a vector to contain the broken-up description (each entry in the
         // vector is a separate rule) and a stack for keeping track of opening
         // punctuation
-        Vector tempRuleList = new Vector();
-        Stack parenStack = new Stack();
+        Vector<String> tempRuleList = new Vector<>();
+        Stack<Character> parenStack = new Stack<>();
 
         int p = 0;
         int ruleStart = 0;
@@ -326,7 +326,7 @@
                     }
                     parenStack.pop();
                     if (!parenStack.empty()) {
-                        lastOpen = ((Character)(parenStack.peek())).charValue();
+                        lastOpen = parenStack.peek().charValue();
                     }
                     else {
                         lastOpen = '\u0000';
@@ -552,7 +552,8 @@
      * character category numbers everywhere a literal character or a [] expression
      * originally occurred.
      */
-    protected void buildCharCategories(Vector tempRuleList) {
+    @SuppressWarnings("fallthrough")
+    protected void buildCharCategories(Vector<String> tempRuleList) {
         int bracketLevel = 0;
         int p = 0;
         int lineNum = 0;
@@ -560,9 +561,9 @@
         // build hash table of every literal character or [] expression in the rule list
         // and use CharSet.parseString() to derive a CharSet object representing the
         // characters each refers to
-        expressions = new Hashtable();
+        expressions = new Hashtable<>();
         while (lineNum < tempRuleList.size()) {
-            String line = (String)(tempRuleList.elementAt(lineNum));
+            String line = tempRuleList.elementAt(lineNum);
             p = 0;
             while (p < line.length()) {
                 int c = line.codePointAt(p);
@@ -618,7 +619,7 @@
         CharSet.releaseExpressionCache();
 
         // create the temporary category table (which is a vector of CharSet objects)
-        categories = new Vector();
+        categories = new Vector<>();
         if (ignoreChars != null) {
             categories.addElement(ignoreChars);
         }
@@ -643,8 +644,7 @@
         // At no time should a character ever occur in more than one character category.
 
         // for each expression in the expressions list, do...
-        Enumeration iter = expressions.elements();
-        while (iter.hasMoreElements()) {
+        for (Enumeration<Object> iter = expressions.elements(); iter.hasMoreElements(); ) {
             // initialize the working char set to the chars in the current expression
             CharSet e = (CharSet)iter.nextElement();
 
@@ -653,7 +653,7 @@
 
                 // if there's overlap between the current working set of chars
                 // and the current category...
-                CharSet that = (CharSet)(categories.elementAt(j));
+                CharSet that = categories.elementAt(j);
                 if (!that.intersection(e).empty()) {
 
                     // add a new category for the characters that were in the
@@ -686,9 +686,9 @@
         // up in some other category
         CharSet allChars = new CharSet();
         for (int i = 1; i < categories.size(); i++) {
-            allChars = allChars.union((CharSet)(categories.elementAt(i)));
+            allChars = allChars.union(categories.elementAt(i));
         }
-        CharSet ignoreChars = (CharSet)(categories.elementAt(0));
+        CharSet ignoreChars = categories.elementAt(0);
         ignoreChars = ignoreChars.difference(allChars);
         categories.setElementAt(ignoreChars, 0);
 
@@ -697,9 +697,9 @@
         // character categories that expression refers to.  The String is encoded: each
         // character is a character category number (plus 0x100 to avoid confusing them
         // with syntax characters in the rule grammar)
-        iter = expressions.keys();
-        while (iter.hasMoreElements()) {
-            String key = (String)iter.nextElement();
+
+        for (Enumeration<String> iter = expressions.keys(); iter.hasMoreElements(); ) {
+            String key = iter.nextElement();
             CharSet cs = (CharSet)expressions.get(key);
             StringBuffer cats = new StringBuffer();
 
@@ -707,7 +707,7 @@
             for (int j = 0; j < categories.size(); j++) {
 
                 // if the current expression contains characters in that category...
-                CharSet temp = cs.intersection((CharSet)(categories.elementAt(j)));
+                CharSet temp = cs.intersection(categories.elementAt(j));
                 if (!temp.empty()) {
 
                     // then add the encoded category number to the String for this
@@ -732,12 +732,12 @@
 
         // for each category...
         for (int i = 0; i < categories.size(); i++) {
-            CharSet chars = (CharSet)(categories.elementAt(i));
+            CharSet chars = categories.elementAt(i);
 
             // go through the character ranges in the category one by one...
-            Enumeration enum_ = chars.getChars();
+            Enumeration<int[]> enum_ = chars.getChars();
             while (enum_.hasMoreElements()) {
-                int[] range = (int[])(enum_.nextElement());
+                int[] range = enum_.nextElement();
 
                 // and set the corresponding elements in the CompactArray accordingly
                 if (i != 0) {
@@ -782,7 +782,7 @@
         numCategories = categories.size();
     }
 
-    protected void mungeExpressionList(Hashtable expressions) {
+    protected void mungeExpressionList(Hashtable<String, Object> expressions) {
         // empty in the parent class.  This function provides a hook for subclasses
         // to mess with the character category table.
     }
@@ -792,19 +792,19 @@
      * work is done in parseRule(), which is called once for each rule in the
      * description.
      */
-    private void buildStateTable(Vector tempRuleList) {
+    private void buildStateTable(Vector<String> tempRuleList) {
         // initialize our temporary state table, and fill it with two states:
         // state 0 is a dummy state that allows state 1 to be the starting state
         // and 0 to represent "stop".  State 1 is added here to seed things
         // before we start parsing
-        tempStateTable = new Vector();
+        tempStateTable = new Vector<>();
         tempStateTable.addElement(new short[numCategories + 1]);
         tempStateTable.addElement(new short[numCategories + 1]);
 
         // call parseRule() for every rule in the rule list (except those which
         // start with !, which are actually backwards-iteration rules)
         for (int i = 0; i < tempRuleList.size(); i++) {
-            String rule = (String)tempRuleList.elementAt(i);
+            String rule = tempRuleList.elementAt(i);
             if (rule.charAt(0) != '!') {
                 parseRule(rule, true);
             }
@@ -891,10 +891,10 @@
         int lastState = currentState;
         String pendingChars = "";
 
-        decisionPointStack = new Stack();
-        decisionPointList = new Vector();
-        loopingStates = new Vector();
-        statesToBackfill = new Vector();
+        decisionPointStack = new Stack<>();
+        decisionPointList = new Vector<>();
+        loopingStates = new Vector<>();
+        statesToBackfill = new Vector<>();
 
         short[] state;
         boolean sawEarlyBreak = false;
@@ -972,8 +972,8 @@
 
                 // if the character we're on is a period, we end up down here
                 else {
-                    int rowNum = ((Integer)decisionPointList.lastElement()).intValue();
-                    state = (short[])tempStateTable.elementAt(rowNum);
+                    int rowNum = decisionPointList.lastElement().intValue();
+                    state = tempStateTable.elementAt(rowNum);
 
                     // if the period is followed by an asterisk, then just set the current
                     // state to loop back on itself
@@ -1001,7 +1001,9 @@
                     // of the current desicion point list onto the stack (this is
                     // the same thing we do on an opening brace)
                     if (p + 1 < rule.length() && rule.charAt(p + 1) == '*') {
-                        decisionPointStack.push(decisionPointList.clone());
+                        @SuppressWarnings("unchecked")
+                        Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
+                        decisionPointStack.push(clone);
                     }
 
                     // create a new state, add it to the list of states to backfill
@@ -1040,7 +1042,9 @@
             // it, preventing it from being affected by whatever's inside the parentheses.
             // This decision point list is restored when a } is encountered.
             else if (c == '{') {
-                decisionPointStack.push(decisionPointList.clone());
+                @SuppressWarnings("unchecked")
+                Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
+                decisionPointStack.push(clone);
             }
 
             // a } marks the end of an optional run of characters.  Pop the last decision
@@ -1053,7 +1057,7 @@
                 // on the character categories that caused us to enter this state
                 if (c == '*') {
                     for (int i = lastState + 1; i < tempStateTable.size(); i++) {
-                        Vector temp = new Vector();
+                        Vector<Integer> temp = new Vector<>();
                         temp.addElement(new Integer(i));
                         updateStateTable(temp, pendingChars, (short)(lastState + 1));
                     }
@@ -1063,7 +1067,7 @@
                 // it with the current decision point list (this causes the divergent
                 // paths through the state table to come together again on the next
                 // new state)
-                Vector temp = (Vector)decisionPointStack.pop();
+                Vector<Integer> temp = decisionPointStack.pop();
                 for (int i = 0; i < decisionPointList.size(); i++)
                     temp.addElement(decisionPointList.elementAt(i));
                 decisionPointList = temp;
@@ -1123,8 +1127,10 @@
                 // stack (this keeps track of the active decision point list before
                 // the () expression), followed by an empty decision point list
                 // (this will hold the exit points)
-                decisionPointStack.push(decisionPointList.clone());
-                decisionPointStack.push(new Vector());
+                @SuppressWarnings("unchecked")
+                Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
+                decisionPointStack.push(clone);
+                decisionPointStack.push(new Vector<Integer>());
             }
 
             // a | separates alternative character sequences in a () expression.  When
@@ -1133,8 +1139,8 @@
             else if (c == '|') {
 
                 // pick out the top two decision point lists on the stack
-                Vector oneDown = (Vector)decisionPointStack.pop();
-                Vector twoDown = (Vector)decisionPointStack.peek();
+                Vector<Integer> oneDown = decisionPointStack.pop();
+                Vector<Integer> twoDown = decisionPointStack.peek();
                 decisionPointStack.push(oneDown);
 
                 // append the current decision point list to the list below it
@@ -1142,7 +1148,9 @@
                 // current decision point list to its state before the () expression
                 for (int i = 0; i < decisionPointList.size(); i++)
                     oneDown.addElement(decisionPointList.elementAt(i));
-                decisionPointList = (Vector)twoDown.clone();
+                @SuppressWarnings("unchecked")
+                Vector<Integer> clone = (Vector<Integer>)twoDown.clone();
+                decisionPointList = clone;
             }
 
             // a ) marks the end of a sequence of characters.  We do one of two things
@@ -1160,7 +1168,7 @@
                 // pull the exit point list off the stack, merge it with the current
                 // decision point list, and make the merged version the current
                 // decision point list
-                Vector exitPoints = (Vector)decisionPointStack.pop();
+                Vector<Integer> exitPoints = decisionPointStack.pop();
                 for (int i = 0; i < decisionPointList.size(); i++)
                     exitPoints.addElement(decisionPointList.elementAt(i));
                 decisionPointList = exitPoints;
@@ -1176,16 +1184,18 @@
 
                     // now exitPoints and decisionPointList have to point to equivalent
                     // vectors, but not the SAME vector
-                    exitPoints = (Vector)decisionPointList.clone();
+                    @SuppressWarnings("unchecked")
+                    Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
+                    exitPoints = clone;
 
                     // pop the original decision point list off the stack
-                    Vector temp = (Vector)decisionPointStack.pop();
+                    Vector<Integer> temp = decisionPointStack.pop();
 
                     // we squirreled away the row number of our entry point list
                     // at the beginning of the original decision point list.  Fish
                     // that state number out and retrieve the entry point list
-                    int tempStateNum = ((Integer)temp.firstElement()).intValue();
-                    short[] tempState = (short[])tempStateTable.elementAt(tempStateNum);
+                    int tempStateNum = temp.firstElement().intValue();
+                    short[] tempState = tempStateTable.elementAt(tempStateNum);
 
                     // merge the original decision point list with the current
                     // decision point list
@@ -1217,8 +1227,8 @@
             else if (c == '/') {
                 sawEarlyBreak = true;
                 for (int i = 0; i < decisionPointList.size(); i++) {
-                    state = (short[])tempStateTable.elementAt(((Integer)decisionPointList.
-                                    elementAt(i)).intValue());
+                    state = tempStateTable.elementAt(decisionPointList.
+                                    elementAt(i).intValue());
                     state[numCategories] |= LOOKAHEAD_STATE_FLAG;
                 }
             }
@@ -1261,8 +1271,8 @@
         // signals that these states cause the break position to be updated to the
         // position of the slash rather than the current break position.
         for (int i = 0; i < decisionPointList.size(); i++) {
-            int rowNum = ((Integer)decisionPointList.elementAt(i)).intValue();
-            state = (short[])tempStateTable.elementAt(rowNum);
+            int rowNum = decisionPointList.elementAt(i).intValue();
+            state = tempStateTable.elementAt(rowNum);
             state[numCategories] |= END_STATE_FLAG;
             if (sawEarlyBreak) {
                 state[numCategories] |= LOOKAHEAD_STATE_FLAG;
@@ -1279,7 +1289,7 @@
      * list of the columns that need updating.
      * @param newValue Update the cells specfied above to contain this value
      */
-    private void updateStateTable(Vector rows,
+    private void updateStateTable(Vector<Integer> rows,
                                   String pendingChars,
                                   short newValue) {
         // create a dummy state that has the specified row number (newValue) in
@@ -1292,7 +1302,7 @@
         // go through the list of rows to update, and update them by calling
         // mergeStates() to merge them the the dummy state we created
         for (int i = 0; i < rows.size(); i++) {
-            mergeStates(((Integer)rows.elementAt(i)).intValue(), newValues, rows);
+            mergeStates(rows.elementAt(i).intValue(), newValues, rows);
         }
     }
 
@@ -1318,8 +1328,8 @@
      */
     private void mergeStates(int rowNum,
                              short[] newValues,
-                             Vector rowsBeingUpdated) {
-        short[] oldValues = (short[])(tempStateTable.elementAt(rowNum));
+                             Vector<Integer> rowsBeingUpdated) {
+        short[] oldValues = tempStateTable.elementAt(rowNum);
         boolean isLoopingState = loopingStates.contains(new Integer(rowNum));
 
         // for each of the cells in the rows we're reconciling, do...
@@ -1375,7 +1385,7 @@
                     // add this pair of row numbers to the merge list (create it first
                     // if we haven't created the merge list yet)
                     if (mergeList == null) {
-                        mergeList = new Vector();
+                        mergeList = new Vector<>();
                     }
                     mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum });
 
@@ -1384,7 +1394,7 @@
                     // state table and update the original row (oldValues) to point
                     // to the new, merged, state
                     short[] newRow = new short[numCategories + 1];
-                    short[] oldRow = (short[])(tempStateTable.elementAt(oldRowNum));
+                    short[] oldRow = tempStateTable.elementAt(oldRowNum);
                     System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1);
                     tempStateTable.addElement(newRow);
                     oldValues[i] = (short)combinedRowNum;
@@ -1408,7 +1418,7 @@
                     // now (groan) do the same thing for all the entries on the
                     // decision point stack
                     for (int k = 0; k < decisionPointStack.size(); k++) {
-                        Vector dpl = (Vector)decisionPointStack.elementAt(k);
+                        Vector<Integer> dpl = decisionPointStack.elementAt(k);
                         if ((dpl.contains(new Integer(oldRowNum))
                                 || dpl.contains(new Integer(newRowNum)))
                             && !dpl.contains(new Integer(combinedRowNum))
@@ -1420,8 +1430,8 @@
                     // FINALLY (puff puff puff), call mergeStates() recursively to copy
                     // the row referred to by newValues into the new row and resolve any
                     // conflicts that come up at that level
-                    mergeStates(combinedRowNum, (short[])(tempStateTable.elementAt(
-                                    newValues[i])), rowsBeingUpdated);
+                    mergeStates(combinedRowNum, tempStateTable.elementAt(
+                                    newValues[i]), rowsBeingUpdated);
                 }
             }
         }
@@ -1445,7 +1455,7 @@
         else {
             int[] entry;
             for (int i = 0; i < mergeList.size(); i++) {
-                entry = (int[])(mergeList.elementAt(i));
+                entry = mergeList.elementAt(i);
 
                 // we have a hit if the two row numbers match the two row numbers
                 // in the beginning of the entry (the two that combine), in either
@@ -1477,20 +1487,21 @@
      * @param endStates The list of states to treat as end states (states that
      * can exit the loop).
      */
-    private void setLoopingStates(Vector newLoopingStates, Vector endStates) {
+    private void setLoopingStates(Vector<Integer> newLoopingStates,
+                                  Vector<Integer> endStates) {
 
         // if the current list of looping states isn't empty, we have to backfill
         // values from the looping states into the states that are waiting to be
         // backfilled
         if (!loopingStates.isEmpty()) {
-            int loopingState = ((Integer)loopingStates.lastElement()).intValue();
+            int loopingState = loopingStates.lastElement().intValue();
             int rowNum;
 
             // don't backfill into an end state OR any state reachable from an end state
             // (since the search for reachable states is recursive, it's split out into
             // a separate function, eliminateBackfillStates(), below)
             for (int i = 0; i < endStates.size(); i++) {
-                eliminateBackfillStates(((Integer)endStates.elementAt(i)).intValue());
+                eliminateBackfillStates(endStates.elementAt(i).intValue());
             }
 
             // we DON'T actually backfill the states that need to be backfilled here.
@@ -1501,8 +1512,8 @@
             // for backfilling by putting the row number of the state to copy from
             // into the flag cell at the end of the row
             for (int i = 0; i < statesToBackfill.size(); i++) {
-                rowNum = ((Integer)statesToBackfill.elementAt(i)).intValue();
-                short[] state = (short[])tempStateTable.elementAt(rowNum);
+                rowNum = statesToBackfill.elementAt(i).intValue();
+                short[] state = tempStateTable.elementAt(rowNum);
                 state[numCategories] =
                     (short)((state[numCategories] & ALL_FLAGS) | loopingState);
             }
@@ -1511,7 +1522,9 @@
         }
 
         if (newLoopingStates != null) {
-            loopingStates = (Vector)newLoopingStates.clone();
+            @SuppressWarnings("unchecked")
+            Vector<Integer> clone = (Vector<Integer>)newLoopingStates.clone();
+            loopingStates = clone;
         }
     }
 
@@ -1530,7 +1543,7 @@
 
             // then go through and recursively call this function for every
             // state that the base state points to
-            short[] state = (short[])tempStateTable.elementAt(baseState);
+            short[] state = tempStateTable.elementAt(baseState);
             for (int i = 0; i < numCategories; i++) {
                 if (state[i] != 0) {
                     eliminateBackfillStates(state[i]);
@@ -1551,7 +1564,7 @@
 
         // for each state in the state table...
         for (int i = 0; i < tempStateTable.size(); i++) {
-            state = (short[])tempStateTable.elementAt(i);
+            state = tempStateTable.elementAt(i);
 
             // check the state's flag word to see if it's marked for backfilling
             // (it's marked for backfilling if any bits other than the two high-order
@@ -1563,7 +1576,7 @@
                 // load up the state to copy from (if we haven't already)
                 if (fromState != loopingStateRowNum) {
                     loopingStateRowNum = fromState;
-                    loopingState = (short[])tempStateTable.elementAt(loopingStateRowNum);
+                    loopingState = tempStateTable.elementAt(loopingStateRowNum);
                 }
 
                 // clear out the backfill part of the flag word
@@ -1594,7 +1607,7 @@
         backfillLoopingStates();
 
         int[] rowNumMap = new int[tempStateTable.size()];
-        Stack rowsToFollow = new Stack();
+        Stack<Integer> rowsToFollow = new Stack<>();
         rowsToFollow.push(new Integer(1));
         rowNumMap[1] = 1;
 
@@ -1602,8 +1615,8 @@
         // (the reachable states will have their row numbers in the row number
         // map, and the nonreachable states will have zero in the row number map)
         while (rowsToFollow.size() != 0) {
-            int rowNum = ((Integer)rowsToFollow.pop()).intValue();
-            short[] row = (short[])(tempStateTable.elementAt(rowNum));
+            int rowNum = rowsToFollow.pop().intValue();
+            short[] row = tempStateTable.elementAt(rowNum);
 
             for (int i = 0; i < numCategories; i++) {
                 if (row[i] != 0) {
@@ -1632,7 +1645,7 @@
             if (rowNumMap[i] == 0) {
                 continue;
             }
-            state1 = (short[])tempStateTable.elementAt(i);
+            state1 = tempStateTable.elementAt(i);
             for (int j = 0; j < numCategories; j++) {
                 if (state1[j] != 0) {
                     ++stateClasses[i];
@@ -1663,10 +1676,10 @@
                 for (int i = 0; i < stateClasses.length; i++) {
                     if (stateClasses[i] == currentClass) {
                         if (state1 == null) {
-                            state1 = (short[])tempStateTable.elementAt(i);
+                            state1 = tempStateTable.elementAt(i);
                         }
                         else {
-                            state2 = (short[])tempStateTable.elementAt(i);
+                            state2 = tempStateTable.elementAt(i);
                             for (int j = 0; j < state2.length; j++) {
                                 if ((j == numCategories && state1[j] != state2[j] && forward)
                                         || (j != numCategories && stateClasses[state1[j]]
@@ -1733,7 +1746,7 @@
             int p = 0;
             int p2 = 0;
             for (int i = 0; i < tempStateTable.size(); i++) {
-                short[] row = (short[])(tempStateTable.elementAt(i));
+                short[] row = tempStateTable.elementAt(i);
                 if (row == null) {
                     continue;
                 }
@@ -1752,7 +1765,7 @@
             backwardsStateTable = new short[newRowNum * numCategories];
             int p = 0;
             for (int i = 0; i < tempStateTable.size(); i++) {
-                short[] row = (short[])(tempStateTable.elementAt(i));
+                short[] row = tempStateTable.elementAt(i);
                 if (row == null) {
                     continue;
                 }
@@ -1769,12 +1782,12 @@
      * table and any additional rules (identified by the ! on the front)
      * supplied in the description
      */
-    private void buildBackwardsStateTable(Vector tempRuleList) {
+    private void buildBackwardsStateTable(Vector<String> tempRuleList) {
 
         // create the temporary state table and seed it with two rows (row 0
         // isn't used for anything, and we have to create row 1 (the initial
         // state) before we can do anything else
-        tempStateTable = new Vector();
+        tempStateTable = new Vector<>();
         tempStateTable.addElement(new short[numCategories + 1]);
         tempStateTable.addElement(new short[numCategories + 1]);
 
@@ -1786,7 +1799,7 @@
         // the same syntax as the normal break rules, but begin with '!' to distinguish
         // them from normal break rules
         for (int i = 0; i < tempRuleList.size(); i++) {
-            String rule = (String)tempRuleList.elementAt(i);
+            String rule = tempRuleList.elementAt(i);
             if (rule.charAt(0) == '!') {
                 parseRule(rule.substring(1), false);
             }
@@ -1831,7 +1844,7 @@
         for (int i = 0; i < numCategories + 1; i++)
             tempStateTable.addElement(new short[numCategories + 1]);
 
-        short[] state = (short[])tempStateTable.elementAt(backTableOffset - 1);
+        short[] state = tempStateTable.elementAt(backTableOffset - 1);
         for (int i = 0; i < numCategories; i++)
             state[i] = (short)(i + backTableOffset);
 
@@ -1855,7 +1868,7 @@
                     for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) {
                         int cellValue = lookupState(nextRow, nextColumn);
                         if (cellValue != 0) {
-                            state = (short[])tempStateTable.elementAt(nextColumn +
+                            state = tempStateTable.elementAt(nextColumn +
                                             backTableOffset);
                             state[column] = (short)(column + backTableOffset);
                         }
@@ -1876,9 +1889,9 @@
             // populated that is also populated in row 1 of the rule-based
             // sub-table, copy the value from row 1 over the value in the
             // auto-generated sub-table
-            state = (short[])tempStateTable.elementAt(1);
+            state = tempStateTable.elementAt(1);
             for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) {
-                short[] state2 = (short[])tempStateTable.elementAt(i);
+                short[] state2 = tempStateTable.elementAt(i);
                 for (int j = 0; j < numCategories; j++) {
                     if (state[j] != 0 && state2[j] != 0) {
                         state2[j] = state[j];
@@ -1890,9 +1903,9 @@
             // an end state, fill in all unpopulated cells with the values
             // of the corresponding cells in the first row of the auto-
             // generated sub-table.
-            state = (short[])tempStateTable.elementAt(backTableOffset - 1);
+            state = tempStateTable.elementAt(backTableOffset - 1);
             for (int i = 1; i < backTableOffset - 1; i++) {
-                short[] state2 = (short[])tempStateTable.elementAt(i);
+                short[] state2 = tempStateTable.elementAt(i);
                 if ((state2[numCategories] & END_STATE_FLAG) == 0) {
                     for (int j = 0; j < numCategories; j++) {
                         if (state2[j] == 0) {
--- a/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
         int new_index = 0;
         int loop_count = dataCount - 1;
         long data = tempTable[old_index];
-        int start = (int)((long)(data>>32)) & CODEPOINT_MASK;
+        int start = (int)(data>>32) & CODEPOINT_MASK;
         int end   = (int)(data>>8) & CODEPOINT_MASK;
 
         /*
@@ -142,7 +142,7 @@
         newTempTable[new_index++] = composeEntry(start, (int)data);
         for (int i = 0; i < loop_count; i++) {
             data = tempTable[++old_index];
-            int nextStart = (int)((long)(data>>32)) & CODEPOINT_MASK;
+            int nextStart = (int)(data>>32) & CODEPOINT_MASK;
 
             /*
              * If the previous end code point is not equal to the previous start
--- a/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1290,7 +1290,7 @@
                     else if (bits == 32 || bits < 8)
                         result.append(hex8((int)val));
                     else {
-                        result.append(hex16((long)val));
+                        result.append(hex16(val));
                         if (!Csyntax)
                             result.append("L");
                     }
--- a/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
  * <p>
  * @author John O'Conner
  */
-public class SpecialCaseMap implements Comparable {
+public class SpecialCaseMap implements Comparable<SpecialCaseMap> {
 
     SpecialCaseMap() {
         chSource = 0xFFFF;
@@ -55,7 +55,7 @@
      */
 
     public static SpecialCaseMap[] readSpecFile(File file, int plane) throws FileNotFoundException {
-        ArrayList caseMaps = new ArrayList(150);
+        ArrayList<SpecialCaseMap> caseMaps = new ArrayList<>(150);
         int count = 0;
         BufferedReader f = new BufferedReader(new FileReader(file));
                 String line = null;
@@ -69,7 +69,7 @@
                 SpecialCaseMap item = parse(line.trim());
                 if (item != null) {
                                 if(item.getCharSource() >> 16 < plane) continue;
-                                if((int)(item.getCharSource() >> 16) > plane) break;
+                                if(item.getCharSource() >> 16 > plane) break;
                                 caseMaps.add(item);
                 ++count;
             }
@@ -83,7 +83,7 @@
 
     }
 
-    /**
+   /**
     * Given one line of a Unicode special casing data file as a String, parse the line
     * and return a SpecialCaseMap object that contains the case mapping.
     *
@@ -177,25 +177,25 @@
         else return -1;
     }
 
-        /*
+    /*
      * Extracts and returns the high surrogate value from a UTF-32 code point.
      * If argument is a BMP character, then it is converted to a char and returned;
      * otherwise the high surrogate value is extracted.
      * @param codePoint a UTF-32 codePoint with value greater than 0xFFFF.
      * @return the high surrogate value that helps create <code>codePoint</code>; else
      *         the char representation of <code>codePoint</code> if it is a BMP character.
-         * @since 1.5
+     * @since 1.5
      */
-        static char getHighSurrogate(int codePoint) {
-                char high = (char)codePoint;
-                if (codePoint > 0xFFFF) {
-                    high = (char)((codePoint - 0x10000)/0x0400 + 0xD800);
-                }
-                return high;
+    static char getHighSurrogate(int codePoint) {
+        char high = (char)codePoint;
+        if (codePoint > 0xFFFF) {
+            high = (char)((codePoint - 0x10000)/0x0400 + 0xD800);
         }
+        return high;
+    }
 
 
-        /*
+    /*
      * Extracts and returns the low surrogate value from a UTF-32 code point.
      * If argument is a BMP character, then it is converted to a char and returned;
      * otherwise the high surrogate value is extracted.
@@ -204,29 +204,28 @@
      *         the char representation of <code>codePoint</code> if it is a BMP character.
      * @since 1.5
      */
-        static char getLowSurrogate(int codePoint) {
-                char low = (char)codePoint;
-                if(codePoint > 0xFFFF) {
-                        low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00);
-                }
-                return low;
+    static char getLowSurrogate(int codePoint) {
+        char low = (char)codePoint;
+        if(codePoint > 0xFFFF) {
+                low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00);
         }
-
-        static String hex6(int n) {
-                String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase();
-                return "000000".substring(Math.min(6, str.length())) + str;
+        return low;
+    }
 
-        }
+    static String hex6(int n) {
+        String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase();
+        return "000000".substring(Math.min(6, str.length())) + str;
+    }
 
-        static String hex6(char[] map){
-                StringBuffer buff = new StringBuffer();
-                int x=0;
-                buff.append(hex6(map[x++]));
-                while(x<map.length) {
-                        buff.append(" " + hex6(map[x++]));
-                }
-                return buff.toString();
+    static String hex6(char[] map){
+        StringBuffer buff = new StringBuffer();
+        int x=0;
+        buff.append(hex6(map[x++]));
+        while(x<map.length) {
+            buff.append(" " + hex6(map[x++]));
         }
+        return buff.toString();
+    }
 
     void setCharSource(int ch) {
         chSource = ch;
@@ -302,56 +301,62 @@
     static String CONTEXT_MODERN = "MODERN";
     static String CONTEXT_NONMODERN = "NON_MODERN";
 
-    public int compareTo(Object otherObject) {
-                SpecialCaseMap other = (SpecialCaseMap)otherObject;
-        if (chSource < other.chSource) {
+    public int compareTo(SpecialCaseMap otherObject) {
+        if (chSource < otherObject.chSource) {
             return -1;
         }
-        else if (chSource > other.chSource) {
+        else if (chSource > otherObject.chSource) {
             return 1;
         }
         else return 0;
     }
 
     public boolean equals(Object o1) {
-                boolean bEqual = false;
-                if (0 == compareTo(o1)) {
-                        bEqual = true;
-                }
+        if (this == o1) {
+            return true;
+        }
+        if (o1 == null || !(o1 instanceof SpecialCaseMap)) {
+            return false;
+        }
+        SpecialCaseMap other = (SpecialCaseMap)o1;
+        boolean bEqual = false;
+        if (0 == compareTo(other)) {
+            bEqual = true;
+        }
         return bEqual;
     }
 
-        public String toString() {
-                StringBuffer buff = new StringBuffer();
-                buff.append(hex6(getCharSource()));
-                buff.append("|" + hex6(lowerCaseMap));
-                buff.append("|" + hex6(upperCaseMap));
-                buff.append("|" + hex6(titleCaseMap));
-                buff.append("|" + context);
-                return buff.toString();
-        }
+    public String toString() {
+        StringBuffer buff = new StringBuffer();
+        buff.append(hex6(getCharSource()));
+        buff.append("|" + hex6(lowerCaseMap));
+        buff.append("|" + hex6(upperCaseMap));
+        buff.append("|" + hex6(titleCaseMap));
+        buff.append("|" + context);
+        return buff.toString();
+    }
+
+    public int hashCode() {
+        return chSource;
+    }
 
-        public int hashCode() {
-                return (int)chSource;
+    public static void main(String[] args) {
+        SpecialCaseMap[] spec = null;
+        if (args.length == 2 ) {
+            try {
+                File file = new File(args[0]);
+                int plane = Integer.parseInt(args[1]);
+                spec = SpecialCaseMap.readSpecFile(file, plane);
+                System.out.println("SpecialCaseMap[" + spec.length + "]:");
+                for (int x=0; x<spec.length; x++) {
+                    System.out.println(spec[x].toString());
+                }
+            }
+            catch(Exception e) {
+                e.printStackTrace();
+            }
         }
 
-        public static void main(String[] args) {
-                SpecialCaseMap[] spec = null;
-                if (args.length == 2 ) {
-                        try {
-                                File file = new File(args[0]);
-                                int plane = Integer.parseInt(args[1]);
-                                spec = SpecialCaseMap.readSpecFile(file, plane);
-                                System.out.println("SpecialCaseMap[" + spec.length + "]:");
-                                for (int x=0; x<spec.length; x++) {
-                                        System.out.println(spec[x].toString());
-                                }
-                        }
-                        catch(Exception e) {
-                                e.printStackTrace();
-                        }
-                }
-
-        }
+    }
 
 }
--- a/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -391,31 +391,31 @@
     */
 
     public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException {
-                ArrayList list = new ArrayList(3000);
+        ArrayList<UnicodeSpec> list = new ArrayList<>(3000);
         UnicodeSpec[] result = null;
         int count = 0;
         BufferedReader f = new BufferedReader(new FileReader(file));
-                String line = null;
+        String line = null;
         loop:
         while(true) {
             try {
                 line = f.readLine();
             }
             catch (IOException e) {
-                                break loop;
-                        }
+                break loop;
+            }
             if (line == null) break loop;
             UnicodeSpec item = parse(line.trim());
-                        int specPlane = (int)(item.getCodePoint() >>> 16);
-                        if (specPlane < plane) continue;
-                        if (specPlane > plane) break;
+            int specPlane = item.getCodePoint() >>> 16;
+            if (specPlane < plane) continue;
+            if (specPlane > plane) break;
 
             if (item != null) {
-                                list.add(item);
+                list.add(item);
             }
         }
-                result = new UnicodeSpec[list.size()];
-                list.toArray(result);
+        result = new UnicodeSpec[list.size()];
+        list.toArray(result);
         return result;
     }
 
--- a/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -250,10 +250,10 @@
         return Integer.parseInt(numericCode);
     }
 
-    static HashMap specialCaseMap = new HashMap();
+    static HashMap<String, Integer> specialCaseMap = new HashMap<>();
 
     private static int makeSpecialCaseEntry(String currencyInfo) throws Exception {
-        Integer oldEntry = (Integer) specialCaseMap.get(currencyInfo);
+        Integer oldEntry = specialCaseMap.get(currencyInfo);
         if (oldEntry != null) {
             return oldEntry.intValue();
         }
--- a/make/tools/src/build/tools/hasher/Hasher.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/hasher/Hasher.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,15 +51,15 @@
 
     boolean verbose = false;
 
-    List keys = new ArrayList();        // Key strings
-    List values = new ArrayList();      // Value expressions
-    String pkg = null;                  // Package prefix for generated class
-    String cln = null;                  // Name of generated class
-    String vtype = "String";            // Value type
-    int maxBits = 11;                   // lg table size
-    int maxDepth = 3;                   // Max chain depth
-    boolean inner = false;              // Generating an inner class?
-    boolean empty = false;              // Generating an empty table?
+    List<String> keys = new ArrayList<>();      // Key strings
+    List<String> values = new ArrayList<>();    // Value expressions
+    String pkg = null;                          // Package prefix for generated class
+    String cln = null;                          // Name of generated class
+    String vtype = "String";                    // Value type
+    int maxBits = 11;                           // lg table size
+    int maxDepth = 3;                           // Max chain depth
+    boolean inner = false;                      // Generating an inner class?
+    boolean empty = false;                      // Generating an empty table?
 
     void usage() {
         err.println("usage: java Hasher [options] [[pkgName.]ClassName]");
@@ -76,9 +76,9 @@
     }
 
     Hasher(String[] args) {
-        List as = Arrays.asList(args);
-        for (Iterator i = as.iterator(); i.hasNext();) {
-            String a = (String)i.next();
+        List<String> as = Arrays.asList(args);
+        for (Iterator<String> i = as.iterator(); i.hasNext();) {
+            String a = i.next();
             if (a.equals("-e")) {
                 empty = true;
             } else if (a.equals("-i")) {
@@ -88,15 +88,15 @@
             } else if (a.equals("-md")) {
                 if (!i.hasNext())
                     usage();
-                maxDepth = Integer.parseInt((String)i.next());
+                maxDepth = Integer.parseInt(i.next());
             } else if (a.equals("-mb")) {
                 if (!i.hasNext())
                     usage();
-                maxBits = Integer.parseInt((String)i.next());
+                maxBits = Integer.parseInt(i.next());
             } else if (a.equals("-t")) {
                 if (!i.hasNext())
                     usage();
-                vtype = (String)i.next();
+                vtype = i.next();
             } else if (a.startsWith("-")) {
                 usage();
             } else {
@@ -153,8 +153,8 @@
         int nw = keys.size();
 
         for (int i = 0; i < nw; i++) {
-            String w = (String)keys.get(i);
-            String v = (String)values.get(i);
+            String w = keys.get(i);
+            String v = values.get(i);
             int h = hash(w);
             if (ht[h] == null)
                 ht[h] = new Object[] { w, v };
@@ -217,7 +217,7 @@
         if (verbose)
             err.println();
         for (int i = 0, n = keys.size(); i < n; i++) {
-            String w = (String)keys.get(i);
+            String w = keys.get(i);
             String v = get(w);
             if (verbose)
                 err.println(hash(w) + "\t" + w);
--- a/make/tools/src/build/tools/jarsplit/JarSplit.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jarsplit/JarSplit.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,8 @@
     /* classlist[0] contains class file list
      * classlist[1] contains non-class file list
      */
-    private static Vector<String>[] classlist = (Vector<String>[])(new Vector[2]);
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    private static Vector<String>[] classlist = new Vector[2];
 
     /* The 2 class list name passed as arguments. */
     private static String[] fileNamelist = new String[2];
--- a/make/tools/src/build/tools/javazic/Gen.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/Gen.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,14 +30,9 @@
 import  java.io.FileOutputStream;
 import  java.io.DataOutputStream;
 import  java.io.RandomAccessFile;
-import  java.util.ArrayList;
-import  java.util.Iterator;
-import  java.util.LinkedList;
 import  java.util.List;
 import  java.util.Map;
 import  java.util.Set;
-import  java.util.TreeMap;
-import  java.util.TreeSet;
 import  sun.util.calendar.ZoneInfoFile;
 
 /**
@@ -105,14 +100,13 @@
                     /* if DST offset is 0, this means DST isn't used.
                      * (NOT: offset's index is 0.)
                      */
-                    if ((dstoffset =
-                         ((Integer)dstOffsets.get(i)).intValue()) == -1) {
+                    if ((dstoffset = dstOffsets.get(i).intValue()) == -1) {
                         dstoffset = 0;
                     }
 
-                    dos.writeLong((((Long)transitions.get(i)).longValue() << 12)
+                    dos.writeLong((transitions.get(i).longValue() << 12)
                                   | (dstoffset << 4)
-                                  | ((Integer)offsets.get(i)).intValue());
+                                  | offsets.get(i).intValue());
 
                 }
 
--- a/make/tools/src/build/tools/javazic/GenDoc.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/GenDoc.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,8 @@
 import  java.io.FileReader;
 import  java.io.FileWriter;
 import  java.io.IOException;
-import  java.util.ArrayList;
-import  java.util.Calendar;
 import  java.util.Date;
 import  java.util.HashMap;
-import  java.util.Iterator;
-import  java.util.LinkedList;
 import  java.util.List;
 import  java.util.Map;
 import  java.util.Set;
@@ -189,7 +185,7 @@
 
             out.write(header1 + new Date() + header3 + zonename + header4);
             out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>");
-            LatitudeAndLongitude location = (LatitudeAndLongitude)mapList.get(zonename);
+            LatitudeAndLongitude location = mapList.get(zonename);
             if (location != null) {
                 int deg, min, sec;
 
@@ -608,12 +604,12 @@
                        "<BR>\n\n" + "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n" +
                        "<TR>\n<TD NOWRAP>\n");
 
-            Set aliasSet = a.keySet();
+            Set<String> aliasSet = a.keySet();
             len = aliasSet.size();
-            Object aliasNames[] = aliasSet.toArray();
+            String aliasNames[] = aliasSet.toArray(new String[0]);
             for (int i = 0; i < len; i++) {
-                displayNameList.put(transform((String)aliasNames[i]),
-                                    (String)aliasNames[i]);
+                displayNameList.put(transform(aliasNames[i]),
+                                    aliasNames[i]);
             }
 
             o = displayNameList.keySet().toArray();
--- a/make/tools/src/build/tools/javazic/Main.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/Main.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 package build.tools.javazic;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
--- a/make/tools/src/build/tools/javazic/Mappings.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/Mappings.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,6 @@
 package build.tools.javazic;
 
 import  java.util.ArrayList;
-import  java.util.HashMap;
-import  java.util.HashSet;
-import  java.util.Iterator;
 import  java.util.LinkedList;
 import  java.util.List;
 import  java.util.Map;
--- a/make/tools/src/build/tools/javazic/Simple.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/Simple.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,10 +29,7 @@
 import  java.io.File;
 import  java.io.FileWriter;
 import  java.io.IOException;
-import  java.util.ArrayList;
 import  java.util.HashMap;
-import  java.util.Iterator;
-import  java.util.LinkedList;
 import  java.util.List;
 import  java.util.Map;
 import  java.util.Set;
@@ -51,22 +48,19 @@
     /**
      * Zone records which are applied for given year.
      */
-    private static Map<String,ZoneRec> lastZoneRecs
-        = new HashMap<String,ZoneRec>();
+    private static Map<String,ZoneRec> lastZoneRecs = new HashMap<>();
 
     /**
      * Rule records which are applied for given year.
      */
-    private static Map<String,List<RuleRec>> lastRules
-        = new TreeMap<String,List<RuleRec>>();
+    private static Map<String,List<RuleRec>> lastRules = new TreeMap<>();
 
     /**
      * zone IDs sorted by their GMT offsets. If zone's GMT
      * offset will change in the future, its last known offset is
      * used.
      */
-    private SortedMap<Integer, Set<String>> zonesByOffset
-        = new TreeMap<Integer,  Set<String>>();
+    private SortedMap<Integer, Set<String>> zonesByOffset = new TreeMap<>();
 
     /**
      * Sets last Rule records and Zone records for given timezone to
@@ -86,7 +80,7 @@
         int lastKnownOffset = tz.getRawOffset();
         Set<String> set = zonesByOffset.get(lastKnownOffset);
         if (set == null) {
-            set = new TreeSet<String>();
+            set = new TreeSet<>();
             zonesByOffset.put(lastKnownOffset, set);
         }
         set.add(zonename);
@@ -101,16 +95,11 @@
      */
     int generateSrc(Mappings map) {
         try {
-            String outputDir = Main.getOutputDir();
-            File outD = new File(outputDir);
-
-            if (!outputDir.endsWith(File.separator)) {
-                outputDir += outD.separator;
-            }
+            File outD = new File(Main.getOutputDir());
             outD.mkdirs();
 
             FileWriter fw =
-                new FileWriter(outputDir + "TimeZoneData.java", false);
+                new FileWriter(new File(outD, "TimeZoneData.java"), false);
             BufferedWriter out = new BufferedWriter(fw);
 
             out.write("import java.util.SimpleTimeZone;\n\n");
--- a/make/tools/src/build/tools/javazic/Time.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/Time.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -268,16 +268,16 @@
         if (index < time.length()) {
             char c = time.charAt(index++);
             if (c == 's') {
-                tm.setType(tm.STD);
+                tm.setType(Time.STD);
             } else if (c == 'u' || c == 'g' || c == 'z') {
-                tm.setType(tm.UTC);
+                tm.setType(Time.UTC);
             } else if (c == 'w') {
-                tm.setType(tm.WALL);
+                tm.setType(Time.WALL);
             } else {
                 Main.panic("unknown time mode: "+c);
             }
         } else {
-            tm.setType(tm.WALL);
+            tm.setType(Time.WALL);
         }
         return tm;
     }
--- a/make/tools/src/build/tools/javazic/Zoneinfo.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/javazic/Zoneinfo.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,7 @@
 import java.io.FileReader;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
@@ -407,9 +405,9 @@
                 if (!zrec.hasUntil()) {
                     if (tz.getNTransitions() > 0) {
                         if (stdOffset == 0) {
-                            tz.setDSTType(tz.X_DST);
+                            tz.setDSTType(Timezone.X_DST);
                         } else {
-                            tz.setDSTType(tz.LAST_DST);
+                            tz.setDSTType(Timezone.LAST_DST);
                         }
                         long time = Time.getLocalTime(maxYear,
                                                       Month.JANUARY, 1, 0);
@@ -419,7 +417,7 @@
                                          tz.getDstOffsetIndex(stdOffset));
                         tz.addUsedRec(zrec);
                     } else {
-                        tz.setDSTType(tz.NO_DST);
+                        tz.setDSTType(Timezone.NO_DST);
                     }
                     break;
                 }
@@ -527,7 +525,7 @@
                         if (year == endYear && !zrec.hasUntil()) {
                             if (tz.getNTransitions() > 0) {
                                 // Assume that this Zone stopped DST
-                                tz.setDSTType(tz.X_DST);
+                                tz.setDSTType(Timezone.X_DST);
                                 long time = Time.getLocalTime(maxYear, Month.JANUARY,
                                                               1, 0);
                                 time -= zrec.getGmtOffset();
@@ -536,7 +534,7 @@
                                                  tz.getDstOffsetIndex(0));
                                 usedZone = true;
                             } else {
-                                tz.setDSTType(tz.NO_DST);
+                                tz.setDSTType(Timezone.NO_DST);
                             }
                         }
                     }
@@ -552,8 +550,8 @@
             }
         }
 
-        if (tz.getDSTType() == tz.UNDEF_DST) {
-            tz.setDSTType(tz.DST);
+        if (tz.getDSTType() == Timezone.UNDEF_DST) {
+            tz.setDSTType(Timezone.DST);
         }
         tz.optimize();
         tz.checksum();
--- a/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package build.tools.jdwpgen;
 
-import java.util.*;
 import java.io.*;
 
 class AbstractCommandNode extends AbstractNamedNode {
@@ -35,8 +34,8 @@
                        " Command</a> (" + nameNode.value() + ")</h5>");
         writer.println(comment());
         writer.println("<dl>");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).document(writer);
+        for (Node node : components) {
+            node.document(writer);
         }
         writer.println("</dl>");
     }
--- a/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,13 @@
 
 package build.tools.jdwpgen;
 
-import java.util.*;
 import java.io.*;
 
 abstract class AbstractGroupNode extends AbstractTypeListNode {
 
     void document(PrintWriter writer) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).document(writer);
+        for (Node node : components) {
+            node.document(writer);
         }
     }
 
--- a/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,10 +38,10 @@
     }
 
     void prune() {
-        Iterator it = components.iterator();
+        Iterator<Node> it = components.iterator();
 
         if (it.hasNext()) {
-            Node nameNode = (Node)it.next();
+            Node nameNode = it.next();
 
             if (nameNode instanceof NameNode) {
                 this.nameNode = (NameNode)nameNode;
@@ -64,8 +64,8 @@
     void document(PrintWriter writer) {
         writer.println("<h4><a name=" + name + ">" + name +
                        " Command Set</a></h4>");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).document(writer);
+        for (Node node : components) {
+            node.document(writer);
         }
     }
 
@@ -90,8 +90,8 @@
         writer.print("class " + javaClassName());
         writer.println(javaClassImplements() + " {");
         genJavaClassSpecifics(writer, depth+1);
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).genJava(writer, depth+1);
+        for (Node node : components) {
+            node.genJava(writer, depth+1);
         }
         indent(writer, depth);
         writer.println("}");
--- a/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
 
     void document(PrintWriter writer) {
         writer.println("<dt>" + name() + " Data");
-        if (components.size() == 0) {
+        if (components.isEmpty()) {
             writer.println("<dd>(None)");
         } else {
             writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
@@ -49,24 +49,24 @@
             }
             writer.println("<th width=\"15%\"><th width=\"65%\">");
             writer.println("");
-            for (Iterator it = components.iterator(); it.hasNext();) {
-                ((Node)it.next()).document(writer);
+            for (Node node : components) {
+                node.document(writer);
             }
             writer.println("</table>");
         }
     }
 
     void genJavaClassBodyComponents(PrintWriter writer, int depth) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
 
             tn.genJavaDeclaration(writer, depth);
         }
     }
 
     void genJavaReads(PrintWriter writer, int depth) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
             tn.genJavaRead(writer, depth, tn.name());
         }
     }
@@ -88,7 +88,7 @@
 
     String javaParams() {
         StringBuffer sb = new StringBuffer();
-        for (Iterator it = components.iterator(); it.hasNext();) {
+        for (Iterator<Node> it = components.iterator(); it.hasNext();) {
             TypeNode tn = (TypeNode)it.next();
             sb.append(tn.javaParam());
             if (it.hasNext()) {
@@ -99,8 +99,8 @@
     }
 
     void genJavaWrites(PrintWriter writer, int depth) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
             tn.genJavaWrite(writer, depth, tn.name());
         }
     }
@@ -111,8 +111,8 @@
         writer.println();
         indent(writer, depth);
         writer.println(className + "(" + javaParams() + ") {");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
             indent(writer, depth+1);
             writer.println("this." + tn.name() + " = " + tn.name() + ";");
         }
--- a/make/tools/src/build/tools/jdwpgen/AltNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/AltNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,7 @@
         indent(writer, depth+1);
         writer.print("return new " + select.name() + "(");
         writer.print("ALT_ID, new " + javaClassName() + "(");
-        for (Iterator it = components.iterator(); it.hasNext();) {
+        for (Iterator<Node> it = components.iterator(); it.hasNext();) {
             TypeNode tn = (TypeNode)it.next();
             writer.print(tn.name());
             if (it.hasNext()) {
--- a/make/tools/src/build/tools/jdwpgen/CommandSetNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/CommandSetNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package build.tools.jdwpgen;
 
-import java.util.*;
 import java.io.*;
 
 class CommandSetNode extends AbstractNamedNode {
@@ -43,8 +42,8 @@
                        " Command Set</a> (" +
                        nameNode.value() + ")</h4>");
         writer.println(comment());
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).document(writer);
+        for (Node node : components) {
+            node.document(writer);
         }
     }
 
@@ -53,8 +52,8 @@
         writer.println(name() + "</a> Command Set (" +
                        nameNode.value() + ")");
         writer.println("<ul>");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).documentIndex(writer);
+        for (Node node : components) {
+            node.documentIndex(writer);
         }
         writer.println("</ul>");
     }
--- a/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,11 @@
     /**
      * The mapping between a constant and its value.
      */
-    protected static final Map<String, String> constantMap = new HashMap<String, String>();
+    protected static final Map<String, String> constantMap = new HashMap<>();
 
     void prune() {
-        List<Node> addons = new ArrayList<Node>();
+        List<Node> addons = new ArrayList<>();
 
-        for (Iterator it = components.iterator(); it.hasNext(); ) {
-            Node node = (Node)it.next();
-        }
         if (!addons.isEmpty()) {
             components.addAll(addons);
         }
@@ -63,8 +60,8 @@
         writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
         writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">");
         ConstantNode n;
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            n = ((ConstantNode)it.next());
+        for (Node node : components) {
+            n = (ConstantNode)node;
             writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>");
             n.document(writer);
         }
--- a/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package build.tools.jdwpgen;
 
-import java.util.*;
 import java.io.*;
 
 class ErrorSetNode extends AbstractSimpleNode {
@@ -41,12 +40,12 @@
     void document(PrintWriter writer) {
 
         writer.println("<dt>" + "Error Data");
-        if (components.size() == 0) {
+        if (components.isEmpty()) {
             writer.println("<dd>(None)");
         } else {
             writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).document(writer);
+        for (Node node : components) {
+            node.document(writer);
         }
         writer.println("</table>");
         }
--- a/make/tools/src/build/tools/jdwpgen/Node.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/Node.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
     String kind;
     List<Node> components;
     int lineno;
-    List<String> commentList = new ArrayList<String>();
+    List<String> commentList = new ArrayList<>();
     Node parent = null;
     Context context = null;
 
@@ -50,8 +50,8 @@
     }
 
     void parentAndExtractComments() {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            Node node = (Node)it.next();
+        for (Iterator<Node> it = components.iterator(); it.hasNext();) {
+            Node node = it.next();
             if (node instanceof CommentNode) {
                 it.remove();
                 commentList.add(((CommentNode)node).text());
@@ -63,16 +63,14 @@
     }
 
     void prune() {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            Node node = (Node)it.next();
+        for (Node node : components) {
             node.prune();
         }
     }
 
     void constrain(Context ctx) {
         context = ctx;
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            Node node = (Node)it.next();
+        for (Node node : components) {
             constrainComponent(ctx, node);
         }
     }
@@ -109,9 +107,9 @@
         if (commentList.size() > 0) {
             indent(writer, depth);
             writer.println("/**");
-            for (Iterator it = commentList.iterator(); it.hasNext();) {
+            for (String comment : commentList) {
                 indent(writer, depth);
-                writer.println(" * " + (String)it.next());
+                writer.println(" * " + comment);
             }
             indent(writer, depth);
             writer.println(" */");
@@ -123,15 +121,13 @@
     }
 
     void genJava(PrintWriter writer, int depth) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            Node node = (Node)it.next();
+        for (Node node : components) {
             node.genJava(writer, depth);
         }
     }
 
     void genCInclude(PrintWriter writer) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            Node node = (Node)it.next();
+        for (Node node : components) {
             node.genCInclude(writer);
         }
     }
@@ -184,8 +180,7 @@
     }
 
     void genJavaPreDef(PrintWriter writer, int depth) {
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            Node node = (Node)it.next();
+        for (Node node : components) {
             node.genJavaPreDef(writer, depth);
         }
     }
--- a/make/tools/src/build/tools/jdwpgen/OutNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/OutNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,8 +48,8 @@
         indent(writer, depth);
         writer.print(
             "static " + cmdName + " process(VirtualMachineImpl vm");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
             writer.println(", ");
             indent(writer, depth+5);
             writer.print(tn.javaParam());
@@ -59,8 +59,8 @@
         writer.println("throws JDWPException {");
         indent(writer, depth+1);
         writer.print("PacketStream ps = enqueueCommand(vm");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
             writer.print(", ");
             writer.print(tn.name());
         }
@@ -76,8 +76,8 @@
         indent(writer, depth);
         writer.print(
             "static PacketStream enqueueCommand(VirtualMachineImpl vm");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            TypeNode tn = (TypeNode)it.next();
+        for (Node node : components) {
+            TypeNode tn = (TypeNode)node;
             writer.println(", ");
             indent(writer, depth+5);
             writer.print(tn.javaParam());
--- a/make/tools/src/build/tools/jdwpgen/RootNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/RootNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,11 +42,11 @@
     void document(PrintWriter writer) {
         writer.println("<html><head><title>" + comment() + "</title></head>");
         writer.println("<body bgcolor=\"white\">");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).documentIndex(writer);
+        for (Node node : components) {
+            node.documentIndex(writer);
         }
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            ((Node)it.next()).document(writer);
+        for (Node node : components) {
+            node.document(writer);
         }
         writer.println("</body></html>");
     }
--- a/make/tools/src/build/tools/jdwpgen/SelectNode.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/jdwpgen/SelectNode.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,10 @@
 
     void prune() {
         super.prune();
-        Iterator it = components.iterator();
+        Iterator<Node> it = components.iterator();
 
         if (it.hasNext()) {
-            Node typeNode = (Node)it.next();
+            Node typeNode = it.next();
 
             if (typeNode instanceof ByteTypeNode ||
                       typeNode instanceof IntTypeNode) {
@@ -131,8 +131,8 @@
         typeNode.genJavaRead(writer, depth, typeNode.name());
         indent(writer, depth);
         writer.println("switch (" + typeNode.name() + ") {");
-        for (Iterator it = components.iterator(); it.hasNext();) {
-            AltNode alt = (AltNode)it.next();
+        for (Node node : components) {
+            AltNode alt = (AltNode)node;
             alt.genJavaReadsSelectCase(writer, depth+1, commonVar());
         }
         indent(writer, depth);
--- a/make/tools/src/build/tools/makeclasslist/MakeClasslist.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/makeclasslist/MakeClasslist.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 
 public class MakeClasslist {
   public static void main(String[] args) throws IOException {
-    List/*<String>*/ classes = new ArrayList();
+    List<String> classes = new ArrayList<>();
     String origJavaHome = System.getProperty("java.home");
     String javaHome     = origJavaHome.toLowerCase();
     if (javaHome.endsWith("jre")) {
@@ -84,10 +84,9 @@
       }
     }
 
-    Set/*<String>*/  seenClasses = new HashSet();
+    Set<String> seenClasses = new HashSet<>();
 
-    for (Iterator iter = classes.iterator(); iter.hasNext(); ) {
-      String str = (String) iter.next();
+    for (String str : seenClasses) {
       if (seenClasses.add(str)) {
         System.out.println(str);
       }
@@ -109,13 +108,13 @@
     // completePackage(seenClasses, rtJar, "java/lang");
   }
 
-  private static void completePackage(Set seenClasses,
+  private static void completePackage(Set<String> seenClasses,
                                       JarFile jar,
                                       String packageName) {
     int len = packageName.length();
-    Enumeration entries = jar.entries();
+    Enumeration<JarEntry> entries = jar.entries();
     while (entries.hasMoreElements()) {
-      JarEntry entry = (JarEntry) entries.nextElement();
+      JarEntry entry = entries.nextElement();
       String name = entry.getName();
       if (name.startsWith(packageName) &&
           name.endsWith(".class") &&
--- a/make/tools/src/build/tools/stripproperties/StripProperties.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/make/tools/src/build/tools/stripproperties/StripProperties.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -246,7 +246,7 @@
     throws IOException {
         BufferedWriter awriter;
         awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
-        for (Enumeration e = properties.keys(); e.hasMoreElements();) {
+        for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
             String key = (String)e.nextElement();
             String val = (String)properties.get(key);
             key = saveConvert(key, true);
--- a/src/share/bin/jli_util.h	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/bin/jli_util.h	Wed Aug 17 22:47:49 2011 -0700
@@ -27,6 +27,8 @@
 #define _JLI_UTIL_H
 
 #include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
 #include <jni.h>
 
 void *JLI_MemAlloc(size_t size);
@@ -58,6 +60,7 @@
 #define JLI_Snprintf                    _snprintf
 #else
 #include <unistd.h>
+#include <strings.h>
 #define JLI_StrCaseCmp(p1, p2)          strcasecmp((p1), (p2))
 #define JLI_StrNCaseCmp(p1, p2, p3)     strncasecmp((p1), (p2), (p3))
 #define JLI_Snprintf                    snprintf
--- a/src/share/classes/com/sun/java/util/jar/pack/Attribute.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Attribute.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
  * attribute layouts.
  * @author John Rose
  */
-class Attribute implements Comparable {
+class Attribute implements Comparable<Attribute> {
     // Attribute instance fields.
 
     Layout def;     // the name and format of this attr
@@ -99,8 +99,7 @@
         return this == def.canon;
     }
 
-    public int compareTo(Object o) {
-        Attribute that = (Attribute) o;
+    public int compareTo(Attribute that) {
         return this.def.compareTo(that.def);
     }
 
@@ -447,7 +446,7 @@
      *  and format.  The formats are specified in a "little language".
      */
     public static
-    class Layout implements Comparable {
+    class Layout implements Comparable<Layout> {
         int ctype;       // attribute context type, e.g., ATTR_CONTEXT_CODE
         String name;     // name of attribute
         boolean hasRefs; // this kind of attr contains CP refs?
@@ -540,8 +539,7 @@
                     * 37 + layout.hashCode())
                     * 37 + ctype);
         }
-        public int compareTo(Object o) {
-            Layout that = (Layout) o;
+        public int compareTo(Layout that) {
             int r;
             r = this.name.compareTo(that.name);
             if (r != 0)  return r;
@@ -663,6 +661,8 @@
 
     public static
     class FormatException extends IOException {
+        private static final long serialVersionUID = -2542243830788066513L;
+
         private int ctype;
         private String name;
         String layout;
--- a/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1704,7 +1704,7 @@
         for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
             assert(attrIndexLimit[i] == 0);
             attrIndexLimit[i] = 32;  // just for the sake of predefs.
-            attrDefs.set(i, new ArrayList<Attribute.Layout>(Collections.nCopies(
+            attrDefs.set(i, new ArrayList<>(Collections.nCopies(
                     attrIndexLimit[i], (Attribute.Layout)null)));
 
         }
@@ -1892,7 +1892,7 @@
         return testBit(archiveOptions, mask);
     }
 
-    protected List getPredefinedAttrs(int ctype) {
+    protected List<Attribute.Layout> getPredefinedAttrs(int ctype) {
         assert(attrIndexLimit[ctype] != 0);
         List<Attribute.Layout> res = new ArrayList<>(attrIndexLimit[ctype]);
         // Remove nulls and non-predefs.
@@ -2649,7 +2649,7 @@
 
     // Utilities for reallocating:
     protected static Object[] realloc(Object[] a, int len) {
-        java.lang.Class elt = a.getClass().getComponentType();
+        java.lang.Class<?> elt = a.getClass().getComponentType();
         Object[] na = (Object[]) java.lang.reflect.Array.newInstance(elt, len);
         System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
         return na;
--- a/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
     long inPos;
     DataInputStream in;
     Map<Attribute.Layout, Attribute> attrDefs;
-    Map attrCommands;
+    Map<Attribute.Layout, String> attrCommands;
     String unknownAttrCommand = "error";;
 
     ClassReader(Class cls, InputStream in) throws IOException {
@@ -82,7 +82,7 @@
         this.attrDefs = attrDefs;
     }
 
-    public void setAttrCommands(Map attrCommands) {
+    public void setAttrCommands(Map<Attribute.Layout, String> attrCommands) {
         this.attrCommands = attrCommands;
     }
 
@@ -348,8 +348,8 @@
             int length = readInt();
             // See if there is a special command that applies.
             if (attrCommands != null) {
-                Object lkey = Attribute.keyForLookup(ctype, name);
-                String cmd = (String) attrCommands.get(lkey);
+                Attribute.Layout lkey = Attribute.keyForLookup(ctype, name);
+                String cmd = attrCommands.get(lkey);
                 if (cmd != null) {
                     switch (cmd) {
                         case "pass":
@@ -483,6 +483,8 @@
     }
 
     static class ClassFormatException extends IOException {
+        private static final long serialVersionUID = -3564121733989501833L;
+
         public ClassFormatException(String message) {
             super(message);
         }
--- a/src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Iterator;
 import java.util.List;
 import static com.sun.java.util.jar.pack.Constants.*;
 /**
@@ -165,14 +164,13 @@
     }
 
     void writeMembers(boolean doMethods) throws IOException {
-        List mems;
+        List<? extends Class.Member> mems;
         if (!doMethods)
             mems = cls.getFields();
         else
             mems = cls.getMethods();
         writeShort(mems.size());
-        for (Iterator i = mems.iterator(); i.hasNext(); ) {
-            Class.Member m = (Class.Member) i.next();
+        for (Class.Member m : mems) {
             writeMember(m, doMethods);
         }
     }
--- a/src/share/classes/com/sun/java/util/jar/pack/Code.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Code.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
         return expandInstructionMap(getInsnMap());
     }
 
-    void addFixups(Collection moreFixups) {
+    void addFixups(Collection<Fixups.Fixup> moreFixups) {
         if (fixups == null) {
             fixups = new Fixups(bytes);
         }
--- a/src/share/classes/com/sun/java/util/jar/pack/Coding.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Coding.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  * varying degrees of length variability, and varying amounts of signed-ness.
  * @author John Rose
  */
-class Coding implements Comparable, CodingMethod, Histogram.BitMetric {
+class Coding implements Comparable<Coding>, CodingMethod, Histogram.BitMetric {
     /*
       Coding schema for single integers, parameterized by (B,H,S):
 
@@ -605,8 +605,7 @@
     public int byteMin(int b) { return byteMin[b-1]; }
     public int byteMax(int b) { return byteMax[b-1]; }
 
-    public int compareTo(Object x) {
-        Coding that = (Coding) x;
+    public int compareTo(Coding that) {
         int dkey = this.del - that.del;
         if (dkey == 0)
             dkey = this.B - that.B;
--- a/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
         return e;
     }
     /** Factory for literal constants (String, Integer, etc.). */
-    public static synchronized LiteralEntry getLiteralEntry(Comparable value) {
+    public static synchronized LiteralEntry getLiteralEntry(Comparable<?> value) {
         Map<Object, LiteralEntry> literalEntries = Utils.getLiteralEntries();
         LiteralEntry e = literalEntries.get(value);
         if (e == null) {
@@ -140,7 +140,7 @@
 
     /** Entries in the constant pool. */
     public static abstract
-    class Entry implements Comparable {
+    class Entry implements Comparable<Object> {
         protected final byte tag;       // a CONSTANT_foo code
         protected int valueHash;        // cached hashCode
 
@@ -257,7 +257,7 @@
             super(tag);
         }
 
-        public abstract Comparable literalValue();
+        public abstract Comparable<?> literalValue();
     }
 
     public static
@@ -280,15 +280,17 @@
         public int compareTo(Object o) {
             int x = superCompareTo(o);
             if (x == 0) {
-                x = ((Comparable)value).compareTo(((NumberEntry)o).value);
+                @SuppressWarnings("unchecked")
+                Comparable<Number> compValue = (Comparable<Number>)value;
+                x = compValue.compareTo(((NumberEntry)o).value);
             }
             return x;
         }
         public Number numberValue() {
             return value;
         }
-        public Comparable literalValue() {
-            return (Comparable) value;
+        public Comparable<?> literalValue() {
+            return (Comparable<?>) value;
         }
         public String stringValue() {
             return value.toString();
@@ -319,7 +321,7 @@
             }
             return x;
         }
-        public Comparable literalValue() {
+        public Comparable<?> literalValue() {
             return ref.stringValue();
         }
         public String stringValue() {
@@ -728,7 +730,7 @@
 
     /** An Index is a mapping between CP entries and small integers. */
     public static final
-    class Index extends AbstractList {
+    class Index extends AbstractList<Entry> {
         protected String debugName;
         protected Entry[] cpMap;
         protected boolean flattenSigs;
@@ -758,7 +760,7 @@
         public int size() {
             return cpMap.length;
         }
-        public Object get(int i) {
+        public Entry get(int i) {
             return cpMap[i];
         }
         public Entry getEntry(int i) {
@@ -803,13 +805,7 @@
             assert(index >= 0);
             return index;
         }
-        public boolean contains(Object e) {
-            return findIndexOf((Entry)e) >= 0;
-        }
-        public int indexOf(Object e) {
-            return findIndexOf((Entry)e);
-        }
-        public int lastIndexOf(Object e) {
+        public int lastIndexOf(Entry e) {
             return indexOf(e);
         }
 
@@ -862,14 +858,14 @@
                 indexValue[probe] = i;
             }
         }
-        public Object[] toArray(Object[] a) {
+        public Entry[] toArray(Entry[] a) {
             int sz = size();
             if (a.length < sz)  return super.toArray(a);
             System.arraycopy(cpMap, 0, a, 0, sz);
             if (a.length > sz)  a[sz] = null;
             return a;
         }
-        public Object[] toArray() {
+        public Entry[] toArray() {
             return toArray(new Entry[size()]);
         }
         public Object clone() {
--- a/src/share/classes/com/sun/java/util/jar/pack/Constants.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Constants.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -153,11 +153,11 @@
     public static final int NO_MODTIME = 0;  // null modtime value
 
     // some comstantly empty containers
-    public final static int[]    noInts = {};
-    public final static byte[]   noBytes = {};
-    public final static Object[] noValues = {};
-    public final static String[] noStrings = {};
-    public final static List     emptyList = Arrays.asList(noValues);
+    public final static int[]        noInts = {};
+    public final static byte[]       noBytes = {};
+    public final static Object[]     noValues = {};
+    public final static String[]     noStrings = {};
+    public final static List<Object> emptyList = Arrays.asList(noValues);
 
     // meta-coding
     public final static int
--- a/src/share/classes/com/sun/java/util/jar/pack/Fixups.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Fixups.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  *
  * @author John Rose
  */
-final class Fixups extends AbstractCollection {
+final class Fixups extends AbstractCollection<Fixups.Fixup> {
     byte[] bytes;    // the subject of the relocations
     int head;        // desc locating first reloc
     int tail;        // desc locating last reloc
@@ -66,11 +66,11 @@
         // If there are no bytes, all descs are kept in bigDescs.
         this((byte[])null);
     }
-    Fixups(byte[] bytes, Collection fixups) {
+    Fixups(byte[] bytes, Collection<Fixup> fixups) {
         this(bytes);
         addAll(fixups);
     }
-    Fixups(Collection fixups) {
+    Fixups(Collection<Fixup> fixups) {
         this((byte[])null);
         addAll(fixups);
     }
@@ -108,8 +108,7 @@
     public void clear() {
         if (bytes != null) {
             // Clean the bytes:
-            for (Iterator i = iterator(); i.hasNext(); ) {
-                Fixup fx = (Fixup) i.next();
+            for (Fixup fx : this) {
                 //System.out.println("clean "+fx);
                 storeIndex(fx.location(), fx.format(), 0);
             }
@@ -124,15 +123,14 @@
         return bytes;
     }
 
-    @SuppressWarnings("unchecked")
     public void setBytes(byte[] newBytes) {
         if (bytes == newBytes)  return;
-        ArrayList old = null;
-        assert((old = new ArrayList(this)) != null);
+        ArrayList<Fixup> old = null;
+        assert((old = new ArrayList<>(this)) != null);
         if (bytes == null || newBytes == null) {
             // One or the other representations is deficient.
             // Construct a checkpoint.
-            ArrayList save = new ArrayList(this);
+            ArrayList<Fixup> save = new ArrayList<>(this);
             clear();
             bytes = newBytes;
             addAll(save);
@@ -140,7 +138,7 @@
             // assume newBytes is some sort of bitwise copy of the old bytes
             bytes = newBytes;
         }
-        assert(old.equals(new ArrayList(this)));
+        assert(old.equals(new ArrayList<>(this)));
     }
 
     static final int LOC_SHIFT = 1;
@@ -236,7 +234,7 @@
 
     /** Simple and necessary tuple to present each fixup. */
     public static
-    class Fixup implements Comparable {
+    class Fixup implements Comparable<Fixup> {
         int desc;         // location and format of reloc
         Entry entry;      // which entry to plug into the bytes
         Fixup(int desc, Entry entry) {
@@ -254,9 +252,6 @@
             // Ordering depends only on location.
             return this.location() - that.location();
         }
-        public int compareTo(Object that) {
-            return compareTo((Fixup)that);
-        }
         public boolean equals(Object x) {
             if (!(x instanceof Fixup))  return false;
             Fixup that = (Fixup) x;
@@ -268,13 +263,13 @@
     }
 
     private
-    class Itr implements Iterator {
+    class Itr implements Iterator<Fixup> {
         int index = 0;               // index into entries
         int bigIndex = BIGSIZE+1;    // index into bigDescs
         int next = head;             // desc pointing to next fixup
         public boolean hasNext() { return index < size; }
         public void remove() { throw new UnsupportedOperationException(); }
-        public Object next() {
+        public Fixup next() {
             int thisIndex = index;
             return new Fixup(nextDesc(), entries[thisIndex]);
         }
@@ -298,7 +293,7 @@
         }
     }
 
-    public Iterator iterator() {
+    public Iterator<Fixup> iterator() {
         return new Itr();
     }
     public void add(int location, int format, Entry entry) {
@@ -308,11 +303,8 @@
         addDesc(f.desc, f.entry);
         return true;
     }
-    public boolean add(Object fixup) {
-        return add((Fixup) fixup);
-    }
-    @SuppressWarnings("unchecked")
-    public boolean addAll(Collection c) {
+
+    public boolean addAll(Collection<? extends Fixup> c) {
         if (c instanceof Fixups) {
             // Use knowledge of Itr structure to avoid building little structs.
             Fixups that = (Fixups) c;
@@ -453,8 +445,7 @@
     void finishRefs(ConstantPool.Index ix) {
         if (isEmpty())
             return;
-        for (Iterator i = iterator(); i.hasNext(); ) {
-            Fixup fx = (Fixup) i.next();
+        for (Fixup fx : this) {
             int index = ix.indexOf(fx.entry);
             //System.out.println("finish "+fx+" = "+index);
             // Note that the iterator has already fetched the
--- a/src/share/classes/com/sun/java/util/jar/pack/Instruction.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Instruction.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -657,6 +657,8 @@
         }
     }
     static class FormatException extends IOException {
+        private static final long serialVersionUID = 3175572275651367015L;
+
         FormatException(String message) {
             super(message);
         }
--- a/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	Wed Aug 17 22:47:49 2011 -0700
@@ -292,7 +292,7 @@
         }
 
         ZipEntry z = new ZipEntry(name);
-        z.setTime( (long)mtime * 1000);
+        z.setTime(mtime * 1000);
 
         if (size == 0) {
             z.setMethod(ZipOutputStream.STORED);
--- a/src/share/classes/com/sun/java/util/jar/pack/Package.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Package.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -188,7 +188,7 @@
     }
 
     public final
-    class Class extends Attribute.Holder implements Comparable {
+    class Class extends Attribute.Holder implements Comparable<Class> {
         public Package getPackage() { return Package.this; }
 
         // Optional file characteristics and data source (a "class stub")
@@ -247,8 +247,7 @@
         }
 
         // Note:  equals and hashCode are identity-based.
-        public int compareTo(Object o) {
-            Class that = (Class)o;
+        public int compareTo(Class that) {
             String n0 = this.getName();
             String n1 = that.getName();
             return n0.compareTo(n1);
@@ -488,7 +487,7 @@
         }
 
         public abstract
-        class Member extends Attribute.Holder implements Comparable {
+        class Member extends Attribute.Holder implements Comparable<Member> {
             DescriptorEntry descriptor;
 
             protected Member(int flags, DescriptorEntry descriptor) {
@@ -549,7 +548,7 @@
                 return descriptor.getLiteralTag();
             }
 
-            public int compareTo(Object o) {
+            public int compareTo(Member o) {
                 Field that = (Field)o;
                 return this.order - that.order;
             }
@@ -582,7 +581,7 @@
             }
 
             // Sort methods in a canonical order (by type, then by name).
-            public int compareTo(Object o) {
+            public int compareTo(Member o) {
                 Method that = (Method)o;
                 return this.getDescriptor().compareTo(that.getDescriptor());
             }
@@ -608,11 +607,10 @@
         public void trimToSize() {
             super.trimToSize();
             for (int isM = 0; isM <= 1; isM++) {
-                ArrayList members = (isM == 0) ? fields : methods;
+                ArrayList<? extends Member> members = (isM == 0) ? fields : methods;
                 if (members == null)  continue;
                 members.trimToSize();
-                for (Iterator i = members.iterator(); i.hasNext(); ) {
-                    Member m = (Member)i.next();
+                for (Member m : members) {
                     m.trimToSize();
                 }
             }
@@ -625,10 +623,9 @@
             if ("InnerClass".equals(attrName))
                 innerClasses = null;
             for (int isM = 0; isM <= 1; isM++) {
-                ArrayList members = (isM == 0) ? fields : methods;
+                ArrayList<? extends Member> members = (isM == 0) ? fields : methods;
                 if (members == null)  continue;
-                for (Iterator i = members.iterator(); i.hasNext(); ) {
-                    Member m = (Member)i.next();
+                for (Member m : members) {
                     m.strip(attrName);
                 }
             }
@@ -641,10 +638,9 @@
             refs.add(superClass);
             refs.addAll(Arrays.asList(interfaces));
             for (int isM = 0; isM <= 1; isM++) {
-                ArrayList members = (isM == 0) ? fields : methods;
+                ArrayList<? extends Member> members = (isM == 0) ? fields : methods;
                 if (members == null)  continue;
-                for (Iterator i = members.iterator(); i.hasNext(); ) {
-                    Member m = (Member)i.next();
+                for (Member m : members) {
                     boolean ok = false;
                     try {
                         m.visitRefs(mode, refs);
@@ -747,13 +743,13 @@
         return classStubs;
     }
 
-    public final class File implements Comparable {
+    public final class File implements Comparable<File> {
         String nameString;  // true name of this file
         Utf8Entry name;
         int modtime = NO_MODTIME;
         int options = 0;  // random flag bits, such as deflate_hint
         Class stubClass;  // if this is a stub, here's the class
-        ArrayList prepend = new ArrayList();  // list of byte[]
+        ArrayList<byte[]> prepend = new ArrayList<>();  // list of byte[]
         java.io.ByteArrayOutputStream append = new ByteArrayOutputStream();
 
         File(Utf8Entry name) {
@@ -798,8 +794,7 @@
             return nameString.hashCode();
         }
         // Simple alphabetic sort.  PackageWriter uses a better comparator.
-        public int compareTo(Object o) {
-            File that = (File)o;
+        public int compareTo(File that) {
             return this.nameString.compareTo(that.nameString);
         }
         public String toString() {
@@ -834,8 +829,7 @@
         public long getFileLength() {
             long len = 0;
             if (prepend == null || append == null)  return 0;
-            for (Iterator i = prepend.iterator(); i.hasNext(); ) {
-                byte[] block = (byte[]) i.next();
+            for (byte[] block : prepend) {
                 len += block.length;
             }
             len += append.size();
@@ -843,8 +837,7 @@
         }
         public void writeTo(OutputStream out) throws IOException {
             if (prepend == null || append == null)  return;
-            for (Iterator i = prepend.iterator(); i.hasNext(); ) {
-                byte[] block = (byte[]) i.next();
+            for (byte[] block : prepend) {
                 out.write(block);
             }
             append.writeTo(out);
@@ -860,8 +853,7 @@
             InputStream in = new ByteArrayInputStream(append.toByteArray());
             if (prepend.isEmpty())  return in;
             List<InputStream> isa = new ArrayList<>(prepend.size()+1);
-            for (Iterator i = prepend.iterator(); i.hasNext(); ) {
-                byte[] bytes = (byte[]) i.next();
+            for (byte[] bytes : prepend) {
                 isa.add(new ByteArrayInputStream(bytes));
             }
             isa.add(in);
@@ -926,7 +918,7 @@
     }
 
     static
-    class InnerClass implements Comparable {
+    class InnerClass implements Comparable<InnerClass> {
         final ClassEntry thisClass;
         final ClassEntry outerClass;
         final Utf8Entry name;
@@ -977,8 +969,7 @@
         public int hashCode() {
             return thisClass.hashCode();
         }
-        public int compareTo(Object o) {
-            InnerClass that = (InnerClass)o;
+        public int compareTo(InnerClass that) {
             return this.thisClass.compareTo(that.thisClass);
         }
 
@@ -1108,7 +1099,7 @@
         return ConstantPool.getUtf8Entry(s);
     }
 
-    static LiteralEntry getRefLiteral(Comparable s) {
+    static LiteralEntry getRefLiteral(Comparable<?> s) {
         return ConstantPool.getLiteralEntry(s);
     }
 
@@ -1199,7 +1190,6 @@
     // compress better.  It also moves classes to the end of the
     // file order.  It also removes JAR directory entries, which
     // are useless.
-    @SuppressWarnings("unchecked")
     void reorderFiles(boolean keepClassOrder, boolean stripDirectories) {
         // First reorder the classes, if that is allowed.
         if (!keepClassOrder) {
@@ -1226,10 +1216,8 @@
         // This keeps files of similar format near each other.
         // Put class files at the end, keeping their fixed order.
         // Be sure the JAR file's required manifest stays at the front. (4893051)
-        Collections.sort(files, new Comparator() {
-                public int compare(Object o0, Object o1) {
-                    File r0 = (File) o0;
-                    File r1 = (File) o1;
+        Collections.sort(files, new Comparator<File>() {
+                public int compare(File r0, File r1) {
                     // Get the file name.
                     String f0 = r0.nameString;
                     String f1 = r1.nameString;
--- a/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Wed Aug 17 22:47:49 2011 -0700
@@ -750,7 +750,7 @@
         file_options.readFrom(in);
         file_bits.setInputStreamFrom(in);
 
-        Iterator nextClass = pkg.getClasses().iterator();
+        Iterator<Class> nextClass = pkg.getClasses().iterator();
 
         // Compute file lengths before reading any file bits.
         long totalFileLength = 0;
@@ -790,14 +790,14 @@
             pkg.addFile(file);
             if (file.isClassStub()) {
                 assert(file.getFileLength() == 0);
-                Class cls = (Class) nextClass.next();
+                Class cls = nextClass.next();
                 cls.initFile(file);
             }
         }
 
         // Do the rest of the classes.
         while (nextClass.hasNext()) {
-            Class cls = (Class) nextClass.next();
+            Class cls = nextClass.next();
             cls.initFile(null);  // implicitly initialize to a trivial one
             cls.file.modtime = pkg.default_modtime;
         }
@@ -1006,14 +1006,14 @@
         if (k >= 0)
             return k;
         if (e.tag == CONSTANT_Utf8) {
-            Entry se = (Entry) utf8Signatures.get(e);
+            Entry se = utf8Signatures.get(e);
             return pkg.cp.untypedIndexOf(se);
         }
         return -1;
     }
 
     Comparator<Entry> entryOutputOrder = new Comparator<Entry>() {
-        public int compare(Entry  e0, Entry e1) {
+        public int compare(Entry e0, Entry e1) {
             int k0 = getOutputIndex(e0);
             int k1 = getOutputIndex(e1);
             if (k0 >= 0 && k1 >= 0)
@@ -1332,7 +1332,8 @@
     // classes, fields, methods, and codes.
     // The holders is a global list, already collected,
     // of attribute "customers".
-    void countAndReadAttrs(int ctype, Collection holders) throws IOException {
+    void countAndReadAttrs(int ctype, Collection<? extends Attribute.Holder> holders)
+            throws IOException {
         //  class_attr_bands:
         //        *class_flags :UNSIGNED5
         //        *class_attr_count :UNSIGNED5
@@ -1386,7 +1387,8 @@
 
     // Read flags and count the attributes that are to be placed
     // on the given holders.
-    void countAttrs(int ctype, Collection holders) throws IOException {
+    void countAttrs(int ctype, Collection<? extends Attribute.Holder> holders)
+            throws IOException {
         // Here, xxx stands for one of class, field, method, code.
         MultiBand xxx_attr_bands = attrBands[ctype];
         long flagMask = attrFlagMask[ctype];
@@ -1414,8 +1416,7 @@
         xxx_flags_lo.expectLength(holders.size());
         xxx_flags_lo.readFrom(in);
         assert((flagMask & overflowMask) == overflowMask);
-        for (Iterator i = holders.iterator(); i.hasNext(); ) {
-            Attribute.Holder h = (Attribute.Holder) i.next();
+        for (Attribute.Holder h : holders) {
             int flags = xxx_flags_lo.getInt();
             h.flags = flags;
             if ((flags & overflowMask) != 0)
@@ -1433,8 +1434,7 @@
         // (class/field/method/code), and also we accumulate (b) a total
         // count for each attribute type.
         int[] totalCounts = new int[defs.length];
-        for (Iterator i = holders.iterator(); i.hasNext(); ) {
-            Attribute.Holder h = (Attribute.Holder) i.next();
+        for (Attribute.Holder h : holders) {
             assert(h.attributes == null);
             // System.out.println("flags="+h.flags+" using fm="+flagMask);
             long attrBits = ((h.flags & flagMask) << 32) >>> 32;
@@ -1582,13 +1582,12 @@
                                    ATTR_CONTEXT_NAME[ctype]+" attribute");
     }
 
-    @SuppressWarnings("unchecked")
-    void readAttrs(int ctype, Collection holders) throws IOException {
+    void readAttrs(int ctype, Collection<? extends Attribute.Holder> holders)
+            throws IOException {
         // Decode band values into attributes.
         Set<Attribute.Layout> sawDefs = new HashSet<>();
         ByteArrayOutputStream buf = new ByteArrayOutputStream();
-        for (Iterator i = holders.iterator(); i.hasNext(); ) {
-            final Attribute.Holder h = (Attribute.Holder) i.next();
+        for (final Attribute.Holder h : holders) {
             if (h.attributes == null)  continue;
             for (ListIterator<Attribute> j = h.attributes.listIterator(); j.hasNext(); ) {
                 Attribute a = j.next();
--- a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Wed Aug 17 22:47:49 2011 -0700
@@ -720,7 +720,6 @@
             Utils.log.info("Wrote "+numFiles+" resource files");
     }
 
-    @SuppressWarnings("unchecked")
     void collectAttributeLayouts() {
         maxFlags = new int[ATTR_CONTEXT_LIMIT];
         allLayouts = new FixedList<>(ATTR_CONTEXT_LIMIT);
@@ -781,26 +780,27 @@
             avHiBits &= (1L<<attrIndexLimit[i])-1;
             int nextLoBit = 0;
             Map<Attribute.Layout, int[]> defMap = allLayouts.get(i);
-            Map.Entry[] layoutsAndCounts = new Map.Entry[defMap.size()];
+            @SuppressWarnings({ "unchecked", "rawtypes" })
+            Map.Entry<Attribute.Layout, int[]>[] layoutsAndCounts =
+                    new Map.Entry[defMap.size()];
             defMap.entrySet().toArray(layoutsAndCounts);
             // Sort by count, most frequent first.
             // Predefs. participate in this sort, though it does not matter.
-            Arrays.sort(layoutsAndCounts, new Comparator<Object>() {
-                public int compare(Object o0, Object o1) {
-                    Map.Entry e0 = (Map.Entry) o0;
-                    Map.Entry e1 = (Map.Entry) o1;
+            Arrays.sort(layoutsAndCounts,
+                        new Comparator<Map.Entry<Attribute.Layout, int[]>>() {
+                public int compare(Map.Entry<Attribute.Layout, int[]> e0,
+                                   Map.Entry<Attribute.Layout, int[]> e1) {
                     // Primary sort key is count, reversed.
-                    int r = - ( ((int[])e0.getValue())[0]
-                              - ((int[])e1.getValue())[0] );
+                    int r = -(e0.getValue()[0] - e1.getValue()[0]);
                     if (r != 0)  return r;
-                    return ((Comparable)e0.getKey()).compareTo(e1.getKey());
+                    return e0.getKey().compareTo(e1.getKey());
                 }
             });
             attrCounts[i] = new int[attrIndexLimit[i]+layoutsAndCounts.length];
             for (int j = 0; j < layoutsAndCounts.length; j++) {
-                Map.Entry e = layoutsAndCounts[j];
-                Attribute.Layout def = (Attribute.Layout) e.getKey();
-                int count = ((int[])e.getValue())[0];
+                Map.Entry<Attribute.Layout, int[]> e = layoutsAndCounts[j];
+                Attribute.Layout def = e.getKey();
+                int count = e.getValue()[0];
                 int index;
                 Integer predefIndex = attrIndexTable.get(def);
                 if (predefIndex != null) {
@@ -881,7 +881,6 @@
 
     Attribute.Layout[] attrDefsWritten;
 
-    @SuppressWarnings("unchecked")
     void writeAttrDefs() throws IOException {
         List<Object[]> defList = new ArrayList<>();
         for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
@@ -906,20 +905,19 @@
         int numAttrDefs = defList.size();
         Object[][] defs = new Object[numAttrDefs][];
         defList.toArray(defs);
-        Arrays.sort(defs, new Comparator() {
-            public int compare(Object o0, Object o1) {
-                Object[] a0 = (Object[]) o0;
-                Object[] a1 = (Object[]) o1;
+        Arrays.sort(defs, new Comparator<Object[]>() {
+            public int compare(Object[] a0, Object[] a1) {
                 // Primary sort key is attr def header.
+                @SuppressWarnings("unchecked")
                 int r = ((Comparable)a0[0]).compareTo(a1[0]);
                 if (r != 0)  return r;
-                Object ind0 = attrIndexTable.get(a0[1]);
-                Object ind1 = attrIndexTable.get(a1[1]);
+                Integer ind0 = attrIndexTable.get(a0[1]);
+                Integer ind1 = attrIndexTable.get(a1[1]);
                 // Secondary sort key is attribute index.
                 // (This must be so, in order to keep overflow attr order.)
                 assert(ind0 != null);
                 assert(ind1 != null);
-                return ((Comparable)ind0).compareTo(ind1);
+                return ind0.compareTo(ind1);
             }
         });
         attrDefsWritten = new Attribute.Layout[numAttrDefs];
--- a/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,8 +69,7 @@
      * Get the set of options for the pack and unpack engines.
      * @return A sorted association of option key strings to option values.
      */
-    @SuppressWarnings("unchecked")
-    public SortedMap properties() {
+    public SortedMap<String, String> properties() {
         return props;
     }
 
@@ -157,7 +156,6 @@
 
     // All the worker bees.....
     // The packer worker.
-    @SuppressWarnings("unchecked")
     private class DoPack {
         final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
 
@@ -199,9 +197,8 @@
             };
             for (int i = 0; i < ctypes.length; i++) {
                 String pfx = keys[i];
-                Map<Object, Object> map = props.prefixMap(pfx);
-                for (Object k : map.keySet()) {
-                    String key = (String)k;
+                Map<String, String> map = props.prefixMap(pfx);
+                for (String key : map.keySet()) {
                     assert(key.startsWith(pfx));
                     String name = key.substring(pfx.length());
                     String layout = props.getProperty(key);
--- a/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Wed Aug 17 22:47:49 2011 -0700
@@ -27,7 +27,6 @@
 
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
@@ -47,8 +46,8 @@
  * Control block for publishing Pack200 options to the other classes.
  */
 
-final class PropMap implements SortedMap<Object, Object>  {
-    private final TreeMap<Object, Object> theMap = new TreeMap<>();;
+final class PropMap implements SortedMap<String, String>  {
+    private final TreeMap<String, String> theMap = new TreeMap<>();;
     private final List<PropertyChangeListener> listenerList = new ArrayList<>(1);
 
     void addListener(PropertyChangeListener listener) {
@@ -68,12 +67,12 @@
     }
 
     // Override:
-    public Object put(Object key, Object value) {
-        Object oldValue = theMap.put(key, value);
+    public String put(String key, String value) {
+        String oldValue = theMap.put(key, value);
         if (value != oldValue && !listenerList.isEmpty()) {
             // Post the property change event.
             PropertyChangeEvent event =
-                new PropertyChangeEvent(this, (String) key,
+                new PropertyChangeEvent(this, key,
                                         oldValue, value);
             for (PropertyChangeListener listener : listenerList) {
                 listener.propertyChange(event);
@@ -85,7 +84,7 @@
     // All this other stuff is private to the current package.
     // Outide clients of Pack200 do not need to use it; they can
     // get by with generic SortedMap functionality.
-    private static Map<Object, Object> defaultProps;
+    private static Map<String, String> defaultProps;
     static {
         Properties props = new Properties();
 
@@ -141,7 +140,9 @@
             }
         }
 
-        defaultProps = (new HashMap<>(props));  // shrink to fit
+        @SuppressWarnings({"unchecked", "rawtypes"})
+        HashMap<String, String> temp = new HashMap(props);  // shrink to fit
+        defaultProps = temp;
     }
 
     PropMap() {
@@ -151,7 +152,7 @@
     // Return a view of this map which includes only properties
     // that begin with the given prefix.  This is easy because
     // the map is sorted, and has a subMap accessor.
-    SortedMap<Object, Object> prefixMap(String prefix) {
+    SortedMap<String, String> prefixMap(String prefix) {
         int len = prefix.length();
         if (len == 0)
             return this;
@@ -162,7 +163,7 @@
     }
 
     String getProperty(String s) {
-        return (String) get(s);
+        return get(s);
     }
     String getProperty(String s, String defaultVal) {
         String val = getProperty(s);
@@ -171,13 +172,13 @@
         return val;
     }
     String setProperty(String s, String val) {
-        return (String) put(s, val);
+        return put(s, val);
     }
 
     // Get sequence of props for "prefix", and "prefix.*".
-    List getProperties(String prefix) {
-        Collection<Object> values = prefixMap(prefix).values();
-        List<Object> res = new ArrayList<>(values.size());
+    List<String> getProperties(String prefix) {
+        Collection<String> values = prefixMap(prefix).values();
+        List<String> res = new ArrayList<>(values.size());
         res.addAll(values);
         while (res.remove(null));
         return res;
@@ -241,8 +242,8 @@
     }
     void list(PrintWriter out) {
         out.println("#"+Utils.PACK_ZIP_ARCHIVE_MARKER_COMMENT+"[");
-        Set defaults = defaultProps.entrySet();
-        for (Map.Entry e : theMap.entrySet()) {
+        Set<Map.Entry<String, String>> defaults = defaultProps.entrySet();
+        for (Map.Entry<String, String> e : theMap.entrySet()) {
             if (defaults.contains(e))  continue;
             out.println("  " + e.getKey() + " = " + e.getValue());
         }
@@ -270,18 +271,17 @@
     }
 
     @Override
-    public Object get(Object key) {
+    public String get(Object key) {
         return theMap.get(key);
     }
 
     @Override
-    public Object remove(Object key) {
+    public String remove(Object key) {
        return theMap.remove(key);
     }
 
     @Override
-    @SuppressWarnings("unchecked")
-    public void putAll(Map m) {
+    public void putAll(Map<? extends String, ? extends String> m) {
        theMap.putAll(m);
     }
 
@@ -291,48 +291,47 @@
     }
 
     @Override
-    public Set<Object> keySet() {
+    public Set<String> keySet() {
        return theMap.keySet();
     }
 
     @Override
-    public Collection<Object> values() {
+    public Collection<String> values() {
        return theMap.values();
     }
 
     @Override
-    public Set<Map.Entry<Object, Object>> entrySet() {
+    public Set<Map.Entry<String, String>> entrySet() {
         return theMap.entrySet();
     }
 
     @Override
-    @SuppressWarnings("unchecked")
-    public Comparator<Object> comparator() {
-        return (Comparator<Object>) theMap.comparator();
+    public Comparator<? super String> comparator() {
+        return theMap.comparator();
     }
 
     @Override
-    public SortedMap<Object, Object> subMap(Object fromKey, Object toKey) {
+    public SortedMap<String, String> subMap(String fromKey, String toKey) {
         return theMap.subMap(fromKey, toKey);
     }
 
     @Override
-    public SortedMap<Object, Object> headMap(Object toKey) {
+    public SortedMap<String, String> headMap(String toKey) {
         return theMap.headMap(toKey);
     }
 
     @Override
-    public SortedMap<Object, Object> tailMap(Object fromKey) {
+    public SortedMap<String, String> tailMap(String fromKey) {
         return theMap.tailMap(fromKey);
     }
 
     @Override
-    public Object firstKey() {
+    public String firstKey() {
         return theMap.firstKey();
     }
 
     @Override
-    public Object lastKey() {
+    public String lastKey() {
        return theMap.lastKey();
     }
 }
--- a/src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
         props = new PropMap();
     }
 
-    SortedMap<Object, Object> getPropMap() {
+    SortedMap<String, String> getPropMap() {
         return props;
     }
 
--- a/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -81,8 +81,7 @@
      * Get the set of options for the pack and unpack engines.
      * @return A sorted association of option key strings to option values.
      */
-    @SuppressWarnings("unchecked")
-    public SortedMap properties() {
+    public SortedMap<String, String> properties() {
         return props;
     }
 
--- a/src/share/classes/com/sun/java/util/jar/pack/Utils.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/Utils.java	Wed Aug 17 22:47:49 2011 -0700
@@ -253,8 +253,8 @@
     }
     static void copyJarFile(JarFile in, JarOutputStream out) throws IOException {
         byte[] buffer = new byte[1 << 14];
-        for (Enumeration e = in.entries(); e.hasMoreElements(); ) {
-            JarEntry je = (JarEntry) e.nextElement();
+        for (Enumeration<JarEntry> e = in.entries(); e.hasMoreElements(); ) {
+            JarEntry je = e.nextElement();
             out.putNextEntry(je);
             InputStream ein = in.getInputStream(je);
             for (int nr; 0 < (nr = ein.read(buffer)); ) {
--- a/src/share/classes/com/sun/jndi/ldap/Filter.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/com/sun/jndi/ldap/Filter.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -632,15 +632,17 @@
         }
     }
 
+    // The complex filter types look like:
+    //     "&(type=val)(type=val)"
+    //     "|(type=val)(type=val)"
+    //     "!(type=val)"
+    //
+    // The filtOffset[0] pointing to the '&', '|', or '!'.
+    //
     private static void encodeComplexFilter(BerEncoder ber, byte[] filter,
         int filterType, int filtOffset[], int filtEnd)
         throws IOException, NamingException {
 
-        //
-        // We have a complex filter of type "&(type=val)(type=val)"
-        // with filtOffset[0] pointing to the &
-        //
-
         if (dbg) {
             dprint("encComplexFilter: ", filter, filtOffset[0], filtEnd);
             dprint(", type: " + Integer.toString(filterType, 16));
@@ -652,7 +654,7 @@
         ber.beginSeq(filterType);
 
             int[] parens = findRightParen(filter, filtOffset, filtEnd);
-            encodeFilterList(ber, filter, parens[0], parens[1]);
+            encodeFilterList(ber, filter, filterType, parens[0], parens[1]);
 
         ber.endSeq();
 
@@ -706,7 +708,7 @@
     // Encode filter list of type "(filter1)(filter2)..."
     //
     private static void encodeFilterList(BerEncoder ber, byte[] filter,
-        int start, int end) throws IOException, NamingException {
+        int filterType, int start, int end) throws IOException, NamingException {
 
         if (dbg) {
             dprint("encFilterList: ", filter, start, end);
@@ -714,12 +716,16 @@
         }
 
         int filtOffset[] = new int[1];
-
-        for (filtOffset[0] = start; filtOffset[0] < end;
-                                                            filtOffset[0]++) {
+        int listNumber = 0;
+        for (filtOffset[0] = start; filtOffset[0] < end; filtOffset[0]++) {
             if (Character.isSpaceChar((char)filter[filtOffset[0]]))
                 continue;
 
+            if ((filterType == LDAP_FILTER_NOT) && (listNumber > 0)) {
+                throw new InvalidSearchFilterException(
+                    "Filter (!) cannot be followed by more than one filters");
+            }
+
             if (filter[filtOffset[0]] == '(') {
                 continue;
             }
@@ -733,6 +739,8 @@
             newfilter[0] = (byte)'(';
             newfilter[len+1] = (byte)')';
             encodeFilter(ber, newfilter, 0, newfilter.length);
+
+            listNumber++;
         }
 
         if (dbg) {
--- a/src/share/classes/java/lang/Class.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/lang/Class.java	Wed Aug 17 22:47:49 2011 -0700
@@ -31,7 +31,6 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.GenericDeclaration;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
@@ -45,10 +44,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.LinkedList;
-import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.Map;
 import java.util.HashMap;
@@ -56,7 +52,6 @@
 import sun.reflect.ConstantPool;
 import sun.reflect.Reflection;
 import sun.reflect.ReflectionFactory;
-import sun.reflect.SignatureIterator;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.repository.ClassRepository;
@@ -354,7 +349,8 @@
                         });
                 cachedConstructor = c;
             } catch (NoSuchMethodException e) {
-                throw new InstantiationException(getName());
+                throw (InstantiationException)
+                    new InstantiationException(getName()).initCause(e);
             }
         }
         Constructor<T> tmpConstructor = cachedConstructor;
@@ -978,7 +974,8 @@
                 descriptor      = (String)   enclosingInfo[2];
                 assert((name != null && descriptor != null) || name == descriptor);
             } catch (ClassCastException cce) {
-                throw new InternalError("Invalid type in enclosing method information");
+                throw (InternalError)
+                    new InternalError("Invalid type in enclosing method information").initCause(cce);
             }
         }
 
@@ -1244,7 +1241,8 @@
         try {
             return getName().substring(enclosingClass.getName().length());
         } catch (IndexOutOfBoundsException ex) {
-            throw new InternalError("Malformed class name");
+            throw (InternalError)
+                new InternalError("Malformed class name").initCause(ex);
         }
     }
 
@@ -2559,7 +2557,7 @@
         // Start by fetching public declared methods
         MethodArray methods = new MethodArray();
         {
-            Method[] tmp = privateGetDeclaredMethods(true);
+                Method[] tmp = privateGetDeclaredMethods(true);
             methods.addAll(tmp);
         }
         // Now recur over superclass and direct superinterfaces.
@@ -2909,6 +2907,7 @@
                         return null;
                     }
 
+                    // Doesn't use Boolean.getBoolean to avoid class init.
                     String val =
                         System.getProperty("sun.reflect.noCaches");
                     if (val != null && val.equals("true")) {
@@ -2958,9 +2957,8 @@
             }
             // These can happen when users concoct enum-like classes
             // that don't comply with the enum spec.
-            catch (InvocationTargetException ex) { return null; }
-            catch (NoSuchMethodException ex) { return null; }
-            catch (IllegalAccessException ex) { return null; }
+            catch (InvocationTargetException | NoSuchMethodException |
+                   IllegalAccessException ex) { return null; }
         }
         return enumConstants;
     }
--- a/src/share/classes/java/lang/Math.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/lang/Math.java	Wed Aug 17 22:47:49 2011 -0700
@@ -50,34 +50,34 @@
  *
  * <p>The quality of implementation specifications concern two
  * properties, accuracy of the returned result and monotonicity of the
- * method.  Accuracy of the floating-point {@code Math} methods
- * is measured in terms of <i>ulps</i>, units in the last place.  For
- * a given floating-point format, an ulp of a specific real number
- * value is the distance between the two floating-point values
- * bracketing that numerical value.  When discussing the accuracy of a
- * method as a whole rather than at a specific argument, the number of
- * ulps cited is for the worst-case error at any argument.  If a
- * method always has an error less than 0.5 ulps, the method always
- * returns the floating-point number nearest the exact result; such a
- * method is <i>correctly rounded</i>.  A correctly rounded method is
- * generally the best a floating-point approximation can be; however,
- * it is impractical for many floating-point methods to be correctly
- * rounded.  Instead, for the {@code Math} class, a larger error
- * bound of 1 or 2 ulps is allowed for certain methods.  Informally,
- * with a 1 ulp error bound, when the exact result is a representable
- * number, the exact result should be returned as the computed result;
- * otherwise, either of the two floating-point values which bracket
- * the exact result may be returned.  For exact results large in
- * magnitude, one of the endpoints of the bracket may be infinite.
- * Besides accuracy at individual arguments, maintaining proper
- * relations between the method at different arguments is also
- * important.  Therefore, most methods with more than 0.5 ulp errors
- * are required to be <i>semi-monotonic</i>: whenever the mathematical
- * function is non-decreasing, so is the floating-point approximation,
- * likewise, whenever the mathematical function is non-increasing, so
- * is the floating-point approximation.  Not all approximations that
- * have 1 ulp accuracy will automatically meet the monotonicity
- * requirements.
+ * method.  Accuracy of the floating-point {@code Math} methods is
+ * measured in terms of <i>ulps</i>, units in the last place.  For a
+ * given floating-point format, an {@linkplain #ulp(double) ulp} of a
+ * specific real number value is the distance between the two
+ * floating-point values bracketing that numerical value.  When
+ * discussing the accuracy of a method as a whole rather than at a
+ * specific argument, the number of ulps cited is for the worst-case
+ * error at any argument.  If a method always has an error less than
+ * 0.5 ulps, the method always returns the floating-point number
+ * nearest the exact result; such a method is <i>correctly
+ * rounded</i>.  A correctly rounded method is generally the best a
+ * floating-point approximation can be; however, it is impractical for
+ * many floating-point methods to be correctly rounded.  Instead, for
+ * the {@code Math} class, a larger error bound of 1 or 2 ulps is
+ * allowed for certain methods.  Informally, with a 1 ulp error bound,
+ * when the exact result is a representable number, the exact result
+ * should be returned as the computed result; otherwise, either of the
+ * two floating-point values which bracket the exact result may be
+ * returned.  For exact results large in magnitude, one of the
+ * endpoints of the bracket may be infinite.  Besides accuracy at
+ * individual arguments, maintaining proper relations between the
+ * method at different arguments is also important.  Therefore, most
+ * methods with more than 0.5 ulp errors are required to be
+ * <i>semi-monotonic</i>: whenever the mathematical function is
+ * non-decreasing, so is the floating-point approximation, likewise,
+ * whenever the mathematical function is non-increasing, so is the
+ * floating-point approximation.  Not all approximations that have 1
+ * ulp accuracy will automatically meet the monotonicity requirements.
  *
  * @author  unascribed
  * @author  Joseph D. Darcy
@@ -940,11 +940,11 @@
     }
 
     /**
-     * Returns the size of an ulp of the argument.  An ulp of a
-     * {@code double} value is the positive distance between this
-     * floating-point value and the {@code double} value next
-     * larger in magnitude.  Note that for non-NaN <i>x</i>,
-     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
+     * Returns the size of an ulp of the argument.  An ulp, unit in
+     * the last place, of a {@code double} value is the positive
+     * distance between this floating-point value and the {@code
+     * double} value next larger in magnitude.  Note that for non-NaN
+     * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
      *
      * <p>Special Cases:
      * <ul>
@@ -967,11 +967,11 @@
     }
 
     /**
-     * Returns the size of an ulp of the argument.  An ulp of a
-     * {@code float} value is the positive distance between this
-     * floating-point value and the {@code float} value next
-     * larger in magnitude.  Note that for non-NaN <i>x</i>,
-     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
+     * Returns the size of an ulp of the argument.  An ulp, unit in
+     * the last place, of a {@code float} value is the positive
+     * distance between this floating-point value and the {@code
+     * float} value next larger in magnitude.  Note that for non-NaN
+     * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
      *
      * <p>Special Cases:
      * <ul>
--- a/src/share/classes/java/lang/StrictMath.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/lang/StrictMath.java	Wed Aug 17 22:47:49 2011 -0700
@@ -932,11 +932,11 @@
     }
 
     /**
-     * Returns the size of an ulp of the argument.  An ulp of a
-     * {@code double} value is the positive distance between this
-     * floating-point value and the {@code double} value next
-     * larger in magnitude.  Note that for non-NaN <i>x</i>,
-     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
+     * Returns the size of an ulp of the argument.  An ulp, unit in
+     * the last place, of a {@code double} value is the positive
+     * distance between this floating-point value and the {@code
+     * double} value next larger in magnitude.  Note that for non-NaN
+     * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
      *
      * <p>Special Cases:
      * <ul>
@@ -959,11 +959,11 @@
     }
 
     /**
-     * Returns the size of an ulp of the argument.  An ulp of a
-     * {@code float} value is the positive distance between this
-     * floating-point value and the {@code float} value next
-     * larger in magnitude.  Note that for non-NaN <i>x</i>,
-     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
+     * Returns the size of an ulp of the argument.  An ulp, unit in
+     * the last place, of a {@code float} value is the positive
+     * distance between this floating-point value and the {@code
+     * float} value next larger in magnitude.  Note that for non-NaN
+     * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
      *
      * <p>Special Cases:
      * <ul>
--- a/src/share/classes/java/lang/reflect/Constructor.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/lang/reflect/Constructor.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,12 @@
 
 import sun.reflect.ConstructorAccessor;
 import sun.reflect.Reflection;
+import sun.reflect.annotation.AnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.scope.ConstructorScope;
 import java.lang.annotation.Annotation;
-import java.util.Map;
-import sun.reflect.annotation.AnnotationParser;
 import java.lang.annotation.AnnotationFormatError;
 import java.lang.reflect.Modifier;
 
@@ -57,11 +56,7 @@
  * @author      Kenneth Russell
  * @author      Nakul Saraiya
  */
-public final
-    class Constructor<T> extends AccessibleObject implements
-                                                    GenericDeclaration,
-                                                    Member {
-
+public final class Constructor<T> extends Executable {
     private Class<T>            clazz;
     private int                 slot;
     private Class<?>[]          parameterTypes;
@@ -82,7 +77,8 @@
     }
 
     // Accessor for generic info repository
-    private ConstructorRepository getGenericInfo() {
+    @Override
+    ConstructorRepository getGenericInfo() {
         // lazily initialize repository if necessary
         if (genericInfo == null) {
             // create and cache generic info repository
@@ -111,8 +107,7 @@
                 int slot,
                 String signature,
                 byte[] annotations,
-                byte[] parameterAnnotations)
-    {
+                byte[] parameterAnnotations) {
         this.clazz = declaringClass;
         this.parameterTypes = parameterTypes;
         this.exceptionTypes = checkedExceptions;
@@ -137,21 +132,31 @@
         // objects be fabricated for each reflective call on Class
         // objects.)
         Constructor<T> res = new Constructor<>(clazz,
-                                                parameterTypes,
-                                                exceptionTypes, modifiers, slot,
-                                                signature,
-                                                annotations,
-                                                parameterAnnotations);
+                                               parameterTypes,
+                                               exceptionTypes, modifiers, slot,
+                                               signature,
+                                               annotations,
+                                               parameterAnnotations);
         res.root = this;
         // Might as well eagerly propagate this if already present
         res.constructorAccessor = constructorAccessor;
         return res;
     }
 
+    @Override
+    boolean hasGenericInformation() {
+        return (getSignature() != null);
+    }
+
+    @Override
+    byte[] getAnnotationBytes() {
+        return annotations;
+    }
+
     /**
-     * Returns the {@code Class} object representing the class that declares
-     * the constructor represented by this {@code Constructor} object.
+     * {@inheritDoc}
      */
+    @Override
     public Class<T> getDeclaringClass() {
         return clazz;
     }
@@ -160,36 +165,25 @@
      * Returns the name of this constructor, as a string.  This is
      * the binary name of the constructor's declaring class.
      */
+    @Override
     public String getName() {
         return getDeclaringClass().getName();
     }
 
     /**
-     * Returns the Java language modifiers for the constructor
-     * represented by this {@code Constructor} object, as an integer. The
-     * {@code Modifier} class should be used to decode the modifiers.
-     *
-     * @see Modifier
+     * {@inheritDoc}
      */
+    @Override
     public int getModifiers() {
         return modifiers;
     }
 
     /**
-     * Returns an array of {@code TypeVariable} objects that represent the
-     * type variables declared by the generic declaration represented by this
-     * {@code GenericDeclaration} object, in declaration order.  Returns an
-     * array of length 0 if the underlying generic declaration declares no type
-     * variables.
-     *
-     * @return an array of {@code TypeVariable} objects that represent
-     *     the type variables declared by this generic declaration
-     * @throws GenericSignatureFormatError if the generic
-     *     signature of this generic declaration does not conform to
-     *     the format specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
       if (getSignature() != null) {
         return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
@@ -199,98 +193,45 @@
 
 
     /**
-     * Returns an array of {@code Class} objects that represent the formal
-     * parameter types, in declaration order, of the constructor
-     * represented by this {@code Constructor} object.  Returns an array of
-     * length 0 if the underlying constructor takes no parameters.
-     *
-     * @return the parameter types for the constructor this object
-     * represents
+     * {@inheritDoc}
      */
+    @Override
     public Class<?>[] getParameterTypes() {
         return (Class<?>[]) parameterTypes.clone();
     }
 
+    /**
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
+     * @since 1.5
+     */
+    @Override
+    public Type[] getGenericParameterTypes() {
+        return super.getGenericParameterTypes();
+    }
 
     /**
-     * Returns an array of {@code Type} objects that represent the formal
-     * parameter types, in declaration order, of the method represented by
-     * this {@code Constructor} object. Returns an array of length 0 if the
-     * underlying method takes no parameters.
-     *
-     * <p>If a formal parameter type is a parameterized type,
-     * the {@code Type} object returned for it must accurately reflect
-     * the actual type parameters used in the source code.
-     *
-     * <p>If a formal parameter type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of {@code Type}s that represent the formal
-     *     parameter types of the underlying method, in declaration order
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if any of the parameter
-     *     types of the underlying method refers to a non-existent type
-     *     declaration
-     * @throws MalformedParameterizedTypeException if any of
-     *     the underlying method's parameter types refer to a parameterized
-     *     type that cannot be instantiated for any reason
-     * @since 1.5
+     * {@inheritDoc}
      */
-    public Type[] getGenericParameterTypes() {
-        if (getSignature() != null)
-            return getGenericInfo().getParameterTypes();
-        else
-            return getParameterTypes();
-    }
-
-
-    /**
-     * Returns an array of {@code Class} objects that represent the types
-     * of exceptions declared to be thrown by the underlying constructor
-     * represented by this {@code Constructor} object.  Returns an array of
-     * length 0 if the constructor declares no exceptions in its {@code throws} clause.
-     *
-     * @return the exception types declared as being thrown by the
-     * constructor this object represents
-     */
+    @Override
     public Class<?>[] getExceptionTypes() {
         return (Class<?>[])exceptionTypes.clone();
     }
 
 
     /**
-     * Returns an array of {@code Type} objects that represent the
-     * exceptions declared to be thrown by this {@code Constructor} object.
-     * Returns an array of length 0 if the underlying method declares
-     * no exceptions in its {@code throws} clause.
-     *
-     * <p>If an exception type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of Types that represent the exception types
-     *     thrown by the underlying method
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if the underlying method's
-     *     {@code throws} clause refers to a non-existent type declaration
-     * @throws MalformedParameterizedTypeException if
-     *     the underlying method's {@code throws} clause refers to a
-     *     parameterized type that cannot be instantiated for any reason
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
      * @since 1.5
      */
-      public Type[] getGenericExceptionTypes() {
-          Type[] result;
-          if (getSignature() != null &&
-              ( (result = getGenericInfo().getExceptionTypes()).length > 0  ))
-              return result;
-          else
-              return getExceptionTypes();
-      }
+    @Override
+    public Type[] getGenericExceptionTypes() {
+        return super.getGenericExceptionTypes();
+    }
 
     /**
      * Compares this {@code Constructor} against the specified object.
@@ -302,16 +243,7 @@
         if (obj != null && obj instanceof Constructor) {
             Constructor<?> other = (Constructor<?>)obj;
             if (getDeclaringClass() == other.getDeclaringClass()) {
-                /* Avoid unnecessary cloning */
-                Class<?>[] params1 = parameterTypes;
-                Class<?>[] params2 = other.parameterTypes;
-                if (params1.length == params2.length) {
-                    for (int i = 0; i < params1.length; i++) {
-                        if (params1[i] != params2[i])
-                            return false;
-                    }
-                    return true;
-                }
+                return equalParamTypes(parameterTypes, other.parameterTypes);
             }
         }
         return false;
@@ -342,34 +274,14 @@
      * constructor has default (package) access.
      */
     public String toString() {
-        try {
-            StringBuffer sb = new StringBuffer();
-            int mod = getModifiers() & Modifier.constructorModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod) + " ");
-            }
-            sb.append(Field.getTypeName(getDeclaringClass()));
-            sb.append("(");
-            Class<?>[] params = parameterTypes; // avoid clone
-            for (int j = 0; j < params.length; j++) {
-                sb.append(Field.getTypeName(params[j]));
-                if (j < (params.length - 1))
-                    sb.append(",");
-            }
-            sb.append(")");
-            Class<?>[] exceptions = exceptionTypes; // avoid clone
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append(exceptions[k].getName());
-                    if (k < (exceptions.length - 1))
-                        sb.append(",");
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        return sharedToString(Modifier.constructorModifiers(),
+                              parameterTypes,
+                              exceptionTypes);
+    }
+
+    @Override
+    void specificToStringHeader(StringBuilder sb) {
+        sb.append(Field.getTypeName(getDeclaringClass()));
     }
 
     /**
@@ -405,56 +317,14 @@
      *
      * @since 1.5
      */
+    @Override
     public String toGenericString() {
-        try {
-            StringBuilder sb = new StringBuilder();
-            int mod = getModifiers() & Modifier.constructorModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod) + " ");
-            }
-            TypeVariable<?>[] typeparms = getTypeParameters();
-            if (typeparms.length > 0) {
-                boolean first = true;
-                sb.append("<");
-                for(TypeVariable<?> typeparm: typeparms) {
-                    if (!first)
-                        sb.append(",");
-                    // Class objects can't occur here; no need to test
-                    // and call Class.getName().
-                    sb.append(typeparm.toString());
-                    first = false;
-                }
-                sb.append("> ");
-            }
-            sb.append(Field.getTypeName(getDeclaringClass()));
-            sb.append("(");
-            Type[] params = getGenericParameterTypes();
-            for (int j = 0; j < params.length; j++) {
-                String param = (params[j] instanceof Class<?>)?
-                    Field.getTypeName((Class<?>)params[j]):
-                    (params[j].toString());
-                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
-                    param = param.replaceFirst("\\[\\]$", "...");
-                sb.append(param);
-                if (j < (params.length - 1))
-                    sb.append(",");
-            }
-            sb.append(")");
-            Type[] exceptions = getGenericExceptionTypes();
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append((exceptions[k] instanceof Class)?
-                              ((Class<?>)exceptions[k]).getName():
-                              exceptions[k].toString());
-                    if (k < (exceptions.length - 1))
-                        sb.append(",");
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        return sharedToGenericString(Modifier.constructorModifiers());
+    }
+
+    @Override
+    void specificToGenericStringHeader(StringBuilder sb) {
+        specificToStringHeader(sb);
     }
 
     /**
@@ -526,29 +396,21 @@
     }
 
     /**
-     * Returns {@code true} if this constructor was declared to take
-     * a variable number of arguments; returns {@code false}
-     * otherwise.
-     *
-     * @return {@code true} if an only if this constructor was declared to
-     * take a variable number of arguments.
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public boolean isVarArgs() {
-        return (getModifiers() & Modifier.VARARGS) != 0;
+        return super.isVarArgs();
     }
 
     /**
-     * Returns {@code true} if this constructor is a synthetic
-     * constructor; returns {@code false} otherwise.
-     *
-     * @return true if and only if this constructor is a synthetic
-     * constructor as defined by
-     * <cite>The Java&trade; Language Specification</cite>.
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public boolean isSynthetic() {
-        return Modifier.isSynthetic(getModifiers());
+        return super.isSynthetic();
     }
 
     // NOTE that there is no synchronization used here. It is correct
@@ -592,9 +454,9 @@
         return slot;
     }
 
-   String getSignature() {
-            return signature;
-   }
+    String getSignature() {
+        return signature;
+    }
 
     byte[] getRawAnnotations() {
         return annotations;
@@ -604,80 +466,50 @@
         return parameterAnnotations;
     }
 
+
     /**
-     * @throws NullPointerException {@inheritDoc}
+     * {@inheritDoc}
+     * @throws NullPointerException  {@inheritDoc}
      * @since 1.5
      */
     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        if (annotationClass == null)
-            throw new NullPointerException();
-
-        return (T) declaredAnnotations().get(annotationClass);
+        return super.getAnnotation(annotationClass);
     }
 
     /**
+     * {@inheritDoc}
      * @since 1.5
      */
     public Annotation[] getDeclaredAnnotations()  {
-        return AnnotationParser.toArray(declaredAnnotations());
-    }
-
-    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
-
-    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
-        if (declaredAnnotations == null) {
-            declaredAnnotations = AnnotationParser.parseAnnotations(
-                annotations, sun.misc.SharedSecrets.getJavaLangAccess().
-                getConstantPool(getDeclaringClass()),
-                getDeclaringClass());
-        }
-        return declaredAnnotations;
+        return super.getDeclaredAnnotations();
     }
 
     /**
-     * Returns an array of arrays that represent the annotations on the formal
-     * parameters, in declaration order, of the method represented by
-     * this {@code Constructor} object. (Returns an array of length zero if the
-     * underlying method is parameterless.  If the method has one or more
-     * parameters, a nested array of length zero is returned for each parameter
-     * with no annotations.) The annotation objects contained in the returned
-     * arrays are serializable.  The caller of this method is free to modify
-     * the returned arrays; it will have no effect on the arrays returned to
-     * other callers.
-     *
-     * @return an array of arrays that represent the annotations on the formal
-     *    parameters, in declaration order, of the method represented by this
-     *    Constructor object
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public Annotation[][] getParameterAnnotations() {
-        int numParameters = parameterTypes.length;
-        if (parameterAnnotations == null)
-            return new Annotation[numParameters][0];
+        return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
+    }
 
-        Annotation[][] result = AnnotationParser.parseParameterAnnotations(
-            parameterAnnotations,
-            sun.misc.SharedSecrets.getJavaLangAccess().
-                getConstantPool(getDeclaringClass()),
-            getDeclaringClass());
-        if (result.length != numParameters) {
-            Class<?> declaringClass = getDeclaringClass();
-            if (declaringClass.isEnum() ||
-                declaringClass.isAnonymousClass() ||
-                declaringClass.isLocalClass() )
-                ; // Can't do reliable parameter counting
-            else {
-                if (!declaringClass.isMemberClass() || // top-level
-                    // Check for the enclosing instance parameter for
-                    // non-static member classes
-                    (declaringClass.isMemberClass() &&
-                     ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
-                     result.length + 1 != numParameters) ) {
-                    throw new AnnotationFormatError(
-                              "Parameter annotations don't match number of parameters");
-                }
+    @Override
+    void handleParameterNumberMismatch(int resultLength, int numParameters) {
+        Class<?> declaringClass = getDeclaringClass();
+        if (declaringClass.isEnum() ||
+            declaringClass.isAnonymousClass() ||
+            declaringClass.isLocalClass() )
+            return ; // Can't do reliable parameter counting
+        else {
+            if (!declaringClass.isMemberClass() || // top-level
+                // Check for the enclosing instance parameter for
+                // non-static member classes
+                (declaringClass.isMemberClass() &&
+                 ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
+                 resultLength + 1 != numParameters) ) {
+                throw new AnnotationFormatError(
+                          "Parameter annotations don't match number of parameters");
             }
         }
-        return result;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/java/lang/reflect/Executable.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.reflect;
+
+import java.lang.annotation.*;
+import java.util.Map;
+import sun.reflect.annotation.AnnotationParser;
+import sun.reflect.generics.repository.ConstructorRepository;
+import sun.reflect.generics.factory.CoreReflectionFactory;
+import sun.reflect.generics.factory.GenericsFactory;
+import sun.reflect.generics.scope.ConstructorScope;
+
+/**
+ * A shared superclass for the common functionality of {@link Method}
+ * and {@link Constructor}.
+ *
+ * @since 1.8
+ */
+public abstract class Executable extends AccessibleObject
+    implements Member, GenericDeclaration {
+    /*
+     * Only grant package-visibility to the constructor.
+     */
+    Executable() {}
+
+    /**
+     * Accessor method to allow code sharing
+     */
+    abstract byte[] getAnnotationBytes();
+
+    /**
+     * Does the Executable have generic information.
+     */
+    abstract boolean hasGenericInformation();
+
+    abstract ConstructorRepository getGenericInfo();
+
+    boolean equalParamTypes(Class<?>[] params1, Class<?>[] params2) {
+        /* Avoid unnecessary cloning */
+        if (params1.length == params2.length) {
+            for (int i = 0; i < params1.length; i++) {
+                if (params1[i] != params2[i])
+                    return false;
+            }
+            return true;
+        }
+        return false;
+    }
+
+    Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) {
+        return AnnotationParser.parseParameterAnnotations(
+               parameterAnnotations,
+               sun.misc.SharedSecrets.getJavaLangAccess().
+               getConstantPool(getDeclaringClass()),
+               getDeclaringClass());
+    }
+
+    void separateWithCommas(Class<?>[] types, StringBuilder sb) {
+        for (int j = 0; j < types.length; j++) {
+            sb.append(Field.getTypeName(types[j]));
+            if (j < (types.length - 1))
+                sb.append(",");
+        }
+
+    }
+
+    void printModifiersIfNonzero(StringBuilder sb, int mask) {
+        int mod = getModifiers() & mask;
+        if (mod != 0) {
+            sb.append(Modifier.toString(mod)).append(' ');
+        }
+    }
+
+    String sharedToString(int modifierMask,
+                          Class<?>[] parameterTypes,
+                          Class<?>[] exceptionTypes) {
+        try {
+            StringBuilder sb = new StringBuilder();
+
+            printModifiersIfNonzero(sb, modifierMask);
+            specificToStringHeader(sb);
+
+            sb.append('(');
+            separateWithCommas(parameterTypes, sb);
+            sb.append(')');
+            if (exceptionTypes.length > 0) {
+                sb.append(" throws ");
+                separateWithCommas(exceptionTypes, sb);
+            }
+            return sb.toString();
+        } catch (Exception e) {
+            return "<" + e + ">";
+        }
+    }
+
+    /**
+     * Generate toString header information specific to a method or
+     * constructor.
+     */
+    abstract void specificToStringHeader(StringBuilder sb);
+
+    String sharedToGenericString(int modifierMask) {
+        try {
+            StringBuilder sb = new StringBuilder();
+
+            printModifiersIfNonzero(sb, modifierMask);
+
+            TypeVariable<?>[] typeparms = getTypeParameters();
+            if (typeparms.length > 0) {
+                boolean first = true;
+                sb.append('<');
+                for(TypeVariable<?> typeparm: typeparms) {
+                    if (!first)
+                        sb.append(',');
+                    // Class objects can't occur here; no need to test
+                    // and call Class.getName().
+                    sb.append(typeparm.toString());
+                    first = false;
+                }
+                sb.append("> ");
+            }
+
+            specificToGenericStringHeader(sb);
+
+            sb.append('(');
+            Type[] params = getGenericParameterTypes();
+            for (int j = 0; j < params.length; j++) {
+                String param = (params[j] instanceof Class)?
+                    Field.getTypeName((Class)params[j]):
+                    (params[j].toString());
+                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
+                    param = param.replaceFirst("\\[\\]$", "...");
+                sb.append(param);
+                if (j < (params.length - 1))
+                    sb.append(',');
+            }
+            sb.append(')');
+            Type[] exceptions = getGenericExceptionTypes();
+            if (exceptions.length > 0) {
+                sb.append(" throws ");
+                for (int k = 0; k < exceptions.length; k++) {
+                    sb.append((exceptions[k] instanceof Class)?
+                              ((Class)exceptions[k]).getName():
+                              exceptions[k].toString());
+                    if (k < (exceptions.length - 1))
+                        sb.append(',');
+                }
+            }
+            return sb.toString();
+        } catch (Exception e) {
+            return "<" + e + ">";
+        }
+    }
+
+    /**
+     * Generate toGenericString header information specific to a
+     * method or constructor.
+     */
+    abstract void specificToGenericStringHeader(StringBuilder sb);
+
+    /**
+     * Returns the {@code Class} object representing the class or interface
+     * that declares the method represented by this executable object.
+     */
+    public abstract Class<?> getDeclaringClass();
+
+    /**
+     * Returns the name of the executable represented by this object.
+     */
+    public abstract String getName();
+
+    /**
+     * Returns the Java language {@linkplain Modifier modifiers} for
+     * the executable represented by this object.
+     */
+    public abstract int getModifiers();
+
+    /**
+     * Returns an array of {@code TypeVariable} objects that represent the
+     * type variables declared by the generic declaration represented by this
+     * {@code GenericDeclaration} object, in declaration order.  Returns an
+     * array of length 0 if the underlying generic declaration declares no type
+     * variables.
+     *
+     * @return an array of {@code TypeVariable} objects that represent
+     *     the type variables declared by this generic declaration
+     * @throws GenericSignatureFormatError if the generic
+     *     signature of this generic declaration does not conform to
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     */
+    public abstract TypeVariable<?>[] getTypeParameters();
+
+    /**
+     * Returns an array of {@code Class} objects that represent the formal
+     * parameter types, in declaration order, of the executable
+     * represented by this object.  Returns an array of length
+     * 0 if the underlying method takes no parameters.
+     *
+     * @return the parameter types for the method this object
+     * represents
+     */
+    public abstract Class<?>[] getParameterTypes();
+
+    /**
+     * Returns an array of {@code Type} objects that represent the formal
+     * parameter types, in declaration order, of the method represented by
+     * this executable object. Returns an array of length 0 if the
+     * underlying method takes no parameters.
+     *
+     * <p>If a formal parameter type is a parameterized type,
+     * the {@code Type} object returned for it must accurately reflect
+     * the actual type parameters used in the source code.
+     *
+     * <p>If a formal parameter type is a type variable or a parameterized
+     * type, it is created. Otherwise, it is resolved.
+     *
+     * @return an array of {@code Type}s that represent the formal
+     *     parameter types of the underlying method, in declaration order
+     * @throws GenericSignatureFormatError
+     *     if the generic method signature does not conform to the format
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * @throws TypeNotPresentException if any of the parameter
+     *     types of the underlying method refers to a non-existent type
+     *     declaration
+     * @throws MalformedParameterizedTypeException if any of
+     *     the underlying method's parameter types refer to a parameterized
+     *     type that cannot be instantiated for any reason
+     */
+    public Type[] getGenericParameterTypes() {
+        if (hasGenericInformation())
+            return getGenericInfo().getParameterTypes();
+        else
+            return getParameterTypes();
+    }
+
+    /**
+     * Returns an array of {@code Class} objects that represent the
+     * types of exceptions declared to be thrown by the underlying
+     * executable represented by this object.  Returns an array of
+     * length 0 if the executable declares no exceptions in its {@code
+     * throws} clause.
+     *
+     * @return the exception types declared as being thrown by the
+     * executable this object represents
+     */
+    public abstract Class<?>[] getExceptionTypes();
+
+    /**
+     * Returns an array of {@code Type} objects that represent the
+     * exceptions declared to be thrown by this executable object.
+     * Returns an array of length 0 if the underlying executable declares
+     * no exceptions in its {@code throws} clause.
+     *
+     * <p>If an exception type is a type variable or a parameterized
+     * type, it is created. Otherwise, it is resolved.
+     *
+     * @return an array of Types that represent the exception types
+     *     thrown by the underlying method
+     * @throws GenericSignatureFormatError
+     *     if the generic method signature does not conform to the format
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * @throws TypeNotPresentException if the underlying method's
+     *     {@code throws} clause refers to a non-existent type declaration
+     * @throws MalformedParameterizedTypeException if
+     *     the underlying method's {@code throws} clause refers to a
+     *     parameterized type that cannot be instantiated for any reason
+     */
+    public Type[] getGenericExceptionTypes() {
+        Type[] result;
+        if (hasGenericInformation() &&
+            ((result = getGenericInfo().getExceptionTypes()).length > 0))
+            return result;
+        else
+            return getExceptionTypes();
+    }
+
+    /**
+     * Returns a string describing this {@code Executable}, including
+     * any type parameters.
+     */
+    public abstract String toGenericString();
+
+    /**
+     * Returns {@code true} if this executable was declared to take a
+     * variable number of arguments; returns {@code false} otherwise.
+     *
+     * @return {@code true} if an only if this executable was declared
+     * to take a variable number of arguments.
+     */
+    public boolean isVarArgs()  {
+        return (getModifiers() & Modifier.VARARGS) != 0;
+    }
+
+    /**
+     * Returns {@code true} if this executable is a synthetic
+     * construct; returns {@code false} otherwise.
+     *
+     * @return true if and only if this executable is a synthetic
+     * construct as defined by
+     * <cite>The Java&trade; Language Specification</cite>.
+     */
+    public boolean isSynthetic() {
+        return Modifier.isSynthetic(getModifiers());
+    }
+
+    /**
+     * Returns an array of arrays that represent the annotations on
+     * the formal parameters, in declaration order, of the executable
+     * represented by this object. (Returns an array of length zero if
+     * the underlying method is parameterless.  If the executable has
+     * one or more parameters, a nested array of length zero is
+     * returned for each parameter with no annotations.) The
+     * annotation objects contained in the returned arrays are
+     * serializable.  The caller of this method is free to modify the
+     * returned arrays; it will have no effect on the arrays returned
+     * to other callers.
+     *
+     * @return an array of arrays that represent the annotations on the formal
+     *    parameters, in declaration order, of the exectuable represented by this
+     *    object
+     */
+    public abstract Annotation[][] getParameterAnnotations();
+
+    Annotation[][] sharedGetParameterAnnotations(Class<?>[] parameterTypes,
+                                                 byte[] parameterAnnotations) {
+        int numParameters = parameterTypes.length;
+        if (parameterAnnotations == null)
+            return new Annotation[numParameters][0];
+
+        Annotation[][] result = parseParameterAnnotations(parameterAnnotations);
+
+        if (result.length != numParameters)
+            handleParameterNumberMismatch(result.length, numParameters);
+        return result;
+    }
+
+    abstract void handleParameterNumberMismatch(int resultLength, int numParameters);
+
+    /**
+     * {@inheritDoc}
+     * @throws NullPointerException  {@inheritDoc}
+     */
+     @SuppressWarnings("unchecked")
+     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        if (annotationClass == null)
+            throw new NullPointerException();
+
+        return (T) declaredAnnotations().get(annotationClass);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Annotation[] getDeclaredAnnotations()  {
+        return AnnotationParser.toArray(declaredAnnotations());
+    }
+
+    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
+
+    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
+        if (declaredAnnotations == null) {
+            declaredAnnotations = AnnotationParser.parseAnnotations(
+                getAnnotationBytes(),
+                sun.misc.SharedSecrets.getJavaLangAccess().
+                getConstantPool(getDeclaringClass()),
+                getDeclaringClass());
+        }
+        return declaredAnnotations;
+    }
+}
--- a/src/share/classes/java/lang/reflect/Method.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/lang/reflect/Method.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.annotation.AnnotationFormatError;
 import java.nio.ByteBuffer;
-import java.util.Map;
 
 /**
  * A {@code Method} provides information about, and access to, a single method
@@ -58,9 +57,7 @@
  * @author Kenneth Russell
  * @author Nakul Saraiya
  */
-public final
-    class Method extends AccessibleObject implements GenericDeclaration,
-                                                     Member {
+public final class Method extends Executable {
     private Class<?>            clazz;
     private int                 slot;
     // This is guaranteed to be interned by the VM in the 1.4
@@ -83,8 +80,8 @@
     // potentially many Method objects pointing to it.)
     private Method              root;
 
-   // Generics infrastructure
 
+    // Generics infrastructure
     private String getGenericSignature() {return signature;}
 
     // Accessor for factory
@@ -94,7 +91,8 @@
     }
 
     // Accessor for generic info repository
-    private MethodRepository getGenericInfo() {
+    @Override
+    MethodRepository getGenericInfo() {
         // lazily initialize repository if necessary
         if (genericInfo == null) {
             // create and cache generic info repository
@@ -119,8 +117,7 @@
            String signature,
            byte[] annotations,
            byte[] parameterAnnotations,
-           byte[] annotationDefault)
-    {
+           byte[] annotationDefault) {
         this.clazz = declaringClass;
         this.name = name;
         this.parameterTypes = parameterTypes;
@@ -156,10 +153,20 @@
         return res;
     }
 
+    @Override
+    boolean hasGenericInformation() {
+        return (getGenericSignature() != null);
+    }
+
+    @Override
+    byte[] getAnnotationBytes() {
+        return annotations;
+    }
+
     /**
-     * Returns the {@code Class} object representing the class or interface
-     * that declares the method represented by this {@code Method} object.
+     * {@inheritDoc}
      */
+    @Override
     public Class<?> getDeclaringClass() {
         return clazz;
     }
@@ -168,36 +175,25 @@
      * Returns the name of the method represented by this {@code Method}
      * object, as a {@code String}.
      */
+    @Override
     public String getName() {
         return name;
     }
 
     /**
-     * Returns the Java language modifiers for the method represented
-     * by this {@code Method} object, as an integer. The {@code Modifier} class should
-     * be used to decode the modifiers.
-     *
-     * @see Modifier
+     * {@inheritDoc}
      */
+    @Override
     public int getModifiers() {
         return modifiers;
     }
 
     /**
-     * Returns an array of {@code TypeVariable} objects that represent the
-     * type variables declared by the generic declaration represented by this
-     * {@code GenericDeclaration} object, in declaration order.  Returns an
-     * array of length 0 if the underlying generic declaration declares no type
-     * variables.
-     *
-     * @return an array of {@code TypeVariable} objects that represent
-     *     the type variables declared by this generic declaration
-     * @throws GenericSignatureFormatError if the generic
-     *     signature of this generic declaration does not conform to
-     *     the format specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public TypeVariable<Method>[] getTypeParameters() {
         if (getGenericSignature() != null)
             return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
@@ -245,99 +241,45 @@
       } else { return getReturnType();}
     }
 
-
     /**
-     * Returns an array of {@code Class} objects that represent the formal
-     * parameter types, in declaration order, of the method
-     * represented by this {@code Method} object.  Returns an array of length
-     * 0 if the underlying method takes no parameters.
-     *
-     * @return the parameter types for the method this object
-     * represents
+     * {@inheritDoc}
      */
+    @Override
     public Class<?>[] getParameterTypes() {
         return (Class<?>[]) parameterTypes.clone();
     }
 
     /**
-     * Returns an array of {@code Type} objects that represent the formal
-     * parameter types, in declaration order, of the method represented by
-     * this {@code Method} object. Returns an array of length 0 if the
-     * underlying method takes no parameters.
-     *
-     * <p>If a formal parameter type is a parameterized type,
-     * the {@code Type} object returned for it must accurately reflect
-     * the actual type parameters used in the source code.
-     *
-     * <p>If a formal parameter type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of Types that represent the formal
-     *     parameter types of the underlying method, in declaration order
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if any of the parameter
-     *     types of the underlying method refers to a non-existent type
-     *     declaration
-     * @throws MalformedParameterizedTypeException if any of
-     *     the underlying method's parameter types refer to a parameterized
-     *     type that cannot be instantiated for any reason
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public Type[] getGenericParameterTypes() {
-        if (getGenericSignature() != null)
-            return getGenericInfo().getParameterTypes();
-        else
-            return getParameterTypes();
+        return super.getGenericParameterTypes();
     }
 
-
     /**
-     * Returns an array of {@code Class} objects that represent
-     * the types of the exceptions declared to be thrown
-     * by the underlying method
-     * represented by this {@code Method} object.  Returns an array of length
-     * 0 if the method declares no exceptions in its {@code throws} clause.
-     *
-     * @return the exception types declared as being thrown by the
-     * method this object represents
+     * {@inheritDoc}
      */
+    @Override
     public Class<?>[] getExceptionTypes() {
         return (Class<?>[]) exceptionTypes.clone();
     }
 
     /**
-     * Returns an array of {@code Type} objects that represent the
-     * exceptions declared to be thrown by this {@code Method} object.
-     * Returns an array of length 0 if the underlying method declares
-     * no exceptions in its {@code throws} clause.
-     *
-     * <p>If an exception type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of Types that represent the exception types
-     *     thrown by the underlying method
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if the underlying method's
-     *     {@code throws} clause refers to a non-existent type declaration
-     * @throws MalformedParameterizedTypeException if
-     *     the underlying method's {@code throws} clause refers to a
-     *     parameterized type that cannot be instantiated for any reason
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
      * @since 1.5
      */
-      public Type[] getGenericExceptionTypes() {
-          Type[] result;
-          if (getGenericSignature() != null &&
-              ((result = getGenericInfo().getExceptionTypes()).length > 0))
-              return result;
-          else
-              return getExceptionTypes();
-      }
+    @Override
+    public Type[] getGenericExceptionTypes() {
+        return super.getGenericExceptionTypes();
+    }
 
     /**
      * Compares this {@code Method} against the specified object.  Returns
@@ -352,16 +294,7 @@
                 && (getName() == other.getName())) {
                 if (!returnType.equals(other.getReturnType()))
                     return false;
-                /* Avoid unnecessary cloning */
-                Class<?>[] params1 = parameterTypes;
-                Class<?>[] params2 = other.parameterTypes;
-                if (params1.length == params2.length) {
-                    for (int i = 0; i < params1.length; i++) {
-                        if (params1[i] != params2[i])
-                            return false;
-                    }
-                    return true;
-                }
+                return equalParamTypes(parameterTypes, other.parameterTypes);
             }
         }
         return false;
@@ -399,35 +332,16 @@
      * {@code synchronized}, {@code native}, {@code strictfp}.
      */
     public String toString() {
-        try {
-            StringBuilder sb = new StringBuilder();
-            int mod = getModifiers() & Modifier.methodModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod)).append(' ');
-            }
-            sb.append(Field.getTypeName(getReturnType())).append(' ');
-            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
-            sb.append(getName()).append('(');
-            Class<?>[] params = parameterTypes; // avoid clone
-            for (int j = 0; j < params.length; j++) {
-                sb.append(Field.getTypeName(params[j]));
-                if (j < (params.length - 1))
-                    sb.append(',');
-            }
-            sb.append(')');
-            Class<?>[] exceptions = exceptionTypes; // avoid clone
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append(exceptions[k].getName());
-                    if (k < (exceptions.length - 1))
-                        sb.append(',');
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        return sharedToString(Modifier.methodModifiers(),
+                              parameterTypes,
+                              exceptionTypes);
+    }
+
+    @Override
+    void specificToStringHeader(StringBuilder sb) {
+        sb.append(Field.getTypeName(getReturnType())).append(' ');
+        sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+        sb.append(getName());
     }
 
     /**
@@ -468,62 +382,20 @@
      *
      * @since 1.5
      */
+    @Override
     public String toGenericString() {
-        try {
-            StringBuilder sb = new StringBuilder();
-            int mod = getModifiers() & Modifier.methodModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod)).append(' ');
-            }
-            TypeVariable<?>[] typeparms = getTypeParameters();
-            if (typeparms.length > 0) {
-                boolean first = true;
-                sb.append('<');
-                for(TypeVariable<?> typeparm: typeparms) {
-                    if (!first)
-                        sb.append(',');
-                    // Class objects can't occur here; no need to test
-                    // and call Class.getName().
-                    sb.append(typeparm.toString());
-                    first = false;
-                }
-                sb.append("> ");
-            }
-
-            Type genRetType = getGenericReturnType();
-            sb.append( ((genRetType instanceof Class<?>)?
-                        Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
-                    .append(' ');
+        return sharedToGenericString(Modifier.methodModifiers());
+    }
 
-            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
-            sb.append(getName()).append('(');
-            Type[] params = getGenericParameterTypes();
-            for (int j = 0; j < params.length; j++) {
-                String param = (params[j] instanceof Class)?
-                    Field.getTypeName((Class)params[j]):
-                    (params[j].toString());
-                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
-                    param = param.replaceFirst("\\[\\]$", "...");
-                sb.append(param);
-                if (j < (params.length - 1))
-                    sb.append(',');
-            }
-            sb.append(')');
-            Type[] exceptions = getGenericExceptionTypes();
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append((exceptions[k] instanceof Class)?
-                              ((Class)exceptions[k]).getName():
-                              exceptions[k].toString());
-                    if (k < (exceptions.length - 1))
-                        sb.append(',');
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+    @Override
+    void specificToGenericStringHeader(StringBuilder sb) {
+        Type genRetType = getGenericReturnType();
+        sb.append( ((genRetType instanceof Class<?>)?
+                    Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
+            .append(' ');
+
+        sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+        sb.append(getName());
     }
 
     /**
@@ -614,28 +486,21 @@
     }
 
     /**
-     * Returns {@code true} if this method was declared to take
-     * a variable number of arguments; returns {@code false}
-     * otherwise.
-     *
-     * @return {@code true} if an only if this method was declared to
-     * take a variable number of arguments.
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public boolean isVarArgs() {
-        return (getModifiers() & Modifier.VARARGS) != 0;
+        return super.isVarArgs();
     }
 
     /**
-     * Returns {@code true} if this method is a synthetic
-     * method; returns {@code false} otherwise.
-     *
-     * @return true if and only if this method is a synthetic
-     * method as defined by the Java Language Specification.
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public boolean isSynthetic() {
-        return Modifier.isSynthetic(getModifiers());
+        return super.isSynthetic();
     }
 
     // NOTE that there is no synchronization used here. It is correct
@@ -675,36 +540,6 @@
     }
 
     /**
-     * @throws NullPointerException {@inheritDoc}
-     * @since 1.5
-     */
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        if (annotationClass == null)
-            throw new NullPointerException();
-
-        return (T) declaredAnnotations().get(annotationClass);
-    }
-
-    /**
-     * @since 1.5
-     */
-    public Annotation[] getDeclaredAnnotations()  {
-        return AnnotationParser.toArray(declaredAnnotations());
-    }
-
-    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
-
-    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
-        if (declaredAnnotations == null) {
-            declaredAnnotations = AnnotationParser.parseAnnotations(
-                annotations, sun.misc.SharedSecrets.getJavaLangAccess().
-                getConstantPool(getDeclaringClass()),
-                getDeclaringClass());
-        }
-        return declaredAnnotations;
-    }
-
-    /**
      * Returns the default value for the annotation member represented by
      * this {@code Method} instance.  If the member is of a primitive type,
      * an instance of the corresponding wrapper type is returned. Returns
@@ -734,34 +569,33 @@
     }
 
     /**
-     * Returns an array of arrays that represent the annotations on the formal
-     * parameters, in declaration order, of the method represented by
-     * this {@code Method} object. (Returns an array of length zero if the
-     * underlying method is parameterless.  If the method has one or more
-     * parameters, a nested array of length zero is returned for each parameter
-     * with no annotations.) The annotation objects contained in the returned
-     * arrays are serializable.  The caller of this method is free to modify
-     * the returned arrays; it will have no effect on the arrays returned to
-     * other callers.
-     *
-     * @return an array of arrays that represent the annotations on the formal
-     *    parameters, in declaration order, of the method represented by this
-     *    Method object
+     * {@inheritDoc}
+     * @throws NullPointerException  {@inheritDoc}
+     * @since 1.5
+     */
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return super.getAnnotation(annotationClass);
+    }
+
+    /**
+     * {@inheritDoc}
      * @since 1.5
      */
-    public Annotation[][] getParameterAnnotations() {
-        int numParameters = parameterTypes.length;
-        if (parameterAnnotations == null)
-            return new Annotation[numParameters][0];
+    public Annotation[] getDeclaredAnnotations()  {
+        return super.getDeclaredAnnotations();
+    }
 
-        Annotation[][] result = AnnotationParser.parseParameterAnnotations(
-            parameterAnnotations,
-            sun.misc.SharedSecrets.getJavaLangAccess().
-                getConstantPool(getDeclaringClass()),
-            getDeclaringClass());
-        if (result.length != numParameters)
-            throw new java.lang.annotation.AnnotationFormatError(
-                "Parameter annotations don't match number of parameters");
-        return result;
+    /**
+     * {@inheritDoc}
+     * @since 1.5
+     */
+    @Override
+    public Annotation[][] getParameterAnnotations() {
+        return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
+    }
+
+    @Override
+    void handleParameterNumberMismatch(int resultLength, int numParameters) {
+        throw new AnnotationFormatError("Parameter annotations don't match number of parameters");
     }
 }
--- a/src/share/classes/java/net/DatagramSocket.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/net/DatagramSocket.java	Wed Aug 17 22:47:49 2011 -0700
@@ -176,13 +176,7 @@
     public DatagramSocket() throws SocketException {
         // create a datagram socket.
         createImpl();
-        try {
-            bind(new InetSocketAddress(0));
-        } catch (SocketException se) {
-            throw se;
-        } catch(IOException e) {
-            throw new SocketException(e.getMessage());
-        }
+        bind(new InetSocketAddress(0));
     }
 
     /**
--- a/src/share/classes/java/net/ServerSocket.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/net/ServerSocket.java	Wed Aug 17 22:47:49 2011 -0700
@@ -716,7 +716,6 @@
         if (!isBound())
             return "ServerSocket[unbound]";
         return "ServerSocket[addr=" + impl.getInetAddress() +
-                ",port=" + impl.getPort() +
                 ",localport=" + impl.getLocalPort()  + "]";
     }
 
--- a/src/share/classes/java/net/SocketPermission.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/net/SocketPermission.java	Wed Aug 17 22:47:49 2011 -0700
@@ -956,10 +956,16 @@
         String thisHost = hostname;
         String thatHost = that.hostname;
 
-        if (thisHost == null)
+        if (thisHost == null) {
             return false;
-        else
+        } else if (this.wildcard) {
+            final int cnameLength = this.cname.length();
+            return thatHost.regionMatches(true,
+                                          (thatHost.length() - cnameLength),
+                                          this.cname, 0, cnameLength);
+        } else {
             return thisHost.equalsIgnoreCase(thatHost);
+        }
     }
 
     /**
--- a/src/share/classes/java/nio/X-Buffer.java.template	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/nio/X-Buffer.java.template	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1080,7 +1080,11 @@
         int h = 1;
         int p = position();
         for (int i = limit() - 1; i >= p; i--)
+#if[int]
+            h = 31 * h + get(i);
+#else[int]
             h = 31 * h + (int)get(i);
+#end[int]
         return h;
     }
 
--- a/src/share/classes/java/nio/channels/AsynchronousFileChannel.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/nio/channels/AsynchronousFileChannel.java	Wed Aug 17 22:47:49 2011 -0700
@@ -248,6 +248,7 @@
         return provider.newAsynchronousFileChannel(file, options, executor, attrs);
     }
 
+    @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
     private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
 
     /**
--- a/src/share/classes/java/nio/channels/FileChannel.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/nio/channels/FileChannel.java	Wed Aug 17 22:47:49 2011 -0700
@@ -287,6 +287,7 @@
         return provider.newFileChannel(path, options, attrs);
     }
 
+    @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
     private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
 
     /**
--- a/src/share/classes/java/nio/charset/Charset.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/nio/charset/Charset.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.nio.CharBuffer;
 import java.nio.charset.spi.CharsetProvider;
 import java.security.AccessController;
-import java.security.AccessControlException;
 import java.security.PrivilegedAction;
 import java.util.Collections;
 import java.util.HashSet;
@@ -339,15 +338,15 @@
     // those whose lookup or instantiation causes a security exception to be
     // thrown.  Should be invoked with full privileges.
     //
-    private static Iterator providers() {
-        return new Iterator() {
+    private static Iterator<CharsetProvider> providers() {
+        return new Iterator<CharsetProvider>() {
 
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
                 ServiceLoader<CharsetProvider> sl =
                     ServiceLoader.load(CharsetProvider.class, cl);
                 Iterator<CharsetProvider> i = sl.iterator();
 
-                Object next = null;
+                CharsetProvider next = null;
 
                 private boolean getNext() {
                     while (next == null) {
@@ -370,10 +369,10 @@
                     return getNext();
                 }
 
-                public Object next() {
+                public CharsetProvider next() {
                     if (!getNext())
                         throw new NoSuchElementException();
-                    Object n = next;
+                    CharsetProvider n = next;
                     next = null;
                     return n;
                 }
@@ -386,7 +385,8 @@
     }
 
     // Thread-local gate to prevent recursive provider lookups
-    private static ThreadLocal<ThreadLocal> gate = new ThreadLocal<ThreadLocal>();
+    private static ThreadLocal<ThreadLocal<?>> gate =
+            new ThreadLocal<ThreadLocal<?>>();
 
     private static Charset lookupViaProviders(final String charsetName) {
 
@@ -410,8 +410,9 @@
             return AccessController.doPrivileged(
                 new PrivilegedAction<Charset>() {
                     public Charset run() {
-                        for (Iterator i = providers(); i.hasNext();) {
-                            CharsetProvider cp = (CharsetProvider)i.next();
+                        for (Iterator<CharsetProvider> i = providers();
+                             i.hasNext();) {
+                            CharsetProvider cp = i.next();
                             Charset cs = cp.charsetForName(charsetName);
                             if (cs != null)
                                 return cs;
@@ -588,8 +589,8 @@
                         new TreeMap<String,Charset>(
                             ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
                     put(standardProvider.charsets(), m);
-                    for (Iterator i = providers(); i.hasNext();) {
-                        CharsetProvider cp = (CharsetProvider)i.next();
+                    for (Iterator<CharsetProvider> i = providers(); i.hasNext();) {
+                        CharsetProvider cp = i.next();
                         put(cp.charsets(), m);
                     }
                     return Collections.unmodifiableSortedMap(m);
--- a/src/share/classes/java/security/KeyStore.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/security/KeyStore.java	Wed Aug 17 22:47:49 2011 -0700
@@ -113,14 +113,8 @@
  *    // get user password and file input stream
  *    char[] password = getPassword();
  *
- *    java.io.FileInputStream fis = null;
- *    try {
- *        fis = new java.io.FileInputStream("keyStoreName");
+ *    try (FileInputStream fis = new FileInputStream("keyStoreName")) {
  *        ks.load(fis, password);
- *    } finally {
- *        if (fis != null) {
- *            fis.close();
- *        }
  *    }
  * </pre>
  *
@@ -146,14 +140,8 @@
  *    ks.setEntry("secretKeyAlias", skEntry, protParam);
  *
  *    // store away the keystore
- *    java.io.FileOutputStream fos = null;
- *    try {
- *        fos = new java.io.FileOutputStream("newKeyStoreName");
+ *    try (FileOutputStream fos = new FileOutputStream("newKeyStoreName")) {
  *        ks.store(fos, password);
- *    } finally {
- *        if (fos != null) {
- *            fos.close();
- *        }
  *    }
  * </pre>
  *
--- a/src/share/classes/java/security/cert/X509CRL.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/security/cert/X509CRL.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,15 +94,9 @@
  * CRLs are instantiated using a certificate factory. The following is an
  * example of how to instantiate an X.509 CRL:
  * <pre><code>
- * InputStream inStream = null;
- * try {
- *     inStream = new FileInputStream("fileName-of-crl");
+ * try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
  *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
  *     X509CRL crl = (X509CRL)cf.generateCRL(inStream);
- * } finally {
- *     if (inStream != null) {
- *         inStream.close();
- *     }
  * }
  * </code></pre>
  *
--- a/src/share/classes/java/security/cert/X509Certificate.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/security/cert/X509Certificate.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,15 +89,9 @@
  * Certificates are instantiated using a certificate factory. The following is
  * an example of how to instantiate an X.509 certificate:
  * <pre>
- * InputStream inStream = null;
- * try {
- *     inStream = new FileInputStream("fileName-of-cert");
+ * try (InputStream inStream = new FileInputStream("fileName-of-cert")) {
  *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
  *     X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
- * } finally {
- *     if (inStream != null) {
- *         inStream.close();
- *     }
  * }
  * </pre>
  *
--- a/src/share/classes/java/security/cert/X509Extension.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/java/security/cert/X509Extension.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,16 +85,10 @@
      * Here is sample code to get a Set of critical extensions from an
      * X509Certificate and print the OIDs:
      * <pre><code>
-     * InputStream inStrm = null;
      * X509Certificate cert = null;
-     * try {
-     *     inStrm = new FileInputStream("DER-encoded-Cert");
+     * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
      *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
      *     cert = (X509Certificate)cf.generateCertificate(inStrm);
-     * } finally {
-     *     if (inStrm != null) {
-     *         inStrm.close();
-     *     }
      * }<p>
      *
      * Set<String> critSet = cert.getCriticalExtensionOIDs();
@@ -120,23 +114,16 @@
      * Here is sample code to get a Set of non-critical extensions from an
      * X509CRL revoked certificate entry and print the OIDs:
      * <pre><code>
-     * InputStream inStrm = null;
      * CertificateFactory cf = null;
      * X509CRL crl = null;
-     * try {
-     *     inStrm = new FileInputStream("DER-encoded-CRL");
+     * try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
      *     cf = CertificateFactory.getInstance("X.509");
      *     crl = (X509CRL)cf.generateCRL(inStrm);
-     * } finally {
-     *     if (inStrm != null) {
-     *         inStrm.close();
-     *     }
      * }<p>
      *
      * byte[] certData = &lt;DER-encoded certificate data&gt;
      * ByteArrayInputStream bais = new ByteArrayInputStream(certData);
      * X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
-     * bais.close();
      * X509CRLEntry badCert =
      *              crl.getRevokedCertificate(cert.getSerialNumber());<p>
      *
--- a/src/share/classes/javax/swing/RepaintManager.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/javax/swing/RepaintManager.java	Wed Aug 17 22:47:49 2011 -0700
@@ -758,6 +758,11 @@
             for(i=0 ; i < count ; i++) {
                 dirtyComponent = roots.get(i);
                 rect = tmpDirtyComponents.get(dirtyComponent);
+                // Sometimes when RepaintManager is changed during the painting
+                // we may get null here, see #6995769 for details
+                if (rect == null) {
+                    continue;
+                }
                 localBoundsH = dirtyComponent.getHeight();
                 localBoundsW = dirtyComponent.getWidth();
 
--- a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Wed Aug 17 22:47:49 2011 -0700
@@ -2167,7 +2167,7 @@
     /**
      * Returns a {@code LayoutStyle} implementing the Java look and feel
      * design guidelines as specified at
-     * <a href="http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html">http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html</a>.
+     * <a href="http://www.oracle.com/technetwork/java/hig-136467.html">http://www.oracle.com/technetwork/java/hig-136467.html</a>.
      *
      * @return LayoutStyle implementing the Java look and feel design
      *         guidelines
--- a/src/share/classes/sun/launcher/LauncherHelper.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/launcher/LauncherHelper.java	Wed Aug 17 22:47:49 2011 -0700
@@ -396,7 +396,11 @@
                 if (mainAttrs == null) {
                     abort(ostream, null, "java.launcher.jar.error3", jarname);
                 }
-                return mainAttrs.getValue(MAIN_CLASS).trim();
+                String mainValue = mainAttrs.getValue(MAIN_CLASS);
+                if (mainValue == null) {
+                    abort(ostream, null, "java.launcher.jar.error3", jarname);
+                }
+                return mainValue.trim();
             } finally {
                 if (jarFile != null) {
                     jarFile.close();
--- a/src/share/classes/sun/launcher/resources/launcher.properties	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/launcher/resources/launcher.properties	Wed Aug 17 22:47:49 2011 -0700
@@ -72,7 +72,7 @@
 \                  load Java programming language agent, see java.lang.instrument\n\
 \    -splash:<imagepath>\n\
 \                  show splash screen with specified image\n\
-See http://java.sun.com/javase/reference for more details.
+See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\
--- a/src/share/classes/sun/net/httpserver/ServerConfig.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/net/httpserver/ServerConfig.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 
 package sun.net.httpserver;
 
-import com.sun.net.httpserver.*;
-import com.sun.net.httpserver.spi.*;
 import java.util.logging.Logger;
 import java.security.PrivilegedAction;
 
@@ -59,48 +57,46 @@
     static long maxReqTime;
     static long maxRspTime;
     static long timerMillis;
-    static boolean debug = false;
+    static boolean debug;
+
+    // the value of the TCP_NODELAY socket-level option
+    static boolean noDelay;
 
     static {
-
-        idleInterval = ((Long)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetLongAction(
-                "sun.net.httpserver.idleInterval",
-                DEFAULT_IDLE_INTERVAL))).longValue() * 1000;
+        java.security.AccessController.doPrivileged(
+            new PrivilegedAction<Void>() {
+                @Override
+                public Void run () {
+                    idleInterval = Long.getLong("sun.net.httpserver.idleInterval",
+                            DEFAULT_IDLE_INTERVAL) * 1000;
 
-        clockTick = ((Integer)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetIntegerAction(
-                "sun.net.httpserver.clockTick",
-                DEFAULT_CLOCK_TICK))).intValue();
+                    clockTick = Integer.getInteger("sun.net.httpserver.clockTick",
+                            DEFAULT_CLOCK_TICK);
 
-        maxIdleConnections = ((Integer)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetIntegerAction(
-                "sun.net.httpserver.maxIdleConnections",
-                DEFAULT_MAX_IDLE_CONNECTIONS))).intValue();
+                    maxIdleConnections = Integer.getInteger(
+                            "sun.net.httpserver.maxIdleConnections",
+                            DEFAULT_MAX_IDLE_CONNECTIONS);
+
+                    drainAmount = Long.getLong("sun.net.httpserver.drainAmount",
+                            DEFAULT_DRAIN_AMOUNT);
 
-        drainAmount = ((Long)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetLongAction(
-                "sun.net.httpserver.drainAmount",
-                DEFAULT_DRAIN_AMOUNT))).longValue();
+                    maxReqTime = Long.getLong("sun.net.httpserver.maxReqTime",
+                            DEFAULT_MAX_REQ_TIME);
 
-        maxReqTime = ((Long)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetLongAction(
-                "sun.net.httpserver.maxReqTime",
-                DEFAULT_MAX_REQ_TIME))).longValue();
+                    maxRspTime = Long.getLong("sun.net.httpserver.maxRspTime",
+                            DEFAULT_MAX_RSP_TIME);
+
+                    timerMillis = Long.getLong("sun.net.httpserver.timerMillis",
+                            DEFAULT_TIMER_MILLIS);
 
-        maxRspTime = ((Long)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetLongAction(
-                "sun.net.httpserver.maxRspTime",
-                DEFAULT_MAX_RSP_TIME))).longValue();
+                    debug = Boolean.getBoolean("sun.net.httpserver.debug");
+
+                    noDelay = Boolean.getBoolean("sun.net.httpserver.nodelay");
 
-        timerMillis = ((Long)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetLongAction(
-                "sun.net.httpserver.timerMillis",
-                DEFAULT_TIMER_MILLIS))).longValue();
+                    return null;
+                }
+            });
 
-        debug = ((Boolean)java.security.AccessController.doPrivileged(
-                new sun.security.action.GetBooleanAction(
-                "sun.net.httpserver.debug"))).booleanValue();
     }
 
 
@@ -172,4 +168,8 @@
     static long getTimerMillis () {
         return timerMillis;
     }
+
+    static boolean noDelay() {
+        return noDelay;
+    }
 }
--- a/src/share/classes/sun/net/httpserver/ServerImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/net/httpserver/ServerImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -27,8 +27,6 @@
 
 import java.net.*;
 import java.io.*;
-import java.nio.*;
-import java.security.*;
 import java.nio.channels.*;
 import java.util.*;
 import java.util.concurrent.*;
@@ -36,7 +34,6 @@
 import java.util.logging.Level;
 import javax.net.ssl.*;
 import com.sun.net.httpserver.*;
-import com.sun.net.httpserver.spi.*;
 import sun.net.httpserver.HttpConnection.State;
 
 /**
@@ -358,6 +355,12 @@
                                 continue;
                             }
                             SocketChannel chan = schan.accept();
+
+                            // Set TCP_NODELAY, if appropriate
+                            if (ServerConfig.noDelay()) {
+                                chan.socket().setTcpNoDelay(true);
+                            }
+
                             if (chan == null) {
                                 continue; /* cancel something ? */
                             }
--- a/src/share/classes/sun/net/www/http/HttpClient.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/net/www/http/HttpClient.java	Wed Aug 17 22:47:49 2011 -0700
@@ -599,7 +599,9 @@
             cachedHttpClient = false;
             if (!failedOnce && requests != null) {
                 failedOnce = true;
-                if (httpuc.getRequestMethod().equals("POST") && (!retryPostProp || streaming)) {
+                if (getRequestMethod().equals("CONNECT") ||
+                    (httpuc.getRequestMethod().equals("POST") &&
+                    (!retryPostProp || streaming))) {
                     // do not retry the request
                 }  else {
                     // try once more
@@ -706,7 +708,9 @@
             } else if (nread != 8) {
                 if (!failedOnce && requests != null) {
                     failedOnce = true;
-                    if (httpuc.getRequestMethod().equals("POST") && (!retryPostProp || streaming)) {
+                    if (getRequestMethod().equals("CONNECT") ||
+                        (httpuc.getRequestMethod().equals("POST") &&
+                         (!retryPostProp || streaming))) {
                         // do not retry the request
                     } else {
                         closeServer();
@@ -891,6 +895,16 @@
         return cacheRequest;
     }
 
+    String getRequestMethod() {
+        if (requests != null) {
+            String requestLine = requests.getKey(0);
+            if (requestLine != null) {
+               return requestLine.split("\\s+")[0];
+            }
+        }
+        return "";
+    }
+
     @Override
     protected void finalize() throws Throwable {
         // This should do nothing.  The stream finalizer will
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1880,14 +1880,7 @@
     private void sendCONNECTRequest() throws IOException {
         int port = url.getPort();
 
-        // setRequests == true indicates the std. request headers
-        // have been set in (previous) requests.
-        // so the first one must be the http method (GET, etc.).
-        // we need to set it to CONNECT soon, remove this one first.
-        // otherwise, there may have 2 http methods in headers
-        if (setRequests) requests.set(0, null, null);
-
-        requests.prepend(HTTP_CONNECT + " " + connectRequestURI(url)
+        requests.set(0, HTTP_CONNECT + " " + connectRequestURI(url)
                          + " " + httpVersion, null);
         requests.setIfNotSet("User-Agent", userAgent);
 
@@ -1912,8 +1905,6 @@
         }
 
         http.writeRequests(requests, null);
-        // remove CONNECT header
-        requests.set(0, null, null);
     }
 
     /**
--- a/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -390,8 +390,10 @@
 
        protected void receive(DatagramPacket p) throws IOException {}
 
+       @Deprecated
        protected void setTTL(byte ttl) throws IOException {}
 
+       @Deprecated
        protected byte getTTL() throws IOException { return 0; }
 
        protected void setTimeToLive(int ttl) throws IOException {}
--- a/src/share/classes/sun/nio/ch/Reflect.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/ch/Reflect.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,29 +50,25 @@
                 }});
     }
 
-    static Constructor lookupConstructor(String className,
-                                         Class[] paramTypes)
+    static Constructor<?> lookupConstructor(String className,
+                                            Class<?>[] paramTypes)
     {
         try {
             Class<?> cl = Class.forName(className);
             Constructor<?> c = cl.getDeclaredConstructor(paramTypes);
             setAccessible(c);
             return c;
-        } catch (ClassNotFoundException x) {
-            throw new ReflectionError(x);
-        } catch (NoSuchMethodException x) {
+        } catch (ClassNotFoundException | NoSuchMethodException x) {
             throw new ReflectionError(x);
         }
     }
 
-    static Object invoke(Constructor c, Object[] args) {
+    static Object invoke(Constructor<?> c, Object[] args) {
         try {
             return c.newInstance(args);
-        } catch (InstantiationException x) {
-            throw new ReflectionError(x);
-        } catch (IllegalAccessException x) {
-            throw new ReflectionError(x);
-        } catch (InvocationTargetException x) {
+        } catch (InstantiationException |
+                 IllegalAccessException |
+                 InvocationTargetException x) {
             throw new ReflectionError(x);
         }
     }
@@ -86,9 +82,7 @@
             Method m = cl.getDeclaredMethod(methodName, paramTypes);
             setAccessible(m);
             return m;
-        } catch (ClassNotFoundException x) {
-            throw new ReflectionError(x);
-        } catch (NoSuchMethodException x) {
+        } catch (ClassNotFoundException | NoSuchMethodException x) {
             throw new ReflectionError(x);
         }
     }
@@ -96,9 +90,7 @@
     static Object invoke(Method m, Object ob, Object[] args) {
         try {
             return m.invoke(ob, args);
-        } catch (IllegalAccessException x) {
-            throw new ReflectionError(x);
-        } catch (InvocationTargetException x) {
+        } catch (IllegalAccessException | InvocationTargetException x) {
             throw new ReflectionError(x);
         }
     }
@@ -119,13 +111,11 @@
 
     static Field lookupField(String className, String fieldName) {
         try {
-            Class cl = Class.forName(className);
+            Class<?> cl = Class.forName(className);
             Field f = cl.getDeclaredField(fieldName);
             setAccessible(f);
             return f;
-        } catch (ClassNotFoundException x) {
-            throw new ReflectionError(x);
-        } catch (NoSuchFieldException x) {
+        } catch (ClassNotFoundException | NoSuchFieldException x) {
             throw new ReflectionError(x);
         }
     }
--- a/src/share/classes/sun/nio/ch/SelectorImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/ch/SelectorImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import java.nio.channels.spi.*;
 import java.net.SocketException;
 import java.util.*;
-import sun.misc.*;
 
 
 /**
@@ -140,19 +139,16 @@
 
     void processDeregisterQueue() throws IOException {
         // Precondition: Synchronized on this, keys, and selectedKeys
-        Set cks = cancelledKeys();
+        Set<SelectionKey> cks = cancelledKeys();
         synchronized (cks) {
             if (!cks.isEmpty()) {
-                Iterator i = cks.iterator();
+                Iterator<SelectionKey> i = cks.iterator();
                 while (i.hasNext()) {
                     SelectionKeyImpl ski = (SelectionKeyImpl)i.next();
                     try {
                         implDereg(ski);
                     } catch (SocketException se) {
-                        IOException ioe = new IOException(
-                            "Error deregistering key");
-                        ioe.initCause(se);
-                        throw ioe;
+                        throw new IOException("Error deregistering key", se);
                     } finally {
                         i.remove();
                     }
--- a/src/share/classes/sun/nio/ch/Util.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/ch/Util.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -355,27 +355,24 @@
         return pageSize;
     }
 
-    private static volatile Constructor directByteBufferConstructor = null;
+    private static volatile Constructor<?> directByteBufferConstructor = null;
 
     private static void initDBBConstructor() {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
                     try {
                         Class<?> cl = Class.forName("java.nio.DirectByteBuffer");
-                        Constructor ctor = cl.getDeclaredConstructor(
+                        Constructor<?> ctor = cl.getDeclaredConstructor(
                             new Class[] { int.class,
                                           long.class,
                                           FileDescriptor.class,
                                           Runnable.class });
                         ctor.setAccessible(true);
                         directByteBufferConstructor = ctor;
-                    } catch (ClassNotFoundException x) {
-                        throw new InternalError();
-                    } catch (NoSuchMethodException x) {
-                        throw new InternalError();
-                    } catch (IllegalArgumentException x) {
-                        throw new InternalError();
-                    } catch (ClassCastException x) {
+                    } catch (ClassNotFoundException   |
+                             NoSuchMethodException    |
+                             IllegalArgumentException |
+                             ClassCastException x) {
                         throw new InternalError();
                     }
                     return null;
@@ -395,37 +392,32 @@
                              new Long(addr),
                              fd,
                              unmapper });
-        } catch (InstantiationException e) {
-            throw new InternalError();
-        } catch (IllegalAccessException e) {
-            throw new InternalError();
-        } catch (InvocationTargetException e) {
+        } catch (InstantiationException |
+                 IllegalAccessException |
+                 InvocationTargetException e) {
             throw new InternalError();
         }
         return dbb;
     }
 
-    private static volatile Constructor directByteBufferRConstructor = null;
+    private static volatile Constructor<?> directByteBufferRConstructor = null;
 
     private static void initDBBRConstructor() {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
                     try {
                         Class<?> cl = Class.forName("java.nio.DirectByteBufferR");
-                        Constructor ctor = cl.getDeclaredConstructor(
+                        Constructor<?> ctor = cl.getDeclaredConstructor(
                             new Class[] { int.class,
                                           long.class,
                                           FileDescriptor.class,
                                           Runnable.class });
                         ctor.setAccessible(true);
                         directByteBufferRConstructor = ctor;
-                    } catch (ClassNotFoundException x) {
-                        throw new InternalError();
-                    } catch (NoSuchMethodException x) {
-                        throw new InternalError();
-                    } catch (IllegalArgumentException x) {
-                        throw new InternalError();
-                    } catch (ClassCastException x) {
+                    } catch (ClassNotFoundException |
+                             NoSuchMethodException |
+                             IllegalArgumentException |
+                             ClassCastException x) {
                         throw new InternalError();
                     }
                     return null;
@@ -445,11 +437,9 @@
                              new Long(addr),
                              fd,
                              unmapper });
-        } catch (InstantiationException e) {
-            throw new InternalError();
-        } catch (IllegalAccessException e) {
-            throw new InternalError();
-        } catch (InvocationTargetException e) {
+        } catch (InstantiationException |
+                 IllegalAccessException |
+                 InvocationTargetException e) {
             throw new InternalError();
         }
         return dbb;
--- a/src/share/classes/sun/nio/cs/FastCharsetProvider.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/cs/FastCharsetProvider.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package sun.nio.cs;
 
-import java.lang.ref.SoftReference;
 import java.nio.charset.Charset;
 import java.nio.charset.spi.CharsetProvider;
 import java.util.Iterator;
@@ -116,17 +115,15 @@
 
         // Instantiate the charset and cache it
         try {
-            Class c = Class.forName(packagePrefix + "." + cln,
+            Class<?> c = Class.forName(packagePrefix + "." + cln,
                                     true,
                                     this.getClass().getClassLoader());
             cs = (Charset)c.newInstance();
             cache.put(csn, cs);
             return cs;
-        } catch (ClassNotFoundException x) {
-            return null;
-        } catch (IllegalAccessException x) {
-            return null;
-        } catch (InstantiationException x) {
+        } catch (ClassNotFoundException |
+                 IllegalAccessException |
+                 InstantiationException x) {
             return null;
         }
     }
--- a/src/share/classes/sun/nio/cs/StreamDecoder.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/cs/StreamDecoder.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,7 @@
         return read0();
     }
 
+    @SuppressWarnings("fallthrough")
     private int read0() throws IOException {
         synchronized (lock) {
 
--- a/src/share/classes/sun/nio/cs/ThreadLocalCoders.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/cs/ThreadLocalCoders.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 
 package sun.nio.cs;
 
-import java.nio.*;
 import java.nio.charset.*;
 
 
@@ -41,7 +40,7 @@
     private static abstract class Cache {
 
         // Thread-local reference to array of cached objects, in LRU order
-        private ThreadLocal cache = new ThreadLocal();
+        private ThreadLocal<Object[]> cache = new ThreadLocal<>();
         private final int size;
 
         Cache(int size) {
@@ -60,7 +59,7 @@
         abstract boolean hasName(Object ob, Object name);
 
         Object forName(Object name) {
-            Object[] oa = (Object[])cache.get();
+            Object[] oa = cache.get();
             if (oa == null) {
                 oa = new Object[size];
                 cache.set(oa);
--- a/src/share/classes/sun/nio/fs/Util.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/nio/fs/Util.java	Wed Aug 17 22:47:49 2011 -0700
@@ -62,6 +62,7 @@
     /**
      * Returns a Set containing the given elements.
      */
+    @SafeVarargs
     static <E> Set<E> newSet(E... elements) {
         HashSet<E> set = new HashSet<>();
         for (E e: elements) {
@@ -74,6 +75,7 @@
      * Returns a Set containing all the elements of the given Set plus
      * the given elements.
      */
+    @SafeVarargs
     static <E> Set<E> newSet(Set<E> other, E... elements) {
         HashSet<E> set = new HashSet<>(other);
         for (E e: elements) {
--- a/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,4 +26,6 @@
 package sun.reflect.generics.reflectiveObjects;
 
 /** Temporary class used to indicate missing functionality */
-public class NotImplementedException extends RuntimeException {}
+public class NotImplementedException extends RuntimeException {
+    private static final long serialVersionUID = -9177857708926624790L;
+}
--- a/src/share/classes/sun/reflect/misc/ConstructorUtil.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/reflect/misc/ConstructorUtil.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,13 +32,13 @@
     private ConstructorUtil() {
     }
 
-    public static Constructor getConstructor(Class cls, Class[] params)
+    public static Constructor<?> getConstructor(Class<?> cls, Class<?>[] params)
         throws NoSuchMethodException {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getConstructor(params);
     }
 
-    public static Constructor[] getConstructors(Class cls) {
+    public static Constructor<?>[] getConstructors(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getConstructors();
     }
--- a/src/share/classes/sun/reflect/misc/FieldUtil.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/reflect/misc/FieldUtil.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,18 +35,18 @@
     private FieldUtil() {
     }
 
-    public static Field getField(Class cls, String name)
+    public static Field getField(Class<?> cls, String name)
         throws NoSuchFieldException {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getField(name);
     }
 
-    public static Field[] getFields(Class cls) {
+    public static Field[] getFields(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getFields();
     }
 
-    public static Field[] getDeclaredFields(Class cls) {
+    public static Field[] getDeclaredFields(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getDeclaredFields();
     }
--- a/src/share/classes/sun/reflect/misc/MethodUtil.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/reflect/misc/MethodUtil.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,13 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLConnection;
-import java.net.HttpURLConnection;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Modifier;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import sun.misc.IOUtils;
-import sun.net.www.ParseUtil;
-import sun.security.util.SecurityConstants;
 
 
 class Trampoline {
@@ -68,13 +64,13 @@
         super();
     }
 
-    public static Method getMethod(Class<?> cls, String name, Class[] args)
+    public static Method getMethod(Class<?> cls, String name, Class<?>[] args)
         throws NoSuchMethodException {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getMethod(name, args);
     }
 
-    public static Method[] getMethods(Class cls) {
+    public static Method[] getMethods(Class<?> cls) {
         ReflectUtil.checkPackageAccess(cls);
         return cls.getMethods();
     }
@@ -85,7 +81,7 @@
      * Class.getMethods() and walking towards Object until
      * we're done.
      */
-     public static Method[] getPublicMethods(Class cls) {
+     public static Method[] getPublicMethods(Class<?> cls) {
         // compatibility for update release
         if (System.getSecurityManager() == null) {
             return cls.getMethods();
@@ -105,11 +101,11 @@
     /*
      * Process the immediate interfaces of this class or interface.
      */
-    private static void getInterfaceMethods(Class cls,
+    private static void getInterfaceMethods(Class<?> cls,
                                             Map<Signature, Method> sigs) {
-        Class[] intfs = cls.getInterfaces();
+        Class<?>[] intfs = cls.getInterfaces();
         for (int i=0; i < intfs.length; i++) {
-            Class intf = intfs[i];
+            Class<?> intf = intfs[i];
             boolean done = getInternalPublicMethods(intf, sigs);
             if (!done) {
                 getInterfaceMethods(intf, sigs);
@@ -121,7 +117,7 @@
      *
      * Process the methods in this class or interface
      */
-    private static boolean getInternalPublicMethods(Class cls,
+    private static boolean getInternalPublicMethods(Class<?> cls,
                                                     Map<Signature, Method> sigs) {
         Method[] methods = null;
         try {
@@ -150,7 +146,7 @@
          */
         boolean done = true;
         for (int i=0; i < methods.length; i++) {
-            Class dc = methods[i].getDeclaringClass();
+            Class<?> dc = methods[i].getDeclaringClass();
             if (!Modifier.isPublic(dc.getModifiers())) {
                 done = false;
                 break;
@@ -171,7 +167,7 @@
              * stripping away inherited methods.
              */
             for (int i=0; i < methods.length; i++) {
-                Class dc = methods[i].getDeclaringClass();
+                Class<?> dc = methods[i].getDeclaringClass();
                 if (cls.equals(dc)) {
                     addMethod(sigs, methods[i]);
                 }
@@ -301,12 +297,12 @@
     }
 
 
-    protected synchronized Class loadClass(String name, boolean resolve)
+    protected synchronized Class<?> loadClass(String name, boolean resolve)
         throws ClassNotFoundException
     {
         // First, check if the class has already been loaded
         ReflectUtil.checkPackageAccess(name);
-        Class c = findLoadedClass(name);
+        Class<?> c = findLoadedClass(name);
         if (c == null) {
             try {
                 c = findClass(name);
@@ -324,7 +320,7 @@
     }
 
 
-    protected Class findClass(final String name)
+    protected Class<?> findClass(final String name)
         throws ClassNotFoundException
     {
         if (!name.startsWith(MISC_PKG)) {
@@ -347,7 +343,7 @@
     /*
      * Define the proxy classes
      */
-    private Class defineClass(String name, URL url) throws IOException {
+    private Class<?> defineClass(String name, URL url) throws IOException {
         byte[] b = getBytes(url);
         CodeSource cs = new CodeSource(null, (java.security.cert.Certificate[])null);
         if (!name.equals(TRAMPOLINE)) {
@@ -389,7 +385,7 @@
         return perms;
     }
 
-    private static Class getTrampolineClass() {
+    private static Class<?> getTrampolineClass() {
         try {
             return Class.forName(TRAMPOLINE, true, new MethodUtil());
         } catch (ClassNotFoundException e) {
--- a/src/share/classes/sun/reflect/misc/ReflectUtil.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/reflect/misc/ReflectUtil.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,13 +34,13 @@
     private ReflectUtil() {
     }
 
-    public static Class forName(String name)
+    public static Class<?> forName(String name)
         throws ClassNotFoundException {
         checkPackageAccess(name);
         return Class.forName(name);
     }
 
-    public static Object newInstance(Class cls)
+    public static Object newInstance(Class<?> cls)
         throws InstantiationException, IllegalAccessException {
         checkPackageAccess(cls);
         return cls.newInstance();
@@ -50,8 +50,8 @@
      * Reflection.ensureMemberAccess is overly-restrictive
      * due to a bug. We awkwardly work around it for now.
      */
-    public static void ensureMemberAccess(Class currentClass,
-                                          Class memberClass,
+    public static void ensureMemberAccess(Class<?> currentClass,
+                                          Class<?> memberClass,
                                           Object target,
                                           int modifiers)
         throws IllegalAccessException
@@ -102,8 +102,8 @@
         }
     }
 
-    private static boolean isSubclassOf(Class queryClass,
-                                Class ofClass)
+    private static boolean isSubclassOf(Class<?> queryClass,
+                                        Class<?> ofClass)
     {
         while (queryClass != null) {
             if (queryClass == ofClass) {
@@ -115,7 +115,7 @@
     }
 
 
-    public static void checkPackageAccess(Class clazz) {
+    public static void checkPackageAccess(Class<?> clazz) {
         checkPackageAccess(clazz.getName());
     }
 
@@ -136,7 +136,7 @@
         }
     }
 
-    public static boolean isPackageAccessible(Class clazz) {
+    public static boolean isPackageAccessible(Class<?> clazz) {
         try {
             checkPackageAccess(clazz);
         } catch (SecurityException e) {
--- a/src/share/classes/sun/security/krb5/PrincipalName.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/security/krb5/PrincipalName.java	Wed Aug 17 22:47:49 2011 -0700
@@ -173,12 +173,6 @@
 
     boolean equalsWithoutRealm(PrincipalName other) {
 
-
-        if (nameType != KRB_NT_UNKNOWN &&
-            other.nameType != KRB_NT_UNKNOWN &&
-            nameType != other.nameType)
-            return false;
-
         if ((nameStrings != null && other.nameStrings == null) ||
             (nameStrings == null && other.nameStrings != null))
             return false;
--- a/src/share/classes/sun/security/ssl/SSLContextImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/security/ssl/SSLContextImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -567,42 +567,46 @@
             }
 
             FileInputStream fs = null;
-            if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) {
-                fs = AccessController.doPrivileged(
-                        new PrivilegedExceptionAction<FileInputStream>() {
-                    public FileInputStream run() throws Exception {
-                        return new FileInputStream(defaultKeyStore);
-                    }
-                });
-            }
-
-            String defaultKeyStorePassword = props.get("keyStorePasswd");
+            KeyStore ks = null;
             char[] passwd = null;
-            if (defaultKeyStorePassword.length() != 0) {
-                passwd = defaultKeyStorePassword.toCharArray();
-            }
+            try {
+                if (defaultKeyStore.length() != 0 &&
+                        !NONE.equals(defaultKeyStore)) {
+                    fs = AccessController.doPrivileged(
+                            new PrivilegedExceptionAction<FileInputStream>() {
+                        public FileInputStream run() throws Exception {
+                            return new FileInputStream(defaultKeyStore);
+                        }
+                    });
+                }
 
-            /**
-             * Try to initialize key store.
-             */
-            KeyStore ks = null;
-            if ((defaultKeyStoreType.length()) != 0) {
-                if (debug != null && Debug.isOn("defaultctx")) {
-                    System.out.println("init keystore");
-                }
-                if (defaultKeyStoreProvider.length() == 0) {
-                    ks = KeyStore.getInstance(defaultKeyStoreType);
-                } else {
-                    ks = KeyStore.getInstance(defaultKeyStoreType,
-                                        defaultKeyStoreProvider);
+                String defaultKeyStorePassword = props.get("keyStorePasswd");
+                if (defaultKeyStorePassword.length() != 0) {
+                    passwd = defaultKeyStorePassword.toCharArray();
                 }
 
-                // if defaultKeyStore is NONE, fs will be null
-                ks.load(fs, passwd);
-            }
-            if (fs != null) {
-                fs.close();
-                fs = null;
+                /**
+                 * Try to initialize key store.
+                 */
+                if ((defaultKeyStoreType.length()) != 0) {
+                    if (debug != null && Debug.isOn("defaultctx")) {
+                        System.out.println("init keystore");
+                    }
+                    if (defaultKeyStoreProvider.length() == 0) {
+                        ks = KeyStore.getInstance(defaultKeyStoreType);
+                    } else {
+                        ks = KeyStore.getInstance(defaultKeyStoreType,
+                                            defaultKeyStoreProvider);
+                    }
+
+                    // if defaultKeyStore is NONE, fs will be null
+                    ks.load(fs, passwd);
+                }
+            } finally {
+                if (fs != null) {
+                    fs.close();
+                    fs = null;
+                }
             }
 
             /*
--- a/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -2443,11 +2443,12 @@
             entrySet, HandshakeCompletedEvent e) {
 
             super("HandshakeCompletedNotify-Thread");
-            targets = entrySet;
+            targets = new HashSet<>(entrySet);          // clone the entry set
             event = e;
         }
 
         public void run() {
+            // Don't need to synchronize, as it only runs in one thread.
             for (Map.Entry<HandshakeCompletedListener,AccessControlContext>
                 entry : targets) {
 
--- a/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -164,72 +164,75 @@
          * If none exists, we use an empty keystore.
          */
 
-        storeFileName = props.get("trustStore");
-        if (!"NONE".equals(storeFileName)) {
-            if (storeFileName != null) {
-                storeFile = new File(storeFileName);
-                fis = getFileInputStream(storeFile);
-            } else {
-                String javaHome = props.get("javaHome");
-                storeFile = new File(javaHome + sep + "lib" + sep
-                                                + "security" + sep +
-                                                "jssecacerts");
-                if ((fis = getFileInputStream(storeFile)) == null) {
+        try {
+            storeFileName = props.get("trustStore");
+            if (!"NONE".equals(storeFileName)) {
+                if (storeFileName != null) {
+                    storeFile = new File(storeFileName);
+                    fis = getFileInputStream(storeFile);
+                } else {
+                    String javaHome = props.get("javaHome");
                     storeFile = new File(javaHome + sep + "lib" + sep
-                                                + "security" + sep +
-                                                "cacerts");
-                    fis = getFileInputStream(storeFile);
+                                                    + "security" + sep +
+                                                    "jssecacerts");
+                    if ((fis = getFileInputStream(storeFile)) == null) {
+                        storeFile = new File(javaHome + sep + "lib" + sep
+                                                    + "security" + sep +
+                                                    "cacerts");
+                        fis = getFileInputStream(storeFile);
+                    }
+                }
+
+                if (fis != null) {
+                    storeFileName = storeFile.getPath();
+                } else {
+                    storeFileName = "No File Available, using empty keystore.";
                 }
             }
 
-            if (fis != null) {
-                storeFileName = storeFile.getPath();
-            } else {
-                storeFileName = "No File Available, using empty keystore.";
+            defaultTrustStoreType = props.get("trustStoreType");
+            defaultTrustStoreProvider = props.get("trustStoreProvider");
+            if (debug != null && Debug.isOn(dbgname)) {
+                System.out.println("trustStore is: " + storeFileName);
+                System.out.println("trustStore type is : " +
+                                    defaultTrustStoreType);
+                System.out.println("trustStore provider is : " +
+                                    defaultTrustStoreProvider);
             }
-        }
-
-        defaultTrustStoreType = props.get("trustStoreType");
-        defaultTrustStoreProvider = props.get("trustStoreProvider");
-        if (debug != null && Debug.isOn(dbgname)) {
-            System.out.println("trustStore is: " + storeFileName);
-            System.out.println("trustStore type is : " +
-                                defaultTrustStoreType);
-            System.out.println("trustStore provider is : " +
-                                defaultTrustStoreProvider);
-        }
 
-        /*
-         * Try to initialize trust store.
-         */
-        if (defaultTrustStoreType.length() != 0) {
-            if (debug != null && Debug.isOn(dbgname)) {
-                System.out.println("init truststore");
-            }
-            if (defaultTrustStoreProvider.length() == 0) {
-                ks = KeyStore.getInstance(defaultTrustStoreType);
-            } else {
-                ks = KeyStore.getInstance(defaultTrustStoreType,
-                                        defaultTrustStoreProvider);
-            }
-            char[] passwd = null;
-            String defaultTrustStorePassword = props.get("trustStorePasswd");
-            if (defaultTrustStorePassword.length() != 0)
-                passwd = defaultTrustStorePassword.toCharArray();
+            /*
+             * Try to initialize trust store.
+             */
+            if (defaultTrustStoreType.length() != 0) {
+                if (debug != null && Debug.isOn(dbgname)) {
+                    System.out.println("init truststore");
+                }
+                if (defaultTrustStoreProvider.length() == 0) {
+                    ks = KeyStore.getInstance(defaultTrustStoreType);
+                } else {
+                    ks = KeyStore.getInstance(defaultTrustStoreType,
+                                            defaultTrustStoreProvider);
+                }
+                char[] passwd = null;
+                String defaultTrustStorePassword =
+                        props.get("trustStorePasswd");
+                if (defaultTrustStorePassword.length() != 0)
+                    passwd = defaultTrustStorePassword.toCharArray();
 
-            // if trustStore is NONE, fis will be null
-            ks.load(fis, passwd);
+                // if trustStore is NONE, fis will be null
+                ks.load(fis, passwd);
 
-            // Zero out the temporary password storage
-            if (passwd != null) {
-                for (int i = 0; i < passwd.length; i++) {
-                    passwd[i] = (char)0;
+                // Zero out the temporary password storage
+                if (passwd != null) {
+                    for (int i = 0; i < passwd.length; i++) {
+                        passwd[i] = (char)0;
+                    }
                 }
             }
-        }
-
-        if (fis != null) {
-            fis.close();
+        } finally {
+            if (fis != null) {
+                fis.close();
+            }
         }
 
         return ks;
--- a/src/share/classes/sun/swing/DefaultLayoutStyle.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/swing/DefaultLayoutStyle.java	Wed Aug 17 22:47:49 2011 -0700
@@ -48,10 +48,12 @@
     @Override
     public int getPreferredGap(JComponent component1, JComponent component2,
             ComponentPlacement type, int position, Container parent) {
-
         if (component1 == null || component2 == null || type == null) {
             throw new NullPointerException();
         }
+
+        checkPosition(position);
+
         if (type == ComponentPlacement.INDENT &&
                 (position == SwingConstants.EAST ||
                  position == SwingConstants.WEST)) {
--- a/src/share/classes/sun/util/locale/LocaleObjectCache.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/classes/sun/util/locale/LocaleObjectCache.java	Wed Aug 17 22:47:49 2011 -0700
@@ -66,14 +66,14 @@
 
             CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue);
 
-            while (value == null) {
-                cleanStaleEntries();
-                entry = map.putIfAbsent(key, newEntry);
-                if (entry == null) {
+            entry = map.putIfAbsent(key, newEntry);
+            if (entry == null) {
+                value = newVal;
+            } else {
+                value = entry.get();
+                if (value == null) {
+                    map.put(key, newEntry);
                     value = newVal;
-                    break;
-                } else {
-                    value = entry.get();
                 }
             }
         }
--- a/src/share/native/java/lang/fdlibm/include/fdlibm.h	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/native/java/lang/fdlibm/include/fdlibm.h	Wed Aug 17 22:47:49 2011 -0700
@@ -135,22 +135,10 @@
 extern double floor __P((double));
 extern double fmod __P((double, double));
 
-extern double erf __P((double));
-extern double erfc __P((double));
-extern double gamma __P((double));
 extern double hypot __P((double, double));
 extern int isnan __P((double));
 extern int finite __P((double));
-extern double j0 __P((double));
-extern double j1 __P((double));
-extern double jn __P((int, double));
-extern double lgamma __P((double));
-extern double y0 __P((double));
-extern double y1 __P((double));
-extern double yn __P((int, double));
 
-extern double acosh __P((double));
-extern double asinh __P((double));
 extern double atanh __P((double));
 extern double cbrt __P((double));
 extern double logb __P((double));
@@ -183,19 +171,9 @@
 extern double expm1 __P((double));
 extern double log1p __P((double));
 
-/*
- * Reentrant version of gamma & lgamma; passes signgam back by reference
- * as the second argument; user must allocate space for signgam.
- */
-#ifdef _REENTRANT
-extern double gamma_r __P((double, int *));
-extern double lgamma_r __P((double, int *));
-#endif  /* _REENTRANT */
-
 /* ieee style elementary functions */
 extern double __ieee754_sqrt __P((double));
 extern double __ieee754_acos __P((double));
-extern double __ieee754_acosh __P((double));
 extern double __ieee754_log __P((double));
 extern double __ieee754_atanh __P((double));
 extern double __ieee754_asin __P((double));
@@ -204,19 +182,9 @@
 extern double __ieee754_cosh __P((double));
 extern double __ieee754_fmod __P((double,double));
 extern double __ieee754_pow __P((double,double));
-extern double __ieee754_lgamma_r __P((double,int *));
-extern double __ieee754_gamma_r __P((double,int *));
-extern double __ieee754_lgamma __P((double));
-extern double __ieee754_gamma __P((double));
 extern double __ieee754_log10 __P((double));
 extern double __ieee754_sinh __P((double));
 extern double __ieee754_hypot __P((double,double));
-extern double __ieee754_j0 __P((double));
-extern double __ieee754_j1 __P((double));
-extern double __ieee754_y0 __P((double));
-extern double __ieee754_y1 __P((double));
-extern double __ieee754_jn __P((int,double));
-extern double __ieee754_yn __P((int,double));
 extern double __ieee754_remainder __P((double,double));
 extern int    __ieee754_rem_pio2 __P((double,double*));
 #ifdef _SCALB_INT
--- a/src/share/native/java/lang/fdlibm/include/jfdlibm.h	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/share/native/java/lang/fdlibm/include/jfdlibm.h	Wed Aug 17 22:47:49 2011 -0700
@@ -64,7 +64,6 @@
 #ifdef __linux__
 #define __ieee754_sqrt          __j__ieee754_sqrt
 #define __ieee754_acos          __j__ieee754_acos
-#define __ieee754_acosh         __j__ieee754_acosh
 #define __ieee754_log           __j__ieee754_log
 #define __ieee754_atanh         __j__ieee754_atanh
 #define __ieee754_asin          __j__ieee754_asin
@@ -73,19 +72,9 @@
 #define __ieee754_cosh          __j__ieee754_cosh
 #define __ieee754_fmod          __j__ieee754_fmod
 #define __ieee754_pow           __j__ieee754_pow
-#define __ieee754_lgamma_r      __j__ieee754_lgamma_r
-#define __ieee754_gamma_r       __j__ieee754_gamma_r
-#define __ieee754_lgamma        __j__ieee754_lgamma
-#define __ieee754_gamma         __j__ieee754_gamma
 #define __ieee754_log10         __j__ieee754_log10
 #define __ieee754_sinh          __j__ieee754_sinh
 #define __ieee754_hypot         __j__ieee754_hypot
-#define __ieee754_j0            __j__ieee754_j0
-#define __ieee754_j1            __j__ieee754_j1
-#define __ieee754_y0            __j__ieee754_y0
-#define __ieee754_y1            __j__ieee754_y1
-#define __ieee754_jn            __j__ieee754_jn
-#define __ieee754_yn            __j__ieee754_yn
 #define __ieee754_remainder     __j__ieee754_remainder
 #define __ieee754_rem_pio2      __j__ieee754_rem_pio2
 #define __ieee754_scalb         __j__ieee754_scalb
--- a/src/share/native/java/lang/fdlibm/src/e_acosh.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_acosh(x)
- * Method :
- *      Based on
- *              acosh(x) = log [ x + sqrt(x*x-1) ]
- *      we have
- *              acosh(x) := log(x)+ln2, if x is large; else
- *              acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
- *              acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
- *
- * Special cases:
- *      acosh(x) is NaN with signal if x<1.
- *      acosh(NaN) is NaN without signal.
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-one     = 1.0,
-ln2     = 6.93147180559945286227e-01;  /* 0x3FE62E42, 0xFEFA39EF */
-
-#ifdef __STDC__
-        double __ieee754_acosh(double x)
-#else
-        double __ieee754_acosh(x)
-        double x;
-#endif
-{
-        double t;
-        int hx;
-        hx = __HI(x);
-        if(hx<0x3ff00000) {             /* x < 1 */
-            return (x-x)/(x-x);
-        } else if(hx >=0x41b00000) {    /* x > 2**28 */
-            if(hx >=0x7ff00000) {       /* x is inf of NaN */
-                return x+x;
-            } else
-                return __ieee754_log(x)+ln2;    /* acosh(huge)=log(2x) */
-        } else if(((hx-0x3ff00000)|__LO(x))==0) {
-            return 0.0;                 /* acosh(1) = 0 */
-        } else if (hx > 0x40000000) {   /* 2**28 > x > 2 */
-            t=x*x;
-            return __ieee754_log(2.0*x-one/(x+sqrt(t-one)));
-        } else {                        /* 1<x<2 */
-            t = x-one;
-            return log1p(t+sqrt(2.0*t+t*t));
-        }
-}
--- a/src/share/native/java/lang/fdlibm/src/e_gamma.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_gamma(x)
- * Return the logarithm of the Gamma function of x.
- *
- * Method: call __ieee754_gamma_r
- */
-
-#include "fdlibm.h"
-
-extern int signgam;
-
-#ifdef __STDC__
-        double __ieee754_gamma(double x)
-#else
-        double __ieee754_gamma(x)
-        double x;
-#endif
-{
-        return __ieee754_gamma_r(x,&signgam);
-}
--- a/src/share/native/java/lang/fdlibm/src/e_gamma_r.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_gamma_r(x, signgamp)
- * Reentrant version of the logarithm of the Gamma function
- * with user provide pointer for the sign of Gamma(x).
- *
- * Method: See __ieee754_lgamma_r
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-        double __ieee754_gamma_r(double x, int *signgamp)
-#else
-        double __ieee754_gamma_r(x,signgamp)
-        double x; int *signgamp;
-#endif
-{
-        return __ieee754_lgamma_r(x,signgamp);
-}
--- a/src/share/native/java/lang/fdlibm/src/e_j0.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,491 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_j0(x), __ieee754_y0(x)
- * Bessel function of the first and second kinds of order zero.
- * Method -- j0(x):
- *      1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ...
- *      2. Reduce x to |x| since j0(x)=j0(-x),  and
- *         for x in (0,2)
- *              j0(x) = 1-z/4+ z^2*R0/S0,  where z = x*x;
- *         (precision:  |j0-1+z/4-z^2R0/S0 |<2**-63.67 )
- *         for x in (2,inf)
- *              j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
- *         where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
- *         as follow:
- *              cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
- *                      = 1/sqrt(2) * (cos(x) + sin(x))
- *              sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4)
- *                      = 1/sqrt(2) * (sin(x) - cos(x))
- *         (To avoid cancellation, use
- *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- *          to compute the worse one.)
- *
- *      3 Special cases
- *              j0(nan)= nan
- *              j0(0) = 1
- *              j0(inf) = 0
- *
- * Method -- y0(x):
- *      1. For x<2.
- *         Since
- *              y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...)
- *         therefore y0(x)-2/pi*j0(x)*ln(x) is an even function.
- *         We use the following function to approximate y0,
- *              y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2
- *         where
- *              U(z) = u00 + u01*z + ... + u06*z^6
- *              V(z) = 1  + v01*z + ... + v04*z^4
- *         with absolute approximation error bounded by 2**-72.
- *         Note: For tiny x, U/V = u0 and j0(x)~1, hence
- *              y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27)
- *      2. For x>=2.
- *              y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))
- *         where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
- *         by the method mentioned above.
- *      3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0.
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static double pzero(double), qzero(double);
-#else
-static double pzero(), qzero();
-#endif
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-huge    = 1e300,
-one     = 1.0,
-invsqrtpi=  5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
-tpi      =  6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
-                /* R0/S0 on [0, 2.00] */
-R02  =  1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */
-R03  = -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */
-R04  =  1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */
-R05  = -4.61832688532103189199e-09, /* 0xBE33D5E7, 0x73D63FCE */
-S01  =  1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */
-S02  =  1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */
-S03  =  5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */
-S04  =  1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */
-
-static double zero = 0.0;
-
-#ifdef __STDC__
-        double __ieee754_j0(double x)
-#else
-        double __ieee754_j0(x)
-        double x;
-#endif
-{
-        double z, s,c,ss,cc,r,u,v;
-        int hx,ix;
-
-        hx = __HI(x);
-        ix = hx&0x7fffffff;
-        if(ix>=0x7ff00000) return one/(x*x);
-        x = fabs(x);
-        if(ix >= 0x40000000) {  /* |x| >= 2.0 */
-                s = sin(x);
-                c = cos(x);
-                ss = s-c;
-                cc = s+c;
-                if(ix<0x7fe00000) {  /* make sure x+x not overflow */
-                    z = -cos(x+x);
-                    if ((s*c)<zero) cc = z/ss;
-                    else            ss = z/cc;
-                }
-        /*
-         * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
-         * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
-         */
-                if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(x);
-                else {
-                    u = pzero(x); v = qzero(x);
-                    z = invsqrtpi*(u*cc-v*ss)/sqrt(x);
-                }
-                return z;
-        }
-        if(ix<0x3f200000) {     /* |x| < 2**-13 */
-            if(huge+x>one) {    /* raise inexact if x != 0 */
-                if(ix<0x3e400000) return one;   /* |x|<2**-27 */
-                else          return one - 0.25*x*x;
-            }
-        }
-        z = x*x;
-        r =  z*(R02+z*(R03+z*(R04+z*R05)));
-        s =  one+z*(S01+z*(S02+z*(S03+z*S04)));
-        if(ix < 0x3FF00000) {   /* |x| < 1.00 */
-            return one + z*(-0.25+(r/s));
-        } else {
-            u = 0.5*x;
-            return((one+u)*(one-u)+z*(r/s));
-        }
-}
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-u00  = -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */
-u01  =  1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */
-u02  = -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */
-u03  =  3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */
-u04  = -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */
-u05  =  1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */
-u06  = -3.98205194132103398453e-11, /* 0xBDC5E43D, 0x693FB3C8 */
-v01  =  1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
-v02  =  7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */
-v03  =  2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
-v04  =  4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */
-
-#ifdef __STDC__
-        double __ieee754_y0(double x)
-#else
-        double __ieee754_y0(x)
-        double x;
-#endif
-{
-        double z, s,c,ss,cc,u,v;
-        int hx,ix,lx;
-
-        hx = __HI(x);
-        ix = 0x7fffffff&hx;
-        lx = __LO(x);
-    /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0  */
-        if(ix>=0x7ff00000) return  one/(x+x*x);
-        if((ix|lx)==0) return -one/zero;
-        if(hx<0) return zero/zero;
-        if(ix >= 0x40000000) {  /* |x| >= 2.0 */
-        /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
-         * where x0 = x-pi/4
-         *      Better formula:
-         *              cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
-         *                      =  1/sqrt(2) * (sin(x) + cos(x))
-         *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
-         *                      =  1/sqrt(2) * (sin(x) - cos(x))
-         * To avoid cancellation, use
-         *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
-         * to compute the worse one.
-         */
-                s = sin(x);
-                c = cos(x);
-                ss = s-c;
-                cc = s+c;
-        /*
-         * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
-         * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
-         */
-                if(ix<0x7fe00000) {  /* make sure x+x not overflow */
-                    z = -cos(x+x);
-                    if ((s*c)<zero) cc = z/ss;
-                    else            ss = z/cc;
-                }
-                if(ix>0x48000000) z = (invsqrtpi*ss)/sqrt(x);
-                else {
-                    u = pzero(x); v = qzero(x);
-                    z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
-                }
-                return z;
-        }
-        if(ix<=0x3e400000) {    /* x < 2**-27 */
-            return(u00 + tpi*__ieee754_log(x));
-        }
-        z = x*x;
-        u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06)))));
-        v = one+z*(v01+z*(v02+z*(v03+z*v04)));
-        return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x)));
-}
-
-/* The asymptotic expansions of pzero is
- *      1 - 9/128 s^2 + 11025/98304 s^4 - ...,  where s = 1/x.
- * For x >= 2, We approximate pzero by
- *      pzero(x) = 1 + (R/S)
- * where  R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10
- *        S = 1 + pS0*s^2 + ... + pS4*s^10
- * and
- *      | pzero(x)-1-R/S | <= 2  ** ( -60.26)
- */
-#ifdef __STDC__
-static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
-  0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
- -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */
- -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */
- -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */
- -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */
- -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */
-};
-#ifdef __STDC__
-static const double pS8[5] = {
-#else
-static double pS8[5] = {
-#endif
-  1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */
-  3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */
-  4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */
-  1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */
-  4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */
-};
-
-#ifdef __STDC__
-static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
- -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */
- -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */
- -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */
- -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */
- -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */
- -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */
-};
-#ifdef __STDC__
-static const double pS5[5] = {
-#else
-static double pS5[5] = {
-#endif
-  6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */
-  1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */
-  5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */
-  9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */
-  2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */
-};
-
-#ifdef __STDC__
-static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#else
-static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
- -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */
- -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */
- -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */
- -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */
- -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */
- -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */
-};
-#ifdef __STDC__
-static const double pS3[5] = {
-#else
-static double pS3[5] = {
-#endif
-  3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */
-  3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */
-  1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */
-  1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */
-  1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */
-};
-
-#ifdef __STDC__
-static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
- -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */
- -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */
- -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */
- -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */
- -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */
- -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */
-};
-#ifdef __STDC__
-static const double pS2[5] = {
-#else
-static double pS2[5] = {
-#endif
-  2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */
-  1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */
-  2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */
-  1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */
-  1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */
-};
-
-#ifdef __STDC__
-        static double pzero(double x)
-#else
-        static double pzero(x)
-        double x;
-#endif
-{
-#ifdef __STDC__
-        const double *p=(void*)0,*q=(void*)0;
-#else
-        double *p,*q;
-#endif
-        double z,r,s;
-        int ix;
-        ix = 0x7fffffff&__HI(x);
-        if(ix>=0x40200000)     {p = pR8; q= pS8;}
-        else if(ix>=0x40122E8B){p = pR5; q= pS5;}
-        else if(ix>=0x4006DB6D){p = pR3; q= pS3;}
-        else if(ix>=0x40000000){p = pR2; q= pS2;}
-        z = one/(x*x);
-        r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
-        s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
-        return one+ r/s;
-}
-
-
-/* For x >= 8, the asymptotic expansions of qzero is
- *      -1/8 s + 75/1024 s^3 - ..., where s = 1/x.
- * We approximate pzero by
- *      qzero(x) = s*(-1.25 + (R/S))
- * where  R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10
- *        S = 1 + qS0*s^2 + ... + qS5*s^12
- * and
- *      | qzero(x)/s +1.25-R/S | <= 2  ** ( -61.22)
- */
-#ifdef __STDC__
-static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
-  0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
-  7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */
-  1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */
-  5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */
-  8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */
-  3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */
-};
-#ifdef __STDC__
-static const double qS8[6] = {
-#else
-static double qS8[6] = {
-#endif
-  1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */
-  8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */
-  1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */
-  8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */
-  8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */
- -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */
-};
-
-#ifdef __STDC__
-static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
-  1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */
-  7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */
-  5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */
-  1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */
-  1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */
-  1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */
-};
-#ifdef __STDC__
-static const double qS5[6] = {
-#else
-static double qS5[6] = {
-#endif
-  8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */
-  2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */
-  1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */
-  5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */
-  3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */
- -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */
-};
-
-#ifdef __STDC__
-static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#else
-static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
-  4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */
-  7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */
-  3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */
-  4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */
-  1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */
-  1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */
-};
-#ifdef __STDC__
-static const double qS3[6] = {
-#else
-static double qS3[6] = {
-#endif
-  4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */
-  7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */
-  3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */
-  6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */
-  2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */
- -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */
-};
-
-#ifdef __STDC__
-static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
-  1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */
-  7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */
-  1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */
-  1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */
-  3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */
-  1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */
-};
-#ifdef __STDC__
-static const double qS2[6] = {
-#else
-static double qS2[6] = {
-#endif
-  3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */
-  2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */
-  8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */
-  8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */
-  2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */
- -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */
-};
-
-#ifdef __STDC__
-        static double qzero(double x)
-#else
-        static double qzero(x)
-        double x;
-#endif
-{
-#ifdef __STDC__
-        const double *p=(void*)0,*q=(void*)0;
-#else
-        double *p,*q;
-#endif
-        double s,r,z;
-        int ix;
-        ix = 0x7fffffff&__HI(x);
-        if(ix>=0x40200000)     {p = qR8; q= qS8;}
-        else if(ix>=0x40122E8B){p = qR5; q= qS5;}
-        else if(ix>=0x4006DB6D){p = qR3; q= qS3;}
-        else if(ix>=0x40000000){p = qR2; q= qS2;}
-        z = one/(x*x);
-        r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
-        s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
-        return (-.125 + r/s)/x;
-}
--- a/src/share/native/java/lang/fdlibm/src/e_j1.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,490 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_j1(x), __ieee754_y1(x)
- * Bessel function of the first and second kinds of order zero.
- * Method -- j1(x):
- *      1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ...
- *      2. Reduce x to |x| since j1(x)=-j1(-x),  and
- *         for x in (0,2)
- *              j1(x) = x/2 + x*z*R0/S0,  where z = x*x;
- *         (precision:  |j1/x - 1/2 - R0/S0 |<2**-61.51 )
- *         for x in (2,inf)
- *              j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
- *              y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- *         where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
- *         as follow:
- *              cos(x1) =  cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
- *                      =  1/sqrt(2) * (sin(x) - cos(x))
- *              sin(x1) =  sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- *                      = -1/sqrt(2) * (sin(x) + cos(x))
- *         (To avoid cancellation, use
- *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- *          to compute the worse one.)
- *
- *      3 Special cases
- *              j1(nan)= nan
- *              j1(0) = 0
- *              j1(inf) = 0
- *
- * Method -- y1(x):
- *      1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN
- *      2. For x<2.
- *         Since
- *              y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...)
- *         therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function.
- *         We use the following function to approximate y1,
- *              y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2
- *         where for x in [0,2] (abs err less than 2**-65.89)
- *              U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4
- *              V(z) = 1  + v0[0]*z + ... + v0[4]*z^5
- *         Note: For tiny x, 1/x dominate y1 and hence
- *              y1(tiny) = -2/pi/tiny, (choose tiny<2**-54)
- *      3. For x>=2.
- *              y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- *         where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
- *         by method mentioned above.
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static double pone(double), qone(double);
-#else
-static double pone(), qone();
-#endif
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-huge    = 1e300,
-one     = 1.0,
-invsqrtpi=  5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
-tpi      =  6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
-        /* R0/S0 on [0,2] */
-r00  = -6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */
-r01  =  1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */
-r02  = -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */
-r03  =  4.96727999609584448412e-08, /* 0x3E6AAAFA, 0x46CA0BD9 */
-s01  =  1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */
-s02  =  1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */
-s03  =  1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */
-s04  =  5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */
-s05  =  1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */
-
-static double zero    = 0.0;
-
-#ifdef __STDC__
-        double __ieee754_j1(double x)
-#else
-        double __ieee754_j1(x)
-        double x;
-#endif
-{
-        double z, s,c,ss,cc,r,u,v,y;
-        int hx,ix;
-
-        hx = __HI(x);
-        ix = hx&0x7fffffff;
-        if(ix>=0x7ff00000) return one/x;
-        y = fabs(x);
-        if(ix >= 0x40000000) {  /* |x| >= 2.0 */
-                s = sin(y);
-                c = cos(y);
-                ss = -s-c;
-                cc = s-c;
-                if(ix<0x7fe00000) {  /* make sure y+y not overflow */
-                    z = cos(y+y);
-                    if ((s*c)>zero) cc = z/ss;
-                    else            ss = z/cc;
-                }
-        /*
-         * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
-         * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
-         */
-                if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(y);
-                else {
-                    u = pone(y); v = qone(y);
-                    z = invsqrtpi*(u*cc-v*ss)/sqrt(y);
-                }
-                if(hx<0) return -z;
-                else     return  z;
-        }
-        if(ix<0x3e400000) {     /* |x|<2**-27 */
-            if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
-        }
-        z = x*x;
-        r =  z*(r00+z*(r01+z*(r02+z*r03)));
-        s =  one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05))));
-        r *= x;
-        return(x*0.5+r/s);
-}
-
-#ifdef __STDC__
-static const double U0[5] = {
-#else
-static double U0[5] = {
-#endif
- -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */
-  5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */
- -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */
-  2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */
- -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */
-};
-#ifdef __STDC__
-static const double V0[5] = {
-#else
-static double V0[5] = {
-#endif
-  1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */
-  2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */
-  1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */
-  6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */
-  1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */
-};
-
-#ifdef __STDC__
-        double __ieee754_y1(double x)
-#else
-        double __ieee754_y1(x)
-        double x;
-#endif
-{
-        double z, s,c,ss,cc,u,v;
-        int hx,ix,lx;
-
-        hx = __HI(x);
-        ix = 0x7fffffff&hx;
-        lx = __LO(x);
-    /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
-        if(ix>=0x7ff00000) return  one/(x+x*x);
-        if((ix|lx)==0) return -one/zero;
-        if(hx<0) return zero/zero;
-        if(ix >= 0x40000000) {  /* |x| >= 2.0 */
-                s = sin(x);
-                c = cos(x);
-                ss = -s-c;
-                cc = s-c;
-                if(ix<0x7fe00000) {  /* make sure x+x not overflow */
-                    z = cos(x+x);
-                    if ((s*c)>zero) cc = z/ss;
-                    else            ss = z/cc;
-                }
-        /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
-         * where x0 = x-3pi/4
-         *      Better formula:
-         *              cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
-         *                      =  1/sqrt(2) * (sin(x) - cos(x))
-         *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
-         *                      = -1/sqrt(2) * (cos(x) + sin(x))
-         * To avoid cancellation, use
-         *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
-         * to compute the worse one.
-         */
-                if(ix>0x48000000) z = (invsqrtpi*ss)/sqrt(x);
-                else {
-                    u = pone(x); v = qone(x);
-                    z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
-                }
-                return z;
-        }
-        if(ix<=0x3c900000) {    /* x < 2**-54 */
-            return(-tpi/x);
-        }
-        z = x*x;
-        u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
-        v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
-        return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
-}
-
-/* For x >= 8, the asymptotic expansions of pone is
- *      1 + 15/128 s^2 - 4725/2^15 s^4 - ...,   where s = 1/x.
- * We approximate pone by
- *      pone(x) = 1 + (R/S)
- * where  R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10
- *        S = 1 + ps0*s^2 + ... + ps4*s^10
- * and
- *      | pone(x)-1-R/S | <= 2  ** ( -60.06)
- */
-
-#ifdef __STDC__
-static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
-  0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
-  1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */
-  1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */
-  4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */
-  3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */
-  7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */
-};
-#ifdef __STDC__
-static const double ps8[5] = {
-#else
-static double ps8[5] = {
-#endif
-  1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */
-  3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */
-  3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */
-  9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */
-  3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */
-};
-
-#ifdef __STDC__
-static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
-  1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */
-  1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */
-  6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */
-  1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */
-  5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */
-  5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */
-};
-#ifdef __STDC__
-static const double ps5[5] = {
-#else
-static double ps5[5] = {
-#endif
-  5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */
-  9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */
-  5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */
-  7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */
-  1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */
-};
-
-#ifdef __STDC__
-static const double pr3[6] = {
-#else
-static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
-  3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */
-  1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */
-  3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */
-  3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */
-  9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */
-  4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */
-};
-#ifdef __STDC__
-static const double ps3[5] = {
-#else
-static double ps3[5] = {
-#endif
-  3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */
-  3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */
-  1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */
-  8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */
-  1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */
-};
-
-#ifdef __STDC__
-static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
-  1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */
-  1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */
-  2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */
-  1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */
-  1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */
-  5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */
-};
-#ifdef __STDC__
-static const double ps2[5] = {
-#else
-static double ps2[5] = {
-#endif
-  2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */
-  1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */
-  2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */
-  1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */
-  8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */
-};
-
-#ifdef __STDC__
-        static double pone(double x)
-#else
-        static double pone(x)
-        double x;
-#endif
-{
-#ifdef __STDC__
-        const double *p=(void*)0,*q=(void*)0;
-#else
-        double *p,*q;
-#endif
-        double z,r,s;
-        int ix;
-        ix = 0x7fffffff&__HI(x);
-        if(ix>=0x40200000)     {p = pr8; q= ps8;}
-        else if(ix>=0x40122E8B){p = pr5; q= ps5;}
-        else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
-        else if(ix>=0x40000000){p = pr2; q= ps2;}
-        z = one/(x*x);
-        r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
-        s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
-        return one+ r/s;
-}
-
-
-/* For x >= 8, the asymptotic expansions of qone is
- *      3/8 s - 105/1024 s^3 - ..., where s = 1/x.
- * We approximate pone by
- *      qone(x) = s*(0.375 + (R/S))
- * where  R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10
- *        S = 1 + qs1*s^2 + ... + qs6*s^12
- * and
- *      | qone(x)/s -0.375-R/S | <= 2  ** ( -61.13)
- */
-
-#ifdef __STDC__
-static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#else
-static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-#endif
-  0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
- -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */
- -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */
- -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */
- -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */
- -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */
-};
-#ifdef __STDC__
-static const double qs8[6] = {
-#else
-static double qs8[6] = {
-#endif
-  1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */
-  7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */
-  1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */
-  7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */
-  6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */
- -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */
-};
-
-#ifdef __STDC__
-static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#else
-static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-#endif
- -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */
- -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */
- -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */
- -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */
- -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */
- -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */
-};
-#ifdef __STDC__
-static const double qs5[6] = {
-#else
-static double qs5[6] = {
-#endif
-  8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */
-  1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */
-  1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */
-  4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */
-  2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */
- -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */
-};
-
-#ifdef __STDC__
-static const double qr3[6] = {
-#else
-static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-#endif
- -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */
- -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */
- -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */
- -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */
- -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */
- -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */
-};
-#ifdef __STDC__
-static const double qs3[6] = {
-#else
-static double qs3[6] = {
-#endif
-  4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */
-  6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */
-  3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */
-  5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */
-  1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */
- -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */
-};
-
-#ifdef __STDC__
-static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#else
-static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-#endif
- -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */
- -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */
- -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */
- -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */
- -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */
- -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */
-};
-#ifdef __STDC__
-static const double qs2[6] = {
-#else
-static double qs2[6] = {
-#endif
-  2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */
-  2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */
-  7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */
-  7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */
-  1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */
- -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */
-};
-
-#ifdef __STDC__
-        static double qone(double x)
-#else
-        static double qone(x)
-        double x;
-#endif
-{
-#ifdef __STDC__
-        const double *p=(void*)0,*q=(void*)0;
-#else
-        double *p,*q;
-#endif
-        double  s,r,z;
-        int ix;
-        ix = 0x7fffffff&__HI(x);
-        if(ix>=0x40200000)     {p = qr8; q= qs8;}
-        else if(ix>=0x40122E8B){p = qr5; q= qs5;}
-        else if(ix>=0x4006DB6D){p = qr3; q= qs3;}
-        else if(ix>=0x40000000){p = qr2; q= qs2;}
-        z = one/(x*x);
-        r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
-        s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
-        return (.375 + r/s)/x;
-}
--- a/src/share/native/java/lang/fdlibm/src/e_jn.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * __ieee754_jn(n, x), __ieee754_yn(n, x)
- * floating point Bessel's function of the 1st and 2nd kind
- * of order n
- *
- * Special cases:
- *      y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
- *      y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
- * Note 2. About jn(n,x), yn(n,x)
- *      For n=0, j0(x) is called,
- *      for n=1, j1(x) is called,
- *      for n<x, forward recursion us used starting
- *      from values of j0(x) and j1(x).
- *      for n>x, a continued fraction approximation to
- *      j(n,x)/j(n-1,x) is evaluated and then backward
- *      recursion is used starting from a supposed value
- *      for j(n,x). The resulting value of j(0,x) is
- *      compared with the actual value to correct the
- *      supposed value of j(n,x).
- *
- *      yn(n,x) is similar in all respects, except
- *      that forward recursion is used for all
- *      values of n>1.
- *
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-invsqrtpi=  5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
-two   =  2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
-one   =  1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
-
-static double zero  =  0.00000000000000000000e+00;
-
-#ifdef __STDC__
-        double __ieee754_jn(int n, double x)
-#else
-        double __ieee754_jn(n,x)
-        int n; double x;
-#endif
-{
-        int i,hx,ix,lx, sgn;
-        double a, b, temp = 0, di;
-        double z, w;
-
-    /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
-     * Thus, J(-n,x) = J(n,-x)
-     */
-        hx = __HI(x);
-        ix = 0x7fffffff&hx;
-        lx = __LO(x);
-    /* if J(n,NaN) is NaN */
-        if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
-        if(n<0){
-                n = -n;
-                x = -x;
-                hx ^= 0x80000000;
-        }
-        if(n==0) return(__ieee754_j0(x));
-        if(n==1) return(__ieee754_j1(x));
-        sgn = (n&1)&(hx>>31);   /* even n -- 0, odd n -- sign(x) */
-        x = fabs(x);
-        if((ix|lx)==0||ix>=0x7ff00000)  /* if x is 0 or inf */
-            b = zero;
-        else if((double)n<=x) {
-                /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
-            if(ix>=0x52D00000) { /* x > 2**302 */
-    /* (x >> n**2)
-     *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *      Let s=sin(x), c=cos(x),
-     *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
-     *
-     *             n    sin(xn)*sqt2    cos(xn)*sqt2
-     *          ----------------------------------
-     *             0     s-c             c+s
-     *             1    -s-c            -c+s
-     *             2    -s+c            -c-s
-     *             3     s+c             c-s
-     */
-                switch(n&3) {
-                    case 0: temp =  cos(x)+sin(x); break;
-                    case 1: temp = -cos(x)+sin(x); break;
-                    case 2: temp = -cos(x)-sin(x); break;
-                    case 3: temp =  cos(x)-sin(x); break;
-                }
-                b = invsqrtpi*temp/sqrt(x);
-            } else {
-                a = __ieee754_j0(x);
-                b = __ieee754_j1(x);
-                for(i=1;i<n;i++){
-                    temp = b;
-                    b = b*((double)(i+i)/x) - a; /* avoid underflow */
-                    a = temp;
-                }
-            }
-        } else {
-            if(ix<0x3e100000) { /* x < 2**-29 */
-    /* x is tiny, return the first Taylor expansion of J(n,x)
-     * J(n,x) = 1/n!*(x/2)^n  - ...
-     */
-                if(n>33)        /* underflow */
-                    b = zero;
-                else {
-                    temp = x*0.5; b = temp;
-                    for (a=one,i=2;i<=n;i++) {
-                        a *= (double)i;         /* a = n! */
-                        b *= temp;              /* b = (x/2)^n */
-                    }
-                    b = b/a;
-                }
-            } else {
-                /* use backward recurrence */
-                /*                      x      x^2      x^2
-                 *  J(n,x)/J(n-1,x) =  ----   ------   ------   .....
-                 *                      2n  - 2(n+1) - 2(n+2)
-                 *
-                 *                      1      1        1
-                 *  (for large x)   =  ----  ------   ------   .....
-                 *                      2n   2(n+1)   2(n+2)
-                 *                      -- - ------ - ------ -
-                 *                       x     x         x
-                 *
-                 * Let w = 2n/x and h=2/x, then the above quotient
-                 * is equal to the continued fraction:
-                 *                  1
-                 *      = -----------------------
-                 *                     1
-                 *         w - -----------------
-                 *                        1
-                 *              w+h - ---------
-                 *                     w+2h - ...
-                 *
-                 * To determine how many terms needed, let
-                 * Q(0) = w, Q(1) = w(w+h) - 1,
-                 * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
-                 * When Q(k) > 1e4      good for single
-                 * When Q(k) > 1e9      good for double
-                 * When Q(k) > 1e17     good for quadruple
-                 */
-            /* determine k */
-                double t,v;
-                double q0,q1,h,tmp; int k,m;
-                w  = (n+n)/(double)x; h = 2.0/(double)x;
-                q0 = w;  z = w+h; q1 = w*z - 1.0; k=1;
-                while(q1<1.0e9) {
-                        k += 1; z += h;
-                        tmp = z*q1 - q0;
-                        q0 = q1;
-                        q1 = tmp;
-                }
-                m = n+n;
-                for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
-                a = t;
-                b = one;
-                /*  estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
-                 *  Hence, if n*(log(2n/x)) > ...
-                 *  single 8.8722839355e+01
-                 *  double 7.09782712893383973096e+02
-                 *  long double 1.1356523406294143949491931077970765006170e+04
-                 *  then recurrent value may overflow and the result is
-                 *  likely underflow to zero
-                 */
-                tmp = n;
-                v = two/x;
-                tmp = tmp*__ieee754_log(fabs(v*tmp));
-                if(tmp<7.09782712893383973096e+02) {
-                    for(i=n-1,di=(double)(i+i);i>0;i--){
-                        temp = b;
-                        b *= di;
-                        b  = b/x - a;
-                        a = temp;
-                        di -= two;
-                    }
-                } else {
-                    for(i=n-1,di=(double)(i+i);i>0;i--){
-                        temp = b;
-                        b *= di;
-                        b  = b/x - a;
-                        a = temp;
-                        di -= two;
-                    /* scale b to avoid spurious overflow */
-                        if(b>1e100) {
-                            a /= b;
-                            t /= b;
-                            b  = one;
-                        }
-                    }
-                }
-                b = (t*__ieee754_j0(x)/b);
-            }
-        }
-        if(sgn==1) return -b; else return b;
-}
-
-#ifdef __STDC__
-        double __ieee754_yn(int n, double x)
-#else
-        double __ieee754_yn(n,x)
-        int n; double x;
-#endif
-{
-        int i,hx,ix,lx;
-        int sign;
-        double a, b, temp = 0;
-
-        hx = __HI(x);
-        ix = 0x7fffffff&hx;
-        lx = __LO(x);
-    /* if Y(n,NaN) is NaN */
-        if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
-        if((ix|lx)==0) return -one/zero;
-        if(hx<0) return zero/zero;
-        sign = 1;
-        if(n<0){
-                n = -n;
-                sign = 1 - ((n&1)<<1);
-        }
-        if(n==0) return(__ieee754_y0(x));
-        if(n==1) return(sign*__ieee754_y1(x));
-        if(ix==0x7ff00000) return zero;
-        if(ix>=0x52D00000) { /* x > 2**302 */
-    /* (x >> n**2)
-     *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *      Let s=sin(x), c=cos(x),
-     *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
-     *
-     *             n    sin(xn)*sqt2    cos(xn)*sqt2
-     *          ----------------------------------
-     *             0     s-c             c+s
-     *             1    -s-c            -c+s
-     *             2    -s+c            -c-s
-     *             3     s+c             c-s
-     */
-                switch(n&3) {
-                    case 0: temp =  sin(x)-cos(x); break;
-                    case 1: temp = -sin(x)-cos(x); break;
-                    case 2: temp = -sin(x)+cos(x); break;
-                    case 3: temp =  sin(x)+cos(x); break;
-                }
-                b = invsqrtpi*temp/sqrt(x);
-        } else {
-            a = __ieee754_y0(x);
-            b = __ieee754_y1(x);
-        /* quit if b is -inf */
-            for(i=1;i<n&&(__HI(b) != 0xfff00000);i++){
-                temp = b;
-                b = ((double)(i+i)/x)*b - a;
-                a = temp;
-            }
-        }
-        if(sign>0) return b; else return -b;
-}
--- a/src/share/native/java/lang/fdlibm/src/e_lgamma.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_lgamma(x)
- * Return the logarithm of the Gamma function of x.
- *
- * Method: call __ieee754_lgamma_r
- */
-
-#include "fdlibm.h"
-
-extern int signgam;
-
-#ifdef __STDC__
-        double __ieee754_lgamma(double x)
-#else
-        double __ieee754_lgamma(x)
-        double x;
-#endif
-{
-        return __ieee754_lgamma_r(x,&signgam);
-}
--- a/src/share/native/java/lang/fdlibm/src/e_lgamma_r.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,316 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* __ieee754_lgamma_r(x, signgamp)
- * Reentrant version of the logarithm of the Gamma function
- * with user provide pointer for the sign of Gamma(x).
- *
- * Method:
- *   1. Argument Reduction for 0 < x <= 8
- *      Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
- *      reduce x to a number in [1.5,2.5] by
- *              lgamma(1+s) = log(s) + lgamma(s)
- *      for example,
- *              lgamma(7.3) = log(6.3) + lgamma(6.3)
- *                          = log(6.3*5.3) + lgamma(5.3)
- *                          = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)
- *   2. Polynomial approximation of lgamma around its
- *      minimun ymin=1.461632144968362245 to maintain monotonicity.
- *      On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use
- *              Let z = x-ymin;
- *              lgamma(x) = -1.214862905358496078218 + z^2*poly(z)
- *      where
- *              poly(z) is a 14 degree polynomial.
- *   2. Rational approximation in the primary interval [2,3]
- *      We use the following approximation:
- *              s = x-2.0;
- *              lgamma(x) = 0.5*s + s*P(s)/Q(s)
- *      with accuracy
- *              |P/Q - (lgamma(x)-0.5s)| < 2**-61.71
- *      Our algorithms are based on the following observation
- *
- *                             zeta(2)-1    2    zeta(3)-1    3
- * lgamma(2+s) = s*(1-Euler) + --------- * s  -  --------- * s  + ...
- *                                 2                 3
- *
- *      where Euler = 0.5771... is the Euler constant, which is very
- *      close to 0.5.
- *
- *   3. For x>=8, we have
- *      lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+....
- *      (better formula:
- *         lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...)
- *      Let z = 1/x, then we approximation
- *              f(z) = lgamma(x) - (x-0.5)(log(x)-1)
- *      by
- *                                  3       5             11
- *              w = w0 + w1*z + w2*z  + w3*z  + ... + w6*z
- *      where
- *              |w - f(z)| < 2**-58.74
- *
- *   4. For negative x, since (G is gamma function)
- *              -x*G(-x)*G(x) = pi/sin(pi*x),
- *      we have
- *              G(x) = pi/(sin(pi*x)*(-x)*G(-x))
- *      since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0
- *      Hence, for x<0, signgam = sign(sin(pi*x)) and
- *              lgamma(x) = log(|Gamma(x)|)
- *                        = log(pi/(|x*sin(pi*x)|)) - lgamma(-x);
- *      Note: one should avoid compute pi*(-x) directly in the
- *            computation of sin(pi*(-x)).
- *
- *   5. Special Cases
- *              lgamma(2+s) ~ s*(1-Euler) for tiny s
- *              lgamma(1)=lgamma(2)=0
- *              lgamma(x) ~ -log(x) for tiny x
- *              lgamma(0) = lgamma(inf) = inf
- *              lgamma(-integer) = +-inf
- *
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-two52=  4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-half=  5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
-one =  1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
-pi  =  3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
-a0  =  7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */
-a1  =  3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */
-a2  =  6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */
-a3  =  2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */
-a4  =  7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */
-a5  =  2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */
-a6  =  1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */
-a7  =  5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */
-a8  =  2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */
-a9  =  1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */
-a10 =  2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */
-a11 =  4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */
-tc  =  1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */
-tf  = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */
-/* tt = -(tail of tf) */
-tt  = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */
-t0  =  4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */
-t1  = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */
-t2  =  6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */
-t3  = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */
-t4  =  1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */
-t5  = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */
-t6  =  6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */
-t7  = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */
-t8  =  2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */
-t9  = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */
-t10 =  8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */
-t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */
-t12 =  3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */
-t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */
-t14 =  3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */
-u0  = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */
-u1  =  6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */
-u2  =  1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */
-u3  =  9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */
-u4  =  2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */
-u5  =  1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */
-v1  =  2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */
-v2  =  2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */
-v3  =  7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */
-v4  =  1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */
-v5  =  3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */
-s0  = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */
-s1  =  2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */
-s2  =  3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */
-s3  =  1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */
-s4  =  2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */
-s5  =  1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */
-s6  =  3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */
-r1  =  1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */
-r2  =  7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */
-r3  =  1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */
-r4  =  1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */
-r5  =  7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */
-r6  =  7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */
-w0  =  4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */
-w1  =  8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */
-w2  = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */
-w3  =  7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */
-w4  = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */
-w5  =  8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */
-w6  = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */
-
-static double zero=  0.00000000000000000000e+00;
-
-#ifdef __STDC__
-        static double sin_pi(double x)
-#else
-        static double sin_pi(x)
-        double x;
-#endif
-{
-        double y,z;
-        int n,ix;
-
-        ix = 0x7fffffff&__HI(x);
-
-        if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0);
-        y = -x;         /* x is assume negative */
-
-    /*
-     * argument reduction, make sure inexact flag not raised if input
-     * is an integer
-     */
-        z = floor(y);
-        if(z!=y) {                              /* inexact anyway */
-            y  *= 0.5;
-            y   = 2.0*(y - floor(y));           /* y = |x| mod 2.0 */
-            n   = (int) (y*4.0);
-        } else {
-            if(ix>=0x43400000) {
-                y = zero; n = 0;                 /* y must be even */
-            } else {
-                if(ix<0x43300000) z = y+two52;  /* exact */
-                n   = __LO(z)&1;        /* lower word of z */
-                y  = n;
-                n<<= 2;
-            }
-        }
-        switch (n) {
-            case 0:   y =  __kernel_sin(pi*y,zero,0); break;
-            case 1:
-            case 2:   y =  __kernel_cos(pi*(0.5-y),zero); break;
-            case 3:
-            case 4:   y =  __kernel_sin(pi*(one-y),zero,0); break;
-            case 5:
-            case 6:   y = -__kernel_cos(pi*(y-1.5),zero); break;
-            default:  y =  __kernel_sin(pi*(y-2.0),zero,0); break;
-            }
-        return -y;
-}
-
-
-#ifdef __STDC__
-        double __ieee754_lgamma_r(double x, int *signgamp)
-#else
-        double __ieee754_lgamma_r(x,signgamp)
-        double x; int *signgamp;
-#endif
-{
-        double t,y,z,nadj=0,p,p1,p2,p3,q,r,w;
-        int i,hx,lx,ix;
-
-        hx = __HI(x);
-        lx = __LO(x);
-
-    /* purge off +-inf, NaN, +-0, and negative arguments */
-        *signgamp = 1;
-        ix = hx&0x7fffffff;
-        if(ix>=0x7ff00000) return x*x;
-        if((ix|lx)==0) return one/zero;
-        if(ix<0x3b900000) {     /* |x|<2**-70, return -log(|x|) */
-            if(hx<0) {
-                *signgamp = -1;
-                return -__ieee754_log(-x);
-            } else return -__ieee754_log(x);
-        }
-        if(hx<0) {
-            if(ix>=0x43300000)  /* |x|>=2**52, must be -integer */
-                return one/zero;
-            t = sin_pi(x);
-            if(t==zero) return one/zero; /* -integer */
-            nadj = __ieee754_log(pi/fabs(t*x));
-            if(t<zero) *signgamp = -1;
-            x = -x;
-        }
-
-    /* purge off 1 and 2 */
-        if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0;
-    /* for x < 2.0 */
-        else if(ix<0x40000000) {
-            if(ix<=0x3feccccc) {        /* lgamma(x) = lgamma(x+1)-log(x) */
-                r = -__ieee754_log(x);
-                if(ix>=0x3FE76944) {y = one-x; i= 0;}
-                else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;}
-                else {y = x; i=2;}
-            } else {
-                r = zero;
-                if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */
-                else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */
-                else {y=x-one;i=2;}
-            }
-            switch(i) {
-              case 0:
-                z = y*y;
-                p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10))));
-                p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11)))));
-                p  = y*p1+p2;
-                r  += (p-0.5*y); break;
-              case 1:
-                z = y*y;
-                w = z*y;
-                p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12)));    /* parallel comp */
-                p2 = t1+w*(t4+w*(t7+w*(t10+w*t13)));
-                p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
-                p  = z*p1-(tt-w*(p2+y*p3));
-                r += (tf + p); break;
-              case 2:
-                p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
-                p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
-                r += (-0.5*y + p1/p2);
-            }
-        }
-        else if(ix<0x40200000) {                        /* x < 8.0 */
-            i = (int)x;
-            t = zero;
-            y = x-(double)i;
-            p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6))))));
-            q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6)))));
-            r = half*y+p/q;
-            z = one;    /* lgamma(1+s) = log(s) + lgamma(s) */
-            switch(i) {
-            case 7: z *= (y+6.0);       /* FALLTHRU */
-            case 6: z *= (y+5.0);       /* FALLTHRU */
-            case 5: z *= (y+4.0);       /* FALLTHRU */
-            case 4: z *= (y+3.0);       /* FALLTHRU */
-            case 3: z *= (y+2.0);       /* FALLTHRU */
-                    r += __ieee754_log(z); break;
-            }
-    /* 8.0 <= x < 2**58 */
-        } else if (ix < 0x43900000) {
-            t = __ieee754_log(x);
-            z = one/x;
-            y = z*z;
-            w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
-            r = (x-half)*(t-one)+w;
-        } else
-    /* 2**58 <= x <= inf */
-            r =  x*(__ieee754_log(x)-one);
-        if(hx<0) r = nadj - r;
-        return r;
-}
--- a/src/share/native/java/lang/fdlibm/src/s_asinh.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* asinh(x)
- * Method :
- *      Based on
- *              asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
- *      we have
- *      asinh(x) := x  if  1+x*x=1,
- *               := sign(x)*(log(x)+ln2)) for large |x|, else
- *               := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
- *               := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-one =  1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
-ln2 =  6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
-huge=  1.00000000000000000000e+300;
-
-#ifdef __STDC__
-        double asinh(double x)
-#else
-        double asinh(x)
-        double x;
-#endif
-{
-        double t,w;
-        int hx,ix;
-        hx = __HI(x);
-        ix = hx&0x7fffffff;
-        if(ix>=0x7ff00000) return x+x;  /* x is inf or NaN */
-        if(ix< 0x3e300000) {    /* |x|<2**-28 */
-            if(huge+x>one) return x;    /* return x inexact except 0 */
-        }
-        if(ix>0x41b00000) {     /* |x| > 2**28 */
-            w = __ieee754_log(fabs(x))+ln2;
-        } else if (ix>0x40000000) {     /* 2**28 > |x| > 2.0 */
-            t = fabs(x);
-            w = __ieee754_log(2.0*t+one/(sqrt(x*x+one)+t));
-        } else {                /* 2.0 > |x| > 2**-28 */
-            t = x*x;
-            w =log1p(fabs(x)+t/(one+sqrt(one+t)));
-        }
-        if(hx>0) return w; else return -w;
-}
--- a/src/share/native/java/lang/fdlibm/src/s_erf.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,323 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* double erf(double x)
- * double erfc(double x)
- *                           x
- *                    2      |\
- *     erf(x)  =  ---------  | exp(-t*t)dt
- *                 sqrt(pi) \|
- *                           0
- *
- *     erfc(x) =  1-erf(x)
- *  Note that
- *              erf(-x) = -erf(x)
- *              erfc(-x) = 2 - erfc(x)
- *
- * Method:
- *      1. For |x| in [0, 0.84375]
- *          erf(x)  = x + x*R(x^2)
- *          erfc(x) = 1 - erf(x)           if x in [-.84375,0.25]
- *                  = 0.5 + ((0.5-x)-x*R)  if x in [0.25,0.84375]
- *         where R = P/Q where P is an odd poly of degree 8 and
- *         Q is an odd poly of degree 10.
- *                                               -57.90
- *                      | R - (erf(x)-x)/x | <= 2
- *
- *
- *         Remark. The formula is derived by noting
- *          erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
- *         and that
- *          2/sqrt(pi) = 1.128379167095512573896158903121545171688
- *         is close to one. The interval is chosen because the fix
- *         point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is
- *         near 0.6174), and by some experiment, 0.84375 is chosen to
- *         guarantee the error is less than one ulp for erf.
- *
- *      2. For |x| in [0.84375,1.25], let s = |x| - 1, and
- *         c = 0.84506291151 rounded to single (24 bits)
- *              erf(x)  = sign(x) * (c  + P1(s)/Q1(s))
- *              erfc(x) = (1-c)  - P1(s)/Q1(s) if x > 0
- *                        1+(c+P1(s)/Q1(s))    if x < 0
- *              |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06
- *         Remark: here we use the taylor series expansion at x=1.
- *              erf(1+s) = erf(1) + s*Poly(s)
- *                       = 0.845.. + P1(s)/Q1(s)
- *         That is, we use rational approximation to approximate
- *                      erf(1+s) - (c = (single)0.84506291151)
- *         Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
- *         where
- *              P1(s) = degree 6 poly in s
- *              Q1(s) = degree 6 poly in s
- *
- *      3. For x in [1.25,1/0.35(~2.857143)],
- *              erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1)
- *              erf(x)  = 1 - erfc(x)
- *         where
- *              R1(z) = degree 7 poly in z, (z=1/x^2)
- *              S1(z) = degree 8 poly in z
- *
- *      4. For x in [1/0.35,28]
- *              erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0
- *                      = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6<x<0
- *                      = 2.0 - tiny            (if x <= -6)
- *              erf(x)  = sign(x)*(1.0 - erfc(x)) if x < 6, else
- *              erf(x)  = sign(x)*(1.0 - tiny)
- *         where
- *              R2(z) = degree 6 poly in z, (z=1/x^2)
- *              S2(z) = degree 7 poly in z
- *
- *      Note1:
- *         To compute exp(-x*x-0.5625+R/S), let s be a single
- *         precision number and s := x; then
- *              -x*x = -s*s + (s-x)*(s+x)
- *              exp(-x*x-0.5626+R/S) =
- *                      exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
- *      Note2:
- *         Here 4 and 5 make use of the asymptotic series
- *                        exp(-x*x)
- *              erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
- *                        x*sqrt(pi)
- *         We use rational approximation to approximate
- *              g(s)=f(1/x^2) = log(erfc(x)*x) - x*x + 0.5625
- *         Here is the error bound for R1/S1 and R2/S2
- *              |R1/S1 - f(x)|  < 2**(-62.57)
- *              |R2/S2 - f(x)|  < 2**(-61.52)
- *
- *      5. For inf > x >= 28
- *              erf(x)  = sign(x) *(1 - tiny)  (raise inexact)
- *              erfc(x) = tiny*tiny (raise underflow) if x > 0
- *                      = 2 - tiny if x<0
- *
- *      7. Special case:
- *              erf(0)  = 0, erf(inf)  = 1, erf(-inf) = -1,
- *              erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,
- *              erfc/erf(NaN) is NaN
- */
-
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-tiny        = 1e-300,
-half=  5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
-one =  1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
-two =  2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
-        /* c = (float)0.84506291151 */
-erx =  8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */
-/*
- * Coefficients for approximation to  erf on [0,0.84375]
- */
-efx =  1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */
-efx8=  1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */
-pp0  =  1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */
-pp1  = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */
-pp2  = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */
-pp3  = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */
-pp4  = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */
-qq1  =  3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */
-qq2  =  6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */
-qq3  =  5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */
-qq4  =  1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */
-qq5  = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */
-/*
- * Coefficients for approximation to  erf  in [0.84375,1.25]
- */
-pa0  = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */
-pa1  =  4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */
-pa2  = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */
-pa3  =  3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */
-pa4  = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */
-pa5  =  3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */
-pa6  = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */
-qa1  =  1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */
-qa2  =  5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */
-qa3  =  7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */
-qa4  =  1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */
-qa5  =  1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */
-qa6  =  1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */
-/*
- * Coefficients for approximation to  erfc in [1.25,1/0.35]
- */
-ra0  = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */
-ra1  = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */
-ra2  = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */
-ra3  = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */
-ra4  = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */
-ra5  = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */
-ra6  = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */
-ra7  = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */
-sa1  =  1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */
-sa2  =  1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */
-sa3  =  4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */
-sa4  =  6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */
-sa5  =  4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */
-sa6  =  1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */
-sa7  =  6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */
-sa8  = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */
-/*
- * Coefficients for approximation to  erfc in [1/.35,28]
- */
-rb0  = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */
-rb1  = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */
-rb2  = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */
-rb3  = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */
-rb4  = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */
-rb5  = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */
-rb6  = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */
-sb1  =  3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */
-sb2  =  3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */
-sb3  =  1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */
-sb4  =  3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */
-sb5  =  2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */
-sb6  =  4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */
-sb7  = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
-
-#ifdef __STDC__
-        double erf(double x)
-#else
-        double erf(x)
-        double x;
-#endif
-{
-        int hx,ix,i;
-        double R,S,P,Q,s,y,z,r;
-        hx = __HI(x);
-        ix = hx&0x7fffffff;
-        if(ix>=0x7ff00000) {            /* erf(nan)=nan */
-            i = ((unsigned)hx>>31)<<1;
-            return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
-        }
-
-        if(ix < 0x3feb0000) {           /* |x|<0.84375 */
-            if(ix < 0x3e300000) {       /* |x|<2**-28 */
-                if (ix < 0x00800000)
-                    return 0.125*(8.0*x+efx8*x);  /*avoid underflow */
-                return x + efx*x;
-            }
-            z = x*x;
-            r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
-            s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
-            y = r/s;
-            return x + x*y;
-        }
-        if(ix < 0x3ff40000) {           /* 0.84375 <= |x| < 1.25 */
-            s = fabs(x)-one;
-            P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
-            Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
-            if(hx>=0) return erx + P/Q; else return -erx - P/Q;
-        }
-        if (ix >= 0x40180000) {         /* inf>|x|>=6 */
-            if(hx>=0) return one-tiny; else return tiny-one;
-        }
-        x = fabs(x);
-        s = one/(x*x);
-        if(ix< 0x4006DB6E) {    /* |x| < 1/0.35 */
-            R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
-                                ra5+s*(ra6+s*ra7))))));
-            S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
-                                sa5+s*(sa6+s*(sa7+s*sa8)))))));
-        } else {        /* |x| >= 1/0.35 */
-            R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
-                                rb5+s*rb6)))));
-            S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
-                                sb5+s*(sb6+s*sb7))))));
-        }
-        z  = x;
-        __LO(z) = 0;
-        r  =  __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
-        if(hx>=0) return one-r/x; else return  r/x-one;
-}
-
-#ifdef __STDC__
-        double erfc(double x)
-#else
-        double erfc(x)
-        double x;
-#endif
-{
-        int hx,ix;
-        double R,S,P,Q,s,y,z,r;
-        hx = __HI(x);
-        ix = hx&0x7fffffff;
-        if(ix>=0x7ff00000) {                    /* erfc(nan)=nan */
-                                                /* erfc(+-inf)=0,2 */
-            return (double)(((unsigned)hx>>31)<<1)+one/x;
-        }
-
-        if(ix < 0x3feb0000) {           /* |x|<0.84375 */
-            if(ix < 0x3c700000)         /* |x|<2**-56 */
-                return one-x;
-            z = x*x;
-            r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
-            s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
-            y = r/s;
-            if(hx < 0x3fd00000) {       /* x<1/4 */
-                return one-(x+x*y);
-            } else {
-                r = x*y;
-                r += (x-half);
-                return half - r ;
-            }
-        }
-        if(ix < 0x3ff40000) {           /* 0.84375 <= |x| < 1.25 */
-            s = fabs(x)-one;
-            P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
-            Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
-            if(hx>=0) {
-                z  = one-erx; return z - P/Q;
-            } else {
-                z = erx+P/Q; return one+z;
-            }
-        }
-        if (ix < 0x403c0000) {          /* |x|<28 */
-            x = fabs(x);
-            s = one/(x*x);
-            if(ix< 0x4006DB6D) {        /* |x| < 1/.35 ~ 2.857143*/
-                R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
-                                ra5+s*(ra6+s*ra7))))));
-                S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
-                                sa5+s*(sa6+s*(sa7+s*sa8)))))));
-            } else {                    /* |x| >= 1/.35 ~ 2.857143 */
-                if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */
-                R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
-                                rb5+s*rb6)))));
-                S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
-                                sb5+s*(sb6+s*sb7))))));
-            }
-            z  = x;
-            __LO(z)  = 0;
-            r  =  __ieee754_exp(-z*z-0.5625)*
-                        __ieee754_exp((z-x)*(z+x)+R/S);
-            if(hx>0) return r/x; else return two-r/x;
-        } else {
-            if(hx>0) return tiny*tiny; else return two-tiny;
-        }
-}
--- a/src/share/native/java/lang/fdlibm/src/w_acosh.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * wrapper acosh(x)
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-        double acosh(double x)          /* wrapper acosh */
-#else
-        double acosh(x)                 /* wrapper acosh */
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_acosh(x);
-#else
-        double z;
-        z = __ieee754_acosh(x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
-        if(x<1.0) {
-                return __kernel_standard(x,x,29); /* acosh(x<1) */
-        } else
-            return z;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_gamma.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* double gamma(double x)
- * Return the logarithm of the Gamma function of x.
- *
- * Method: call gamma_r
- */
-
-#include "fdlibm.h"
-
-extern int signgam;
-
-#ifdef __STDC__
-        double gamma(double x)
-#else
-        double gamma(x)
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_gamma_r(x,&signgam);
-#else
-        double y;
-        y = __ieee754_gamma_r(x,&signgam);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!finite(y)&&finite(x)) {
-            if(floor(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,41); /* gamma pole */
-            else
-                return __kernel_standard(x,x,40); /* gamma overflow */
-        } else
-            return y;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_gamma_r.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * wrapper double gamma_r(double x, int *signgamp)
- */
-
-#include "fdlibm.h"
-
-
-#ifdef __STDC__
-        double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-#else
-        double gamma_r(x,signgamp)              /* wrapper lgamma_r */
-        double x; int *signgamp;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_gamma_r(x,signgamp);
-#else
-        double y;
-        y = __ieee754_gamma_r(x,signgamp);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!finite(y)&&finite(x)) {
-            if(floor(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,41); /* gamma pole */
-            else
-                return __kernel_standard(x,x,40); /* gamma overflow */
-        } else
-            return y;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_j0.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * wrapper j0(double x), y0(double x)
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-        double j0(double x)             /* wrapper j0 */
-#else
-        double j0(x)                    /* wrapper j0 */
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_j0(x);
-#else
-        double z = __ieee754_j0(x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
-        if(fabs(x)>X_TLOSS) {
-                return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
-        } else
-            return z;
-#endif
-}
-
-#ifdef __STDC__
-        double y0(double x)             /* wrapper y0 */
-#else
-        double y0(x)                    /* wrapper y0 */
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_y0(x);
-#else
-        double z;
-        z = __ieee754_y0(x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard(x,x,8);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard(x,x,9);
-        }
-        if(x>X_TLOSS) {
-                return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
-        } else
-            return z;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_j1.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * wrapper of j1,y1
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-        double j1(double x)             /* wrapper j1 */
-#else
-        double j1(x)                    /* wrapper j1 */
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_j1(x);
-#else
-        double z;
-        z = __ieee754_j1(x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
-        if(fabs(x)>X_TLOSS) {
-                return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
-        } else
-            return z;
-#endif
-}
-
-#ifdef __STDC__
-        double y1(double x)             /* wrapper y1 */
-#else
-        double y1(x)                    /* wrapper y1 */
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_y1(x);
-#else
-        double z;
-        z = __ieee754_y1(x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard(x,x,10);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard(x,x,11);
-        }
-        if(x>X_TLOSS) {
-                return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
-        } else
-            return z;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_jn.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * wrapper jn(int n, double x), yn(int n, double x)
- * floating point Bessel's function of the 1st and 2nd kind
- * of order n
- *
- * Special cases:
- *      y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
- *      y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
- * Note 2. About jn(n,x), yn(n,x)
- *      For n=0, j0(x) is called,
- *      for n=1, j1(x) is called,
- *      for n<x, forward recursion us used starting
- *      from values of j0(x) and j1(x).
- *      for n>x, a continued fraction approximation to
- *      j(n,x)/j(n-1,x) is evaluated and then backward
- *      recursion is used starting from a supposed value
- *      for j(n,x). The resulting value of j(0,x) is
- *      compared with the actual value to correct the
- *      supposed value of j(n,x).
- *
- *      yn(n,x) is similar in all respects, except
- *      that forward recursion is used for all
- *      values of n>1.
- *
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-        double jn(int n, double x)      /* wrapper jn */
-#else
-        double jn(n,x)                  /* wrapper jn */
-        double x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_jn(n,x);
-#else
-        double z;
-        z = __ieee754_jn(n,x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
-        if(fabs(x)>X_TLOSS) {
-            return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */
-        } else
-            return z;
-#endif
-}
-
-#ifdef __STDC__
-        double yn(int n, double x)      /* wrapper yn */
-#else
-        double yn(n,x)                  /* wrapper yn */
-        double x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_yn(n,x);
-#else
-        double z;
-        z = __ieee754_yn(n,x);
-        if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard((double)n,x,12);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard((double)n,x,13);
-        }
-        if(x>X_TLOSS) {
-            return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */
-        } else
-            return z;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_lgamma.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* double lgamma(double x)
- * Return the logarithm of the Gamma function of x.
- *
- * Method: call __ieee754_lgamma_r
- */
-
-#include "fdlibm.h"
-
-extern int signgam;
-
-#ifdef __STDC__
-        double lgamma(double x)
-#else
-        double lgamma(x)
-        double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_lgamma_r(x,&signgam);
-#else
-        double y;
-        y = __ieee754_lgamma_r(x,&signgam);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!finite(y)&&finite(x)) {
-            if(floor(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,15); /* lgamma pole */
-            else
-                return __kernel_standard(x,x,14); /* lgamma overflow */
-        } else
-            return y;
-#endif
-}
--- a/src/share/native/java/lang/fdlibm/src/w_lgamma_r.c	Fri Aug 12 09:48:09 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * wrapper double lgamma_r(double x, int *signgamp)
- */
-
-#include "fdlibm.h"
-
-
-#ifdef __STDC__
-        double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-#else
-        double lgamma_r(x,signgamp)              /* wrapper lgamma_r */
-        double x; int *signgamp;
-#endif
-{
-#ifdef _IEEE_LIBM
-        return __ieee754_lgamma_r(x,signgamp);
-#else
-        double y;
-        y = __ieee754_lgamma_r(x,signgamp);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!finite(y)&&finite(x)) {
-            if(floor(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,15); /* lgamma pole */
-            else
-                return __kernel_standard(x,x,14); /* lgamma overflow */
-        } else
-            return y;
-#endif
-}
--- a/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,8 +53,6 @@
 import com.sun.nio.sctp.NotificationHandler;
 import com.sun.nio.sctp.SctpChannel;
 import com.sun.nio.sctp.SctpSocketOption;
-import sun.nio.ch.PollArrayWrapper;
-import sun.nio.ch.SelChImpl;
 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
 import static sun.nio.ch.SctpResultContainer.SEND_FAILED;
 import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED;
@@ -118,7 +116,7 @@
 
     private Association association;
 
-    private Set<SocketAddress> remoteAddresses = Collections.EMPTY_SET;
+    private Set<SocketAddress> remoteAddresses = Collections.emptySet();
 
     /* -- End of fields protected by stateLock -- */
 
@@ -853,7 +851,7 @@
         return n;
     }
 
-    private InternalNotificationHandler<?> internalNotificationHandler =
+    private InternalNotificationHandler internalNotificationHandler =
             new InternalNotificationHandler();
 
     private void handleNotificationInternal(SctpResultContainer resultContainer)
@@ -862,12 +860,12 @@
                 internalNotificationHandler, null);
     }
 
-    private class InternalNotificationHandler<T>
-            extends AbstractNotificationHandler<T>
+    private class InternalNotificationHandler
+            extends AbstractNotificationHandler<Object>
     {
         @Override
         public HandlerResult handleNotification(
-                AssociationChangeNotification not, T unused) {
+                AssociationChangeNotification not, Object unused) {
             if (not.event().equals(
                     AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
                     association == null) {
@@ -893,8 +891,8 @@
         }
 
         /* AbstractNotificationHandler */
-        AbstractNotificationHandler absHandler =
-                (AbstractNotificationHandler)handler;
+        AbstractNotificationHandler<T> absHandler =
+                (AbstractNotificationHandler<T>)handler;
         switch(resultContainer.type()) {
             case ASSOCIATION_CHANGED :
                 return absHandler.handleNotification(
@@ -1053,7 +1051,7 @@
             if (!isOpen())
                 throw new ClosedChannelException();
             if (!isBound())
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
 
             return SctpNet.getLocalAddresses(fdVal);
         }
@@ -1066,7 +1064,7 @@
             if (!isOpen())
                 throw new ClosedChannelException();
             if (!isConnected() || isShutdown)
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
 
             try {
                 return SctpNet.getRemoteAddresses(fdVal, 0/*unused*/);
--- a/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -586,12 +586,12 @@
                 internalNotificationHandler, null);
     }
 
-    private class InternalNotificationHandler<T>
-            extends AbstractNotificationHandler<T>
+    private class InternalNotificationHandler
+            extends AbstractNotificationHandler<Object>
     {
         @Override
         public HandlerResult handleNotification(
-                AssociationChangeNotification not, T unused) {
+                AssociationChangeNotification not, Object unused) {
             SctpAssocChange sac = (SctpAssocChange) not;
 
             /* Update map to reflect change in association */
@@ -622,8 +622,8 @@
         if (!(handler instanceof AbstractNotificationHandler)) {
             result = handler.handleNotification(notification, attachment);
         } else { /* AbstractNotificationHandler */
-            AbstractNotificationHandler absHandler =
-                    (AbstractNotificationHandler)handler;
+            AbstractNotificationHandler<T> absHandler =
+                    (AbstractNotificationHandler<T>)handler;
             switch(resultContainer.type()) {
                 case ASSOCIATION_CHANGED :
                     result = absHandler.handleNotification(
@@ -912,7 +912,7 @@
             if (!isOpen())
                 throw new ClosedChannelException();
             if (!isBound())
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
 
             return SctpNet.getLocalAddresses(fdVal);
         }
@@ -931,7 +931,7 @@
             } catch (SocketException se) {
                 /* a valid association should always have remote addresses */
                 Set<SocketAddress> addrs = associationMap.get(association);
-                return addrs != null ? addrs : Collections.EMPTY_SET;
+                return addrs != null ? addrs : Collections.<SocketAddress>emptySet();
             }
         }
     }
--- a/src/solaris/classes/sun/nio/ch/SctpNet.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/solaris/classes/sun/nio/ch/SctpNet.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,18 +118,14 @@
         return set;
     }
 
-    static void setSocketOption(int fd,
-                                SctpSocketOption name,
-                                Object value,
-                                int assocId)
+    static <T> void setSocketOption(int fd,
+                                    SctpSocketOption<T> name,
+                                    T value,
+                                    int assocId)
             throws IOException {
         if (value == null)
             throw new IllegalArgumentException("Invalid option value");
 
-        Class<?> type = name.type();
-        if (!type.isInstance(value))
-            throw new IllegalArgumentException("Invalid option value");
-
         if (name.equals(SCTP_INIT_MAXSTREAMS)) {
             InitMaxStreams maxStreamValue = (InitMaxStreams)value;
             SctpNet.setInitMsgOption0(fd,
@@ -169,7 +165,7 @@
         }
     }
 
-    static Object getSocketOption(int fd, SctpSocketOption name, int assocId)
+    static Object getSocketOption(int fd, SctpSocketOption<?> name, int assocId)
              throws IOException {
          if (name.equals(SCTP_SET_PEER_PRIMARY_ADDR)) {
             throw new IllegalArgumentException(
@@ -194,7 +190,7 @@
         }
     }
 
-    static void setIntOption(int fd, SctpSocketOption name, Object value)
+    static void setIntOption(int fd, SctpSocketOption<?> name, Object value)
             throws IOException {
         if (value == null)
             throw new IllegalArgumentException("Invalid option value");
@@ -234,7 +230,7 @@
         setIntOption0(fd, ((SctpStdSocketOption)name).constValue(), arg);
     }
 
-    static Object getIntOption(int fd, SctpSocketOption name)
+    static Object getIntOption(int fd, SctpSocketOption<?> name)
             throws IOException {
         Class<?> type = name.type();
 
--- a/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -367,6 +367,7 @@
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public <T> T getOption(SctpSocketOption<T> name) throws IOException {
         if (name == null)
             throw new NullPointerException();
@@ -403,7 +404,7 @@
             if (!isOpen())
                 throw new ClosedChannelException();
             if (!isBound())
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
 
             return SctpNet.getLocalAddresses(fdVal);
         }
--- a/src/windows/classes/sun/nio/ch/PendingIoCache.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/windows/classes/sun/nio/ch/PendingIoCache.java	Wed Aug 17 22:47:49 2011 -0700
@@ -60,6 +60,7 @@
     private boolean closePending;
 
     // maps OVERLAPPED to PendingFuture
+    @SuppressWarnings("rawtypes")
     private final Map<Long,PendingFuture> pendingIoMap =
         new HashMap<Long,PendingFuture>();
 
--- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -314,7 +314,7 @@
         // create Future and task that will be invoked to acquire lock
         PendingFuture<FileLock,A> result =
             new PendingFuture<FileLock,A>(this, handler, attachment);
-        LockTask lockTask = new LockTask<A>(position, fli, result);
+        LockTask<A> lockTask = new LockTask<A>(position, fli, result);
         result.setContext(lockTask);
 
         // initiate I/O
@@ -552,7 +552,7 @@
         // create Future and task that initiates read
         PendingFuture<Integer,A> result =
             new PendingFuture<Integer,A>(this, handler, attachment);
-        ReadTask readTask = new ReadTask<A>(dst, pos, rem, position, result);
+        ReadTask<A> readTask = new ReadTask<A>(dst, pos, rem, position, result);
         result.setContext(readTask);
 
         // initiate I/O
@@ -726,7 +726,7 @@
         // create Future and task to initiate write
         PendingFuture<Integer,A> result =
             new PendingFuture<Integer,A>(this, handler, attachment);
-        WriteTask writeTask = new WriteTask<A>(src, pos, rem, position, result);
+        WriteTask<A> writeTask = new WriteTask<A>(src, pos, rem, position, result);
         result.setContext(writeTask);
 
         // initiate I/O
--- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java	Wed Aug 17 22:47:49 2011 -0700
@@ -351,7 +351,7 @@
         // setup task
         PendingFuture<Void,A> result =
             new PendingFuture<Void,A>(this, handler, attachment);
-        ConnectTask task = new ConnectTask<A>(isa, result);
+        ConnectTask<A> task = new ConnectTask<A>(isa, result);
         result.setContext(task);
 
         // initiate I/O
@@ -615,7 +615,8 @@
             bufs = new ByteBuffer[1];
             bufs[0] = dst;
         }
-        final ReadTask readTask = new ReadTask<V,A>(bufs, isScatteringRead, result);
+        final ReadTask<V,A> readTask =
+                new ReadTask<V,A>(bufs, isScatteringRead, result);
         result.setContext(readTask);
 
         // schedule timeout
@@ -872,7 +873,8 @@
             bufs = new ByteBuffer[1];
             bufs[0] = src;
         }
-        final WriteTask writeTask = new WriteTask<V,A>(bufs, gatheringWrite, result);
+        final WriteTask<V,A> writeTask =
+                new WriteTask<V,A>(bufs, gatheringWrite, result);
         result.setContext(writeTask);
 
         // schedule timeout
--- a/test/ProblemList.txt	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/ProblemList.txt	Wed Aug 17 22:47:49 2011 -0700
@@ -349,10 +349,19 @@
 # Only print test left, excluding just because all print tests have been
 javax/print/attribute/MediaMappingsTest.java 			generic-all
 
+# Filed 7058852
+javax/sound/sampled/FileWriter/AlawEncoderSync.java		generic-all
+
 ############################################################################
 
 # jdk_net
 
+# Filed 7052625
+com/sun/net/httpserver/bugs/6725892/Test.java			generic-all
+
+# Filed 7036666
+com/sun/net/httpserver/Test9a.java				generic-all
+
 ############################################################################
 
 # jdk_io
@@ -528,9 +537,6 @@
 sun/security/provider/PolicyFile/getinstance/getinstance.sh	solaris-sparc
 sun/security/tools/jarsigner/samename.sh			solaris-sparc
 
-# Timed out, Solaris 10 64bit sparcv9
-com/sun/crypto/provider/Cipher/DES/PaddingTest.java		generic-all
-
 # Othervm, sparc, NoRouteToHostException: Cannot assign requested address
 sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java generic-all
 
@@ -605,6 +611,18 @@
 # Filed 6952105
 com/sun/jdi/SuspendThreadTest.java				generic-all
 
+# Filed 6653793
+com/sun/jdi/RedefineCrossEvent.java				generic-all
+
+# Filed 6987312
+com/sun/jdi/DoubleAgentTest.java				generic-all
+
+# Filed 7020857
+com/sun/jdi/FieldWatchpoints.java				generic-all
+
+# Filed 6402201
+com/sun/jdi/ProcessAttachTest.sh				generic-all
+
 # Filed 6986875
 sun/tools/jps/jps-Vvml.sh					generic-all
 
@@ -626,18 +644,8 @@
 #   11 separate stacktraces created... file reuse problem?
 java/util/zip/ZipFile/ReadLongZipFileName.java			generic-all
 
-# Assert error, failures, on Linux Fedora 9 -server
-#   Windows samevm failure, assert error "Passed = 134, failed = 2"
-java/util/Arrays/ArrayObjectMethods.java			generic-all
-
-# Windows 2000, -client, samevm, java.lang.Error: Completed != 2
+# Filed 6772009
 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
 
-# Windows X64, Executor Stuck samevm mode:
-java/util/concurrent/FutureTask/BlockingTaskExecutor.java	generic-all
-
-# Problems on windows, jmap.exe hangs? (these run jmap), fails on Solaris 10 x86
-java/util/concurrent/locks/Lock/TimedAcquireLeak.java		generic-all
-
 ############################################################################
 
--- a/test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,16 +23,17 @@
 
 /*
  * @test
- * @bug 0000000 6296075
+ * @bug 0000000 6296075 6330275
  * @summary PaddingTest
  * @author Jan Luehe
  */
 import java.io.*;
-import java.security.*;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.security.spec.*;
 import javax.crypto.*;
 import javax.crypto.spec.*;
-import com.sun.crypto.provider.*;
+import java.util.Arrays;
 
 public class PaddingTest {
 
@@ -80,7 +81,7 @@
     public void run() throws Exception {
 
         for (int l=0; l<numFiles; l++) {
-            pinfile = new String(dataDir + "plain" + l + ".txt");
+            pinfile = dataDir + "plain" + l + ".txt";
             for (int i=0; i<crypts.length; i++) {
                 for (int j=0; j<modes.length; j++) {
                     for (int k=0; k<paddings.length; k++) {
@@ -89,14 +90,12 @@
                         System.out.println
                             (crypts[i]+" "+modes[j]+" " + paddings[k]+ " " +
                              "plain" + l + " test");
-                        cfile = new String
-                            ("c" + l + "_" +
+                        cfile = "c" + l + "_" +
                              crypts[i] + "_" +
                              modes[j] + "_" +
-                             paddings[k] + ".bin");
-                        poutfile = new String
-                            ("p" + l +
-                             "_" + crypts[i] + modes[j] + paddings[k] + ".txt");
+                             paddings[k] + ".bin";
+                        poutfile = "p" + l +
+                             "_" + crypts[i] + modes[j] + paddings[k] + ".txt";
 
                         init(crypts[i], modes[j], paddings[k]);
                         padding = paddings[k];
@@ -108,10 +107,7 @@
     }
 
     public void init(String crypt, String mode, String padding)
-        throws Exception {
-
-        SunJCE jce = new SunJCE();
-        Security.addProvider(jce);
+            throws Exception {
 
         KeySpec desKeySpec = null;
         SecretKeyFactory factory = null;
@@ -148,82 +144,60 @@
         int len;
         int totalInputLen = 0;
 
-        BufferedInputStream pin = null;
-        BufferedOutputStream cout = null;
-        BufferedInputStream cin = null;
-        BufferedOutputStream pout = null;
+        try {
+            try (FileInputStream fin = new FileInputStream(pinfile);
+                    BufferedInputStream pin = new BufferedInputStream(fin);
+                    FileOutputStream fout = new FileOutputStream(cfile);
+                    BufferedOutputStream cout = new BufferedOutputStream(fout)) {
+                cipher.init(Cipher.ENCRYPT_MODE, cipherKey, params);
 
-        try {
-            pin = new BufferedInputStream(new FileInputStream(pinfile));
-            cout = new BufferedOutputStream(new FileOutputStream(cfile));
-            cipher.init(Cipher.ENCRYPT_MODE, cipherKey, params);
+                while ((len = pin.read(input, 0, bufferLen)) > 0) {
+                    totalInputLen += len;
+                    byte[] output = cipher.update(input, 0, len);
+                    cout.write(output, 0, output.length);
+                }
 
-            while ((len = pin.read(input, 0, bufferLen)) > 0) {
-                totalInputLen += len;
-                byte[] output = cipher.update(input, 0, len);
-                cout.write(output, 0, output.length);
-                cout.flush();
+                len = cipher.getOutputSize(0);
+
+                byte[] out = new byte[len];
+                len = cipher.doFinal(out, 0);
+                cout.write(out, 0, len);
             }
 
-            len = cipher.getOutputSize(0);
-
-            byte[] out = new byte[len];
-            len = cipher.doFinal(out, 0);
-            cout.write(out, 0, len);
-            cout.flush();
+            try (FileInputStream fin = new FileInputStream(cfile);
+                    BufferedInputStream cin = new BufferedInputStream(fin);
+                    FileOutputStream fout = new FileOutputStream(poutfile);
+                    BufferedOutputStream pout = new BufferedOutputStream(fout)) {
+                cipher.init(Cipher.DECRYPT_MODE, cipherKey, params);
 
-            cin = new BufferedInputStream(new FileInputStream(cfile));
-            pout = new BufferedOutputStream(new FileOutputStream(poutfile));
-            cipher.init(Cipher.DECRYPT_MODE, cipherKey, params);
+                byte[] output = null;
+                while ((len = cin.read(input, 0, bufferLen)) > 0) {
+                    output = cipher.update(input, 0, len);
+                    pout.write(output, 0, output.length);
+                }
 
-            byte[] output = null;
-            while ((len = cin.read(input, 0, bufferLen)) > 0) {
-                output = cipher.update(input, 0, len);
-                pout.write(output, 0, output.length);
-                pout.flush();
+                len = cipher.getOutputSize(0);
+                byte[] out = new byte[len];
+                len = cipher.doFinal(out, 0);
+                pout.write(out, 0, len);
             }
 
-            len = cipher.getOutputSize(0);
-            out = new byte[len];
-            len = cipher.doFinal(out, 0);
-            pout.write(out, 0, len);
-            pout.flush();
-
-            Process child = Runtime.getRuntime().exec
-                ("diff " + pinfile + " " + poutfile);
-            InputStream in = child.getInputStream();
-            byte[] data = new byte[64];
-
-            while((len = in.read(data)) != -1)
-                System.out.write(data, 0, len);
-            in.close();
-            child.waitFor();
-            System.out.println("child exited with " + child.exitValue());
-        }
-        catch (IllegalBlockSizeException ex) {
-            if ((totalInputLen % 8 != 0) && (padding.equals("NoPadding")))
+            diff(pinfile, poutfile);
+        } catch (IllegalBlockSizeException ex) {
+            if ((totalInputLen % 8 != 0) && (padding.equals("NoPadding"))) {
                 return;
-            else {
+            } else {
                 System.out.println("Test failed!");
                 throw ex;
             }
         }
-        finally {
-            try {
-                if (pin != null)
-                    pin.close();
-                if (pout != null)
-                    pout.close();
-                if (cin != null)
-                    cin.close();
-                if (cout != null)
-                    cout.close();
-            }
-            catch (IOException e) {
-                e.printStackTrace();
-                return;
-            }
+    }
+
+    private static void diff(String fname1, String fname2) throws Exception {
+        if (!Arrays.equals(Files.readAllBytes(Paths.get(fname1)),
+                Files.readAllBytes(Paths.get(fname1)))) {
+            throw new Exception(
+                    "files " + fname1 + " and " + fname2 + " differ");
         }
     }
-
 }
--- a/test/com/sun/jdi/ShellScaffold.sh	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/com/sun/jdi/ShellScaffold.sh	Wed Aug 17 22:47:49 2011 -0700
@@ -250,6 +250,7 @@
     isCygwin=
     case "$osname" in
        Windows* | CYGWIN*)	   
+         devnull=NUL
 	 if [ "$osname" = Windows_98 -o "$osname" = Windows_ME ]; then
              isWin98=1
              debuggeeKeyword='we_cant_kill_debuggees_on_win98'
@@ -259,6 +260,7 @@
          case "$osname" in
            CYGWIN*)
              isCygwin=1
+             devnull=/dev/null
              ;;
          esac
 
@@ -269,7 +271,6 @@
             transport=dt_socket
             address=
          fi
-         devnull=NUL
          baseArgs="$baseArgs -XX:-ShowMessageBoxOnError"
          # jtreg puts \\s in TESTCLASSES and some uses, eg. echo
          # treat them as control chars on mks (eg \t is tab)
--- a/test/com/sun/jndi/ldap/InvalidLdapFilters.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/com/sun/jndi/ldap/InvalidLdapFilters.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,10 @@
 
 /**
  * @test
- * @bug 6916202
+ * @bug 6916202 7041125
  * @summary More cases of invalid ldap filters accepted and processed
+ *      LDAP API does not catch malformed filters that contain two operands
+ *      for the ! operator
  * @run main/othervm InvalidLdapFilters valid (cn=Babs)
  * @run main/othervm InvalidLdapFilters valid (&(cn=Bob))
  * @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(uid=*))
@@ -34,6 +36,7 @@
  * @run main/othervm InvalidLdapFilters valid (!(!(cn=Tim)))
  * @run main/othervm InvalidLdapFilters valid (!(&(objectClass=*)(uid=*)))
  * @run main/othervm InvalidLdapFilters valid (!(|(objectClass=*)(uid=*)))
+ * @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(!(uid=*)))
  * @run main/othervm InvalidLdapFilters valid (o=univ*of*mich*)
  * @run main/othervm InvalidLdapFilters valid (seeAlso=)
  * @run main/othervm InvalidLdapFilters valid (cn:caseExactMatch:=Flintstone)
@@ -75,6 +78,8 @@
          "((objectCategory=person)(cn=u)(!(cn=u2*)))"
  * @run main/othervm InvalidLdapFilters invalid
          "((&(objectClass=user)(cn=andy*)(cn=steve*)(cn=bob*)))"
+ * @run main/othervm InvalidLdapFilters invalid
+         (&(objectClass=Person)(!(sn=Jensen)(cn=Bab)))
  *
  * @author Xuelei Fan
  */
--- a/test/com/sun/net/httpserver/Test1.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/com/sun/net/httpserver/Test1.java	Wed Aug 17 22:47:49 2011 -0700
@@ -26,6 +26,7 @@
  * @bug 6270015
  * @run main/othervm Test1
  * @run main/othervm -Dsun.net.httpserver.maxReqTime=10 Test1
+ * @run main/othervm -Dsun.net.httpserver.nodelay=true Test1
  * @summary  Light weight HTTP server
  */
 
@@ -42,6 +43,10 @@
  *      - send/receive large/small file
  *      - chunked encoding
  *      - via http and https
+ *
+ * The test is also run with sun.net.httpserver.nodelay simply to exercise
+ * this option. There is no specific pass or failure related to running with
+ * this option.
  */
 
 public class Test1 extends Test {
--- a/test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,15 +36,19 @@
 
     public static void main(String[] args) throws Exception {
 
-        Locale.setDefault(Locale.ITALY);
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(Locale.ITALY);
 
-        try {
             throw new XMLSecurityException("foo");
         } catch (XMLSecurityException xse) {
             System.out.println("Test PASSED");
         } catch (Throwable t) {
             System.out.println("Test FAILED");
             t.printStackTrace();
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
     }
 }
--- a/test/demo/zipfs/basic.sh	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/demo/zipfs/basic.sh	Wed Aug 17 22:47:49 2011 -0700
@@ -39,7 +39,7 @@
 
 OS=`uname -s`
 case "$OS" in
-    Windows_* )
+    Windows_* | CYGWIN* )
         CLASSPATH="${TESTCLASSES};${ZIPFS}"
         ;;
     * )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.Button;
+import java.awt.CardLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+
+/**
+ * @test
+ * @bug 6263470
+ * @summary Tries to change font of MenuBar. Test passes if the font has changed
+ * fails otherwise.
+ * @author Vyacheslav.Baranov: area=menu
+ * @run main MenuBarSetFont
+ */
+public final class MenuBarSetFont {
+
+    private static final Frame frame = new Frame();
+    private static final MenuBar mb = new MenuBar();
+    private static volatile boolean clicked;
+
+    private static final class Listener implements ActionListener {
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            //Click on this button is performed
+            //_only_ if font of MenuBar is not changed on time
+            MenuBarSetFont.clicked = true;
+        }
+    }
+
+    private static void addMenu() {
+        mb.add(new Menu("w"));
+        frame.validate();
+    }
+
+    public static void main(final String[] args) throws Exception {
+        //Components initialization.
+        frame.setMenuBar(mb);
+        mb.setFont(new Font("Helvetica", Font.ITALIC, 5));
+
+        final Button button = new Button("Click Me");
+        button.addActionListener(new Listener());
+        frame.setLayout(new CardLayout());
+        frame.add(button, "First");
+        frame.setSize(400, 400);
+        frame.setVisible(true);
+        sleep();
+
+        final int fInsets = frame.getInsets().top;  //Frame insets without menu.
+        addMenu();
+        final int fMenuInsets = frame.getInsets().top; //Frame insets with menu.
+        final int menuBarHeight = fMenuInsets - fInsets;
+        // There is no way to change menubar height on windows. But on windows
+        // we can try to split menubar in 2 rows.
+        for (int i = 0; i < 100 && fMenuInsets == frame.getInsets().top; ++i) {
+            // Fill whole menubar.
+            addMenu();
+        }
+
+        mb.remove(0);
+        frame.validate();
+        sleep();
+
+        // Test execution.
+        // On XToolkit, menubar font should be changed to 60.
+        // On WToolkit, menubar font should be changed to default and menubar
+        // should be splitted in 2 rows.
+        mb.setFont(new Font("Helvetica", Font.ITALIC, 60));
+        sleep();
+
+        final Robot r = new Robot();
+        r.setAutoDelay(200);
+        final Point pt = frame.getLocation();
+        r.mouseMove(pt.x + frame.getWidth() / 2,
+                    pt.y + fMenuInsets + menuBarHeight / 2);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        sleep();
+        frame.dispose();
+
+        if (clicked) {
+            fail("Font was not changed");
+        }
+    }
+
+    private static void sleep() {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(500L);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    private static void fail(final String message) {
+        throw new RuntimeException(message);
+    }
+}
--- a/test/java/beans/XMLDecoder/Test6341798.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/beans/XMLDecoder/Test6341798.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,8 +47,14 @@
             + "</java> ";
 
     public static void main(String[] args) {
-        test(ENGLISH, DATA.getBytes());
-        test(TURKISH, DATA.getBytes());
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            test(ENGLISH, DATA.getBytes());
+            test(TURKISH, DATA.getBytes());
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
     private static void test(Locale locale, byte[] data) {
--- a/test/java/io/pathNames/win32/bug6344646.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/io/pathNames/win32/bug6344646.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,17 +32,24 @@
 
 public class bug6344646 {
     public static void main(String[] s) {
-        /* This test is only valid on win32 systems */
-        if (File.separatorChar != '\\') {
-            return;
-        }
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            /* This test is only valid on win32 systems */
+            if (File.separatorChar != '\\') {
+                return;
+            }
 
-        Locale.setDefault(new Locale("lt"));
-        File f1 = new File("J\u0301");
-        File f2 = new File("j\u0301");
+            Locale.setDefault(new Locale("lt"));
+            File f1 = new File("J\u0301");
+            File f2 = new File("j\u0301");
 
-        if (f1.hashCode() != f2.hashCode()) {
-            throw new RuntimeException("File.hashCode() for \"J\u0301\" and \"j\u0301\" should be the same");
+            if (f1.hashCode() != f2.hashCode()) {
+                throw new RuntimeException("File.hashCode() for \"J\u0301\" " +
+                        "and \"j\u0301\" should be the same");
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
     }
 }
--- a/test/java/lang/instrument/ManifestTest.sh	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/lang/instrument/ManifestTest.sh	Wed Aug 17 22:47:49 2011 -0700
@@ -26,7 +26,7 @@
 # @summary JLI JAR manifest processing should ignore leading and trailing white space.
 # @author Daniel D. Daugherty
 #
-# @run build ManifestTestApp
+# @run build ManifestTestApp ExampleForBootClassPath
 # @run shell/timeout=900 ManifestTest.sh
 #
 
@@ -42,6 +42,9 @@
     expect_retrans_line="isRetransformClassesSupported()=false"
     can_set_nmp_line=""
     expect_set_nmp_line="isNativeMethodPrefixSupported()=false"
+    # some tests create directories with spaces in their name,
+    # explicitly delete these.
+    to_be_deleted=""
 
     while [ $# != 0 ] ; do
         case "$1" in
@@ -59,30 +62,33 @@
         boot_cp_line2)
             boot_cp_line="Boot-Class-Path:  has_leading_blank"
             expect_boot_cp_line="ExampleForBootClassPath was loaded."
+            to_be_deleted=" has_leading_blank"
             mkdir -p has_leading_blank " has_leading_blank"
             # the good class is in the directory without the blank
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class \
                 has_leading_blank
             # the bad class is in the directory with the blank
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
-                " has_leading_blank"/ExampleForBootClassPath.class
+                " has_leading_blank/ExampleForBootClassPath.class"
             ;;
 
         boot_cp_line3)
             boot_cp_line="Boot-Class-Path: has_trailing_blank "
             expect_boot_cp_line="ExampleForBootClassPath was loaded."
+            to_be_deleted="has_trailing_blank "
             mkdir -p has_trailing_blank "has_trailing_blank "
             # the good class is in the directory without the blank
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class \
                 has_trailing_blank
             # the bad class is in the directory with the blank
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
-                "has_trailing_blank "/ExampleForBootClassPath.class
+                "has_trailing_blank /ExampleForBootClassPath.class"
             ;;
 
         boot_cp_line4)
             boot_cp_line="Boot-Class-Path:  has_leading_and_trailing_blank "
             expect_boot_cp_line="ExampleForBootClassPath was loaded."
+            to_be_deleted=" has_leading_and_trailing_blank "
             mkdir -p has_leading_and_trailing_blank \
                 " has_leading_and_trailing_blank "
             # the good class is in the directory without the blanks
@@ -90,18 +96,19 @@
                 has_leading_and_trailing_blank
             # the bad class is in the directory with the blanks
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
-                " has_leading_and_trailing_blank "/ExampleForBootClassPath.class
+                " has_leading_and_trailing_blank /ExampleForBootClassPath.class"
             ;;
 
         boot_cp_line5)
             boot_cp_line="Boot-Class-Path: has_embedded blank"
             expect_boot_cp_line="ExampleForBootClassPath was loaded."
+            to_be_deleted="has_embedded blank"
             mkdir -p has_embedded "has_embedded blank"
             # the good class is in the first blank separated word
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class has_embedded
             # the bad class is in the directory with the blank
             cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
-                "has_embedded blank"/ExampleForBootClassPath.class
+                "has_embedded blank/ExampleForBootClassPath.class"
             ;;
 
         can_redef_line1)
@@ -429,6 +436,12 @@
         touch $FAIL_MARKER
     fi
 
+    #clean up any problematic directories
+    if [ -n "$to_be_deleted" ]; then
+        echo "Test removing [$to_be_deleted]"
+        rm -rf "$to_be_deleted"
+    fi
+
     echo "===== end test case: $token ====="
     echo
 done << EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/reflect/Constructor/Equals.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7073296
+ * @summary Generic framework to test Constructor.equals.
+ *
+ * @compile Equals.java
+ * @run main Equals
+ */
+
+import java.lang.reflect.*;
+
+public class Equals {
+    public Equals(){}
+    public Equals(Object o) {/* only for testing*/}
+    public Equals(int i) {/* only for testing */}
+
+    public Equals m() { return this; }
+
+    public static void main(String [] args) {
+        Equals e = new Equals();
+        e.equalConstructors();
+    }
+
+    public void equalConstructors() {
+        Constructor<?>[] constructors = Equals.class.getDeclaredConstructors();
+        for(Constructor<?> ctor1 : constructors) {
+            for(Constructor<?> ctor2 : constructors) {
+                boolean expected = (ctor1 == ctor2);
+                if (ctor1.equals(ctor2) != expected)
+                    throw new RuntimeException("Constructors '" +
+                        ctor1 + "'("+ System.identityHashCode(ctor1) + ") " +
+                        (expected ? "!=" : "==") + " '" +
+                        ctor2 + "'("+ System.identityHashCode(ctor2) + ")");
+            }
+        }
+    }
+}
--- a/test/java/net/CookieHandler/B6791927.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/net/CookieHandler/B6791927.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,23 @@
 
 public class B6791927 {
     public static final void main( String[] aaParamters ) throws Exception{
-        // Forces a non US locale
-        Locale.setDefault(Locale.FRANCE);
-        List<HttpCookie> cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT");
-        if (cookies == null || cookies.isEmpty()) {
-            throw new RuntimeException("No cookie found");
-        }
-        for (HttpCookie c : cookies) {
-            if (c.getMaxAge() == 0) {
-                throw new RuntimeException("Expiration date shouldn't be 0");
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            // Forces a non US locale
+            Locale.setDefault(Locale.FRANCE);
+            List<HttpCookie> cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT");
+            if (cookies == null || cookies.isEmpty()) {
+                throw new RuntimeException("No cookie found");
             }
+            for (HttpCookie c : cookies) {
+                if (c.getMaxAge() == 0) {
+                    throw new RuntimeException(
+                        "Expiration date shouldn't be 0");
+                }
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/SocketPermission/Wildcard.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7021280
+ * @summary SocketPermission should accept wildcards
+ */
+
+import java.net.SocketPermission;
+
+public class Wildcard
+{
+    public static void main(String[] args) throws Exception {
+        SocketPermission star_All =
+                new SocketPermission("*.blabla.bla", "listen,accept,connect");
+        SocketPermission www_All =
+                new SocketPermission("bla.blabla.bla", "listen,accept,connect");
+
+        if (!star_All.implies(www_All)) {
+            throw new RuntimeException(
+                   "Failed: " + star_All + " does not imply " + www_All);
+        }
+    }
+}
--- a/test/java/net/URLConnection/SetIfModifiedSince.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/net/URLConnection/SetIfModifiedSince.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,7 @@
     }
 
     public static void main (String[] args) {
+        Locale reservedLocale = Locale.getDefault();
         try {
             Locale.setDefault(Locale.JAPAN);
             ServerSocket serversocket = new ServerSocket (0);
@@ -87,6 +88,10 @@
             int i=0, c;
             Thread.sleep (5000);
         } catch (Exception e) {
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
+
     }
 }
--- a/test/java/nio/charset/coders/CheckSJISMappingProp.sh	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/nio/charset/coders/CheckSJISMappingProp.sh	Wed Aug 17 22:47:49 2011 -0700
@@ -36,7 +36,7 @@
 case "$OS" in
   SunOS | Linux ) ;;
   # Skip locale test for Windows
-  Windows* )
+  Windows* | CYGWIN* )
     echo "Passed"; exit 0 ;;
   * ) echo "Unrecognized system!" ;  exit 1 ;;
 esac
--- a/test/java/nio/charset/spi/basic.sh	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/nio/charset/spi/basic.sh	Wed Aug 17 22:47:49 2011 -0700
@@ -45,9 +45,19 @@
 JAVA=$TESTJAVA/bin/java
 JAR=$TESTJAVA/bin/jar
 
-JARD=`pwd`/x.jar
-EXTD=`pwd`/x.ext
-TESTD=`pwd`/x.test
+DIR=`pwd`
+case `uname` in
+  SunOS | Linux ) CPS=':' ;;
+  Windows* )      CPS=';' ;;
+  CYGWIN*  )
+    DIR=`/usr/bin/cygpath -a -s -m $DIR`
+    CPS=";";;
+  *)              echo "Unknown platform: `uname`"; exit 1 ;;
+esac
+
+JARD=$DIR/x.jar
+EXTD=$DIR/x.ext
+TESTD=$DIR/x.test
 
 CSS='US-ASCII 8859_1 iso-ir-6 UTF-16 windows-1252 !BAR cp1252'
 
@@ -84,12 +94,6 @@
 TMP=${TMP:-$TEMP}; TMP=${TMP:-/tmp}
 cd $TMP
 
-case `uname` in
-  SunOS | Linux ) CPS=':' ;;
-  Windows* )      CPS=';' ;;
-  *)              echo "Unknown platform: `uname`"; exit 1 ;;
-esac
-
 failures=0
 for where in ext app; do
   for security in none minimal-policy cp-policy; do
--- a/test/java/util/Locale/LocaleCategory.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/Locale/LocaleCategory.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,30 +29,37 @@
     private static String enc = null;
 
     public static void main(String[] args) {
-        Locale.Builder builder = new Locale.Builder();
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.Builder builder = new Locale.Builder();
 
-        base = builder.setLanguage(System.getProperty("user.language", ""))
-                      .setScript(System.getProperty("user.script", ""))
-                      .setRegion(System.getProperty("user.country", ""))
-                      .setVariant(System.getProperty("user.variant", "")).build();
-        disp = builder.setLanguage(System.getProperty("user.language.display",
-                                                      Locale.getDefault().getLanguage()))
-                      .setScript(System.getProperty("user.script.display",
-                                                    Locale.getDefault().getScript()))
-                      .setRegion(System.getProperty("user.country.display",
-                                                    Locale.getDefault().getCountry()))
-                      .setVariant(System.getProperty("user.variant.display",
-                                                     Locale.getDefault().getVariant())).build();
-        fmt = builder.setLanguage(System.getProperty("user.language.format",
-                                                     Locale.getDefault().getLanguage()))
-                     .setScript(System.getProperty("user.script.format",
-                                                   Locale.getDefault().getScript()))
-                     .setRegion(System.getProperty("user.country.format",
-                                                   Locale.getDefault().getCountry()))
-                     .setVariant(System.getProperty("user.variant.format",
-                                                     Locale.getDefault().getVariant())).build();
-        checkDefault();
-        testGetSetDefault();
+            base = builder.setLanguage(System.getProperty("user.language", ""))
+                  .setScript(System.getProperty("user.script", ""))
+                  .setRegion(System.getProperty("user.country", ""))
+                  .setVariant(System.getProperty("user.variant", "")).build();
+            disp = builder.setLanguage(
+                    System.getProperty("user.language.display",
+                                Locale.getDefault().getLanguage()))
+                        .setScript(System.getProperty("user.script.display",
+                                Locale.getDefault().getScript()))
+                        .setRegion(System.getProperty("user.country.display",
+                                Locale.getDefault().getCountry()))
+                        .setVariant(System.getProperty("user.variant.display",
+                                Locale.getDefault().getVariant())).build();
+            fmt = builder.setLanguage(System.getProperty("user.language.format",
+                                Locale.getDefault().getLanguage()))
+                       .setScript(System.getProperty("user.script.format",
+                                Locale.getDefault().getScript()))
+                       .setRegion(System.getProperty("user.country.format",
+                                Locale.getDefault().getCountry()))
+                       .setVariant(System.getProperty("user.variant.format",
+                                  Locale.getDefault().getVariant())).build();
+            checkDefault();
+            testGetSetDefault();
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
     static void checkDefault() {
--- a/test/java/util/Locale/LocaleCategory.sh	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/Locale/LocaleCategory.sh	Wed Aug 17 22:47:49 2011 -0700
@@ -34,7 +34,7 @@
     PS=":"
     FS="/"
     ;;
-  Windows* )
+  Windows* | CYGWIN* )
     PS=";"
     FS="\\"
     ;;
--- a/test/java/util/PluggableLocale/CurrencyNameProviderTest.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/PluggableLocale/CurrencyNameProviderTest.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,13 @@
 public class CurrencyNameProviderTest extends ProviderTest {
 
     public static void main(String[] s) {
-        new CurrencyNameProviderTest();
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            new CurrencyNameProviderTest();
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
     CurrencyNameProviderTest() {
--- a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,6 +113,7 @@
 
     void test2() {
         Locale defaultLocale = Locale.getDefault();
+        TimeZone reservedTimeZone = TimeZone.getDefault();
         Date d = new Date(2005-1900, Calendar.DECEMBER, 22);
         String formatted;
 
@@ -139,7 +140,6 @@
                 df = new SimpleDateFormat(pattern, DateFormatSymbols.getInstance());
                 System.out.println(formatted = df.format(d));
                 if(!formatted.equals(DISPLAY_NAMES_KYOTO[i])) {
-                    Locale.setDefault(defaultLocale);
                     throw new RuntimeException("Timezone " + TIMEZONES[i] +
                         ": formatted zone names mismatch. " +
                         formatted + " should match with " +
@@ -148,10 +148,12 @@
                 df.parse(DISPLAY_NAMES_KYOTO[i]);
             }
         } catch (ParseException pe) {
+            throw new RuntimeException("parse error occured" + pe);
+        } finally {
+            // restore the reserved locale and time zone
             Locale.setDefault(defaultLocale);
-            throw new RuntimeException("parse error occured" + pe);
+            TimeZone.setDefault(reservedTimeZone);
         }
-        Locale.setDefault(defaultLocale);
     }
 
     final String LATIME = "America/Los_Angeles";
--- a/test/java/util/ResourceBundle/Bug6190861.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/ResourceBundle/Bug6190861.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,27 +32,34 @@
 public class Bug6190861 {
 
     static public void main(String[] args) {
-        Locale.setDefault(new Locale("en", "US"));
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("en", "US"));
 
-        List localeList = new ArrayList();
-        localeList.add(Locale.ENGLISH);
-        localeList.add(Locale.KOREA);
-        localeList.add(Locale.UK);
-        localeList.add(new Locale("en", "CA"));
-        localeList.add(Locale.ENGLISH);
+            List localeList = new ArrayList();
+            localeList.add(Locale.ENGLISH);
+            localeList.add(Locale.KOREA);
+            localeList.add(Locale.UK);
+            localeList.add(new Locale("en", "CA"));
+            localeList.add(Locale.ENGLISH);
 
-        Iterator iter = localeList.iterator();
-        while (iter.hasNext()){
-            Locale currentLocale = (Locale) iter.next();
-            System.out.println("\ncurrentLocale = "
+            Iterator iter = localeList.iterator();
+            while (iter.hasNext()){
+                Locale currentLocale = (Locale) iter.next();
+                System.out.println("\ncurrentLocale = "
                                + currentLocale.getDisplayName());
 
-            ResourceBundle messages = ResourceBundle.getBundle("Bug6190861Data",currentLocale);
+                ResourceBundle messages =
+                    ResourceBundle.getBundle("Bug6190861Data",currentLocale);
 
-            Locale messagesLocale = messages.getLocale();
-            System.out.println("messagesLocale = "
+                Locale messagesLocale = messages.getLocale();
+                System.out.println("messagesLocale = "
                                + messagesLocale.getDisplayName());
-            checkMessages(messages);
+                checkMessages(messages);
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
     }
 
--- a/test/java/util/ResourceBundle/Control/Bug6530694.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/ResourceBundle/Control/Bug6530694.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,12 @@
     }
 
     public static void main(String[] args) {
-        new Bug6530694();
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            new Bug6530694();
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 }
--- a/test/java/util/ResourceBundle/Control/StressTest.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/ResourceBundle/Control/StressTest.java	Wed Aug 17 22:47:49 2011 -0700
@@ -69,36 +69,44 @@
         if (args.length > 1) {
             duration = Math.max(5, Integer.parseInt(args[1]));
         }
-        Locale.setDefault(Locale.US);
-        Thread[] tasks = new Thread[locales.length * threadsFactor];
-        counters = new AtomicIntegerArray(tasks.length);
+
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(Locale.US);
+            Thread[] tasks = new Thread[locales.length * threadsFactor];
+            counters = new AtomicIntegerArray(tasks.length);
 
-        for (int i = 0; i < tasks.length; i++) {
-            tasks[i] = new Thread(new Worker(i));
-        }
-        for (int i = 0; i < tasks.length; i++) {
-            tasks[i].start();
-        }
+            for (int i = 0; i < tasks.length; i++) {
+                tasks[i] = new Thread(new Worker(i));
+            }
+            for (int i = 0; i < tasks.length; i++) {
+                tasks[i].start();
+            }
 
-        int nProcessors = Runtime.getRuntime().availableProcessors();
-        intervalForCounterCheck = Math.max(tasks.length / nProcessors, 1);
-        System.out.printf("%d processors, intervalForCounterCheck = %d [sec]%n",
+            int nProcessors = Runtime.getRuntime().availableProcessors();
+            intervalForCounterCheck = Math.max(tasks.length / nProcessors, 1);
+            System.out.printf(
+                "%d processors, intervalForCounterCheck = %d [sec]%n",
                           nProcessors, intervalForCounterCheck);
-        try {
-            for (int i = 0; runrun && i < duration; i++) {
-                Thread.sleep(1000); // 1 second
-                if ((i % intervalForCounterCheck) == 0) {
-                    checkCounters();
+            try {
+                for (int i = 0; runrun && i < duration; i++) {
+                    Thread.sleep(1000); // 1 second
+                    if ((i % intervalForCounterCheck) == 0) {
+                        checkCounters();
+                    }
                 }
+                runrun = false;
+                for (int i = 0; i < tasks.length; i++) {
+                    tasks[i].join();
+                }
+            } catch (InterruptedException e) {
             }
-            runrun = false;
-            for (int i = 0; i < tasks.length; i++) {
-                tasks[i].join();
-            }
-        } catch (InterruptedException e) {
+
+            printCounters();
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
-
-        printCounters();
     }
 
     static void checkCounters() {
--- a/test/java/util/ResourceBundle/Test4314141.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/ResourceBundle/Test4314141.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,8 +35,14 @@
 public class Test4314141 {
 
     public static void main(String[] args) {
-        testCandidateOmission();
-        testExample();
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            testCandidateOmission();
+            testExample();
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
     /**
--- a/test/java/util/ResourceBundle/Test4318520.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/ResourceBundle/Test4318520.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,14 @@
 public class Test4318520 {
 
     public static void main(String[] args) {
-        test(Locale.GERMAN);
-        test(Locale.ENGLISH);
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            test(Locale.GERMAN);
+            test(Locale.ENGLISH);
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
     private static void test(Locale locale) {
--- a/test/java/util/concurrent/Executors/AutoShutdown.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/concurrent/Executors/AutoShutdown.java	Wed Aug 17 22:47:49 2011 -0700
@@ -67,6 +67,11 @@
         e1 = e2 = null;
         for (int i = 0; i < 10 && Thread.activeCount() > count0; i++)
             tryWaitForFinalizersToRun();
+        for (int i = 0; i < 10; ++i) { // give JVM a chance to settle.
+            if (Thread.activeCount() == count0)
+                return;
+            Thread.sleep(1000);
+        }
         equal(Thread.activeCount(), count0);
     }
 
--- a/test/java/util/concurrent/Phaser/Arrive.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/concurrent/Phaser/Arrive.java	Wed Aug 17 22:47:49 2011 -0700
@@ -45,9 +45,12 @@
 
 public class Arrive {
     void test(String[] args) throws Throwable {
+        for (int i = 0; i < 100; ++i)
+            doTest(args);
+    }
+    void doTest(String[] args) throws Throwable {
         final int n = ThreadLocalRandom.current().nextInt(1, 10);
-        final int nthreads = n*3/2;
-        final Phaser startingGate = new Phaser(nthreads);
+        final Phaser startingGate = new Phaser(n);
         final Phaser phaser = new Phaser(n);
         final List<Thread> threads = new ArrayList<Thread>();
         final AtomicInteger count0 = new AtomicInteger(0);
@@ -64,14 +67,14 @@
             else
                 fail();
         }};
-        for (int i = 0; i < nthreads; i++)
+        for (int i = 0; i < n; i++)
             threads.add(new Thread(task));
         for (Thread thread : threads)
             thread.start();
         for (Thread thread : threads)
             thread.join();
         equal(count0.get(), n);
-        equal(count1.get(), nthreads-n);
+        equal(count1.get(), 0);
         equal(phaser.getPhase(), 1);
     }
 
--- a/test/java/util/jar/JarFile/TurkCert.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/java/util/jar/JarFile/TurkCert.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
  * @bug 4624534
  * @summary Make sure jar certificates work for Turkish locale
  * @author kladko
- * @run main/othervm TurkCert
  */
 
 import java.util.*;
@@ -36,15 +35,24 @@
 
 public class TurkCert {
     public static void main(String[] args) throws Exception{
-        Locale.setDefault(new Locale("TR", "tr"));
-        File f = new File(System.getProperty("test.src","."), "test.jar");
-        JarFile jf = new JarFile(f, true);
-        JarEntry je = (JarEntry)jf.getEntry("test.class");
-        InputStream is = jf.getInputStream(je);
-        byte[] b = new byte[1024];
-        while (is.read(b) != -1) {
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("TR", "tr"));
+            File f = new File(System.getProperty("test.src","."), "test.jar");
+            try (JarFile jf = new JarFile(f, true)) {
+                JarEntry je = (JarEntry)jf.getEntry("test.class");
+                try (InputStream is = jf.getInputStream(je)) {
+                    byte[] b = new byte[1024];
+                    while (is.read(b) != -1) {
+                    }
+                }
+                if (je.getCertificates() == null) {
+                    throw new Exception("Null certificate for test.class.");
+                }
+            }
+        } finally {
+            // restore the default locale
+            Locale.setDefault(reservedLocale);
         }
-        if (je.getCertificates() == null)
-            throw new Exception("Null certificate for test.class.");
     }
 }
--- a/test/javax/crypto/Cipher/Turkish.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/javax/crypto/Cipher/Turkish.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,15 +35,21 @@
 public class Turkish {
 
     public static void main(String[] args) throws Exception {
-        Locale.setDefault(new Locale("tr", "TR"));
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("tr", "TR"));
 
-        System.out.println(Cipher.getInstance("RSA/ECB/PKCS1Padding"));
-        System.out.println(Cipher.getInstance("RSA/ECB/PKCS1PADDING"));
-        System.out.println(Cipher.getInstance("rsa/ecb/pkcs1padding"));
-        System.out.println(Cipher.getInstance("Blowfish"));
-        System.out.println(Cipher.getInstance("blowfish"));
-        System.out.println(Cipher.getInstance("BLOWFISH"));
+            System.out.println(Cipher.getInstance("RSA/ECB/PKCS1Padding"));
+            System.out.println(Cipher.getInstance("RSA/ECB/PKCS1PADDING"));
+            System.out.println(Cipher.getInstance("rsa/ecb/pkcs1padding"));
+            System.out.println(Cipher.getInstance("Blowfish"));
+            System.out.println(Cipher.getInstance("blowfish"));
+            System.out.println(Cipher.getInstance("BLOWFISH"));
 
-        System.out.println("OK");
+            System.out.println("OK");
+        } finally {
+            // restore the default locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/GroupLayout/7071166/bug7071166.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7071166
+ * @summary LayoutStyle.getPreferredGap() - IAE is expected but not thrown
+ * @author Pavel Porvatov
+ */
+
+import javax.swing.*;
+import static javax.swing.SwingConstants.*;
+import java.awt.*;
+
+public class bug7071166 {
+    private static final int[] POSITIONS = {NORTH, EAST, SOUTH, WEST, // valid positions
+            NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST, 123, -456}; // invalid positions
+
+    public static void main(String[] args) throws Exception {
+        for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
+            UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
+
+            System.out.println("LookAndFeel: " + lookAndFeelInfo.getName());
+
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    LayoutStyle layoutStyle = LayoutStyle.getInstance();
+
+                    System.out.println("LayoutStyle: " + layoutStyle);
+
+                    for (int i = 0; i < POSITIONS.length; i++) {
+                        int position = POSITIONS[i];
+
+                        try {
+                            layoutStyle.getPreferredGap(new JButton(), new JButton(),
+                                    LayoutStyle.ComponentPlacement.RELATED, position, new Container());
+
+                            if (i > 3) {
+                                throw new RuntimeException("IllegalArgumentException is not thrown for position " +
+                                        position);
+                            }
+                        } catch (IllegalArgumentException e) {
+                            if (i <= 3) {
+                                throw new RuntimeException("IllegalArgumentException is thrown for position " +
+                                        position);
+                            }
+                        }
+                    }
+                }
+            });
+
+            System.out.println("passed");
+        }
+    }
+}
--- a/test/javax/swing/JColorChooser/Test6524757.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/javax/swing/JColorChooser/Test6524757.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,17 +98,23 @@
     private static final Object[] FRENCH = convert(Locale.FRENCH, KEYS);
 
     public static void main(String[] args) {
-        // it affects Swing because it is not initialized
-        Locale.setDefault(Locale.KOREAN);
-        validate(KOREAN, create());
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            // it affects Swing because it is not initialized
+            Locale.setDefault(Locale.KOREAN);
+            validate(KOREAN, create());
 
-        // it does not affect Swing because it is initialized
-        Locale.setDefault(Locale.CANADA);
-        validate(KOREAN, create());
+            // it does not affect Swing because it is initialized
+            Locale.setDefault(Locale.CANADA);
+            validate(KOREAN, create());
 
-        // it definitely should affect Swing
-        JComponent.setDefaultLocale(Locale.FRENCH);
-        validate(FRENCH, create());
+            // it definitely should affect Swing
+            JComponent.setDefaultLocale(Locale.FRENCH);
+            validate(FRENCH, create());
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 
     private static void validate(Object[] expected, Object[] actual) {
--- a/test/sun/security/krb5/auto/KDC.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/security/krb5/auto/KDC.java	Wed Aug 17 22:47:49 2011 -0700
@@ -170,6 +170,10 @@
          * Use only one preauth, so that some keys are not easy to generate
          */
         ONLY_ONE_PREAUTH,
+        /**
+         * Set all name-type to a value in response
+         */
+        RESP_NT,
     };
 
     static {
@@ -637,10 +641,16 @@
      */
     private byte[] processTgsReq(byte[] in) throws Exception {
         TGSReq tgsReq = new TGSReq(in);
+        PrincipalName service = tgsReq.reqBody.sname;
+        if (options.containsKey(KDC.Option.RESP_NT)) {
+            service = new PrincipalName(service.getNameStrings(),
+                    (int)options.get(KDC.Option.RESP_NT));
+            service.setRealm(service.getRealm());
+        }
         try {
             System.out.println(realm + "> " + tgsReq.reqBody.cname +
                     " sends TGS-REQ for " +
-                    tgsReq.reqBody.sname);
+                    service);
             KDCReqBody body = tgsReq.reqBody;
             int[] eTypes = KDCReqBodyDotEType(body);
             int e2 = eTypes[0];     // etype for outgoing session key
@@ -708,7 +718,7 @@
                 bFlags[Krb5.TKT_OPTS_MAY_POSTDATE] = true;
             }
 
-            if (configMatch("", body.sname.getNameString(), "ok-as-delegate")) {
+            if (configMatch("", service.getNameString(), "ok-as-delegate")) {
                 bFlags[Krb5.TKT_OPTS_DELEGATE] = true;
             }
             bFlags[Krb5.TKT_OPTS_INITIAL] = true;
@@ -728,13 +738,13 @@
                             : new HostAddresses(
                                 new InetAddress[]{InetAddress.getLocalHost()}),
                     null);
-            EncryptionKey skey = keyForUser(body.sname, e3, true);
+            EncryptionKey skey = keyForUser(service, e3, true);
             if (skey == null) {
                 throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO
             }
             Ticket t = new Ticket(
                     body.crealm,
-                    body.sname,
+                    service,
                     new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET)
             );
             EncTGSRepPart enc_part = new EncTGSRepPart(
@@ -750,7 +760,7 @@
                     body.from,
                     till, body.rtime,
                     body.crealm,
-                    body.sname,
+                    service,
                     body.addresses != null  // always set caddr
                             ? body.addresses
                             : new HostAddresses(
@@ -781,7 +791,7 @@
                         0,
                         ke.returnCode(),
                         body.crealm, body.cname,
-                        new Realm(getRealm()), body.sname,
+                        new Realm(getRealm()), service,
                         KrbException.errorMessage(ke.returnCode()),
                         null);
             }
@@ -800,10 +810,16 @@
         int[] eTypes = null;
         List<PAData> outPAs = new ArrayList<>();
 
+        PrincipalName service = asReq.reqBody.sname;
+        if (options.containsKey(KDC.Option.RESP_NT)) {
+            service = new PrincipalName(service.getNameStrings(),
+                    (int)options.get(KDC.Option.RESP_NT));
+            service.setRealm(service.getRealm());
+        }
         try {
             System.out.println(realm + "> " + asReq.reqBody.cname +
                     " sends AS-REQ for " +
-                    asReq.reqBody.sname);
+                    service);
 
             KDCReqBody body = asReq.reqBody;
             body.cname.setRealm(getRealm());
@@ -812,7 +828,7 @@
             int eType = eTypes[0];
 
             EncryptionKey ckey = keyForUser(body.cname, eType, false);
-            EncryptionKey skey = keyForUser(body.sname, eType, true);
+            EncryptionKey skey = keyForUser(service, eType, true);
 
             if (options.containsKey(KDC.Option.ONLY_RC4_TGT)) {
                 int tgtEType = EncryptedData.ETYPE_ARCFOUR_HMAC;
@@ -826,7 +842,7 @@
                 if (!found) {
                     throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
                 }
-                skey = keyForUser(body.sname, tgtEType, true);
+                skey = keyForUser(service, tgtEType, true);
             }
             if (ckey == null) {
                 throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
@@ -943,7 +959,7 @@
                     null);
             Ticket t = new Ticket(
                     body.crealm,
-                    body.sname,
+                    service,
                     new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET)
             );
             EncASRepPart enc_part = new EncASRepPart(
@@ -959,7 +975,7 @@
                     body.from,
                     till, body.rtime,
                     body.crealm,
-                    body.sname,
+                    service,
                     body.addresses
                     );
             EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_AS_REP_PART);
@@ -1023,7 +1039,7 @@
                         0,
                         ke.returnCode(),
                         body.crealm, body.cname,
-                        new Realm(getRealm()), body.sname,
+                        new Realm(getRealm()), service,
                         KrbException.errorMessage(ke.returnCode()),
                         eData);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/krb5/auto/PrincipalNameEquals.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7061379
+ * @summary [Kerberos] Cross-realm authentication fails, due to nameType problem
+ * @compile -XDignore.symbol.file PrincipalNameEquals.java
+ * @run main/othervm PrincipalNameEquals
+ */
+
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.PrincipalName;
+
+public class PrincipalNameEquals {
+
+    public static void main(String[] args) throws Exception {
+
+        OneKDC kdc = new OneKDC(null);
+        kdc.writeJAASConf();
+        kdc.setOption(KDC.Option.RESP_NT, PrincipalName.KRB_NT_PRINCIPAL);
+
+        Context c, s;
+        c = Context.fromJAAS("client");
+        s = Context.fromJAAS("server");
+
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+        Context.handshake(c, s);
+
+        Context.transmit("i say high --", c, s);
+        Context.transmit("   you say low", s, c);
+
+        s.dispose();
+        c.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java	Wed Aug 17 22:47:49 2011 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6670868
+ * @summary StackOverFlow with bad authenticated Proxy tunnels
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Authenticator;
+import java.net.Proxy;
+import java.net.InetSocketAddress;
+import java.net.PasswordAuthentication;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URL;
+import javax.net.ssl.HttpsURLConnection;
+
+public class HttpsProxyStackOverflow {
+
+    public static void main(String[] args) throws IOException {
+        BadAuthProxyServer server = startServer();
+        doClient(server);
+    }
+
+    static void doClient(BadAuthProxyServer server) throws IOException {
+        // url doesn't matter since we will never make the connection
+        URL url = new URL("https://anythingwilldo/");
+        HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(
+                      new Proxy(Proxy.Type.HTTP,
+                      new InetSocketAddress("localhost", server.getPort())));
+        try (InputStream is = conn.getInputStream()) {
+        } catch(IOException unused) {
+            // no real server, IOException is expected.
+            // failure if StackOverflowError
+        } finally {
+            server.done();
+        }
+    }
+
+    static BadAuthProxyServer startServer() throws IOException {
+        Authenticator.setDefault(new Authenticator() {
+            @Override
+            protected PasswordAuthentication getPasswordAuthentication() {
+                return new PasswordAuthentication("xyz", "xyz".toCharArray());
+            }
+            });
+
+        BadAuthProxyServer server = new BadAuthProxyServer(new ServerSocket(0));
+        Thread serverThread = new Thread(server);
+        serverThread.start();
+        return server;
+    }
+
+    static class BadAuthProxyServer implements Runnable {
+        private ServerSocket ss;
+        private boolean done;
+
+        BadAuthProxyServer(ServerSocket ss) { this.ss = ss; }
+
+        public void run() {
+            try {
+               while (!done) {
+                    Socket s = ss.accept();
+                    s.getOutputStream().write(
+                            ("HTTP/1.1 407\nProxy-Authenticate:Basic " +
+                            "realm=\"WallyWorld\"\n\n").getBytes("US-ASCII"));
+
+                    s.close();
+
+                    s = ss.accept();
+                    s.close();
+                }
+            } catch (IOException e) {
+                // Ignore IOException when the main thread calls done
+            } finally {
+                try { ss.close(); } catch (IOException e) {}
+            }
+        }
+
+        int getPort() {
+            return ss.getLocalPort();
+        }
+
+        void done() {
+            try { ss.close(); } catch (IOException e) {}
+            done = true;
+        }
+    }
+}
+
--- a/test/sun/security/tools/keytool/KeyToolTest.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/security/tools/keytool/KeyToolTest.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1278,52 +1278,58 @@
     }
 
     public static void main(String[] args) throws Exception {
-        // first test if HumanInputStream really acts like a human being
-        HumanInputStream.test();
-        KeyToolTest t = new KeyToolTest();
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            // first test if HumanInputStream really acts like a human being
+            HumanInputStream.test();
+            KeyToolTest t = new KeyToolTest();
 
-        if (System.getProperty("file") != null) {
-            t.sqeTest();
-            t.testAll();
-            t.i18nTest();
-            t.v3extTest("RSA");
-            t.v3extTest("DSA");
-            boolean testEC = true;
-            try {
-                KeyPairGenerator.getInstance("EC");
-            } catch (NoSuchAlgorithmException nae) {
-                testEC = false;
+            if (System.getProperty("file") != null) {
+                t.sqeTest();
+                t.testAll();
+                t.i18nTest();
+                t.v3extTest("RSA");
+                t.v3extTest("DSA");
+                boolean testEC = true;
+                try {
+                    KeyPairGenerator.getInstance("EC");
+                } catch (NoSuchAlgorithmException nae) {
+                    testEC = false;
+                }
+                if (testEC) t.v3extTest("EC");
             }
-            if (testEC) t.v3extTest("EC");
-        }
 
-        if (System.getProperty("nss") != null) {
-            t.srcP11Arg = NSS_SRC_P11_ARG;
-            t.p11Arg = NSS_P11_ARG;
+            if (System.getProperty("nss") != null) {
+                t.srcP11Arg = NSS_SRC_P11_ARG;
+                t.p11Arg = NSS_P11_ARG;
 
-            t.testPKCS11();
+                t.testPKCS11();
+
+                // FAIL:
+                // 1. we still don't have srcprovidername yet
+                // 2. cannot store privatekey into NSS keystore
+                //    java.security.KeyStoreException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE.
+                //t.testPKCS11ImportKeyStore();
+
+                t.i18nPKCS11Test();
+                //FAIL: currently PKCS11-NSS does not support 2 NSS KeyStores to be loaded at the same time
+                //t.sszzTest();
+            }
 
-            // FAIL:
-            // 1. we still don't have srcprovidername yet
-            // 2. cannot store privatekey into NSS keystore
-            //    java.security.KeyStoreException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE.
-            //t.testPKCS11ImportKeyStore();
+            if (System.getProperty("solaris") != null) {
+                // For Solaris Cryptography Framework
+                t.srcP11Arg = SUN_SRC_P11_ARG;
+                t.p11Arg = SUN_P11_ARG;
+                t.testPKCS11();
+                t.testPKCS11ImportKeyStore();
+                t.i18nPKCS11Test();
+            }
 
-            t.i18nPKCS11Test();
-            //FAIL: currently PKCS11-NSS does not support 2 NSS KeyStores to be loaded at the same time
-            //t.sszzTest();
+            System.out.println("Test pass!!!");
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
-
-        if (System.getProperty("solaris") != null) {
-            // For Solaris Cryptography Framework
-            t.srcP11Arg = SUN_SRC_P11_ARG;
-            t.p11Arg = SUN_P11_ARG;
-            t.testPKCS11();
-            t.testPKCS11ImportKeyStore();
-            t.i18nPKCS11Test();
-        }
-
-        System.out.println("Test pass!!!");
     }
 }
 
--- a/test/sun/text/resources/Collator/Bug4248694.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/text/resources/Collator/Bug4248694.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,43 +35,49 @@
   /********************************************************
   *********************************************************/
   public static void main (String[] args) {
-      int errors=0;
+      Locale reservedLocale = Locale.getDefault();
+      try {
+          int errors=0;
 
-      Locale loc = new Locale ("is", "is");   // Icelandic
+          Locale loc = new Locale ("is", "is");   // Icelandic
 
-      Locale.setDefault (loc);
-      Collator col = Collator.getInstance ();
+          Locale.setDefault (loc);
+          Collator col = Collator.getInstance ();
 
-      String[] data = {"\u00e6ard",
-                       "Zard",
-                       "aard",
-                       "\u00feard",
-                       "vird",
-                       "\u00c6ard",
-                       "Zerd",
-                       "\u00deard"};
+          String[] data = {"\u00e6ard",
+                           "Zard",
+                           "aard",
+                           "\u00feard",
+                           "vird",
+                           "\u00c6ard",
+                           "Zerd",
+                           "\u00deard"};
 
-      String[] sortedData = {"aard",
-                             "vird",
-                             "Zard",
-                             "Zerd",
-                             "\u00feard",
-                             "\u00deard",
-                             "\u00e6ard",
-                             "\u00c6ard"};
+          String[] sortedData = {"aard",
+                                 "vird",
+                                 "Zard",
+                                 "Zerd",
+                                 "\u00feard",
+                                 "\u00deard",
+                                 "\u00e6ard",
+                                 "\u00c6ard"};
 
-      Arrays.sort (data, col);
+          Arrays.sort (data, col);
 
-      System.out.println ("Using " + loc.getDisplayName());
-      for (int i = 0;  i < data.length;  i++) {
-          System.out.println(data[i] + "  :  " + sortedData[i]);
-          if (sortedData[i].compareTo(data[i]) != 0) {
-              errors++;
-          }
-      }//end for
+          System.out.println ("Using " + loc.getDisplayName());
+          for (int i = 0;  i < data.length;  i++) {
+              System.out.println(data[i] + "  :  " + sortedData[i]);
+              if (sortedData[i].compareTo(data[i]) != 0) {
+                  errors++;
+              }
+          }//end for
 
-      if (errors > 0)
-          throw new RuntimeException();
+          if (errors > 0)
+              throw new RuntimeException();
+      } finally {
+          // restore the reserved locale
+          Locale.setDefault(reservedLocale);
+      }
   }//end main
 
 }//end class CollatorTest
--- a/test/sun/text/resources/Collator/Bug4804273.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/text/resources/Collator/Bug4804273.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,82 +35,89 @@
   /********************************************************
   *********************************************************/
   public static void main (String[] args) {
-      int errors=0;
+      Locale reservedLocale = Locale.getDefault();
+      try {
+        int errors=0;
 
-      Locale loc = new Locale ("sv", "se");   // Swedish
+        Locale loc = new Locale ("sv", "se");   // Swedish
 
-      Locale.setDefault (loc);
-      Collator col = Collator.getInstance ();
+        Locale.setDefault (loc);
+        Collator col = Collator.getInstance ();
 
-      String[] data = {"A",
-                       "Aa",
-                       "Ae",
-                       "B",
-                       "Y",
-                       "U\u0308", // U-umlaut
-                       "Z",
-                       "A\u030a", // A-ring
-                       "A\u0308", // A-umlaut
-                       "\u00c6", // AE ligature
-                       "O\u0308", // O-umlaut
-                       "a\u030b", // a-double-acute
-                       "\u00d8", // O-stroke
-                       "a",
-                       "aa",
-                       "ae",
-                       "b",
-                       "y",
-                       "u\u0308", // u-umlaut
-                       "z",
-                       "A\u030b", // A-double-acute
-                       "a\u030a", // a-ring
-                       "a\u0308", // a-umlaut
-                       "\u00e6", // ae ligature
-                       "o\u0308", // o-umlaut
-                       "\u00f8", // o-stroke
-      };
+        String[] data = {"A",
+                         "Aa",
+                         "Ae",
+                         "B",
+                         "Y",
+                         "U\u0308", // U-umlaut
+                         "Z",
+                         "A\u030a", // A-ring
+                         "A\u0308", // A-umlaut
+                         "\u00c6", // AE ligature
+                         "O\u0308", // O-umlaut
+                         "a\u030b", // a-double-acute
+                         "\u00d8", // O-stroke
+                         "a",
+                         "aa",
+                         "ae",
+                         "b",
+                         "y",
+                         "u\u0308", // u-umlaut
+                         "z",
+                         "A\u030b", // A-double-acute
+                         "a\u030a", // a-ring
+                         "a\u0308", // a-umlaut
+                         "\u00e6", // ae ligature
+                         "o\u0308", // o-umlaut
+                         "\u00f8", // o-stroke
+        };
 
 
-      String[] sortedData = {"a",
-                             "A",
-                             "aa",
-                             "Aa",
-                             "ae",
-                             "Ae",
-                             "b",
-                             "B",
-                             "y",
-                             "Y",
-                             "u\u0308", // o-umlaut
-                             "U\u0308", // o-umlaut
-                             "z",
-                             "Z",
-                             "a\u030a", // a-ring
-                             "A\u030a", // A-ring
-                             "a\u0308", // a-umlaut
-                             "A\u0308", // A-umlaut
-                             "a\u030b", // a-double-acute
-                             "A\u030b", // A-double-acute
-                             "\u00e6", // ae ligature
-                             "\u00c6", // AE ligature
-                             "o\u0308", // o-umlaut
-                             "O\u0308", // O-umlaut
-                             "\u00f8", // o-stroke
-                             "\u00d8", // O-stroke
-      };
+        String[] sortedData = {"a",
+                               "A",
+                               "aa",
+                               "Aa",
+                               "ae",
+                               "Ae",
+                               "b",
+                               "B",
+                               "y",
+                               "Y",
+                               "u\u0308", // o-umlaut
+                               "U\u0308", // o-umlaut
+                               "z",
+                               "Z",
+                               "a\u030a", // a-ring
+                               "A\u030a", // A-ring
+                               "a\u0308", // a-umlaut
+                               "A\u0308", // A-umlaut
+                               "a\u030b", // a-double-acute
+                               "A\u030b", // A-double-acute
+                               "\u00e6", // ae ligature
+                               "\u00c6", // AE ligature
+                               "o\u0308", // o-umlaut
+                               "O\u0308", // O-umlaut
+                               "\u00f8", // o-stroke
+                               "\u00d8", // O-stroke
+        };
 
-      Arrays.sort (data, col);
+        Arrays.sort (data, col);
 
-      System.out.println ("Using " + loc.getDisplayName());
-      for (int i = 0;  i < data.length;  i++) {
-          System.out.println(data[i] + "  :  " + sortedData[i]);
-          if (sortedData[i].compareTo(data[i]) != 0) {
-              errors++;
-          }
-      }//end for
+        System.out.println ("Using " + loc.getDisplayName());
+        for (int i = 0;  i < data.length;  i++) {
+            System.out.println(data[i] + "  :  " + sortedData[i]);
+            if (sortedData[i].compareTo(data[i]) != 0) {
+                errors++;
+            }
+        }//end for
 
-      if (errors > 0)
-          throw new RuntimeException("There are " + errors + " words sorted incorrectly!");
+        if (errors > 0)
+            throw new RuntimeException("There are " + errors +
+                        " words sorted incorrectly!");
+      } finally {
+          // restore the reserved locale
+          Locale.setDefault(reservedLocale);
+      }
   }//end main
 
 }//end class CollatorTest
--- a/test/sun/text/resources/Collator/Bug4848897.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/text/resources/Collator/Bug4848897.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,39 +35,44 @@
   /********************************************************
   *********************************************************/
   public static void main (String[] args) {
-
-      int errors=0;
-      Locale loc = new Locale ("no", "NO");   // Norwegian
-
-      Locale.setDefault (loc);
-      Collator col = Collator.getInstance ();
+      Locale reservedLocale = Locale.getDefault();
+      try {
+          int errors=0;
+          Locale loc = new Locale ("no", "NO");   // Norwegian
 
-      String[] data = {"wird",
-                       "vird",
-                       "verd",
-                       "werd",
-                       "vard",
-                       "ward"};
+          Locale.setDefault (loc);
+          Collator col = Collator.getInstance ();
+
+          String[] data = {"wird",
+                           "vird",
+                           "verd",
+                           "werd",
+                           "vard",
+                           "ward"};
 
-      String[] sortedData = {"vard",
-                             "verd",
-                             "vird",
-                             "ward",
-                             "werd",
-                             "wird"};
+          String[] sortedData = {"vard",
+                                 "verd",
+                                 "vird",
+                                 "ward",
+                                 "werd",
+                                 "wird"};
 
-      Arrays.sort (data, col);
+          Arrays.sort (data, col);
 
-      System.out.println ("Using " + loc.getDisplayName());
-      for (int i = 0;  i < data.length;  i++) {
-          System.out.println(data[i] + "  :  " + sortedData[i]);
-          if (sortedData[i].compareTo(data[i]) != 0) {
-              errors++;
-          }
-      }//end for
+          System.out.println ("Using " + loc.getDisplayName());
+          for (int i = 0;  i < data.length;  i++) {
+              System.out.println(data[i] + "  :  " + sortedData[i]);
+              if (sortedData[i].compareTo(data[i]) != 0) {
+                  errors++;
+              }
+          }//end for
 
-      if (errors > 0)
-          throw new RuntimeException();
-  }//end main
+          if (errors > 0)
+              throw new RuntimeException();
+      } finally {
+          // restore the reserved locale
+          Locale.setDefault(reservedLocale);
+      }
+  } // end main
 
 }//end class CollatorTest
--- a/test/sun/text/resources/Format/Bug4651568.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/text/resources/Format/Bug4651568.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,23 +34,29 @@
 public class Bug4651568 {
 
     public static void main (String argv[] )  {
-        String expectedCurrencyPattern = "\u00A4 #.##0,00";
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            String expectedCurrencyPattern = "\u00A4 #.##0,00";
 
-        Locale locale = new Locale ("pt", "BR");
-        Locale.setDefault(locale);
+            Locale locale = new Locale ("pt", "BR");
+            Locale.setDefault(locale);
 
-        DecimalFormat formatter =
-            (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
+            DecimalFormat formatter =
+                (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
 
-        if (formatter.toLocalizedPattern().equals(expectedCurrencyPattern))
-{
-            System.out.println ("Passed.");
-        } else {
-             System.out.println ("Failed Currency pattern." +
-                    "  Expected:  " + expectedCurrencyPattern +
-                    "  Received:  " + formatter.toLocalizedPattern() );
-             throw new RuntimeException();
+            if (formatter.toLocalizedPattern().equals(
+                        expectedCurrencyPattern)) {
+                System.out.println ("Passed.");
+            } else {
+                 System.out.println ("Failed Currency pattern." +
+                        "  Expected:  " + expectedCurrencyPattern +
+                        "  Received:  " + formatter.toLocalizedPattern() );
+                 throw new RuntimeException();
 
- }
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
 }
--- a/test/sun/util/resources/Locale/Bug4965260.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/util/resources/Locale/Bug4965260.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,49 +30,55 @@
 
 public class Bug4965260  {
 
-  // Define supported locales
-  static Locale[] locales2Test = new Locale[] {
-    new Locale("de"),
-    new Locale("es"),
-    new Locale("fr"),
-    new Locale("it"),
-    new Locale("sv")
-  };
+    // Define supported locales
+    static Locale[] locales2Test = new Locale[] {
+        new Locale("de"),
+        new Locale("es"),
+        new Locale("fr"),
+        new Locale("it"),
+        new Locale("sv")
+    };
 
-  static String[] expectedNames = new String[] {
-    "Niederl\u00e4ndisch",
-    "neerland\u00e9s",
-    "n\u00e9erlandais",
-    "neerlandese",
-    "nederl\u00e4ndska"
-  };
+    static String[] expectedNames = new String[] {
+        "Niederl\u00e4ndisch",
+        "neerland\u00e9s",
+        "n\u00e9erlandais",
+        "neerlandese",
+        "nederl\u00e4ndska"
+    };
 
-  public static void main(String[] args) throws Exception {
-    Locale.setDefault(Locale.ENGLISH);
-    if (locales2Test.length != expectedNames.length) {
-      throw new Exception("\nData sizes does not match!\n");
-    }
+    public static void main(String[] args) throws Exception {
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(Locale.ENGLISH);
+            if (locales2Test.length != expectedNames.length) {
+                throw new Exception("\nData sizes does not match!\n");
+            }
 
-    StringBuffer message = new StringBuffer("");
-    Locale dutch = new Locale("nl", "BE");
-    String current;
-    for (int i = 0; i < locales2Test.length; i++) {
-      Locale locale = locales2Test[i];
-      current = dutch.getDisplayLanguage(locale);
-      if (!current.equals(expectedNames[i])) {
-        message.append("[");
-        message.append(locale.getDisplayLanguage());
-        message.append("] ");
-        message.append("Language name is ");
-        message.append(current);
-        message.append(" should be ");
-        message.append(expectedNames[i]);
-        message.append("\n");
-      }
+            StringBuffer message = new StringBuffer("");
+            Locale dutch = new Locale("nl", "BE");
+            String current;
+            for (int i = 0; i < locales2Test.length; i++) {
+                Locale locale = locales2Test[i];
+                current = dutch.getDisplayLanguage(locale);
+                if (!current.equals(expectedNames[i])) {
+                    message.append("[");
+                    message.append(locale.getDisplayLanguage());
+                    message.append("] ");
+                    message.append("Language name is ");
+                    message.append(current);
+                    message.append(" should be ");
+                    message.append(expectedNames[i]);
+                    message.append("\n");
+                }
+            }
+
+            if (message.length() >0) {
+                throw new Exception("\n" + message.toString());
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
+        }
     }
-
-    if (message.length() >0) {
-      throw new Exception("\n" + message.toString());
-    }
-  }
 }
--- a/test/sun/util/resources/TimeZone/Bug4640234.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/sun/util/resources/TimeZone/Bug4640234.java	Wed Aug 17 22:47:49 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,11 @@
 /**
  * @test
  * @bug 4640234 4946057 4938151 4873691 5023181
- * @summary Verifies the translation of time zone names, this test will catch presence
- *          of country name for english and selected locales for all ISO country
- *          codes.
- *          The test program also displays which timezone, country and language names
- *          are not translated
+ * @summary Verifies the translation of time zone names, this test will catch
+ *          presence of country name for english and selected locales for all
+ *          ISO country codes.
+ *          The test program also displays which timezone, country and
+ *          language names are not translated
  */
 
 
@@ -51,230 +51,242 @@
 
 
 public class Bug4640234  {
-  static SimpleDateFormat sdfEn = new SimpleDateFormat("zzzz", Locale.US);
-  static SimpleDateFormat sdfEnShort = new SimpleDateFormat("z", Locale.US);
-  static Locale locEn = Locale.ENGLISH;
+    static SimpleDateFormat sdfEn = new SimpleDateFormat("zzzz", Locale.US);
+    static SimpleDateFormat sdfEnShort = new SimpleDateFormat("z", Locale.US);
+    static Locale locEn = Locale.ENGLISH;
 
-  static SimpleDateFormat sdfLoc;
-  static SimpleDateFormat sdfLocShort;
-  static Date date = new Date();
+    static SimpleDateFormat sdfLoc;
+    static SimpleDateFormat sdfLocShort;
+    static Date date = new Date();
 
-  // Define supported locales
-  static Locale[] locales2Test = new Locale[] {
-    new Locale("de"),
-    new Locale("es"),
-    new Locale("fr"),
-    new Locale("it"),
-    new Locale("ja"),
-    new Locale("ko"),
-    new Locale("sv"),
-    new Locale("zh", "CN"),
-    new Locale("zh", "TW")
-  };
+    // Define supported locales
+    static Locale[] locales2Test = new Locale[] {
+        new Locale("de"),
+        new Locale("es"),
+        new Locale("fr"),
+        new Locale("it"),
+        new Locale("ja"),
+        new Locale("ko"),
+        new Locale("sv"),
+        new Locale("zh", "CN"),
+        new Locale("zh", "TW")
+    };
 
-  public static void main(String[] args) throws Exception {
-    Locale.setDefault(Locale.ENGLISH);
+    public static void main(String[] args) throws Exception {
+        Locale reservedLocale = Locale.getDefault();
+        try {
+            Locale.setDefault(Locale.ENGLISH);
 
-    StringBuffer errors = new StringBuffer("");
-    StringBuffer warnings = new StringBuffer("");
+            StringBuffer errors = new StringBuffer("");
+            StringBuffer warnings = new StringBuffer("");
 
-    String[] timezones = TimeZone.getAvailableIDs();
-    String[] countries = locEn.getISOCountries();
-    String[] languages = locEn.getISOLanguages();
+            String[] timezones = TimeZone.getAvailableIDs();
+            String[] countries = locEn.getISOCountries();
+            String[] languages = locEn.getISOLanguages();
 
-    ResourceBundle resEn = ResourceBundle.getBundle("sun.util.resources.LocaleNames", locEn);
-    Map<String, String> countryMapEn = getList(resEn, true);
-    Map<String, String> languageMapEn = getList(resEn, false);
+            ResourceBundle resEn = ResourceBundle.getBundle(
+                    "sun.util.resources.LocaleNames", locEn);
+            Map<String, String> countryMapEn = getList(resEn, true);
+            Map<String, String> languageMapEn = getList(resEn, false);
 
-    ResourceBundle resLoc;
-    Map<String, String> countryMap;
-    Map<String, String> languageMap;
+            ResourceBundle resLoc;
+            Map<String, String> countryMap;
+            Map<String, String> languageMap;
 
-    for (Locale locale : locales2Test) {
-      resLoc = ResourceBundle.getBundle("sun.util.resources.LocaleNames", locale);
+            for (Locale locale : locales2Test) {
+                resLoc = ResourceBundle.getBundle(
+                    "sun.util.resources.LocaleNames", locale);
 
-      sdfLoc = new SimpleDateFormat("zzzz", locale);
-      sdfLocShort = new SimpleDateFormat("z", locale);
+                sdfLoc = new SimpleDateFormat("zzzz", locale);
+                sdfLocShort = new SimpleDateFormat("z", locale);
 
-      for (String timezone : timezones) {
-        if (isTZIgnored(timezone)) {
-          continue;
-        }
-        warnings.append(testTZ(timezone, locale));
-      }
+                for (String timezone : timezones) {
+                    if (isTZIgnored(timezone)) {
+                        continue;
+                    }
+                    warnings.append(testTZ(timezone, locale));
+                }
+
+                countryMap = getList(resLoc, true);
 
-      countryMap = getList(resLoc, true);
+                for (String country : countries) {
+                    String[] result = testEntry(country,
+                        countryMapEn,
+                        countryMap,
+                        locale,
+                        "ERROR: {0} country name for country code: {1} not found!\n",
+                        "WARNING: {0} country name for country code: {1} not localized!\n"
+                    );
+                    if (warnings.indexOf(result[0]) == -1) {
+                        warnings.append(result[0]);
+                    }
+                    if (errors.indexOf(result[1]) == -1) {
+                        errors.append(result[1]);
+                    }
+                }
 
-      for (String country : countries) {
-        String[] result = testEntry(country,
-          countryMapEn,
-          countryMap,
-          locale,
-          "ERROR: {0} country name for country code: {1} not found!\n",
-          "WARNING: {0} country name for country code: {1} not localized!\n"
-        );
-        if (warnings.indexOf(result[0]) == -1) {
-          warnings.append(result[0]);
-        }
-        if (errors.indexOf(result[1]) == -1) {
-          errors.append(result[1]);
+                languageMap = getList(resLoc, false);
+                for (String language : languages) {
+                    String[] result = testEntry(language,
+                        languageMapEn,
+                        languageMap,
+                        locale,
+                        "ERROR: {0} language name for language code: {1} not found!\n",
+                        "WARNING: {0} language name for language code: {1} not localized!\n");
+                    if (warnings.indexOf(result[0]) == -1) {
+                        warnings.append(result[0]);
+                    }
+                    if (errors.indexOf(result[1]) == -1) {
+                        errors.append(result[1]);
+                    }
+                }
+            }
+
+            StringBuffer message = new StringBuffer("");
+            if (!"".equals(errors.toString())) {
+                message.append("Test failed! ");
+                message.append("ERROR: some keys are missing! ");
+            }
+
+            if ("".equals(message.toString())) {
+                System.out.println("\nTest passed");
+                System.out.println(warnings.toString());
+            } else {
+                System.out.println("\nTest failed!");
+                System.out.println(errors.toString());
+                System.out.println(warnings.toString());
+                throw new Exception("\n" + message);
+            }
+        } finally {
+            // restore the reserved locale
+            Locale.setDefault(reservedLocale);
         }
-      }
-
-      languageMap = getList(resLoc, false);
-      for (String language : languages) {
-        String[] result = testEntry(language,
-          languageMapEn,
-          languageMap,
-          locale,
-          "ERROR: {0} language name for language code: {1} not found!\n",
-          "WARNING: {0} language name for language code: {1} not localized!\n");
-        if (warnings.indexOf(result[0]) == -1) {
-          warnings.append(result[0]);
-        }
-        if (errors.indexOf(result[1]) == -1) {
-          errors.append(result[1]);
-        }
-      }
-    }
-
-    StringBuffer message = new StringBuffer("");
-    if (!"".equals(errors.toString())) {
-      message.append("Test failed! ");
-      message.append("ERROR: some keys are missing! ");
     }
 
-    if ("".equals(message.toString())) {
-      System.out.println("\nTest passed");
-      System.out.println(warnings.toString());
-    } else {
-      System.out.println("\nTest failed!");
-      System.out.println(errors.toString());
-      System.out.println(warnings.toString());
-      throw new Exception("\n" + message);
-    }
-  }
+    /**
+    * Compares the english timezone name and timezone name in specified locale
+    * @param timeZoneName - name of the timezone to compare
+    * @param locale - locale to test against english
+    * @return empty string when passed, descriptive error message in other cases
+    */
+    private static String testTZ(String timeZoneName, Locale locale) {
+        StringBuffer timeZoneResult = new StringBuffer("");
+        TimeZone tz = TimeZone.getTimeZone(timeZoneName);
+        sdfEn.setTimeZone(tz);
+        sdfEnShort.setTimeZone(tz);
+        sdfLoc.setTimeZone(tz);
+        sdfLocShort.setTimeZone(tz);
+
+        String en, enShort, loc, locShort;
+        en = sdfEn.format(date);
+        enShort = sdfEnShort.format(date);
+        loc = sdfLoc.format(date);
+        locShort = sdfLocShort.format(date);
+
+        String displayLanguage = locale.getDisplayLanguage();
+        String displayCountry = locale.getDisplayCountry();
 
-  /**
-  * Compares the english timezone name and timezone name in specified locale
-  * @param timeZoneName - name of the timezone to compare
-  * @param locale - locale to test against english
-  * @return empty string when passed, descriptive error message in other cases
-  */
-  private static String testTZ(String timeZoneName, Locale locale) {
-    StringBuffer timeZoneResult = new StringBuffer("");
-    TimeZone tz = TimeZone.getTimeZone(timeZoneName);
-    sdfEn.setTimeZone(tz);
-    sdfEnShort.setTimeZone(tz);
-    sdfLoc.setTimeZone(tz);
-    sdfLocShort.setTimeZone(tz);
+        if (loc.equals(en)) {
+            timeZoneResult.append("[");
+            timeZoneResult.append(displayLanguage);
+            if (!"".equals(displayCountry)) {
+                timeZoneResult.append(" ");
+                timeZoneResult.append(displayCountry);
+            }
+            timeZoneResult.append("] timezone \"");
+            timeZoneResult.append(timeZoneName);
+            timeZoneResult.append("\" long name \"" + en);
+            timeZoneResult.append("\" not localized!\n");
+        }
 
-    String en, enShort, loc, locShort;
-    en = sdfEn.format(date);
-    enShort = sdfEnShort.format(date);
-    loc = sdfLoc.format(date);
-    locShort = sdfLocShort.format(date);
-
-    String displayLanguage = locale.getDisplayLanguage();
-    String displayCountry = locale.getDisplayCountry();
-
-    if (loc.equals(en)) {
-      timeZoneResult.append("[");
-      timeZoneResult.append(displayLanguage);
-      if (!"".equals(displayCountry)) {
-        timeZoneResult.append(" ");
-        timeZoneResult.append(displayCountry);
-      }
-      timeZoneResult.append("] timezone \"");
-      timeZoneResult.append(timeZoneName);
-      timeZoneResult.append("\" long name \"" + en);
-      timeZoneResult.append("\" not localized!\n");
+        if (!locShort.equals(enShort)) {
+            timeZoneResult.append("[");
+            timeZoneResult.append(displayLanguage);
+            if (!"".equals(displayCountry)) {
+                timeZoneResult.append(" ");
+                timeZoneResult.append(displayCountry);
+            }
+            timeZoneResult.append("] timezone \"");
+            timeZoneResult.append(timeZoneName);
+            timeZoneResult.append("\" short name \"" + enShort);
+            timeZoneResult.append("\" is localized \"");
+            timeZoneResult.append(locShort);
+            timeZoneResult.append("\"!\n");
+        }
+        return timeZoneResult.toString();
     }
 
-    if (!locShort.equals(enShort)) {
-      timeZoneResult.append("[");
-      timeZoneResult.append(displayLanguage);
-      if (!"".equals(displayCountry)) {
-        timeZoneResult.append(" ");
-        timeZoneResult.append(displayCountry);
-      }
-      timeZoneResult.append("] timezone \"");
-      timeZoneResult.append(timeZoneName);
-      timeZoneResult.append("\" short name \"" + enShort);
-      timeZoneResult.append("\" is localized \"");
-      timeZoneResult.append(locShort);
-      timeZoneResult.append("\"!\n");
-    }
-    return timeZoneResult.toString();
-  }
+    /**
+    * Verifies whether the name for ISOCode is localized.
+    * @param ISOCode - ISO country/language code for country/language name
+    *      to test
+    * @param entriesEn - array of english country/language names
+    * @param entriesLoc - array of localized country/language names for
+    *      specified locale
+    * @param locale - locale to test against english
+    * @param notFoundMessage - message in form ready for MessageFormat,
+    *      {0} will be human readable language name, {1} will be ISOCode.
+    * @param notLocalizedMessage - message in for ready for MessageFormat,
+    *      same formatting like for notFountMessage
+    * @return array of two empty strings when passed, descriptive error message
+    *      in other cases, [0] - warnings for not localized, [1] - errors for
+    *      missing keys.
+    */
+    private static String[] testEntry(String ISOCode,
+                Map<String, String> entriesEn,
+                Map<String, String> entriesLoc,
+                Locale locale,
+                String notFoundMessage,
+                String notLocalizedMessage) {
+        String nameEn = null;
+        String nameLoc = null;
 
-  /**
-  * Verifies whether the name for ISOCode is localized.
-  * @param ISOCode - ISO country/language code for country/language name to test
-  * @param entriesEn - array of english country/language names
-  * @param entriesLoc - array of localized country/language names for specified locale
-  * @param locale - locale to test against english
-  * @param notFoundMessage - message in form ready for MessageFormat, {0} will be human readable
-  *                          language name, {1} will be ISOCode.
-  * @param notLocalizedMessage - message in for ready for MessageFormat, same formatting like
-  *                              for notFountMessage
-  * @return array of two empty strings when passed, descriptive error message in
-  *         other cases, [0] - warnings for not localized, [1] - errors for missing keys.
-  */
-  private static String[] testEntry(String ISOCode,
-                                    Map<String, String> entriesEn,
-                                    Map<String, String> entriesLoc,
-                                    Locale locale,
-                                    String notFoundMessage,
-                                    String notLocalizedMessage) {
-    String nameEn = null;
-    String nameLoc = null;
+        for (String key: entriesEn.keySet()) {
+            if (ISOCode.equalsIgnoreCase(key)) {
+                nameEn = entriesEn.get(key);
+                break;
+            }
+        }
+
+        for (String key: entriesLoc.keySet()) {
+            if (ISOCode.equalsIgnoreCase(key)) {
+                nameLoc = entriesLoc.get(key);
+                break;
+            }
+        }
 
-    for (String key: entriesEn.keySet()) {
-      if (ISOCode.equalsIgnoreCase(key)) {
-        nameEn = entriesEn.get(key);
-        break;
-      }
+        if (nameEn == null) {
+            // We should not get here but test is a MUST have
+            return new String[] {"", MessageFormat.format(notFoundMessage,
+                new String[] {"English", ISOCode})};
+        }
+
+        if (nameLoc == null) {
+            return new String[] {"", MessageFormat.format(notFoundMessage,
+                new String[] {locale.getDisplayName(), ISOCode})};
+        }
+
+        if (nameEn.equals(nameLoc)) {
+            return new String[] {MessageFormat.format(notLocalizedMessage,
+                new String[] {locale.getDisplayName(), ISOCode}), ""};
+        }
+
+        return new String[] {"", ""};
     }
 
-    for (String key: entriesLoc.keySet()) {
-      if (ISOCode.equalsIgnoreCase(key)) {
-        nameLoc = entriesLoc.get(key);
-        break;
-      }
-    }
-
-    if (nameEn == null) {
-      // We should not get here but test is a MUST have
-      return new String[] {"", MessageFormat.format(notFoundMessage,
-        new String[] {"English", ISOCode})};
-    }
-
-    if (nameLoc == null) {
-      return new String[] {"", MessageFormat.format(notFoundMessage,
-        new String[] {locale.getDisplayName(), ISOCode})};
+    private static boolean isTZIgnored(String TZName) {
+        if (TZName.startsWith("Etc/GMT") ||
+                TZName.indexOf("Riyadh8") != -1 ||
+                TZName.equals("GMT0") ||
+                TZName.equals("MET")
+                ) {
+            return true;
+        }
+        return false;
     }
 
-    if (nameEn.equals(nameLoc)) {
-      return new String[] {MessageFormat.format(notLocalizedMessage,
-        new String[] {locale.getDisplayName(), ISOCode}), ""};
-    }
-
-    return new String[] {"", ""};
-  }
-
-  private static boolean isTZIgnored(String TZName) {
-    if (TZName.startsWith("Etc/GMT") ||
-        TZName.indexOf("Riyadh8") != -1 ||
-        TZName.equals("GMT0") ||
-        TZName.equals("MET")
-        ) {
-      return true;
-    }
-    return false;
-  }
-
-    private static Map<String, String> getList(ResourceBundle rs, Boolean getCountryList) {
+    private static Map<String, String> getList(
+            ResourceBundle rs, Boolean getCountryList) {
         char beginChar = 'a';
         char endChar = 'z';
         if (getCountryList) {
--- a/test/tools/launcher/Arrrghs.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/tools/launcher/Arrrghs.java	Wed Aug 17 22:47:49 2011 -0700
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938
- *      6894719 6968053
+ *      6894719 6968053 7067922
  * @summary Argument parsing validation.
  * @compile -XDignore.symbol.file Arrrghs.java TestHelper.java
  * @run main Arrrghs
@@ -362,6 +362,16 @@
         tr.checkPositive();
         System.out.println(tr);
     }
+
+    static void test7067922() {
+        // a missing manifest entry 7067922
+        TestHelper.TestResult tr = null;
+        TestHelper.createJar("cvf", "missingmainentry.jar", ".");
+        tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "missingmainentry.jar");
+        tr.contains("no main manifest attribute");
+        System.out.println(tr);
+    }
+
     /**
      * @param args the command line arguments
      * @throws java.io.FileNotFoundException
@@ -374,6 +384,7 @@
         runBasicErrorMessageTests();
         runMainMethodTests();
         test6894719();
+        test7067922();
         runDiagOptionTests();
         if (TestHelper.testExitValue > 0) {
             System.out.println("Total of " + TestHelper.testExitValue + " failed");
--- a/test/tools/launcher/TestHelper.java	Fri Aug 12 09:48:09 2011 -0700
+++ b/test/tools/launcher/TestHelper.java	Wed Aug 17 22:47:49 2011 -0700
@@ -171,15 +171,15 @@
         if (jarName.exists()) {
             jarName.delete();
         }
-        PrintStream ps = new PrintStream(new FileOutputStream(mainClass + ".java"));
-        ps.println("public class Foo {");
-        if (mainDefs != null) {
-            for (String x : mainDefs) {
-                ps.println(x);
+        try (PrintStream ps = new PrintStream(new FileOutputStream(mainClass + ".java"))) {
+            ps.println("public class Foo {");
+            if (mainDefs != null) {
+                for (String x : mainDefs) {
+                    ps.println(x);
+                }
             }
+            ps.println("}");
         }
-        ps.println("}");
-        ps.close();
 
         String compileArgs[] = {
             mainClass + ".java"
@@ -196,12 +196,20 @@
             mEntry,
             mainClass.getName() + ".class"
         };
+        createJar(jarArgs);
+    }
+
+   static void createJar(String... args) {
         sun.tools.jar.Main jarTool =
                 new sun.tools.jar.Main(System.out, System.err, "JarCreator");
-        if (!jarTool.run(jarArgs)) {
-            throw new RuntimeException("jar creation failed " + jarName);
+        if (!jarTool.run(args)) {
+            String message = "jar creation failed with command:";
+            for (String x : args) {
+                message = message.concat(" " + x);
+            }
+            throw new RuntimeException(message);
         }
-    }
+   }
 
    static void copyFile(File src, File dst) throws IOException {
         Path parent = dst.toPath().getParent();