1.1 --- a/make/com/sun/java/pack/Makefile Fri Aug 05 15:35:04 2011 -0700
1.2 +++ b/make/com/sun/java/pack/Makefile Tue Aug 09 17:38:52 2011 -0700
1.3 @@ -32,6 +32,8 @@
1.4 LIBRARY = unpack
1.5 PRODUCT = sun
1.6 PGRM = unpack200
1.7 +JAVAC_MAX_WARNINGS=true
1.8 +JAVAC_WARNINGS_FATAL=true
1.9 include $(BUILDDIR)/common/Defs.gmk
1.10
1.11 CPLUSPLUSLIBRARY=true
2.1 --- a/make/com/sun/nio/Makefile Fri Aug 05 15:35:04 2011 -0700
2.2 +++ b/make/com/sun/nio/Makefile Tue Aug 09 17:38:52 2011 -0700
2.3 @@ -1,5 +1,5 @@
2.4 #
2.5 -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
2.6 +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
2.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2.8 #
2.9 # This code is free software; you can redistribute it and/or modify it
2.10 @@ -28,6 +28,8 @@
2.11 #
2.12
2.13 BUILDDIR = ../../..
2.14 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
2.15 +SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
2.16 include $(BUILDDIR)/common/Defs.gmk
2.17
2.18 SUBDIRS = sctp
3.1 --- a/make/com/sun/nio/sctp/Makefile Fri Aug 05 15:35:04 2011 -0700
3.2 +++ b/make/com/sun/nio/sctp/Makefile Tue Aug 09 17:38:52 2011 -0700
3.3 @@ -31,7 +31,6 @@
3.4 PACKAGE = com.sun.nio.sctp
3.5 LIBRARY = sctp
3.6 PRODUCT = sun
3.7 -#OTHER_JAVACFLAGS += -Xmaxwarns 1000 -Xlint
3.8 include $(BUILDDIR)/common/Defs.gmk
3.9
3.10 #
4.1 --- a/make/common/shared/Defs-java.gmk Fri Aug 05 15:35:04 2011 -0700
4.2 +++ b/make/common/shared/Defs-java.gmk Tue Aug 09 17:38:52 2011 -0700
4.3 @@ -116,12 +116,17 @@
4.4 JAVACFLAGS += -g
4.5 endif
4.6 ifeq ($(JAVAC_MAX_WARNINGS), true)
4.7 - JAVACFLAGS += -Xlint:all
4.8 + JAVAC_LINT_OPTIONS += -Xlint:all
4.9 endif
4.10 ifeq ($(JAVAC_WARNINGS_FATAL), true)
4.11 JAVACFLAGS += -Werror
4.12 endif
4.13
4.14 +# TODO: Workaround for CR 7063027. Remove -path eventually.
4.15 +JAVAC_LINT_OPTIONS += -Xlint:-path
4.16 +
4.17 +JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
4.18 +
4.19 #
4.20 # Some licensees do not get the Security Source bundles. We will
4.21 # fall back on the prebuilt jce.jar so that we can do a best
4.22 @@ -211,16 +216,12 @@
4.23 # The javac options supplied to the boot javac is limited. This compiler
4.24 # should only be used to build the 'make/tools' sources, which are not
4.25 # class files that end up in the classes directory.
4.26 -ifeq ($(JAVAC_MAX_WARNINGS), true)
4.27 - BOOT_JAVACFLAGS += -Xlint:all
4.28 -endif
4.29 +BOOT_JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
4.30 ifeq ($(JAVAC_WARNINGS_FATAL), true)
4.31 BOOT_JAVACFLAGS += -Werror
4.32 endif
4.33
4.34 -BOOT_SOURCE_LANGUAGE_VERSION = 6
4.35 -BOOT_TARGET_CLASS_VERSION = 6
4.36 -BOOT_JAVACFLAGS += -encoding ascii -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
4.37 +BOOT_JAVACFLAGS += -encoding ascii
4.38 BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
4.39
4.40 BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
5.1 --- a/make/common/shared/Defs-versions.gmk Fri Aug 05 15:35:04 2011 -0700
5.2 +++ b/make/common/shared/Defs-versions.gmk Tue Aug 09 17:38:52 2011 -0700
5.3 @@ -191,7 +191,7 @@
5.4
5.5 # Generic
5.6 REQUIRED_ANT_VER = 1.7.1
5.7 -REQUIRED_BOOT_VER = 1.6
5.8 +REQUIRED_BOOT_VER = 1.7
5.9 REQUIRED_FREETYPE_VERSION = 2.3.0
5.10 REQUIRED_MAKE_VER = 3.81
5.11 REQUIRED_UNZIP_VER = 5.12
6.1 --- a/make/java/fdlibm/FILES_c.gmk Fri Aug 05 15:35:04 2011 -0700
6.2 +++ b/make/java/fdlibm/FILES_c.gmk Tue Aug 09 17:38:52 2011 -0700
6.3 @@ -30,21 +30,13 @@
6.4 k_sin.c \
6.5 k_tan.c \
6.6 e_acos.c \
6.7 - e_acosh.c \
6.8 e_asin.c \
6.9 e_atan2.c \
6.10 e_atanh.c \
6.11 e_cosh.c \
6.12 e_exp.c \
6.13 e_fmod.c \
6.14 - e_gamma.c \
6.15 - e_gamma_r.c \
6.16 e_hypot.c \
6.17 - e_j0.c \
6.18 - e_j1.c \
6.19 - e_jn.c \
6.20 - e_lgamma.c \
6.21 - e_lgamma_r.c \
6.22 e_log.c \
6.23 e_log10.c \
6.24 e_pow.c \
6.25 @@ -54,21 +46,13 @@
6.26 e_sinh.c \
6.27 e_sqrt.c \
6.28 w_acos.c \
6.29 - w_acosh.c \
6.30 w_asin.c \
6.31 w_atan2.c \
6.32 w_atanh.c \
6.33 w_cosh.c \
6.34 w_exp.c \
6.35 w_fmod.c \
6.36 - w_gamma.c \
6.37 - w_gamma_r.c \
6.38 w_hypot.c \
6.39 - w_j0.c \
6.40 - w_j1.c \
6.41 - w_jn.c \
6.42 - w_lgamma.c \
6.43 - w_lgamma_r.c \
6.44 w_log.c \
6.45 w_log10.c \
6.46 w_pow.c \
6.47 @@ -76,13 +60,11 @@
6.48 w_scalb.c \
6.49 w_sinh.c \
6.50 w_sqrt.c \
6.51 - s_asinh.c \
6.52 s_atan.c \
6.53 s_cbrt.c \
6.54 s_ceil.c \
6.55 s_copysign.c \
6.56 s_cos.c \
6.57 - s_erf.c \
6.58 s_expm1.c \
6.59 s_fabs.c \
6.60 s_finite.c \
7.1 --- a/make/java/java/Makefile Fri Aug 05 15:35:04 2011 -0700
7.2 +++ b/make/java/java/Makefile Tue Aug 09 17:38:52 2011 -0700
7.3 @@ -32,6 +32,8 @@
7.4 PACKAGE = java.lang
7.5 LIBRARY = java
7.6 PRODUCT = java
7.7 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
7.8 +SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
7.9 include $(BUILDDIR)/common/Defs.gmk
7.10
7.11 # windows compiler flags
8.1 --- a/make/java/math/Makefile Fri Aug 05 15:35:04 2011 -0700
8.2 +++ b/make/java/math/Makefile Tue Aug 09 17:38:52 2011 -0700
8.3 @@ -1,5 +1,5 @@
8.4 #
8.5 -# Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
8.6 +# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
8.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8.8 #
8.9 # This code is free software; you can redistribute it and/or modify it
8.10 @@ -27,6 +27,8 @@
8.11
8.12 PACKAGE = java.math
8.13 PRODUCT = sun
8.14 +JAVAC_MAX_WARNINGS = true
8.15 +JAVAC_WARNINGS_FATAL = true
8.16 include $(BUILDDIR)/common/Defs.gmk
8.17
8.18 #
9.1 --- a/make/java/nio/Makefile Fri Aug 05 15:35:04 2011 -0700
9.2 +++ b/make/java/nio/Makefile Tue Aug 09 17:38:52 2011 -0700
9.3 @@ -31,7 +31,8 @@
9.4 PACKAGE = java.nio
9.5 LIBRARY = nio
9.6 PRODUCT = java
9.7 -OTHER_JAVACFLAGS += -Xmaxwarns 1000 -Xlint:serial -Werror
9.8 +JAVAC_MAX_WARNINGS = true
9.9 +JAVAC_WARNINGS_FATAL = true
9.10 include $(BUILDDIR)/common/Defs.gmk
9.11
9.12 NIO_SRC = $(SHARE_SRC)/classes/java/nio
10.1 --- a/make/java/sun_nio/Makefile Fri Aug 05 15:35:04 2011 -0700
10.2 +++ b/make/java/sun_nio/Makefile Tue Aug 09 17:38:52 2011 -0700
10.3 @@ -1,5 +1,5 @@
10.4 #
10.5 -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
10.6 +# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
10.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10.8 #
10.9 # This code is free software; you can redistribute it and/or modify it
10.10 @@ -31,7 +31,9 @@
10.11 PACKAGE = sun.nio
10.12 PRODUCT = sun
10.13
10.14 -OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
10.15 +JAVAC_MAX_WARNINGS = false
10.16 +JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
10.17 +JAVAC_WARNINGS_FATAL = true
10.18 include $(BUILDDIR)/common/Defs.gmk
10.19
10.20 #
11.1 --- a/make/jprt.properties Fri Aug 05 15:35:04 2011 -0700
11.2 +++ b/make/jprt.properties Tue Aug 09 17:38:52 2011 -0700
11.3 @@ -25,22 +25,12 @@
11.4
11.5 # Properties for jprt
11.6
11.7 -# At submit time, the release supplied will be in jprt.submit.release
11.8 -# and will be one of the official release names defined in jprt.
11.9 -# jprt supports property value expansion using ${property.name} syntax.
11.10 -
11.11 -# This tells jprt what default release we want to build
11.12 -jprt.tools.default.release=${jprt.submit.release}
11.13 +# Release to build for
11.14 +jprt.tools.default.release=jdk8
11.15
11.16 # The different build flavors we want, we override here so we just get these 2
11.17 jprt.build.flavors=product,fastdebug
11.18
11.19 -# Define the Windows we want (temporary)
11.20 -jprt.my.windows.i586.jdk7b107=windows_i586_5.0
11.21 -jprt.my.windows.i586.jdk7temp=windows_i586_5.0
11.22 -jprt.my.windows.i586.jdk7=windows_i586_5.1
11.23 -jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
11.24 -
11.25 # Standard list of jprt build targets for this source tree
11.26 jprt.build.targets= \
11.27 solaris_sparc_5.10-{product|fastdebug}, \
11.28 @@ -49,7 +39,7 @@
11.29 solaris_x64_5.10-{product|fastdebug}, \
11.30 linux_i586_2.6-{product|fastdebug}, \
11.31 linux_x64_2.6-{product|fastdebug}, \
11.32 - ${jprt.my.windows.i586}-{product|fastdebug}, \
11.33 + windows_i586_5.1-{product|fastdebug}, \
11.34 windows_x64_5.2-{product|fastdebug}
11.35
11.36 # User can select the test set with jprt submit "-testset name" option
11.37 @@ -63,7 +53,7 @@
11.38 solaris_x64_5.10-product-c2-jvm98, \
11.39 linux_i586_2.6-product-{c1|c2}-jvm98, \
11.40 linux_x64_2.6-product-c2-jvm98, \
11.41 - ${jprt.my.windows.i586}-product-c1-jvm98, \
11.42 + windows_i586_5.1-product-c1-jvm98, \
11.43 windows_x64_5.2-product-c2-jvm98
11.44
11.45 # Select vm testlist to use (allow for testset to be empty too)
11.46 @@ -80,7 +70,7 @@
11.47 solaris_x64_5.10-product-c2-jdk_beans1, \
11.48 linux_i586_2.6-product-{c1|c2}-jdk_beans1, \
11.49 linux_x64_2.6-product-c2-jdk_beans1, \
11.50 - ${jprt.my.windows.i586}-product-c1-jdk_beans1, \
11.51 + windows_i586_5.1-product-c1-jdk_beans1, \
11.52 windows_x64_5.2-product-c2-jdk_beans1, \
11.53 \
11.54 solaris_sparc_5.10-product-c1-jdk_io, \
11.55 @@ -89,7 +79,7 @@
11.56 solaris_x64_5.10-product-c2-jdk_io, \
11.57 linux_i586_2.6-product-{c1|c2}-jdk_io, \
11.58 linux_x64_2.6-product-c2-jdk_io, \
11.59 - ${jprt.my.windows.i586}-product-c1-jdk_io, \
11.60 + windows_i586_5.1-product-c1-jdk_io, \
11.61 windows_x64_5.2-product-c2-jdk_io, \
11.62 \
11.63 solaris_sparc_5.10-product-c1-jdk_lang, \
11.64 @@ -98,7 +88,7 @@
11.65 solaris_x64_5.10-product-c2-jdk_lang, \
11.66 linux_i586_2.6-product-{c1|c2}-jdk_lang, \
11.67 linux_x64_2.6-product-c2-jdk_lang, \
11.68 - ${jprt.my.windows.i586}-product-c1-jdk_lang, \
11.69 + windows_i586_5.1-product-c1-jdk_lang, \
11.70 windows_x64_5.2-product-c2-jdk_lang, \
11.71 \
11.72 solaris_sparc_5.10-product-c1-jdk_math, \
11.73 @@ -107,7 +97,7 @@
11.74 solaris_x64_5.10-product-c2-jdk_math, \
11.75 linux_i586_2.6-product-{c1|c2}-jdk_math, \
11.76 linux_x64_2.6-product-c2-jdk_math, \
11.77 - ${jprt.my.windows.i586}-product-c1-jdk_math, \
11.78 + windows_i586_5.1-product-c1-jdk_math, \
11.79 windows_x64_5.2-product-c2-jdk_math, \
11.80 \
11.81 solaris_sparc_5.10-product-c1-jdk_misc, \
11.82 @@ -116,7 +106,7 @@
11.83 solaris_x64_5.10-product-c2-jdk_misc, \
11.84 linux_i586_2.6-product-{c1|c2}-jdk_misc, \
11.85 linux_x64_2.6-product-c2-jdk_misc, \
11.86 - ${jprt.my.windows.i586}-product-c1-jdk_misc, \
11.87 + windows_i586_5.1-product-c1-jdk_misc, \
11.88 windows_x64_5.2-product-c2-jdk_misc, \
11.89 \
11.90 solaris_sparc_5.10-product-c1-jdk_net, \
11.91 @@ -125,7 +115,7 @@
11.92 solaris_x64_5.10-product-c2-jdk_net, \
11.93 linux_i586_2.6-product-{c1|c2}-jdk_net, \
11.94 linux_x64_2.6-product-c2-jdk_net, \
11.95 - ${jprt.my.windows.i586}-product-c1-jdk_net, \
11.96 + windows_i586_5.1-product-c1-jdk_net, \
11.97 windows_x64_5.2-product-c2-jdk_net, \
11.98 \
11.99 solaris_sparc_5.10-product-c1-jdk_nio1, \
11.100 @@ -134,7 +124,7 @@
11.101 solaris_x64_5.10-product-c2-jdk_nio1, \
11.102 linux_i586_2.6-product-{c1|c2}-jdk_nio1, \
11.103 linux_x64_2.6-product-c2-jdk_nio1, \
11.104 - ${jprt.my.windows.i586}-product-c1-jdk_nio1, \
11.105 + windows_i586_5.1-product-c1-jdk_nio1, \
11.106 windows_x64_5.2-product-c2-jdk_nio1, \
11.107 \
11.108 solaris_sparc_5.10-product-c1-jdk_nio2, \
11.109 @@ -143,7 +133,7 @@
11.110 solaris_x64_5.10-product-c2-jdk_nio2, \
11.111 linux_i586_2.6-product-{c1|c2}-jdk_nio2, \
11.112 linux_x64_2.6-product-c2-jdk_nio2, \
11.113 - ${jprt.my.windows.i586}-product-c1-jdk_nio2, \
11.114 + windows_i586_5.1-product-c1-jdk_nio2, \
11.115 windows_x64_5.2-product-c2-jdk_nio2, \
11.116 \
11.117 solaris_sparc_5.10-product-c1-jdk_nio3, \
11.118 @@ -152,7 +142,7 @@
11.119 solaris_x64_5.10-product-c2-jdk_nio3, \
11.120 linux_i586_2.6-product-{c1|c2}-jdk_nio3, \
11.121 linux_x64_2.6-product-c2-jdk_nio3, \
11.122 - ${jprt.my.windows.i586}-product-c1-jdk_nio3, \
11.123 + windows_i586_5.1-product-c1-jdk_nio3, \
11.124 windows_x64_5.2-product-c2-jdk_nio3, \
11.125 \
11.126 solaris_sparc_5.10-product-c1-jdk_security1, \
11.127 @@ -161,7 +151,7 @@
11.128 solaris_x64_5.10-product-c2-jdk_security1, \
11.129 linux_i586_2.6-product-{c1|c2}-jdk_security1, \
11.130 linux_x64_2.6-product-c2-jdk_security1, \
11.131 - ${jprt.my.windows.i586}-product-c1-jdk_security1, \
11.132 + windows_i586_5.1-product-c1-jdk_security1, \
11.133 windows_x64_5.2-product-c2-jdk_security1, \
11.134 \
11.135 solaris_sparc_5.10-product-c1-jdk_text, \
11.136 @@ -170,7 +160,7 @@
11.137 solaris_x64_5.10-product-c2-jdk_text, \
11.138 linux_i586_2.6-product-{c1|c2}-jdk_text, \
11.139 linux_x64_2.6-product-c2-jdk_text, \
11.140 - ${jprt.my.windows.i586}-product-c1-jdk_text, \
11.141 + windows_i586_5.1-product-c1-jdk_text, \
11.142 windows_x64_5.2-product-c2-jdk_text, \
11.143 \
11.144 solaris_sparc_5.10-product-c1-jdk_tools1, \
11.145 @@ -179,7 +169,7 @@
11.146 solaris_x64_5.10-product-c2-jdk_tools1, \
11.147 linux_i586_2.6-product-{c1|c2}-jdk_tools1, \
11.148 linux_x64_2.6-product-c2-jdk_tools1, \
11.149 - ${jprt.my.windows.i586}-product-c1-jdk_tools1, \
11.150 + windows_i586_5.1-product-c1-jdk_tools1, \
11.151 windows_x64_5.2-product-c2-jdk_tools1, \
11.152 \
11.153 solaris_sparc_5.10-product-c1-jdk_util, \
11.154 @@ -188,7 +178,7 @@
11.155 solaris_x64_5.10-product-c2-jdk_util, \
11.156 linux_i586_2.6-product-{c1|c2}-jdk_util, \
11.157 linux_x64_2.6-product-c2-jdk_util, \
11.158 - ${jprt.my.windows.i586}-product-c1-jdk_util, \
11.159 + windows_i586_5.1-product-c1-jdk_util, \
11.160 windows_x64_5.2-product-c2-jdk_util
11.161
11.162 # All jdk test targets in test/Makefile (still no fastdebug & limited c2)
11.163 @@ -202,7 +192,7 @@
11.164 solaris_x64_5.10-product-c2-jdk_awt, \
11.165 linux_i586_2.6-product-{c1|c2}-jdk_awt, \
11.166 linux_x64_2.6-product-c2-jdk_awt, \
11.167 - ${jprt.my.windows.i586}-product-c1-jdk_awt, \
11.168 + windows_i586_5.1-product-c1-jdk_awt, \
11.169 windows_x64_5.2-product-c2-jdk_awt, \
11.170 \
11.171 solaris_sparc_5.10-product-c1-jdk_beans2, \
11.172 @@ -211,7 +201,7 @@
11.173 solaris_x64_5.10-product-c2-jdk_beans2, \
11.174 linux_i586_2.6-product-{c1|c2}-jdk_beans2, \
11.175 linux_x64_2.6-product-c2-jdk_beans2, \
11.176 - ${jprt.my.windows.i586}-product-c1-jdk_beans2, \
11.177 + windows_i586_5.1-product-c1-jdk_beans2, \
11.178 windows_x64_5.2-product-c2-jdk_beans2, \
11.179 \
11.180 solaris_sparc_5.10-product-c1-jdk_beans3, \
11.181 @@ -220,7 +210,7 @@
11.182 solaris_x64_5.10-product-c2-jdk_beans3, \
11.183 linux_i586_2.6-product-{c1|c2}-jdk_beans3, \
11.184 linux_x64_2.6-product-c2-jdk_beans3, \
11.185 - ${jprt.my.windows.i586}-product-c1-jdk_beans3, \
11.186 + windows_i586_5.1-product-c1-jdk_beans3, \
11.187 windows_x64_5.2-product-c2-jdk_beans3, \
11.188 \
11.189 solaris_sparc_5.10-product-c1-jdk_management1, \
11.190 @@ -229,7 +219,7 @@
11.191 solaris_x64_5.10-product-c2-jdk_management1, \
11.192 linux_i586_2.6-product-{c1|c2}-jdk_management1, \
11.193 linux_x64_2.6-product-c2-jdk_management1, \
11.194 - ${jprt.my.windows.i586}-product-c1-jdk_management1, \
11.195 + windows_i586_5.1-product-c1-jdk_management1, \
11.196 windows_x64_5.2-product-c2-jdk_management1, \
11.197 \
11.198 solaris_sparc_5.10-product-c1-jdk_management2, \
11.199 @@ -238,7 +228,7 @@
11.200 solaris_x64_5.10-product-c2-jdk_management2, \
11.201 linux_i586_2.6-product-{c1|c2}-jdk_management2, \
11.202 linux_x64_2.6-product-c2-jdk_management2, \
11.203 - ${jprt.my.windows.i586}-product-c1-jdk_management2, \
11.204 + windows_i586_5.1-product-c1-jdk_management2, \
11.205 windows_x64_5.2-product-c2-jdk_management2, \
11.206 \
11.207 solaris_sparc_5.10-product-c1-jdk_rmi, \
11.208 @@ -247,7 +237,7 @@
11.209 solaris_x64_5.10-product-c2-jdk_rmi, \
11.210 linux_i586_2.6-product-{c1|c2}-jdk_rmi, \
11.211 linux_x64_2.6-product-c2-jdk_rmi, \
11.212 - ${jprt.my.windows.i586}-product-c1-jdk_rmi, \
11.213 + windows_i586_5.1-product-c1-jdk_rmi, \
11.214 windows_x64_5.2-product-c2-jdk_rmi, \
11.215 \
11.216 solaris_sparc_5.10-product-c1-jdk_security2, \
11.217 @@ -256,7 +246,7 @@
11.218 solaris_x64_5.10-product-c2-jdk_security2, \
11.219 linux_i586_2.6-product-{c1|c2}-jdk_security2, \
11.220 linux_x64_2.6-product-c2-jdk_security2, \
11.221 - ${jprt.my.windows.i586}-product-c1-jdk_security2, \
11.222 + windows_i586_5.1-product-c1-jdk_security2, \
11.223 windows_x64_5.2-product-c2-jdk_security2, \
11.224 \
11.225 solaris_sparc_5.10-product-c1-jdk_security3, \
11.226 @@ -265,7 +255,7 @@
11.227 solaris_x64_5.10-product-c2-jdk_security3, \
11.228 linux_i586_2.6-product-{c1|c2}-jdk_security3, \
11.229 linux_x64_2.6-product-c2-jdk_security3, \
11.230 - ${jprt.my.windows.i586}-product-c1-jdk_security3, \
11.231 + windows_i586_5.1-product-c1-jdk_security3, \
11.232 windows_x64_5.2-product-c2-jdk_security3, \
11.233 \
11.234 solaris_sparc_5.10-product-c1-jdk_swing, \
11.235 @@ -274,7 +264,7 @@
11.236 solaris_x64_5.10-product-c2-jdk_swing, \
11.237 linux_i586_2.6-product-{c1|c2}-jdk_swing, \
11.238 linux_x64_2.6-product-c2-jdk_swing, \
11.239 - ${jprt.my.windows.i586}-product-c1-jdk_swing, \
11.240 + windows_i586_5.1-product-c1-jdk_swing, \
11.241 windows_x64_5.2-product-c2-jdk_swing, \
11.242 \
11.243 solaris_sparc_5.10-product-c1-jdk_tools2, \
11.244 @@ -283,7 +273,7 @@
11.245 solaris_x64_5.10-product-c2-jdk_tools2, \
11.246 linux_i586_2.6-product-{c1|c2}-jdk_tools2, \
11.247 linux_x64_2.6-product-c2-jdk_tools2, \
11.248 - ${jprt.my.windows.i586}-product-c1-jdk_tools2, \
11.249 + windows_i586_5.1-product-c1-jdk_tools2, \
11.250 windows_x64_5.2-product-c2-jdk_tools2
11.251
11.252 # JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
12.1 --- a/make/sun/nio/Makefile Fri Aug 05 15:35:04 2011 -0700
12.2 +++ b/make/sun/nio/Makefile Tue Aug 09 17:38:52 2011 -0700
12.3 @@ -1,5 +1,5 @@
12.4 #
12.5 -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
12.6 +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
12.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12.8 #
12.9 # This code is free software; you can redistribute it and/or modify it
12.10 @@ -26,6 +26,8 @@
12.11 BUILDDIR = ../..
12.12 PACKAGE = sun.nio
12.13 PRODUCT = sun
12.14 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
12.15 +SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
12.16 include $(BUILDDIR)/common/Defs.gmk
12.17
12.18 SUBDIRS = cs
13.1 --- a/make/sun/nio/cs/Makefile Fri Aug 05 15:35:04 2011 -0700
13.2 +++ b/make/sun/nio/cs/Makefile Tue Aug 09 17:38:52 2011 -0700
13.3 @@ -36,7 +36,9 @@
13.4 # This re-directs all the class files to a separate location
13.5 CLASSDESTDIR = $(TEMPDIR)/classes
13.6
13.7 -OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
13.8 +JAVAC_MAX_WARNINGS = false
13.9 +JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
13.10 +JAVAC_WARNINGS_FATAL = true
13.11 include $(BUILDDIR)/common/Defs.gmk
13.12
13.13 #
14.1 --- a/make/sun/security/ec/Makefile Fri Aug 05 15:35:04 2011 -0700
14.2 +++ b/make/sun/security/ec/Makefile Tue Aug 09 17:38:52 2011 -0700
14.3 @@ -156,7 +156,7 @@
14.4 $(PKGDIR)/ECDSASignature.java \
14.5 $(PKGDIR)/ECKeyPairGenerator.java
14.6
14.7 - JAVAHFLAGS += -classpath $(CLASSDESTDIR)
14.8 + JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
14.9
14.10 #
14.11 # C and C++ files
15.1 --- a/make/sun/security/mscapi/Makefile Fri Aug 05 15:35:04 2011 -0700
15.2 +++ b/make/sun/security/mscapi/Makefile Tue Aug 09 17:38:52 2011 -0700
15.3 @@ -149,7 +149,7 @@
15.4 # Rules
15.5 #
15.6 CLASSDESTDIR = $(TEMPDIR)/classes
15.7 -JAVAHFLAGS += -classpath $(CLASSDESTDIR)
15.8 +JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR)
15.9
15.10 include $(BUILDDIR)/common/Mapfile-vers.gmk
15.11
16.1 --- a/make/tools/Makefile Fri Aug 05 15:35:04 2011 -0700
16.2 +++ b/make/tools/Makefile Tue Aug 09 17:38:52 2011 -0700
16.3 @@ -28,6 +28,8 @@
16.4 #
16.5
16.6 BUILDDIR = ..
16.7 +
16.8 +SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL=true
16.9 include $(BUILDDIR)/common/Defs.gmk
16.10
16.11 # Note: freetypecheck is built by Sanity.gmk if needed
17.1 --- a/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java Fri Aug 05 15:35:04 2011 -0700
17.2 +++ b/make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java Tue Aug 09 17:38:52 2011 -0700
17.3 @@ -1,5 +1,5 @@
17.4 /*
17.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
17.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
17.8 *
17.9 * This code is free software; you can redistribute it and/or modify it
17.10 @@ -114,8 +114,8 @@
17.11 */
17.12
17.13 out.println(jmi.getJarFileKind().getMarkerChar() + " " + filename);
17.14 - for (Iterator<String> iter = index.iterator(); iter.hasNext(); ) {
17.15 - out.println(iter.next());
17.16 + for (String entry : index) {
17.17 + out.println(entry);
17.18 }
17.19
17.20 }
17.21 @@ -171,8 +171,7 @@
17.22 * A hashmap contains a mapping from the prefix string to
17.23 * a hashset which contains a set of the second level of prefix string.
17.24 */
17.25 - private HashMap<String, HashSet<String>> knownPrefixMap = new
17.26 - HashMap<String, HashSet<String>>();
17.27 + private HashMap<String, HashSet<String>> knownPrefixMap = new HashMap<>();
17.28
17.29 /*
17.30 * We add maximum 5 second level entries to "sun", "java" and
17.31 @@ -195,12 +194,12 @@
17.32 if (indexSet == null) {
17.33 synchronized(this) {
17.34 if (indexSet == null) {
17.35 - indexSet = new HashSet<String>();
17.36 - Enumeration entries = jar.entries();
17.37 + indexSet = new HashSet<>();
17.38 + Enumeration<JarEntry> entries = jar.entries();
17.39 boolean containsOnlyClass = true;
17.40 boolean containsOnlyResource = true;
17.41 while (entries.hasMoreElements()) {
17.42 - JarEntry entry = (JarEntry) entries.nextElement();
17.43 + JarEntry entry = entries.nextElement();
17.44 String name = entry.getName();
17.45 /* We only look at the non-directory entry.
17.46 MANIFEST file is also skipped. */
17.47 @@ -338,9 +337,7 @@
17.48 /* Iterate through the hash map, add the second level package names
17.49 * to the indexSet if has any.
17.50 */
17.51 - for (Iterator<String> keysIterator = knownPrefixMap.keySet().iterator();
17.52 - keysIterator.hasNext();) {
17.53 - String key = keysIterator.next();
17.54 + for (String key : knownPrefixMap.keySet()) {
17.55 HashSet<String> pkgSetStartsWithKey = knownPrefixMap.get(key);
17.56 int setSize = pkgSetStartsWithKey.size();
17.57
17.58 @@ -353,9 +350,8 @@
17.59 /* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add
17.60 * them to the indexSet of the MetaIndex object.
17.61 */
17.62 - for (Iterator<String> secondPkgElements = pkgSetStartsWithKey.iterator();
17.63 - secondPkgElements.hasNext();) {
17.64 - indexSet.add(key + "/" + secondPkgElements.next());
17.65 + for (String secondPkgElement : pkgSetStartsWithKey) {
17.66 + indexSet.add(key + "/" + secondPkgElement);
17.67 }
17.68 }
17.69 } // end the outer "for"
18.1 --- a/make/tools/src/build/tools/compileproperties/CompileProperties.java Fri Aug 05 15:35:04 2011 -0700
18.2 +++ b/make/tools/src/build/tools/compileproperties/CompileProperties.java Tue Aug 09 17:38:52 2011 -0700
18.3 @@ -1,5 +1,5 @@
18.4 /*
18.5 - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
18.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18.8 *
18.9 * This code is free software; you can redistribute it and/or modify it
18.10 @@ -36,7 +36,6 @@
18.11 import java.text.MessageFormat;
18.12 import java.util.ArrayList;
18.13 import java.util.Collections;
18.14 -import java.util.Iterator;
18.15 import java.util.List;
18.16 import java.util.Properties;
18.17
18.18 @@ -223,18 +222,16 @@
18.19 if ( ok ) {
18.20 String packageName = inferPackageName(propertiesPath, outputPath);
18.21 System.out.println("inferred package name: " + packageName);
18.22 - List<String> sortedKeys = new ArrayList<String>();
18.23 + List<String> sortedKeys = new ArrayList<>();
18.24 for ( Object key : p.keySet() ) {
18.25 sortedKeys.add((String)key);
18.26 }
18.27 Collections.sort(sortedKeys);
18.28 - Iterator keys = sortedKeys.iterator();
18.29
18.30 StringBuffer data = new StringBuffer();
18.31
18.32 - while (keys.hasNext()) {
18.33 - Object key = keys.next();
18.34 - data.append(" { \"" + escape((String)key) + "\", \"" +
18.35 + for (String key : sortedKeys) {
18.36 + data.append(" { \"" + escape(key) + "\", \"" +
18.37 escape((String)p.get(key)) + "\" },\n");
18.38 }
18.39
19.1 --- a/make/tools/src/build/tools/dirdiff/DirDiff.java Fri Aug 05 15:35:04 2011 -0700
19.2 +++ b/make/tools/src/build/tools/dirdiff/DirDiff.java Tue Aug 09 17:38:52 2011 -0700
19.3 @@ -1,5 +1,5 @@
19.4 /*
19.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
19.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19.8 *
19.9 * This code is free software; you can redistribute it and/or modify it
19.10 @@ -164,7 +164,7 @@
19.11 }
19.12
19.13 File[] currentGoldenDirs = null;
19.14 - TreeSet goldDirSet = new TreeSet();
19.15 + TreeSet<String> goldDirSet = new TreeSet<>();
19.16 if (goldenDir != null) {
19.17 currentGoldenDirs = goldenDir.listFiles();
19.18 for (int i=0; i<currentGoldenDirs.length; i++) {
20.1 --- a/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java Fri Aug 05 15:35:04 2011 -0700
20.2 +++ b/make/tools/src/build/tools/dtdbuilder/DTDBuilder.java Tue Aug 09 17:38:52 2011 -0700
20.3 @@ -1,5 +1,5 @@
20.4 /*
20.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
20.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20.8 *
20.9 * This code is free software; you can redistribute it and/or modify it
20.10 @@ -63,9 +63,9 @@
20.11 static PublicMapping mapping = null;
20.12
20.13 // Hash from name to Integer
20.14 - private Hashtable namesHash = new Hashtable();
20.15 + private Hashtable<String, Integer> namesHash = new Hashtable<>();
20.16 // Vector of all names
20.17 - private Vector namesVector = new Vector();
20.18 + private Vector<String> namesVector = new Vector<>();
20.19
20.20 /**
20.21 * Create a new DTD.
20.22 @@ -87,15 +87,15 @@
20.23 int numNames = namesVector.size();
20.24 out.writeShort((short) (namesVector.size()));
20.25 for (int i = 0; i < namesVector.size(); i++) {
20.26 - String nm = (String) namesVector.elementAt(i);
20.27 + String nm = namesVector.elementAt(i);
20.28 out.writeUTF(nm);
20.29 }
20.30
20.31 saveEntities(out);
20.32
20.33 out.writeShort((short) (elements.size()));
20.34 - for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) {
20.35 - saveElement(out, (Element)e.nextElement());
20.36 + for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
20.37 + saveElement(out, e.nextElement());
20.38 }
20.39
20.40 if (namesVector.size() != numNames) {
20.41 @@ -106,21 +106,21 @@
20.42 }
20.43
20.44 private void buildNamesTable() {
20.45 - for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
20.46 - Entity ent = (Entity) e.nextElement();
20.47 + for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
20.48 + Entity ent = e.nextElement();
20.49 // Do even if not isGeneral(). That way, exclusions and inclusions
20.50 // will definitely have their element.
20.51 getNameId(ent.getName());
20.52 }
20.53 - for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) {
20.54 - Element el = (Element) e.nextElement();
20.55 + for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
20.56 + Element el = e.nextElement();
20.57 getNameId(el.getName());
20.58 for (AttributeList atts = el.getAttributes() ; atts != null ; atts = atts.getNext()) {
20.59 getNameId(atts.getName());
20.60 if (atts.getValue() != null) {
20.61 getNameId(atts.getValue());
20.62 }
20.63 - Enumeration vals = atts.getValues();
20.64 + Enumeration<?> vals = atts.getValues();
20.65 while (vals != null && vals.hasMoreElements()) {
20.66 String s = (String) vals.nextElement();
20.67 getNameId(s);
20.68 @@ -133,9 +133,9 @@
20.69 // The the id of a name from the list of names
20.70 //
20.71 private short getNameId(String name) {
20.72 - Object o = namesHash.get(name);
20.73 + Integer o = namesHash.get(name);
20.74 if (o != null) {
20.75 - return (short) ((Integer) o).intValue();
20.76 + return (short) o.intValue();
20.77 }
20.78 int i = namesVector.size();
20.79 namesVector.addElement(name);
20.80 @@ -149,16 +149,16 @@
20.81 */
20.82 void saveEntities(DataOutputStream out) throws IOException {
20.83 int num = 0;
20.84 - for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
20.85 - Entity ent = (Entity) e.nextElement();
20.86 + for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
20.87 + Entity ent = e.nextElement();
20.88 if (ent.isGeneral()) {
20.89 num++;
20.90 }
20.91 }
20.92
20.93 out.writeShort((short) num);
20.94 - for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
20.95 - Entity ent = (Entity) e.nextElement();
20.96 + for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
20.97 + Entity ent = e.nextElement();
20.98 if (ent.isGeneral()) {
20.99 out.writeShort(getNameId(ent.getName()));
20.100 out.writeByte(ent.getType() & ~GENERAL);
21.1 --- a/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java Fri Aug 05 15:35:04 2011 -0700
21.2 +++ b/make/tools/src/build/tools/dtdbuilder/DTDInputStream.java Tue Aug 09 17:38:52 2011 -0700
21.3 @@ -1,5 +1,5 @@
21.4 /*
21.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
21.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21.8 *
21.9 * This code is free software; you can redistribute it and/or modify it
21.10 @@ -48,7 +48,7 @@
21.11 public final
21.12 class DTDInputStream extends FilterReader implements DTDConstants {
21.13 public DTD dtd;
21.14 - public Stack stack = new Stack();
21.15 + public Stack<Object> stack = new Stack<>();
21.16 public char str[] = new char[64];
21.17 public int replace = 0;
21.18 public int ln = 1;
21.19 @@ -105,6 +105,7 @@
21.20 * parameter entities.
21.21 * [60] 350:22
21.22 */
21.23 + @SuppressWarnings("fallthrough")
21.24 public int read() throws IOException {
21.25 switch (ch) {
21.26 case '%': {
21.27 @@ -134,6 +135,7 @@
21.28 switch (ch) {
21.29 case '\r':
21.30 ln++;
21.31 + /* fall through */
21.32 case ';':
21.33 ch = in.read();
21.34 break;
22.1 --- a/make/tools/src/build/tools/dtdbuilder/DTDParser.java Fri Aug 05 15:35:04 2011 -0700
22.2 +++ b/make/tools/src/build/tools/dtdbuilder/DTDParser.java Tue Aug 09 17:38:52 2011 -0700
22.3 @@ -1,5 +1,5 @@
22.4 /*
22.5 - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
22.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22.8 *
22.9 * This code is free software; you can redistribute it and/or modify it
22.10 @@ -87,7 +87,7 @@
22.11 return null;
22.12 }
22.13
22.14 - return MessageFormat.format(prop, args);
22.15 + return MessageFormat.format(prop, (Object[])args);
22.16 }
22.17
22.18 /**
22.19 @@ -201,6 +201,7 @@
22.20 * Parse identifier. Uppercase characters are automatically
22.21 * folded to lowercase. Returns falsed if no identifier is found.
22.22 */
22.23 + @SuppressWarnings("fallthrough")
22.24 boolean parseIdentifier(boolean lower) throws IOException {
22.25 switch (ch) {
22.26 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
22.27 @@ -211,6 +212,7 @@
22.28 if (lower) {
22.29 ch = 'a' + (ch - 'A');
22.30 }
22.31 + /* fall through */
22.32
22.33 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
22.34 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
22.35 @@ -233,6 +235,7 @@
22.36 * Parses name token. If <code>lower</code> is true, upper case letters
22.37 * are folded to lower case. Returns falsed if no token is found.
22.38 */
22.39 + @SuppressWarnings("fallthrough")
22.40 boolean parseNameToken(boolean lower) throws IOException {
22.41 boolean first = true;
22.42
22.43 @@ -246,6 +249,7 @@
22.44 if (lower) {
22.45 ch = 'a' + (ch - 'A');
22.46 }
22.47 + /* fall through */
22.48
22.49 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
22.50 case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
22.51 @@ -271,8 +275,8 @@
22.52 /**
22.53 * Parse a list of identifiers.
22.54 */
22.55 - Vector parseIdentifierList(boolean lower) throws IOException {
22.56 - Vector elems = new Vector();
22.57 + Vector<String> parseIdentifierList(boolean lower) throws IOException {
22.58 + Vector<String> elems = new Vector<>();
22.59 skipSpace();
22.60 switch (ch) {
22.61 case '(':
22.62 @@ -507,7 +511,7 @@
22.63 * [116] 405:6
22.64 */
22.65 void parseElementDeclaration() throws IOException {
22.66 - Vector elems = parseIdentifierList(true);
22.67 + Vector<String> elems = parseIdentifierList(true);
22.68 BitSet inclusions = null;
22.69 BitSet exclusions = null;
22.70 boolean omitStart = false;
22.71 @@ -544,26 +548,26 @@
22.72 if ((type == MODEL) || (type == ANY)) {
22.73 if (ch == '-') {
22.74 ch = in.read();
22.75 - Vector v = parseIdentifierList(true);
22.76 + Vector<String> v = parseIdentifierList(true);
22.77 exclusions = new BitSet();
22.78 - for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
22.79 - exclusions.set(dtd.getElement((String)e.nextElement()).getIndex());
22.80 + for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
22.81 + exclusions.set(dtd.getElement(e.nextElement()).getIndex());
22.82 }
22.83 }
22.84 if (ch == '+') {
22.85 ch = in.read();
22.86 - Vector v = parseIdentifierList(true);
22.87 + Vector<String> v = parseIdentifierList(true);
22.88 inclusions = new BitSet();
22.89 - for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
22.90 - inclusions.set(dtd.getElement((String)e.nextElement()).getIndex());
22.91 + for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
22.92 + inclusions.set(dtd.getElement(e.nextElement()).getIndex());
22.93 }
22.94 }
22.95 }
22.96 expect('>');
22.97
22.98 if (in.replace == 0) {
22.99 - for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) {
22.100 - dtd.defineElement((String)e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
22.101 + for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
22.102 + dtd.defineElement(e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
22.103 }
22.104 }
22.105 }
22.106 @@ -582,7 +586,7 @@
22.107 error("invalid", "attribute value");
22.108 return;
22.109 }
22.110 - atts.type = atts.name2type(getString(0));
22.111 + atts.type = AttributeList.name2type(getString(0));
22.112 skipParameterSpace();
22.113 if (atts.type == NOTATION) {
22.114 atts.values = parseIdentifierList(true);
22.115 @@ -593,6 +597,7 @@
22.116 * Parse an attribute value specification.
22.117 * [33] 331:1
22.118 */
22.119 + @SuppressWarnings("fallthrough")
22.120 String parseAttributeValueSpecification() throws IOException {
22.121 int delim = -1;
22.122 switch (ch) {
22.123 @@ -627,6 +632,7 @@
22.124 ch = in.read();
22.125 return getString(0);
22.126 }
22.127 + /* fall through */
22.128
22.129 default:
22.130 addString(ch & 0xFF);
22.131 @@ -648,7 +654,7 @@
22.132 return;
22.133 }
22.134 skipParameterSpace();
22.135 - atts.modifier = atts.name2type(getString(0));
22.136 + atts.modifier = AttributeList.name2type(getString(0));
22.137 if (atts.modifier != FIXED) {
22.138 return;
22.139 }
22.140 @@ -663,7 +669,7 @@
22.141 * REMIND: associated notation name
22.142 */
22.143 void parseAttlistDeclaration() throws IOException {
22.144 - Vector elems = parseIdentifierList(true);
22.145 + Vector<String> elems = parseIdentifierList(true);
22.146 AttributeList attlist = null, atts = null;
22.147
22.148 while (parseIdentifier(true)) {
22.149 @@ -685,8 +691,8 @@
22.150 expect('>');
22.151
22.152 if (in.replace == 0) {
22.153 - for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) {
22.154 - dtd.defineAttributes((String)e.nextElement(), attlist);
22.155 + for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
22.156 + dtd.defineAttributes(e.nextElement(), attlist);
22.157 }
22.158 }
22.159 }
22.160 @@ -810,6 +816,7 @@
22.161 /**
22.162 * Parse a section of the input upto EOF or ']'.
22.163 */
22.164 + @SuppressWarnings("fallthrough")
22.165 void parseSection() throws IOException {
22.166 while (true) {
22.167 switch (ch) {
22.168 @@ -883,6 +890,7 @@
22.169 default:
22.170 char str[] = {(char)ch};
22.171 error("invalid.arg", "character", "'" + new String(str) + "' / " + ch);
22.172 + /* fall through */
22.173
22.174 case ' ':
22.175 case '\t':
23.1 --- a/make/tools/src/build/tools/dtdbuilder/PublicMapping.java Fri Aug 05 15:35:04 2011 -0700
23.2 +++ b/make/tools/src/build/tools/dtdbuilder/PublicMapping.java Tue Aug 09 17:38:52 2011 -0700
23.3 @@ -1,5 +1,5 @@
23.4 /*
23.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
23.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23.8 *
23.9 * This code is free software; you can redistribute it and/or modify it
23.10 @@ -44,7 +44,7 @@
23.11 final class PublicMapping {
23.12
23.13 String baseStr;
23.14 - Hashtable tab = new Hashtable();
23.15 + Hashtable<String, String> tab = new Hashtable<>();
23.16
23.17 /**
23.18 * Create a mapping.
23.19 @@ -103,6 +103,6 @@
23.20 */
23.21 public String get(String id) {
23.22 // System.err.println(" id = "+id);
23.23 - return (String) tab.get(id);
23.24 + return tab.get(id);
23.25 }
23.26 }
24.1 --- a/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java Fri Aug 05 15:35:04 2011 -0700
24.2 +++ b/make/tools/src/build/tools/generatebreakiteratordata/CharSet.java Tue Aug 09 17:38:52 2011 -0700
24.3 @@ -1,5 +1,5 @@
24.4 /*
24.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
24.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24.8 *
24.9 * This code is free software; you can redistribute it and/or modify it
24.10 @@ -66,7 +66,7 @@
24.11 * A cache which is used to speed up parseString() whenever it is
24.12 * used to parse a description that has been parsed before
24.13 */
24.14 - private static Hashtable expressionCache = null;
24.15 + private static Hashtable<String, CharSet> expressionCache = null;
24.16
24.17 /**
24.18 * Builds a CharSet based on a textual description. For the syntax of
24.19 @@ -79,7 +79,7 @@
24.20 // if "s" is in the expression cache, pull the result out
24.21 // of the expresison cache
24.22 if (expressionCache != null) {
24.23 - result = (CharSet)expressionCache.get(s);
24.24 + result = expressionCache.get(s);
24.25 }
24.26
24.27 // otherwise, use doParseString() to actually parse the string,
24.28 @@ -87,7 +87,7 @@
24.29 if (result == null) {
24.30 result = doParseString(s);
24.31 if (expressionCache == null) {
24.32 - expressionCache = new Hashtable();
24.33 + expressionCache = new Hashtable<>();
24.34 }
24.35 expressionCache.put(s, result);
24.36 }
24.37 @@ -336,8 +336,8 @@
24.38 * Returns a copy of CharSet's expression cache and sets CharSet's
24.39 * expression cache to empty.
24.40 */
24.41 - public static Hashtable releaseExpressionCache() {
24.42 - Hashtable result = expressionCache;
24.43 + public static Hashtable<String, CharSet> releaseExpressionCache() {
24.44 + Hashtable<String, CharSet> result = expressionCache;
24.45 expressionCache = null;
24.46 return result;
24.47 }
24.48 @@ -778,7 +778,7 @@
24.49 * An Enumeration that can be used to extract the character ranges
24.50 * from a CharSet one at a time
24.51 */
24.52 - public class Enumeration implements java.util.Enumeration {
24.53 + public class Enumeration implements java.util.Enumeration<int[]> {
24.54 /**
24.55 * Initializes a CharSet.Enumeration
24.56 */
24.57 @@ -798,7 +798,7 @@
24.58 /**
24.59 * Returns the next range in the CarSet
24.60 */
24.61 - public Object nextElement() {
24.62 + public int[] nextElement() {
24.63 int[] result = new int[2];
24.64 result[0] = chars[p++];
24.65 result[1] = chars[p++];
25.1 --- a/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java Fri Aug 05 15:35:04 2011 -0700
25.2 +++ b/make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java Tue Aug 09 17:38:52 2011 -0700
25.3 @@ -1,5 +1,5 @@
25.4 /*
25.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
25.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25.8 *
25.9 * This code is free software; you can redistribute it and/or modify it
25.10 @@ -78,12 +78,12 @@
25.11 * contains "true" for every character category that includes a dictionary
25.12 * character.
25.13 */
25.14 - protected void buildCharCategories(Vector tempRuleList) {
25.15 + protected void buildCharCategories(Vector<String> tempRuleList) {
25.16 super.buildCharCategories(tempRuleList);
25.17
25.18 categoryFlags = new boolean[categories.size()];
25.19 for (int i = 0; i < categories.size(); i++) {
25.20 - CharSet cs = (CharSet)categories.elementAt(i);
25.21 + CharSet cs = categories.elementAt(i);
25.22 if (!(cs.intersection(dictionaryChars).empty())) {
25.23 categoryFlags[i] = true;
25.24 }
25.25 @@ -95,7 +95,7 @@
25.26 // the function above. This gives us a way to create a separate character
25.27 // category for the dictionary characters even when
25.28 // RuleBasedBreakIteratorBuilder isn't making a distinction.
25.29 - protected void mungeExpressionList(Hashtable expressions) {
25.30 + protected void mungeExpressionList(Hashtable<String, Object> expressions) {
25.31 expressions.put(dictionaryExpression, dictionaryChars);
25.32 }
25.33
26.1 --- a/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java Fri Aug 05 15:35:04 2011 -0700
26.2 +++ b/make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java Tue Aug 09 17:38:52 2011 -0700
26.3 @@ -1,5 +1,5 @@
26.4 /*
26.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
26.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26.8 *
26.9 * This code is free software; you can redistribute it and/or modify it
26.10 @@ -91,9 +91,9 @@
26.11 try {
26.12 info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
26.13
26.14 - Enumeration keys = info.getKeys();
26.15 + Enumeration<String> keys = info.getKeys();
26.16 while (keys.hasMoreElements()) {
26.17 - String key = (String)keys.nextElement();
26.18 + String key = keys.nextElement();
26.19
26.20 if (key.equals("CharacterData")) {
26.21 generateDataFile(info.getString(key),
27.1 --- a/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java Fri Aug 05 15:35:04 2011 -0700
27.2 +++ b/make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java Tue Aug 09 17:38:52 2011 -0700
27.3 @@ -1,5 +1,5 @@
27.4 /*
27.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
27.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
27.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
27.8 *
27.9 * This code is free software; you can redistribute it and/or modify it
27.10 @@ -110,13 +110,13 @@
27.11 * A temporary holding place used for calculating the character categories.
27.12 * This object contains CharSet objects.
27.13 */
27.14 - protected Vector categories = null;
27.15 + protected Vector<CharSet> categories = null;
27.16
27.17 /**
27.18 * A table used to map parts of regexp text to lists of character
27.19 * categories, rather than having to figure them out from scratch each time
27.20 */
27.21 - protected Hashtable expressions = null;
27.22 + protected Hashtable<String, Object> expressions = null;
27.23
27.24 /**
27.25 * A temporary holding place for the list of ignore characters
27.26 @@ -126,32 +126,32 @@
27.27 /**
27.28 * A temporary holding place where the forward state table is built
27.29 */
27.30 - protected Vector tempStateTable = null;
27.31 + protected Vector<short[]> tempStateTable = null;
27.32
27.33 /**
27.34 * A list of all the states that have to be filled in with transitions to
27.35 * the next state that is created. Used when building the state table from
27.36 * the regular expressions.
27.37 */
27.38 - protected Vector decisionPointList = null;
27.39 + protected Vector<Integer> decisionPointList = null;
27.40
27.41 /**
27.42 * A stack for holding decision point lists. This is used to handle nested
27.43 * parentheses and braces in regexps.
27.44 */
27.45 - protected Stack decisionPointStack = null;
27.46 + protected Stack<Vector<Integer>> decisionPointStack = null;
27.47
27.48 /**
27.49 * A list of states that loop back on themselves. Used to handle .*?
27.50 */
27.51 - protected Vector loopingStates = null;
27.52 + protected Vector<Integer> loopingStates = null;
27.53
27.54 /**
27.55 * Looping states actually have to be backfilled later in the process
27.56 * than everything else. This is where a the list of states to backfill
27.57 * is accumulated. This is also used to handle .*?
27.58 */
27.59 - protected Vector statesToBackfill = null;
27.60 + protected Vector<Integer> statesToBackfill = null;
27.61
27.62 /**
27.63 * A list mapping pairs of state numbers for states that are to be combined
27.64 @@ -159,7 +159,7 @@
27.65 * in the process of making the state table deterministic to prevent
27.66 * infinite recursion.
27.67 */
27.68 - protected Vector mergeList = null;
27.69 + protected Vector<int[]> mergeList = null;
27.70
27.71 /**
27.72 * A flag that is used to indicate when the list of looping states can
27.73 @@ -198,7 +198,7 @@
27.74 * just vectors different parts of the job off to other functions.
27.75 */
27.76 public RuleBasedBreakIteratorBuilder(String description) {
27.77 - Vector tempRuleList = buildRuleList(description);
27.78 + Vector<String> tempRuleList = buildRuleList(description);
27.79 buildCharCategories(tempRuleList);
27.80 buildStateTable(tempRuleList);
27.81 buildBackwardsStateTable(tempRuleList);
27.82 @@ -213,7 +213,7 @@
27.83 * variable names)
27.84 * </ul>
27.85 */
27.86 - private Vector buildRuleList(String description) {
27.87 + private Vector<String> buildRuleList(String description) {
27.88 // invariants:
27.89 // - parentheses must be balanced: ()[]{}<>
27.90 // - nothing can be nested inside <>
27.91 @@ -240,8 +240,8 @@
27.92 // set up a vector to contain the broken-up description (each entry in the
27.93 // vector is a separate rule) and a stack for keeping track of opening
27.94 // punctuation
27.95 - Vector tempRuleList = new Vector();
27.96 - Stack parenStack = new Stack();
27.97 + Vector<String> tempRuleList = new Vector<>();
27.98 + Stack<Character> parenStack = new Stack<>();
27.99
27.100 int p = 0;
27.101 int ruleStart = 0;
27.102 @@ -326,7 +326,7 @@
27.103 }
27.104 parenStack.pop();
27.105 if (!parenStack.empty()) {
27.106 - lastOpen = ((Character)(parenStack.peek())).charValue();
27.107 + lastOpen = parenStack.peek().charValue();
27.108 }
27.109 else {
27.110 lastOpen = '\u0000';
27.111 @@ -552,7 +552,8 @@
27.112 * character category numbers everywhere a literal character or a [] expression
27.113 * originally occurred.
27.114 */
27.115 - protected void buildCharCategories(Vector tempRuleList) {
27.116 + @SuppressWarnings("fallthrough")
27.117 + protected void buildCharCategories(Vector<String> tempRuleList) {
27.118 int bracketLevel = 0;
27.119 int p = 0;
27.120 int lineNum = 0;
27.121 @@ -560,9 +561,9 @@
27.122 // build hash table of every literal character or [] expression in the rule list
27.123 // and use CharSet.parseString() to derive a CharSet object representing the
27.124 // characters each refers to
27.125 - expressions = new Hashtable();
27.126 + expressions = new Hashtable<>();
27.127 while (lineNum < tempRuleList.size()) {
27.128 - String line = (String)(tempRuleList.elementAt(lineNum));
27.129 + String line = tempRuleList.elementAt(lineNum);
27.130 p = 0;
27.131 while (p < line.length()) {
27.132 int c = line.codePointAt(p);
27.133 @@ -618,7 +619,7 @@
27.134 CharSet.releaseExpressionCache();
27.135
27.136 // create the temporary category table (which is a vector of CharSet objects)
27.137 - categories = new Vector();
27.138 + categories = new Vector<>();
27.139 if (ignoreChars != null) {
27.140 categories.addElement(ignoreChars);
27.141 }
27.142 @@ -643,8 +644,7 @@
27.143 // At no time should a character ever occur in more than one character category.
27.144
27.145 // for each expression in the expressions list, do...
27.146 - Enumeration iter = expressions.elements();
27.147 - while (iter.hasMoreElements()) {
27.148 + for (Enumeration<Object> iter = expressions.elements(); iter.hasMoreElements(); ) {
27.149 // initialize the working char set to the chars in the current expression
27.150 CharSet e = (CharSet)iter.nextElement();
27.151
27.152 @@ -653,7 +653,7 @@
27.153
27.154 // if there's overlap between the current working set of chars
27.155 // and the current category...
27.156 - CharSet that = (CharSet)(categories.elementAt(j));
27.157 + CharSet that = categories.elementAt(j);
27.158 if (!that.intersection(e).empty()) {
27.159
27.160 // add a new category for the characters that were in the
27.161 @@ -686,9 +686,9 @@
27.162 // up in some other category
27.163 CharSet allChars = new CharSet();
27.164 for (int i = 1; i < categories.size(); i++) {
27.165 - allChars = allChars.union((CharSet)(categories.elementAt(i)));
27.166 + allChars = allChars.union(categories.elementAt(i));
27.167 }
27.168 - CharSet ignoreChars = (CharSet)(categories.elementAt(0));
27.169 + CharSet ignoreChars = categories.elementAt(0);
27.170 ignoreChars = ignoreChars.difference(allChars);
27.171 categories.setElementAt(ignoreChars, 0);
27.172
27.173 @@ -697,9 +697,9 @@
27.174 // character categories that expression refers to. The String is encoded: each
27.175 // character is a character category number (plus 0x100 to avoid confusing them
27.176 // with syntax characters in the rule grammar)
27.177 - iter = expressions.keys();
27.178 - while (iter.hasMoreElements()) {
27.179 - String key = (String)iter.nextElement();
27.180 +
27.181 + for (Enumeration<String> iter = expressions.keys(); iter.hasMoreElements(); ) {
27.182 + String key = iter.nextElement();
27.183 CharSet cs = (CharSet)expressions.get(key);
27.184 StringBuffer cats = new StringBuffer();
27.185
27.186 @@ -707,7 +707,7 @@
27.187 for (int j = 0; j < categories.size(); j++) {
27.188
27.189 // if the current expression contains characters in that category...
27.190 - CharSet temp = cs.intersection((CharSet)(categories.elementAt(j)));
27.191 + CharSet temp = cs.intersection(categories.elementAt(j));
27.192 if (!temp.empty()) {
27.193
27.194 // then add the encoded category number to the String for this
27.195 @@ -732,12 +732,12 @@
27.196
27.197 // for each category...
27.198 for (int i = 0; i < categories.size(); i++) {
27.199 - CharSet chars = (CharSet)(categories.elementAt(i));
27.200 + CharSet chars = categories.elementAt(i);
27.201
27.202 // go through the character ranges in the category one by one...
27.203 - Enumeration enum_ = chars.getChars();
27.204 + Enumeration<int[]> enum_ = chars.getChars();
27.205 while (enum_.hasMoreElements()) {
27.206 - int[] range = (int[])(enum_.nextElement());
27.207 + int[] range = enum_.nextElement();
27.208
27.209 // and set the corresponding elements in the CompactArray accordingly
27.210 if (i != 0) {
27.211 @@ -782,7 +782,7 @@
27.212 numCategories = categories.size();
27.213 }
27.214
27.215 - protected void mungeExpressionList(Hashtable expressions) {
27.216 + protected void mungeExpressionList(Hashtable<String, Object> expressions) {
27.217 // empty in the parent class. This function provides a hook for subclasses
27.218 // to mess with the character category table.
27.219 }
27.220 @@ -792,19 +792,19 @@
27.221 * work is done in parseRule(), which is called once for each rule in the
27.222 * description.
27.223 */
27.224 - private void buildStateTable(Vector tempRuleList) {
27.225 + private void buildStateTable(Vector<String> tempRuleList) {
27.226 // initialize our temporary state table, and fill it with two states:
27.227 // state 0 is a dummy state that allows state 1 to be the starting state
27.228 // and 0 to represent "stop". State 1 is added here to seed things
27.229 // before we start parsing
27.230 - tempStateTable = new Vector();
27.231 + tempStateTable = new Vector<>();
27.232 tempStateTable.addElement(new short[numCategories + 1]);
27.233 tempStateTable.addElement(new short[numCategories + 1]);
27.234
27.235 // call parseRule() for every rule in the rule list (except those which
27.236 // start with !, which are actually backwards-iteration rules)
27.237 for (int i = 0; i < tempRuleList.size(); i++) {
27.238 - String rule = (String)tempRuleList.elementAt(i);
27.239 + String rule = tempRuleList.elementAt(i);
27.240 if (rule.charAt(0) != '!') {
27.241 parseRule(rule, true);
27.242 }
27.243 @@ -891,10 +891,10 @@
27.244 int lastState = currentState;
27.245 String pendingChars = "";
27.246
27.247 - decisionPointStack = new Stack();
27.248 - decisionPointList = new Vector();
27.249 - loopingStates = new Vector();
27.250 - statesToBackfill = new Vector();
27.251 + decisionPointStack = new Stack<>();
27.252 + decisionPointList = new Vector<>();
27.253 + loopingStates = new Vector<>();
27.254 + statesToBackfill = new Vector<>();
27.255
27.256 short[] state;
27.257 boolean sawEarlyBreak = false;
27.258 @@ -972,8 +972,8 @@
27.259
27.260 // if the character we're on is a period, we end up down here
27.261 else {
27.262 - int rowNum = ((Integer)decisionPointList.lastElement()).intValue();
27.263 - state = (short[])tempStateTable.elementAt(rowNum);
27.264 + int rowNum = decisionPointList.lastElement().intValue();
27.265 + state = tempStateTable.elementAt(rowNum);
27.266
27.267 // if the period is followed by an asterisk, then just set the current
27.268 // state to loop back on itself
27.269 @@ -1001,7 +1001,9 @@
27.270 // of the current desicion point list onto the stack (this is
27.271 // the same thing we do on an opening brace)
27.272 if (p + 1 < rule.length() && rule.charAt(p + 1) == '*') {
27.273 - decisionPointStack.push(decisionPointList.clone());
27.274 + @SuppressWarnings("unchecked")
27.275 + Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
27.276 + decisionPointStack.push(clone);
27.277 }
27.278
27.279 // create a new state, add it to the list of states to backfill
27.280 @@ -1040,7 +1042,9 @@
27.281 // it, preventing it from being affected by whatever's inside the parentheses.
27.282 // This decision point list is restored when a } is encountered.
27.283 else if (c == '{') {
27.284 - decisionPointStack.push(decisionPointList.clone());
27.285 + @SuppressWarnings("unchecked")
27.286 + Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
27.287 + decisionPointStack.push(clone);
27.288 }
27.289
27.290 // a } marks the end of an optional run of characters. Pop the last decision
27.291 @@ -1053,7 +1057,7 @@
27.292 // on the character categories that caused us to enter this state
27.293 if (c == '*') {
27.294 for (int i = lastState + 1; i < tempStateTable.size(); i++) {
27.295 - Vector temp = new Vector();
27.296 + Vector<Integer> temp = new Vector<>();
27.297 temp.addElement(new Integer(i));
27.298 updateStateTable(temp, pendingChars, (short)(lastState + 1));
27.299 }
27.300 @@ -1063,7 +1067,7 @@
27.301 // it with the current decision point list (this causes the divergent
27.302 // paths through the state table to come together again on the next
27.303 // new state)
27.304 - Vector temp = (Vector)decisionPointStack.pop();
27.305 + Vector<Integer> temp = decisionPointStack.pop();
27.306 for (int i = 0; i < decisionPointList.size(); i++)
27.307 temp.addElement(decisionPointList.elementAt(i));
27.308 decisionPointList = temp;
27.309 @@ -1123,8 +1127,10 @@
27.310 // stack (this keeps track of the active decision point list before
27.311 // the () expression), followed by an empty decision point list
27.312 // (this will hold the exit points)
27.313 - decisionPointStack.push(decisionPointList.clone());
27.314 - decisionPointStack.push(new Vector());
27.315 + @SuppressWarnings("unchecked")
27.316 + Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
27.317 + decisionPointStack.push(clone);
27.318 + decisionPointStack.push(new Vector<Integer>());
27.319 }
27.320
27.321 // a | separates alternative character sequences in a () expression. When
27.322 @@ -1133,8 +1139,8 @@
27.323 else if (c == '|') {
27.324
27.325 // pick out the top two decision point lists on the stack
27.326 - Vector oneDown = (Vector)decisionPointStack.pop();
27.327 - Vector twoDown = (Vector)decisionPointStack.peek();
27.328 + Vector<Integer> oneDown = decisionPointStack.pop();
27.329 + Vector<Integer> twoDown = decisionPointStack.peek();
27.330 decisionPointStack.push(oneDown);
27.331
27.332 // append the current decision point list to the list below it
27.333 @@ -1142,7 +1148,9 @@
27.334 // current decision point list to its state before the () expression
27.335 for (int i = 0; i < decisionPointList.size(); i++)
27.336 oneDown.addElement(decisionPointList.elementAt(i));
27.337 - decisionPointList = (Vector)twoDown.clone();
27.338 + @SuppressWarnings("unchecked")
27.339 + Vector<Integer> clone = (Vector<Integer>)twoDown.clone();
27.340 + decisionPointList = clone;
27.341 }
27.342
27.343 // a ) marks the end of a sequence of characters. We do one of two things
27.344 @@ -1160,7 +1168,7 @@
27.345 // pull the exit point list off the stack, merge it with the current
27.346 // decision point list, and make the merged version the current
27.347 // decision point list
27.348 - Vector exitPoints = (Vector)decisionPointStack.pop();
27.349 + Vector<Integer> exitPoints = decisionPointStack.pop();
27.350 for (int i = 0; i < decisionPointList.size(); i++)
27.351 exitPoints.addElement(decisionPointList.elementAt(i));
27.352 decisionPointList = exitPoints;
27.353 @@ -1176,16 +1184,18 @@
27.354
27.355 // now exitPoints and decisionPointList have to point to equivalent
27.356 // vectors, but not the SAME vector
27.357 - exitPoints = (Vector)decisionPointList.clone();
27.358 + @SuppressWarnings("unchecked")
27.359 + Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
27.360 + exitPoints = clone;
27.361
27.362 // pop the original decision point list off the stack
27.363 - Vector temp = (Vector)decisionPointStack.pop();
27.364 + Vector<Integer> temp = decisionPointStack.pop();
27.365
27.366 // we squirreled away the row number of our entry point list
27.367 // at the beginning of the original decision point list. Fish
27.368 // that state number out and retrieve the entry point list
27.369 - int tempStateNum = ((Integer)temp.firstElement()).intValue();
27.370 - short[] tempState = (short[])tempStateTable.elementAt(tempStateNum);
27.371 + int tempStateNum = temp.firstElement().intValue();
27.372 + short[] tempState = tempStateTable.elementAt(tempStateNum);
27.373
27.374 // merge the original decision point list with the current
27.375 // decision point list
27.376 @@ -1217,8 +1227,8 @@
27.377 else if (c == '/') {
27.378 sawEarlyBreak = true;
27.379 for (int i = 0; i < decisionPointList.size(); i++) {
27.380 - state = (short[])tempStateTable.elementAt(((Integer)decisionPointList.
27.381 - elementAt(i)).intValue());
27.382 + state = tempStateTable.elementAt(decisionPointList.
27.383 + elementAt(i).intValue());
27.384 state[numCategories] |= LOOKAHEAD_STATE_FLAG;
27.385 }
27.386 }
27.387 @@ -1261,8 +1271,8 @@
27.388 // signals that these states cause the break position to be updated to the
27.389 // position of the slash rather than the current break position.
27.390 for (int i = 0; i < decisionPointList.size(); i++) {
27.391 - int rowNum = ((Integer)decisionPointList.elementAt(i)).intValue();
27.392 - state = (short[])tempStateTable.elementAt(rowNum);
27.393 + int rowNum = decisionPointList.elementAt(i).intValue();
27.394 + state = tempStateTable.elementAt(rowNum);
27.395 state[numCategories] |= END_STATE_FLAG;
27.396 if (sawEarlyBreak) {
27.397 state[numCategories] |= LOOKAHEAD_STATE_FLAG;
27.398 @@ -1279,7 +1289,7 @@
27.399 * list of the columns that need updating.
27.400 * @param newValue Update the cells specfied above to contain this value
27.401 */
27.402 - private void updateStateTable(Vector rows,
27.403 + private void updateStateTable(Vector<Integer> rows,
27.404 String pendingChars,
27.405 short newValue) {
27.406 // create a dummy state that has the specified row number (newValue) in
27.407 @@ -1292,7 +1302,7 @@
27.408 // go through the list of rows to update, and update them by calling
27.409 // mergeStates() to merge them the the dummy state we created
27.410 for (int i = 0; i < rows.size(); i++) {
27.411 - mergeStates(((Integer)rows.elementAt(i)).intValue(), newValues, rows);
27.412 + mergeStates(rows.elementAt(i).intValue(), newValues, rows);
27.413 }
27.414 }
27.415
27.416 @@ -1318,8 +1328,8 @@
27.417 */
27.418 private void mergeStates(int rowNum,
27.419 short[] newValues,
27.420 - Vector rowsBeingUpdated) {
27.421 - short[] oldValues = (short[])(tempStateTable.elementAt(rowNum));
27.422 + Vector<Integer> rowsBeingUpdated) {
27.423 + short[] oldValues = tempStateTable.elementAt(rowNum);
27.424 boolean isLoopingState = loopingStates.contains(new Integer(rowNum));
27.425
27.426 // for each of the cells in the rows we're reconciling, do...
27.427 @@ -1375,7 +1385,7 @@
27.428 // add this pair of row numbers to the merge list (create it first
27.429 // if we haven't created the merge list yet)
27.430 if (mergeList == null) {
27.431 - mergeList = new Vector();
27.432 + mergeList = new Vector<>();
27.433 }
27.434 mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum });
27.435
27.436 @@ -1384,7 +1394,7 @@
27.437 // state table and update the original row (oldValues) to point
27.438 // to the new, merged, state
27.439 short[] newRow = new short[numCategories + 1];
27.440 - short[] oldRow = (short[])(tempStateTable.elementAt(oldRowNum));
27.441 + short[] oldRow = tempStateTable.elementAt(oldRowNum);
27.442 System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1);
27.443 tempStateTable.addElement(newRow);
27.444 oldValues[i] = (short)combinedRowNum;
27.445 @@ -1408,7 +1418,7 @@
27.446 // now (groan) do the same thing for all the entries on the
27.447 // decision point stack
27.448 for (int k = 0; k < decisionPointStack.size(); k++) {
27.449 - Vector dpl = (Vector)decisionPointStack.elementAt(k);
27.450 + Vector<Integer> dpl = decisionPointStack.elementAt(k);
27.451 if ((dpl.contains(new Integer(oldRowNum))
27.452 || dpl.contains(new Integer(newRowNum)))
27.453 && !dpl.contains(new Integer(combinedRowNum))
27.454 @@ -1420,8 +1430,8 @@
27.455 // FINALLY (puff puff puff), call mergeStates() recursively to copy
27.456 // the row referred to by newValues into the new row and resolve any
27.457 // conflicts that come up at that level
27.458 - mergeStates(combinedRowNum, (short[])(tempStateTable.elementAt(
27.459 - newValues[i])), rowsBeingUpdated);
27.460 + mergeStates(combinedRowNum, tempStateTable.elementAt(
27.461 + newValues[i]), rowsBeingUpdated);
27.462 }
27.463 }
27.464 }
27.465 @@ -1445,7 +1455,7 @@
27.466 else {
27.467 int[] entry;
27.468 for (int i = 0; i < mergeList.size(); i++) {
27.469 - entry = (int[])(mergeList.elementAt(i));
27.470 + entry = mergeList.elementAt(i);
27.471
27.472 // we have a hit if the two row numbers match the two row numbers
27.473 // in the beginning of the entry (the two that combine), in either
27.474 @@ -1477,20 +1487,21 @@
27.475 * @param endStates The list of states to treat as end states (states that
27.476 * can exit the loop).
27.477 */
27.478 - private void setLoopingStates(Vector newLoopingStates, Vector endStates) {
27.479 + private void setLoopingStates(Vector<Integer> newLoopingStates,
27.480 + Vector<Integer> endStates) {
27.481
27.482 // if the current list of looping states isn't empty, we have to backfill
27.483 // values from the looping states into the states that are waiting to be
27.484 // backfilled
27.485 if (!loopingStates.isEmpty()) {
27.486 - int loopingState = ((Integer)loopingStates.lastElement()).intValue();
27.487 + int loopingState = loopingStates.lastElement().intValue();
27.488 int rowNum;
27.489
27.490 // don't backfill into an end state OR any state reachable from an end state
27.491 // (since the search for reachable states is recursive, it's split out into
27.492 // a separate function, eliminateBackfillStates(), below)
27.493 for (int i = 0; i < endStates.size(); i++) {
27.494 - eliminateBackfillStates(((Integer)endStates.elementAt(i)).intValue());
27.495 + eliminateBackfillStates(endStates.elementAt(i).intValue());
27.496 }
27.497
27.498 // we DON'T actually backfill the states that need to be backfilled here.
27.499 @@ -1501,8 +1512,8 @@
27.500 // for backfilling by putting the row number of the state to copy from
27.501 // into the flag cell at the end of the row
27.502 for (int i = 0; i < statesToBackfill.size(); i++) {
27.503 - rowNum = ((Integer)statesToBackfill.elementAt(i)).intValue();
27.504 - short[] state = (short[])tempStateTable.elementAt(rowNum);
27.505 + rowNum = statesToBackfill.elementAt(i).intValue();
27.506 + short[] state = tempStateTable.elementAt(rowNum);
27.507 state[numCategories] =
27.508 (short)((state[numCategories] & ALL_FLAGS) | loopingState);
27.509 }
27.510 @@ -1511,7 +1522,9 @@
27.511 }
27.512
27.513 if (newLoopingStates != null) {
27.514 - loopingStates = (Vector)newLoopingStates.clone();
27.515 + @SuppressWarnings("unchecked")
27.516 + Vector<Integer> clone = (Vector<Integer>)newLoopingStates.clone();
27.517 + loopingStates = clone;
27.518 }
27.519 }
27.520
27.521 @@ -1530,7 +1543,7 @@
27.522
27.523 // then go through and recursively call this function for every
27.524 // state that the base state points to
27.525 - short[] state = (short[])tempStateTable.elementAt(baseState);
27.526 + short[] state = tempStateTable.elementAt(baseState);
27.527 for (int i = 0; i < numCategories; i++) {
27.528 if (state[i] != 0) {
27.529 eliminateBackfillStates(state[i]);
27.530 @@ -1551,7 +1564,7 @@
27.531
27.532 // for each state in the state table...
27.533 for (int i = 0; i < tempStateTable.size(); i++) {
27.534 - state = (short[])tempStateTable.elementAt(i);
27.535 + state = tempStateTable.elementAt(i);
27.536
27.537 // check the state's flag word to see if it's marked for backfilling
27.538 // (it's marked for backfilling if any bits other than the two high-order
27.539 @@ -1563,7 +1576,7 @@
27.540 // load up the state to copy from (if we haven't already)
27.541 if (fromState != loopingStateRowNum) {
27.542 loopingStateRowNum = fromState;
27.543 - loopingState = (short[])tempStateTable.elementAt(loopingStateRowNum);
27.544 + loopingState = tempStateTable.elementAt(loopingStateRowNum);
27.545 }
27.546
27.547 // clear out the backfill part of the flag word
27.548 @@ -1594,7 +1607,7 @@
27.549 backfillLoopingStates();
27.550
27.551 int[] rowNumMap = new int[tempStateTable.size()];
27.552 - Stack rowsToFollow = new Stack();
27.553 + Stack<Integer> rowsToFollow = new Stack<>();
27.554 rowsToFollow.push(new Integer(1));
27.555 rowNumMap[1] = 1;
27.556
27.557 @@ -1602,8 +1615,8 @@
27.558 // (the reachable states will have their row numbers in the row number
27.559 // map, and the nonreachable states will have zero in the row number map)
27.560 while (rowsToFollow.size() != 0) {
27.561 - int rowNum = ((Integer)rowsToFollow.pop()).intValue();
27.562 - short[] row = (short[])(tempStateTable.elementAt(rowNum));
27.563 + int rowNum = rowsToFollow.pop().intValue();
27.564 + short[] row = tempStateTable.elementAt(rowNum);
27.565
27.566 for (int i = 0; i < numCategories; i++) {
27.567 if (row[i] != 0) {
27.568 @@ -1632,7 +1645,7 @@
27.569 if (rowNumMap[i] == 0) {
27.570 continue;
27.571 }
27.572 - state1 = (short[])tempStateTable.elementAt(i);
27.573 + state1 = tempStateTable.elementAt(i);
27.574 for (int j = 0; j < numCategories; j++) {
27.575 if (state1[j] != 0) {
27.576 ++stateClasses[i];
27.577 @@ -1663,10 +1676,10 @@
27.578 for (int i = 0; i < stateClasses.length; i++) {
27.579 if (stateClasses[i] == currentClass) {
27.580 if (state1 == null) {
27.581 - state1 = (short[])tempStateTable.elementAt(i);
27.582 + state1 = tempStateTable.elementAt(i);
27.583 }
27.584 else {
27.585 - state2 = (short[])tempStateTable.elementAt(i);
27.586 + state2 = tempStateTable.elementAt(i);
27.587 for (int j = 0; j < state2.length; j++) {
27.588 if ((j == numCategories && state1[j] != state2[j] && forward)
27.589 || (j != numCategories && stateClasses[state1[j]]
27.590 @@ -1733,7 +1746,7 @@
27.591 int p = 0;
27.592 int p2 = 0;
27.593 for (int i = 0; i < tempStateTable.size(); i++) {
27.594 - short[] row = (short[])(tempStateTable.elementAt(i));
27.595 + short[] row = tempStateTable.elementAt(i);
27.596 if (row == null) {
27.597 continue;
27.598 }
27.599 @@ -1752,7 +1765,7 @@
27.600 backwardsStateTable = new short[newRowNum * numCategories];
27.601 int p = 0;
27.602 for (int i = 0; i < tempStateTable.size(); i++) {
27.603 - short[] row = (short[])(tempStateTable.elementAt(i));
27.604 + short[] row = tempStateTable.elementAt(i);
27.605 if (row == null) {
27.606 continue;
27.607 }
27.608 @@ -1769,12 +1782,12 @@
27.609 * table and any additional rules (identified by the ! on the front)
27.610 * supplied in the description
27.611 */
27.612 - private void buildBackwardsStateTable(Vector tempRuleList) {
27.613 + private void buildBackwardsStateTable(Vector<String> tempRuleList) {
27.614
27.615 // create the temporary state table and seed it with two rows (row 0
27.616 // isn't used for anything, and we have to create row 1 (the initial
27.617 // state) before we can do anything else
27.618 - tempStateTable = new Vector();
27.619 + tempStateTable = new Vector<>();
27.620 tempStateTable.addElement(new short[numCategories + 1]);
27.621 tempStateTable.addElement(new short[numCategories + 1]);
27.622
27.623 @@ -1786,7 +1799,7 @@
27.624 // the same syntax as the normal break rules, but begin with '!' to distinguish
27.625 // them from normal break rules
27.626 for (int i = 0; i < tempRuleList.size(); i++) {
27.627 - String rule = (String)tempRuleList.elementAt(i);
27.628 + String rule = tempRuleList.elementAt(i);
27.629 if (rule.charAt(0) == '!') {
27.630 parseRule(rule.substring(1), false);
27.631 }
27.632 @@ -1831,7 +1844,7 @@
27.633 for (int i = 0; i < numCategories + 1; i++)
27.634 tempStateTable.addElement(new short[numCategories + 1]);
27.635
27.636 - short[] state = (short[])tempStateTable.elementAt(backTableOffset - 1);
27.637 + short[] state = tempStateTable.elementAt(backTableOffset - 1);
27.638 for (int i = 0; i < numCategories; i++)
27.639 state[i] = (short)(i + backTableOffset);
27.640
27.641 @@ -1855,7 +1868,7 @@
27.642 for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) {
27.643 int cellValue = lookupState(nextRow, nextColumn);
27.644 if (cellValue != 0) {
27.645 - state = (short[])tempStateTable.elementAt(nextColumn +
27.646 + state = tempStateTable.elementAt(nextColumn +
27.647 backTableOffset);
27.648 state[column] = (short)(column + backTableOffset);
27.649 }
27.650 @@ -1876,9 +1889,9 @@
27.651 // populated that is also populated in row 1 of the rule-based
27.652 // sub-table, copy the value from row 1 over the value in the
27.653 // auto-generated sub-table
27.654 - state = (short[])tempStateTable.elementAt(1);
27.655 + state = tempStateTable.elementAt(1);
27.656 for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) {
27.657 - short[] state2 = (short[])tempStateTable.elementAt(i);
27.658 + short[] state2 = tempStateTable.elementAt(i);
27.659 for (int j = 0; j < numCategories; j++) {
27.660 if (state[j] != 0 && state2[j] != 0) {
27.661 state2[j] = state[j];
27.662 @@ -1890,9 +1903,9 @@
27.663 // an end state, fill in all unpopulated cells with the values
27.664 // of the corresponding cells in the first row of the auto-
27.665 // generated sub-table.
27.666 - state = (short[])tempStateTable.elementAt(backTableOffset - 1);
27.667 + state = tempStateTable.elementAt(backTableOffset - 1);
27.668 for (int i = 1; i < backTableOffset - 1; i++) {
27.669 - short[] state2 = (short[])tempStateTable.elementAt(i);
27.670 + short[] state2 = tempStateTable.elementAt(i);
27.671 if ((state2[numCategories] & END_STATE_FLAG) == 0) {
27.672 for (int j = 0; j < numCategories; j++) {
27.673 if (state2[j] == 0) {
28.1 --- a/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java Fri Aug 05 15:35:04 2011 -0700
28.2 +++ b/make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java Tue Aug 09 17:38:52 2011 -0700
28.3 @@ -1,5 +1,5 @@
28.4 /*
28.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
28.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28.8 *
28.9 * This code is free software; you can redistribute it and/or modify it
28.10 @@ -128,7 +128,7 @@
28.11 int new_index = 0;
28.12 int loop_count = dataCount - 1;
28.13 long data = tempTable[old_index];
28.14 - int start = (int)((long)(data>>32)) & CODEPOINT_MASK;
28.15 + int start = (int)(data>>32) & CODEPOINT_MASK;
28.16 int end = (int)(data>>8) & CODEPOINT_MASK;
28.17
28.18 /*
28.19 @@ -142,7 +142,7 @@
28.20 newTempTable[new_index++] = composeEntry(start, (int)data);
28.21 for (int i = 0; i < loop_count; i++) {
28.22 data = tempTable[++old_index];
28.23 - int nextStart = (int)((long)(data>>32)) & CODEPOINT_MASK;
28.24 + int nextStart = (int)(data>>32) & CODEPOINT_MASK;
28.25
28.26 /*
28.27 * If the previous end code point is not equal to the previous start
29.1 --- a/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java Fri Aug 05 15:35:04 2011 -0700
29.2 +++ b/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java Tue Aug 09 17:38:52 2011 -0700
29.3 @@ -1,5 +1,5 @@
29.4 /*
29.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
29.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
29.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
29.8 *
29.9 * This code is free software; you can redistribute it and/or modify it
29.10 @@ -1290,7 +1290,7 @@
29.11 else if (bits == 32 || bits < 8)
29.12 result.append(hex8((int)val));
29.13 else {
29.14 - result.append(hex16((long)val));
29.15 + result.append(hex16(val));
29.16 if (!Csyntax)
29.17 result.append("L");
29.18 }
30.1 --- a/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java Fri Aug 05 15:35:04 2011 -0700
30.2 +++ b/make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java Tue Aug 09 17:38:52 2011 -0700
30.3 @@ -1,5 +1,5 @@
30.4 /*
30.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
30.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
30.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
30.8 *
30.9 * This code is free software; you can redistribute it and/or modify it
30.10 @@ -39,7 +39,7 @@
30.11 * <p>
30.12 * @author John O'Conner
30.13 */
30.14 -public class SpecialCaseMap implements Comparable {
30.15 +public class SpecialCaseMap implements Comparable<SpecialCaseMap> {
30.16
30.17 SpecialCaseMap() {
30.18 chSource = 0xFFFF;
30.19 @@ -55,7 +55,7 @@
30.20 */
30.21
30.22 public static SpecialCaseMap[] readSpecFile(File file, int plane) throws FileNotFoundException {
30.23 - ArrayList caseMaps = new ArrayList(150);
30.24 + ArrayList<SpecialCaseMap> caseMaps = new ArrayList<>(150);
30.25 int count = 0;
30.26 BufferedReader f = new BufferedReader(new FileReader(file));
30.27 String line = null;
30.28 @@ -69,7 +69,7 @@
30.29 SpecialCaseMap item = parse(line.trim());
30.30 if (item != null) {
30.31 if(item.getCharSource() >> 16 < plane) continue;
30.32 - if((int)(item.getCharSource() >> 16) > plane) break;
30.33 + if(item.getCharSource() >> 16 > plane) break;
30.34 caseMaps.add(item);
30.35 ++count;
30.36 }
30.37 @@ -83,7 +83,7 @@
30.38
30.39 }
30.40
30.41 - /**
30.42 + /**
30.43 * Given one line of a Unicode special casing data file as a String, parse the line
30.44 * and return a SpecialCaseMap object that contains the case mapping.
30.45 *
30.46 @@ -177,25 +177,25 @@
30.47 else return -1;
30.48 }
30.49
30.50 - /*
30.51 + /*
30.52 * Extracts and returns the high surrogate value from a UTF-32 code point.
30.53 * If argument is a BMP character, then it is converted to a char and returned;
30.54 * otherwise the high surrogate value is extracted.
30.55 * @param codePoint a UTF-32 codePoint with value greater than 0xFFFF.
30.56 * @return the high surrogate value that helps create <code>codePoint</code>; else
30.57 * the char representation of <code>codePoint</code> if it is a BMP character.
30.58 - * @since 1.5
30.59 + * @since 1.5
30.60 */
30.61 - static char getHighSurrogate(int codePoint) {
30.62 - char high = (char)codePoint;
30.63 - if (codePoint > 0xFFFF) {
30.64 - high = (char)((codePoint - 0x10000)/0x0400 + 0xD800);
30.65 - }
30.66 - return high;
30.67 + static char getHighSurrogate(int codePoint) {
30.68 + char high = (char)codePoint;
30.69 + if (codePoint > 0xFFFF) {
30.70 + high = (char)((codePoint - 0x10000)/0x0400 + 0xD800);
30.71 }
30.72 + return high;
30.73 + }
30.74
30.75
30.76 - /*
30.77 + /*
30.78 * Extracts and returns the low surrogate value from a UTF-32 code point.
30.79 * If argument is a BMP character, then it is converted to a char and returned;
30.80 * otherwise the high surrogate value is extracted.
30.81 @@ -204,29 +204,28 @@
30.82 * the char representation of <code>codePoint</code> if it is a BMP character.
30.83 * @since 1.5
30.84 */
30.85 - static char getLowSurrogate(int codePoint) {
30.86 - char low = (char)codePoint;
30.87 - if(codePoint > 0xFFFF) {
30.88 - low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00);
30.89 - }
30.90 - return low;
30.91 + static char getLowSurrogate(int codePoint) {
30.92 + char low = (char)codePoint;
30.93 + if(codePoint > 0xFFFF) {
30.94 + low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00);
30.95 }
30.96 + return low;
30.97 + }
30.98
30.99 - static String hex6(int n) {
30.100 - String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase();
30.101 - return "000000".substring(Math.min(6, str.length())) + str;
30.102 + static String hex6(int n) {
30.103 + String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase();
30.104 + return "000000".substring(Math.min(6, str.length())) + str;
30.105 + }
30.106
30.107 + static String hex6(char[] map){
30.108 + StringBuffer buff = new StringBuffer();
30.109 + int x=0;
30.110 + buff.append(hex6(map[x++]));
30.111 + while(x<map.length) {
30.112 + buff.append(" " + hex6(map[x++]));
30.113 }
30.114 -
30.115 - static String hex6(char[] map){
30.116 - StringBuffer buff = new StringBuffer();
30.117 - int x=0;
30.118 - buff.append(hex6(map[x++]));
30.119 - while(x<map.length) {
30.120 - buff.append(" " + hex6(map[x++]));
30.121 - }
30.122 - return buff.toString();
30.123 - }
30.124 + return buff.toString();
30.125 + }
30.126
30.127 void setCharSource(int ch) {
30.128 chSource = ch;
30.129 @@ -302,56 +301,62 @@
30.130 static String CONTEXT_MODERN = "MODERN";
30.131 static String CONTEXT_NONMODERN = "NON_MODERN";
30.132
30.133 - public int compareTo(Object otherObject) {
30.134 - SpecialCaseMap other = (SpecialCaseMap)otherObject;
30.135 - if (chSource < other.chSource) {
30.136 + public int compareTo(SpecialCaseMap otherObject) {
30.137 + if (chSource < otherObject.chSource) {
30.138 return -1;
30.139 }
30.140 - else if (chSource > other.chSource) {
30.141 + else if (chSource > otherObject.chSource) {
30.142 return 1;
30.143 }
30.144 else return 0;
30.145 }
30.146
30.147 public boolean equals(Object o1) {
30.148 - boolean bEqual = false;
30.149 - if (0 == compareTo(o1)) {
30.150 - bEqual = true;
30.151 - }
30.152 + if (this == o1) {
30.153 + return true;
30.154 + }
30.155 + if (o1 == null || !(o1 instanceof SpecialCaseMap)) {
30.156 + return false;
30.157 + }
30.158 + SpecialCaseMap other = (SpecialCaseMap)o1;
30.159 + boolean bEqual = false;
30.160 + if (0 == compareTo(other)) {
30.161 + bEqual = true;
30.162 + }
30.163 return bEqual;
30.164 }
30.165
30.166 - public String toString() {
30.167 - StringBuffer buff = new StringBuffer();
30.168 - buff.append(hex6(getCharSource()));
30.169 - buff.append("|" + hex6(lowerCaseMap));
30.170 - buff.append("|" + hex6(upperCaseMap));
30.171 - buff.append("|" + hex6(titleCaseMap));
30.172 - buff.append("|" + context);
30.173 - return buff.toString();
30.174 + public String toString() {
30.175 + StringBuffer buff = new StringBuffer();
30.176 + buff.append(hex6(getCharSource()));
30.177 + buff.append("|" + hex6(lowerCaseMap));
30.178 + buff.append("|" + hex6(upperCaseMap));
30.179 + buff.append("|" + hex6(titleCaseMap));
30.180 + buff.append("|" + context);
30.181 + return buff.toString();
30.182 + }
30.183 +
30.184 + public int hashCode() {
30.185 + return chSource;
30.186 + }
30.187 +
30.188 + public static void main(String[] args) {
30.189 + SpecialCaseMap[] spec = null;
30.190 + if (args.length == 2 ) {
30.191 + try {
30.192 + File file = new File(args[0]);
30.193 + int plane = Integer.parseInt(args[1]);
30.194 + spec = SpecialCaseMap.readSpecFile(file, plane);
30.195 + System.out.println("SpecialCaseMap[" + spec.length + "]:");
30.196 + for (int x=0; x<spec.length; x++) {
30.197 + System.out.println(spec[x].toString());
30.198 + }
30.199 + }
30.200 + catch(Exception e) {
30.201 + e.printStackTrace();
30.202 + }
30.203 }
30.204
30.205 - public int hashCode() {
30.206 - return (int)chSource;
30.207 - }
30.208 -
30.209 - public static void main(String[] args) {
30.210 - SpecialCaseMap[] spec = null;
30.211 - if (args.length == 2 ) {
30.212 - try {
30.213 - File file = new File(args[0]);
30.214 - int plane = Integer.parseInt(args[1]);
30.215 - spec = SpecialCaseMap.readSpecFile(file, plane);
30.216 - System.out.println("SpecialCaseMap[" + spec.length + "]:");
30.217 - for (int x=0; x<spec.length; x++) {
30.218 - System.out.println(spec[x].toString());
30.219 - }
30.220 - }
30.221 - catch(Exception e) {
30.222 - e.printStackTrace();
30.223 - }
30.224 - }
30.225 -
30.226 - }
30.227 + }
30.228
30.229 }
31.1 --- a/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java Fri Aug 05 15:35:04 2011 -0700
31.2 +++ b/make/tools/src/build/tools/generatecharacter/UnicodeSpec.java Tue Aug 09 17:38:52 2011 -0700
31.3 @@ -1,5 +1,5 @@
31.4 /*
31.5 - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
31.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
31.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
31.8 *
31.9 * This code is free software; you can redistribute it and/or modify it
31.10 @@ -391,31 +391,31 @@
31.11 */
31.12
31.13 public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException {
31.14 - ArrayList list = new ArrayList(3000);
31.15 + ArrayList<UnicodeSpec> list = new ArrayList<>(3000);
31.16 UnicodeSpec[] result = null;
31.17 int count = 0;
31.18 BufferedReader f = new BufferedReader(new FileReader(file));
31.19 - String line = null;
31.20 + String line = null;
31.21 loop:
31.22 while(true) {
31.23 try {
31.24 line = f.readLine();
31.25 }
31.26 catch (IOException e) {
31.27 - break loop;
31.28 - }
31.29 + break loop;
31.30 + }
31.31 if (line == null) break loop;
31.32 UnicodeSpec item = parse(line.trim());
31.33 - int specPlane = (int)(item.getCodePoint() >>> 16);
31.34 - if (specPlane < plane) continue;
31.35 - if (specPlane > plane) break;
31.36 + int specPlane = item.getCodePoint() >>> 16;
31.37 + if (specPlane < plane) continue;
31.38 + if (specPlane > plane) break;
31.39
31.40 if (item != null) {
31.41 - list.add(item);
31.42 + list.add(item);
31.43 }
31.44 }
31.45 - result = new UnicodeSpec[list.size()];
31.46 - list.toArray(result);
31.47 + result = new UnicodeSpec[list.size()];
31.48 + list.toArray(result);
31.49 return result;
31.50 }
31.51
32.1 --- a/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java Fri Aug 05 15:35:04 2011 -0700
32.2 +++ b/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java Tue Aug 09 17:38:52 2011 -0700
32.3 @@ -1,5 +1,5 @@
32.4 /*
32.5 - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
32.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
32.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
32.8 *
32.9 * This code is free software; you can redistribute it and/or modify it
32.10 @@ -250,10 +250,10 @@
32.11 return Integer.parseInt(numericCode);
32.12 }
32.13
32.14 - static HashMap specialCaseMap = new HashMap();
32.15 + static HashMap<String, Integer> specialCaseMap = new HashMap<>();
32.16
32.17 private static int makeSpecialCaseEntry(String currencyInfo) throws Exception {
32.18 - Integer oldEntry = (Integer) specialCaseMap.get(currencyInfo);
32.19 + Integer oldEntry = specialCaseMap.get(currencyInfo);
32.20 if (oldEntry != null) {
32.21 return oldEntry.intValue();
32.22 }
33.1 --- a/make/tools/src/build/tools/hasher/Hasher.java Fri Aug 05 15:35:04 2011 -0700
33.2 +++ b/make/tools/src/build/tools/hasher/Hasher.java Tue Aug 09 17:38:52 2011 -0700
33.3 @@ -1,5 +1,5 @@
33.4 /*
33.5 - * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
33.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
33.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33.8 *
33.9 * This code is free software; you can redistribute it and/or modify it
33.10 @@ -51,15 +51,15 @@
33.11
33.12 boolean verbose = false;
33.13
33.14 - List keys = new ArrayList(); // Key strings
33.15 - List values = new ArrayList(); // Value expressions
33.16 - String pkg = null; // Package prefix for generated class
33.17 - String cln = null; // Name of generated class
33.18 - String vtype = "String"; // Value type
33.19 - int maxBits = 11; // lg table size
33.20 - int maxDepth = 3; // Max chain depth
33.21 - boolean inner = false; // Generating an inner class?
33.22 - boolean empty = false; // Generating an empty table?
33.23 + List<String> keys = new ArrayList<>(); // Key strings
33.24 + List<String> values = new ArrayList<>(); // Value expressions
33.25 + String pkg = null; // Package prefix for generated class
33.26 + String cln = null; // Name of generated class
33.27 + String vtype = "String"; // Value type
33.28 + int maxBits = 11; // lg table size
33.29 + int maxDepth = 3; // Max chain depth
33.30 + boolean inner = false; // Generating an inner class?
33.31 + boolean empty = false; // Generating an empty table?
33.32
33.33 void usage() {
33.34 err.println("usage: java Hasher [options] [[pkgName.]ClassName]");
33.35 @@ -76,9 +76,9 @@
33.36 }
33.37
33.38 Hasher(String[] args) {
33.39 - List as = Arrays.asList(args);
33.40 - for (Iterator i = as.iterator(); i.hasNext();) {
33.41 - String a = (String)i.next();
33.42 + List<String> as = Arrays.asList(args);
33.43 + for (Iterator<String> i = as.iterator(); i.hasNext();) {
33.44 + String a = i.next();
33.45 if (a.equals("-e")) {
33.46 empty = true;
33.47 } else if (a.equals("-i")) {
33.48 @@ -88,15 +88,15 @@
33.49 } else if (a.equals("-md")) {
33.50 if (!i.hasNext())
33.51 usage();
33.52 - maxDepth = Integer.parseInt((String)i.next());
33.53 + maxDepth = Integer.parseInt(i.next());
33.54 } else if (a.equals("-mb")) {
33.55 if (!i.hasNext())
33.56 usage();
33.57 - maxBits = Integer.parseInt((String)i.next());
33.58 + maxBits = Integer.parseInt(i.next());
33.59 } else if (a.equals("-t")) {
33.60 if (!i.hasNext())
33.61 usage();
33.62 - vtype = (String)i.next();
33.63 + vtype = i.next();
33.64 } else if (a.startsWith("-")) {
33.65 usage();
33.66 } else {
33.67 @@ -153,8 +153,8 @@
33.68 int nw = keys.size();
33.69
33.70 for (int i = 0; i < nw; i++) {
33.71 - String w = (String)keys.get(i);
33.72 - String v = (String)values.get(i);
33.73 + String w = keys.get(i);
33.74 + String v = values.get(i);
33.75 int h = hash(w);
33.76 if (ht[h] == null)
33.77 ht[h] = new Object[] { w, v };
33.78 @@ -217,7 +217,7 @@
33.79 if (verbose)
33.80 err.println();
33.81 for (int i = 0, n = keys.size(); i < n; i++) {
33.82 - String w = (String)keys.get(i);
33.83 + String w = keys.get(i);
33.84 String v = get(w);
33.85 if (verbose)
33.86 err.println(hash(w) + "\t" + w);
34.1 --- a/make/tools/src/build/tools/jarsplit/JarSplit.java Fri Aug 05 15:35:04 2011 -0700
34.2 +++ b/make/tools/src/build/tools/jarsplit/JarSplit.java Tue Aug 09 17:38:52 2011 -0700
34.3 @@ -1,5 +1,5 @@
34.4 /*
34.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
34.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
34.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
34.8 *
34.9 * This code is free software; you can redistribute it and/or modify it
34.10 @@ -43,7 +43,8 @@
34.11 /* classlist[0] contains class file list
34.12 * classlist[1] contains non-class file list
34.13 */
34.14 - private static Vector<String>[] classlist = (Vector<String>[])(new Vector[2]);
34.15 + @SuppressWarnings({ "unchecked", "rawtypes" })
34.16 + private static Vector<String>[] classlist = new Vector[2];
34.17
34.18 /* The 2 class list name passed as arguments. */
34.19 private static String[] fileNamelist = new String[2];
35.1 --- a/make/tools/src/build/tools/javazic/Gen.java Fri Aug 05 15:35:04 2011 -0700
35.2 +++ b/make/tools/src/build/tools/javazic/Gen.java Tue Aug 09 17:38:52 2011 -0700
35.3 @@ -1,5 +1,5 @@
35.4 /*
35.5 - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
35.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
35.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35.8 *
35.9 * This code is free software; you can redistribute it and/or modify it
35.10 @@ -30,14 +30,9 @@
35.11 import java.io.FileOutputStream;
35.12 import java.io.DataOutputStream;
35.13 import java.io.RandomAccessFile;
35.14 -import java.util.ArrayList;
35.15 -import java.util.Iterator;
35.16 -import java.util.LinkedList;
35.17 import java.util.List;
35.18 import java.util.Map;
35.19 import java.util.Set;
35.20 -import java.util.TreeMap;
35.21 -import java.util.TreeSet;
35.22 import sun.util.calendar.ZoneInfoFile;
35.23
35.24 /**
35.25 @@ -105,14 +100,13 @@
35.26 /* if DST offset is 0, this means DST isn't used.
35.27 * (NOT: offset's index is 0.)
35.28 */
35.29 - if ((dstoffset =
35.30 - ((Integer)dstOffsets.get(i)).intValue()) == -1) {
35.31 + if ((dstoffset = dstOffsets.get(i).intValue()) == -1) {
35.32 dstoffset = 0;
35.33 }
35.34
35.35 - dos.writeLong((((Long)transitions.get(i)).longValue() << 12)
35.36 + dos.writeLong((transitions.get(i).longValue() << 12)
35.37 | (dstoffset << 4)
35.38 - | ((Integer)offsets.get(i)).intValue());
35.39 + | offsets.get(i).intValue());
35.40
35.41 }
35.42
36.1 --- a/make/tools/src/build/tools/javazic/GenDoc.java Fri Aug 05 15:35:04 2011 -0700
36.2 +++ b/make/tools/src/build/tools/javazic/GenDoc.java Tue Aug 09 17:38:52 2011 -0700
36.3 @@ -1,5 +1,5 @@
36.4 /*
36.5 - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
36.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
36.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36.8 *
36.9 * This code is free software; you can redistribute it and/or modify it
36.10 @@ -31,12 +31,8 @@
36.11 import java.io.FileReader;
36.12 import java.io.FileWriter;
36.13 import java.io.IOException;
36.14 -import java.util.ArrayList;
36.15 -import java.util.Calendar;
36.16 import java.util.Date;
36.17 import java.util.HashMap;
36.18 -import java.util.Iterator;
36.19 -import java.util.LinkedList;
36.20 import java.util.List;
36.21 import java.util.Map;
36.22 import java.util.Set;
36.23 @@ -189,7 +185,7 @@
36.24
36.25 out.write(header1 + new Date() + header3 + zonename + header4);
36.26 out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>");
36.27 - LatitudeAndLongitude location = (LatitudeAndLongitude)mapList.get(zonename);
36.28 + LatitudeAndLongitude location = mapList.get(zonename);
36.29 if (location != null) {
36.30 int deg, min, sec;
36.31
36.32 @@ -608,12 +604,12 @@
36.33 "<BR>\n\n" + "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n" +
36.34 "<TR>\n<TD NOWRAP>\n");
36.35
36.36 - Set aliasSet = a.keySet();
36.37 + Set<String> aliasSet = a.keySet();
36.38 len = aliasSet.size();
36.39 - Object aliasNames[] = aliasSet.toArray();
36.40 + String aliasNames[] = aliasSet.toArray(new String[0]);
36.41 for (int i = 0; i < len; i++) {
36.42 - displayNameList.put(transform((String)aliasNames[i]),
36.43 - (String)aliasNames[i]);
36.44 + displayNameList.put(transform(aliasNames[i]),
36.45 + aliasNames[i]);
36.46 }
36.47
36.48 o = displayNameList.keySet().toArray();
37.1 --- a/make/tools/src/build/tools/javazic/Main.java Fri Aug 05 15:35:04 2011 -0700
37.2 +++ b/make/tools/src/build/tools/javazic/Main.java Tue Aug 09 17:38:52 2011 -0700
37.3 @@ -1,5 +1,5 @@
37.4 /*
37.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
37.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37.8 *
37.9 * This code is free software; you can redistribute it and/or modify it
37.10 @@ -26,7 +26,6 @@
37.11 package build.tools.javazic;
37.12
37.13 import java.util.ArrayList;
37.14 -import java.util.Iterator;
37.15 import java.util.List;
37.16
37.17 /**
38.1 --- a/make/tools/src/build/tools/javazic/Mappings.java Fri Aug 05 15:35:04 2011 -0700
38.2 +++ b/make/tools/src/build/tools/javazic/Mappings.java Tue Aug 09 17:38:52 2011 -0700
38.3 @@ -1,5 +1,5 @@
38.4 /*
38.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
38.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
38.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
38.8 *
38.9 * This code is free software; you can redistribute it and/or modify it
38.10 @@ -26,9 +26,6 @@
38.11 package build.tools.javazic;
38.12
38.13 import java.util.ArrayList;
38.14 -import java.util.HashMap;
38.15 -import java.util.HashSet;
38.16 -import java.util.Iterator;
38.17 import java.util.LinkedList;
38.18 import java.util.List;
38.19 import java.util.Map;
39.1 --- a/make/tools/src/build/tools/javazic/Simple.java Fri Aug 05 15:35:04 2011 -0700
39.2 +++ b/make/tools/src/build/tools/javazic/Simple.java Tue Aug 09 17:38:52 2011 -0700
39.3 @@ -1,5 +1,5 @@
39.4 /*
39.5 - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
39.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
39.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
39.8 *
39.9 * This code is free software; you can redistribute it and/or modify it
39.10 @@ -29,10 +29,7 @@
39.11 import java.io.File;
39.12 import java.io.FileWriter;
39.13 import java.io.IOException;
39.14 -import java.util.ArrayList;
39.15 import java.util.HashMap;
39.16 -import java.util.Iterator;
39.17 -import java.util.LinkedList;
39.18 import java.util.List;
39.19 import java.util.Map;
39.20 import java.util.Set;
39.21 @@ -51,22 +48,19 @@
39.22 /**
39.23 * Zone records which are applied for given year.
39.24 */
39.25 - private static Map<String,ZoneRec> lastZoneRecs
39.26 - = new HashMap<String,ZoneRec>();
39.27 + private static Map<String,ZoneRec> lastZoneRecs = new HashMap<>();
39.28
39.29 /**
39.30 * Rule records which are applied for given year.
39.31 */
39.32 - private static Map<String,List<RuleRec>> lastRules
39.33 - = new TreeMap<String,List<RuleRec>>();
39.34 + private static Map<String,List<RuleRec>> lastRules = new TreeMap<>();
39.35
39.36 /**
39.37 * zone IDs sorted by their GMT offsets. If zone's GMT
39.38 * offset will change in the future, its last known offset is
39.39 * used.
39.40 */
39.41 - private SortedMap<Integer, Set<String>> zonesByOffset
39.42 - = new TreeMap<Integer, Set<String>>();
39.43 + private SortedMap<Integer, Set<String>> zonesByOffset = new TreeMap<>();
39.44
39.45 /**
39.46 * Sets last Rule records and Zone records for given timezone to
39.47 @@ -86,7 +80,7 @@
39.48 int lastKnownOffset = tz.getRawOffset();
39.49 Set<String> set = zonesByOffset.get(lastKnownOffset);
39.50 if (set == null) {
39.51 - set = new TreeSet<String>();
39.52 + set = new TreeSet<>();
39.53 zonesByOffset.put(lastKnownOffset, set);
39.54 }
39.55 set.add(zonename);
39.56 @@ -101,16 +95,11 @@
39.57 */
39.58 int generateSrc(Mappings map) {
39.59 try {
39.60 - String outputDir = Main.getOutputDir();
39.61 - File outD = new File(outputDir);
39.62 -
39.63 - if (!outputDir.endsWith(File.separator)) {
39.64 - outputDir += outD.separator;
39.65 - }
39.66 + File outD = new File(Main.getOutputDir());
39.67 outD.mkdirs();
39.68
39.69 FileWriter fw =
39.70 - new FileWriter(outputDir + "TimeZoneData.java", false);
39.71 + new FileWriter(new File(outD, "TimeZoneData.java"), false);
39.72 BufferedWriter out = new BufferedWriter(fw);
39.73
39.74 out.write("import java.util.SimpleTimeZone;\n\n");
40.1 --- a/make/tools/src/build/tools/javazic/Time.java Fri Aug 05 15:35:04 2011 -0700
40.2 +++ b/make/tools/src/build/tools/javazic/Time.java Tue Aug 09 17:38:52 2011 -0700
40.3 @@ -1,5 +1,5 @@
40.4 /*
40.5 - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
40.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
40.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
40.8 *
40.9 * This code is free software; you can redistribute it and/or modify it
40.10 @@ -268,16 +268,16 @@
40.11 if (index < time.length()) {
40.12 char c = time.charAt(index++);
40.13 if (c == 's') {
40.14 - tm.setType(tm.STD);
40.15 + tm.setType(Time.STD);
40.16 } else if (c == 'u' || c == 'g' || c == 'z') {
40.17 - tm.setType(tm.UTC);
40.18 + tm.setType(Time.UTC);
40.19 } else if (c == 'w') {
40.20 - tm.setType(tm.WALL);
40.21 + tm.setType(Time.WALL);
40.22 } else {
40.23 Main.panic("unknown time mode: "+c);
40.24 }
40.25 } else {
40.26 - tm.setType(tm.WALL);
40.27 + tm.setType(Time.WALL);
40.28 }
40.29 return tm;
40.30 }
41.1 --- a/make/tools/src/build/tools/javazic/Zoneinfo.java Fri Aug 05 15:35:04 2011 -0700
41.2 +++ b/make/tools/src/build/tools/javazic/Zoneinfo.java Tue Aug 09 17:38:52 2011 -0700
41.3 @@ -1,5 +1,5 @@
41.4 /*
41.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
41.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
41.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41.8 *
41.9 * This code is free software; you can redistribute it and/or modify it
41.10 @@ -29,9 +29,7 @@
41.11 import java.io.FileReader;
41.12 import java.io.FileNotFoundException;
41.13 import java.io.IOException;
41.14 -import java.util.ArrayList;
41.15 import java.util.HashMap;
41.16 -import java.util.Iterator;
41.17 import java.util.List;
41.18 import java.util.Map;
41.19 import java.util.StringTokenizer;
41.20 @@ -407,9 +405,9 @@
41.21 if (!zrec.hasUntil()) {
41.22 if (tz.getNTransitions() > 0) {
41.23 if (stdOffset == 0) {
41.24 - tz.setDSTType(tz.X_DST);
41.25 + tz.setDSTType(Timezone.X_DST);
41.26 } else {
41.27 - tz.setDSTType(tz.LAST_DST);
41.28 + tz.setDSTType(Timezone.LAST_DST);
41.29 }
41.30 long time = Time.getLocalTime(maxYear,
41.31 Month.JANUARY, 1, 0);
41.32 @@ -419,7 +417,7 @@
41.33 tz.getDstOffsetIndex(stdOffset));
41.34 tz.addUsedRec(zrec);
41.35 } else {
41.36 - tz.setDSTType(tz.NO_DST);
41.37 + tz.setDSTType(Timezone.NO_DST);
41.38 }
41.39 break;
41.40 }
41.41 @@ -527,7 +525,7 @@
41.42 if (year == endYear && !zrec.hasUntil()) {
41.43 if (tz.getNTransitions() > 0) {
41.44 // Assume that this Zone stopped DST
41.45 - tz.setDSTType(tz.X_DST);
41.46 + tz.setDSTType(Timezone.X_DST);
41.47 long time = Time.getLocalTime(maxYear, Month.JANUARY,
41.48 1, 0);
41.49 time -= zrec.getGmtOffset();
41.50 @@ -536,7 +534,7 @@
41.51 tz.getDstOffsetIndex(0));
41.52 usedZone = true;
41.53 } else {
41.54 - tz.setDSTType(tz.NO_DST);
41.55 + tz.setDSTType(Timezone.NO_DST);
41.56 }
41.57 }
41.58 }
41.59 @@ -552,8 +550,8 @@
41.60 }
41.61 }
41.62
41.63 - if (tz.getDSTType() == tz.UNDEF_DST) {
41.64 - tz.setDSTType(tz.DST);
41.65 + if (tz.getDSTType() == Timezone.UNDEF_DST) {
41.66 + tz.setDSTType(Timezone.DST);
41.67 }
41.68 tz.optimize();
41.69 tz.checksum();
42.1 --- a/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java Fri Aug 05 15:35:04 2011 -0700
42.2 +++ b/make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java Tue Aug 09 17:38:52 2011 -0700
42.3 @@ -1,5 +1,5 @@
42.4 /*
42.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
42.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
42.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42.8 *
42.9 * This code is free software; you can redistribute it and/or modify it
42.10 @@ -25,7 +25,6 @@
42.11
42.12 package build.tools.jdwpgen;
42.13
42.14 -import java.util.*;
42.15 import java.io.*;
42.16
42.17 class AbstractCommandNode extends AbstractNamedNode {
42.18 @@ -35,8 +34,8 @@
42.19 " Command</a> (" + nameNode.value() + ")</h5>");
42.20 writer.println(comment());
42.21 writer.println("<dl>");
42.22 - for (Iterator it = components.iterator(); it.hasNext();) {
42.23 - ((Node)it.next()).document(writer);
42.24 + for (Node node : components) {
42.25 + node.document(writer);
42.26 }
42.27 writer.println("</dl>");
42.28 }
43.1 --- a/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java Fri Aug 05 15:35:04 2011 -0700
43.2 +++ b/make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java Tue Aug 09 17:38:52 2011 -0700
43.3 @@ -1,5 +1,5 @@
43.4 /*
43.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
43.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
43.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
43.8 *
43.9 * This code is free software; you can redistribute it and/or modify it
43.10 @@ -25,14 +25,13 @@
43.11
43.12 package build.tools.jdwpgen;
43.13
43.14 -import java.util.*;
43.15 import java.io.*;
43.16
43.17 abstract class AbstractGroupNode extends AbstractTypeListNode {
43.18
43.19 void document(PrintWriter writer) {
43.20 - for (Iterator it = components.iterator(); it.hasNext();) {
43.21 - ((Node)it.next()).document(writer);
43.22 + for (Node node : components) {
43.23 + node.document(writer);
43.24 }
43.25 }
43.26
44.1 --- a/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java Fri Aug 05 15:35:04 2011 -0700
44.2 +++ b/make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java Tue Aug 09 17:38:52 2011 -0700
44.3 @@ -1,5 +1,5 @@
44.4 /*
44.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
44.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
44.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44.8 *
44.9 * This code is free software; you can redistribute it and/or modify it
44.10 @@ -38,10 +38,10 @@
44.11 }
44.12
44.13 void prune() {
44.14 - Iterator it = components.iterator();
44.15 + Iterator<Node> it = components.iterator();
44.16
44.17 if (it.hasNext()) {
44.18 - Node nameNode = (Node)it.next();
44.19 + Node nameNode = it.next();
44.20
44.21 if (nameNode instanceof NameNode) {
44.22 this.nameNode = (NameNode)nameNode;
44.23 @@ -64,8 +64,8 @@
44.24 void document(PrintWriter writer) {
44.25 writer.println("<h4><a name=" + name + ">" + name +
44.26 " Command Set</a></h4>");
44.27 - for (Iterator it = components.iterator(); it.hasNext();) {
44.28 - ((Node)it.next()).document(writer);
44.29 + for (Node node : components) {
44.30 + node.document(writer);
44.31 }
44.32 }
44.33
44.34 @@ -90,8 +90,8 @@
44.35 writer.print("class " + javaClassName());
44.36 writer.println(javaClassImplements() + " {");
44.37 genJavaClassSpecifics(writer, depth+1);
44.38 - for (Iterator it = components.iterator(); it.hasNext();) {
44.39 - ((Node)it.next()).genJava(writer, depth+1);
44.40 + for (Node node : components) {
44.41 + node.genJava(writer, depth+1);
44.42 }
44.43 indent(writer, depth);
44.44 writer.println("}");
45.1 --- a/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java Fri Aug 05 15:35:04 2011 -0700
45.2 +++ b/make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java Tue Aug 09 17:38:52 2011 -0700
45.3 @@ -1,5 +1,5 @@
45.4 /*
45.5 - * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
45.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
45.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45.8 *
45.9 * This code is free software; you can redistribute it and/or modify it
45.10 @@ -40,7 +40,7 @@
45.11
45.12 void document(PrintWriter writer) {
45.13 writer.println("<dt>" + name() + " Data");
45.14 - if (components.size() == 0) {
45.15 + if (components.isEmpty()) {
45.16 writer.println("<dd>(None)");
45.17 } else {
45.18 writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
45.19 @@ -49,24 +49,24 @@
45.20 }
45.21 writer.println("<th width=\"15%\"><th width=\"65%\">");
45.22 writer.println("");
45.23 - for (Iterator it = components.iterator(); it.hasNext();) {
45.24 - ((Node)it.next()).document(writer);
45.25 + for (Node node : components) {
45.26 + node.document(writer);
45.27 }
45.28 writer.println("</table>");
45.29 }
45.30 }
45.31
45.32 void genJavaClassBodyComponents(PrintWriter writer, int depth) {
45.33 - for (Iterator it = components.iterator(); it.hasNext();) {
45.34 - TypeNode tn = (TypeNode)it.next();
45.35 + for (Node node : components) {
45.36 + TypeNode tn = (TypeNode)node;
45.37
45.38 tn.genJavaDeclaration(writer, depth);
45.39 }
45.40 }
45.41
45.42 void genJavaReads(PrintWriter writer, int depth) {
45.43 - for (Iterator it = components.iterator(); it.hasNext();) {
45.44 - TypeNode tn = (TypeNode)it.next();
45.45 + for (Node node : components) {
45.46 + TypeNode tn = (TypeNode)node;
45.47 tn.genJavaRead(writer, depth, tn.name());
45.48 }
45.49 }
45.50 @@ -88,7 +88,7 @@
45.51
45.52 String javaParams() {
45.53 StringBuffer sb = new StringBuffer();
45.54 - for (Iterator it = components.iterator(); it.hasNext();) {
45.55 + for (Iterator<Node> it = components.iterator(); it.hasNext();) {
45.56 TypeNode tn = (TypeNode)it.next();
45.57 sb.append(tn.javaParam());
45.58 if (it.hasNext()) {
45.59 @@ -99,8 +99,8 @@
45.60 }
45.61
45.62 void genJavaWrites(PrintWriter writer, int depth) {
45.63 - for (Iterator it = components.iterator(); it.hasNext();) {
45.64 - TypeNode tn = (TypeNode)it.next();
45.65 + for (Node node : components) {
45.66 + TypeNode tn = (TypeNode)node;
45.67 tn.genJavaWrite(writer, depth, tn.name());
45.68 }
45.69 }
45.70 @@ -111,8 +111,8 @@
45.71 writer.println();
45.72 indent(writer, depth);
45.73 writer.println(className + "(" + javaParams() + ") {");
45.74 - for (Iterator it = components.iterator(); it.hasNext();) {
45.75 - TypeNode tn = (TypeNode)it.next();
45.76 + for (Node node : components) {
45.77 + TypeNode tn = (TypeNode)node;
45.78 indent(writer, depth+1);
45.79 writer.println("this." + tn.name() + " = " + tn.name() + ";");
45.80 }
46.1 --- a/make/tools/src/build/tools/jdwpgen/AltNode.java Fri Aug 05 15:35:04 2011 -0700
46.2 +++ b/make/tools/src/build/tools/jdwpgen/AltNode.java Tue Aug 09 17:38:52 2011 -0700
46.3 @@ -1,5 +1,5 @@
46.4 /*
46.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
46.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
46.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
46.8 *
46.9 * This code is free software; you can redistribute it and/or modify it
46.10 @@ -100,7 +100,7 @@
46.11 indent(writer, depth+1);
46.12 writer.print("return new " + select.name() + "(");
46.13 writer.print("ALT_ID, new " + javaClassName() + "(");
46.14 - for (Iterator it = components.iterator(); it.hasNext();) {
46.15 + for (Iterator<Node> it = components.iterator(); it.hasNext();) {
46.16 TypeNode tn = (TypeNode)it.next();
46.17 writer.print(tn.name());
46.18 if (it.hasNext()) {
47.1 --- a/make/tools/src/build/tools/jdwpgen/CommandSetNode.java Fri Aug 05 15:35:04 2011 -0700
47.2 +++ b/make/tools/src/build/tools/jdwpgen/CommandSetNode.java Tue Aug 09 17:38:52 2011 -0700
47.3 @@ -1,5 +1,5 @@
47.4 /*
47.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
47.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
47.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
47.8 *
47.9 * This code is free software; you can redistribute it and/or modify it
47.10 @@ -25,7 +25,6 @@
47.11
47.12 package build.tools.jdwpgen;
47.13
47.14 -import java.util.*;
47.15 import java.io.*;
47.16
47.17 class CommandSetNode extends AbstractNamedNode {
47.18 @@ -43,8 +42,8 @@
47.19 " Command Set</a> (" +
47.20 nameNode.value() + ")</h4>");
47.21 writer.println(comment());
47.22 - for (Iterator it = components.iterator(); it.hasNext();) {
47.23 - ((Node)it.next()).document(writer);
47.24 + for (Node node : components) {
47.25 + node.document(writer);
47.26 }
47.27 }
47.28
47.29 @@ -53,8 +52,8 @@
47.30 writer.println(name() + "</a> Command Set (" +
47.31 nameNode.value() + ")");
47.32 writer.println("<ul>");
47.33 - for (Iterator it = components.iterator(); it.hasNext();) {
47.34 - ((Node)it.next()).documentIndex(writer);
47.35 + for (Node node : components) {
47.36 + node.documentIndex(writer);
47.37 }
47.38 writer.println("</ul>");
47.39 }
48.1 --- a/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java Fri Aug 05 15:35:04 2011 -0700
48.2 +++ b/make/tools/src/build/tools/jdwpgen/ConstantSetNode.java Tue Aug 09 17:38:52 2011 -0700
48.3 @@ -1,5 +1,5 @@
48.4 /*
48.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
48.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
48.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48.8 *
48.9 * This code is free software; you can redistribute it and/or modify it
48.10 @@ -33,14 +33,11 @@
48.11 /**
48.12 * The mapping between a constant and its value.
48.13 */
48.14 - protected static final Map<String, String> constantMap = new HashMap<String, String>();
48.15 + protected static final Map<String, String> constantMap = new HashMap<>();
48.16
48.17 void prune() {
48.18 - List<Node> addons = new ArrayList<Node>();
48.19 + List<Node> addons = new ArrayList<>();
48.20
48.21 - for (Iterator it = components.iterator(); it.hasNext(); ) {
48.22 - Node node = (Node)it.next();
48.23 - }
48.24 if (!addons.isEmpty()) {
48.25 components.addAll(addons);
48.26 }
48.27 @@ -63,8 +60,8 @@
48.28 writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
48.29 writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">");
48.30 ConstantNode n;
48.31 - for (Iterator it = components.iterator(); it.hasNext();) {
48.32 - n = ((ConstantNode)it.next());
48.33 + for (Node node : components) {
48.34 + n = (ConstantNode)node;
48.35 writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>");
48.36 n.document(writer);
48.37 }
49.1 --- a/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java Fri Aug 05 15:35:04 2011 -0700
49.2 +++ b/make/tools/src/build/tools/jdwpgen/ErrorSetNode.java Tue Aug 09 17:38:52 2011 -0700
49.3 @@ -1,5 +1,5 @@
49.4 /*
49.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
49.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
49.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
49.8 *
49.9 * This code is free software; you can redistribute it and/or modify it
49.10 @@ -25,7 +25,6 @@
49.11
49.12 package build.tools.jdwpgen;
49.13
49.14 -import java.util.*;
49.15 import java.io.*;
49.16
49.17 class ErrorSetNode extends AbstractSimpleNode {
49.18 @@ -41,12 +40,12 @@
49.19 void document(PrintWriter writer) {
49.20
49.21 writer.println("<dt>" + "Error Data");
49.22 - if (components.size() == 0) {
49.23 + if (components.isEmpty()) {
49.24 writer.println("<dd>(None)");
49.25 } else {
49.26 writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">");
49.27 - for (Iterator it = components.iterator(); it.hasNext();) {
49.28 - ((Node)it.next()).document(writer);
49.29 + for (Node node : components) {
49.30 + node.document(writer);
49.31 }
49.32 writer.println("</table>");
49.33 }
50.1 --- a/make/tools/src/build/tools/jdwpgen/Node.java Fri Aug 05 15:35:04 2011 -0700
50.2 +++ b/make/tools/src/build/tools/jdwpgen/Node.java Tue Aug 09 17:38:52 2011 -0700
50.3 @@ -1,5 +1,5 @@
50.4 /*
50.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
50.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
50.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
50.8 *
50.9 * This code is free software; you can redistribute it and/or modify it
50.10 @@ -34,7 +34,7 @@
50.11 String kind;
50.12 List<Node> components;
50.13 int lineno;
50.14 - List<String> commentList = new ArrayList<String>();
50.15 + List<String> commentList = new ArrayList<>();
50.16 Node parent = null;
50.17 Context context = null;
50.18
50.19 @@ -50,8 +50,8 @@
50.20 }
50.21
50.22 void parentAndExtractComments() {
50.23 - for (Iterator it = components.iterator(); it.hasNext();) {
50.24 - Node node = (Node)it.next();
50.25 + for (Iterator<Node> it = components.iterator(); it.hasNext();) {
50.26 + Node node = it.next();
50.27 if (node instanceof CommentNode) {
50.28 it.remove();
50.29 commentList.add(((CommentNode)node).text());
50.30 @@ -63,16 +63,14 @@
50.31 }
50.32
50.33 void prune() {
50.34 - for (Iterator it = components.iterator(); it.hasNext();) {
50.35 - Node node = (Node)it.next();
50.36 + for (Node node : components) {
50.37 node.prune();
50.38 }
50.39 }
50.40
50.41 void constrain(Context ctx) {
50.42 context = ctx;
50.43 - for (Iterator it = components.iterator(); it.hasNext();) {
50.44 - Node node = (Node)it.next();
50.45 + for (Node node : components) {
50.46 constrainComponent(ctx, node);
50.47 }
50.48 }
50.49 @@ -109,9 +107,9 @@
50.50 if (commentList.size() > 0) {
50.51 indent(writer, depth);
50.52 writer.println("/**");
50.53 - for (Iterator it = commentList.iterator(); it.hasNext();) {
50.54 + for (String comment : commentList) {
50.55 indent(writer, depth);
50.56 - writer.println(" * " + (String)it.next());
50.57 + writer.println(" * " + comment);
50.58 }
50.59 indent(writer, depth);
50.60 writer.println(" */");
50.61 @@ -123,15 +121,13 @@
50.62 }
50.63
50.64 void genJava(PrintWriter writer, int depth) {
50.65 - for (Iterator it = components.iterator(); it.hasNext();) {
50.66 - Node node = (Node)it.next();
50.67 + for (Node node : components) {
50.68 node.genJava(writer, depth);
50.69 }
50.70 }
50.71
50.72 void genCInclude(PrintWriter writer) {
50.73 - for (Iterator it = components.iterator(); it.hasNext();) {
50.74 - Node node = (Node)it.next();
50.75 + for (Node node : components) {
50.76 node.genCInclude(writer);
50.77 }
50.78 }
50.79 @@ -184,8 +180,7 @@
50.80 }
50.81
50.82 void genJavaPreDef(PrintWriter writer, int depth) {
50.83 - for (Iterator it = components.iterator(); it.hasNext();) {
50.84 - Node node = (Node)it.next();
50.85 + for (Node node : components) {
50.86 node.genJavaPreDef(writer, depth);
50.87 }
50.88 }
51.1 --- a/make/tools/src/build/tools/jdwpgen/OutNode.java Fri Aug 05 15:35:04 2011 -0700
51.2 +++ b/make/tools/src/build/tools/jdwpgen/OutNode.java Tue Aug 09 17:38:52 2011 -0700
51.3 @@ -1,5 +1,5 @@
51.4 /*
51.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
51.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
51.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
51.8 *
51.9 * This code is free software; you can redistribute it and/or modify it
51.10 @@ -48,8 +48,8 @@
51.11 indent(writer, depth);
51.12 writer.print(
51.13 "static " + cmdName + " process(VirtualMachineImpl vm");
51.14 - for (Iterator it = components.iterator(); it.hasNext();) {
51.15 - TypeNode tn = (TypeNode)it.next();
51.16 + for (Node node : components) {
51.17 + TypeNode tn = (TypeNode)node;
51.18 writer.println(", ");
51.19 indent(writer, depth+5);
51.20 writer.print(tn.javaParam());
51.21 @@ -59,8 +59,8 @@
51.22 writer.println("throws JDWPException {");
51.23 indent(writer, depth+1);
51.24 writer.print("PacketStream ps = enqueueCommand(vm");
51.25 - for (Iterator it = components.iterator(); it.hasNext();) {
51.26 - TypeNode tn = (TypeNode)it.next();
51.27 + for (Node node : components) {
51.28 + TypeNode tn = (TypeNode)node;
51.29 writer.print(", ");
51.30 writer.print(tn.name());
51.31 }
51.32 @@ -76,8 +76,8 @@
51.33 indent(writer, depth);
51.34 writer.print(
51.35 "static PacketStream enqueueCommand(VirtualMachineImpl vm");
51.36 - for (Iterator it = components.iterator(); it.hasNext();) {
51.37 - TypeNode tn = (TypeNode)it.next();
51.38 + for (Node node : components) {
51.39 + TypeNode tn = (TypeNode)node;
51.40 writer.println(", ");
51.41 indent(writer, depth+5);
51.42 writer.print(tn.javaParam());
52.1 --- a/make/tools/src/build/tools/jdwpgen/RootNode.java Fri Aug 05 15:35:04 2011 -0700
52.2 +++ b/make/tools/src/build/tools/jdwpgen/RootNode.java Tue Aug 09 17:38:52 2011 -0700
52.3 @@ -1,5 +1,5 @@
52.4 /*
52.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
52.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
52.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
52.8 *
52.9 * This code is free software; you can redistribute it and/or modify it
52.10 @@ -42,11 +42,11 @@
52.11 void document(PrintWriter writer) {
52.12 writer.println("<html><head><title>" + comment() + "</title></head>");
52.13 writer.println("<body bgcolor=\"white\">");
52.14 - for (Iterator it = components.iterator(); it.hasNext();) {
52.15 - ((Node)it.next()).documentIndex(writer);
52.16 + for (Node node : components) {
52.17 + node.documentIndex(writer);
52.18 }
52.19 - for (Iterator it = components.iterator(); it.hasNext();) {
52.20 - ((Node)it.next()).document(writer);
52.21 + for (Node node : components) {
52.22 + node.document(writer);
52.23 }
52.24 writer.println("</body></html>");
52.25 }
53.1 --- a/make/tools/src/build/tools/jdwpgen/SelectNode.java Fri Aug 05 15:35:04 2011 -0700
53.2 +++ b/make/tools/src/build/tools/jdwpgen/SelectNode.java Tue Aug 09 17:38:52 2011 -0700
53.3 @@ -1,5 +1,5 @@
53.4 /*
53.5 - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
53.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
53.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
53.8 *
53.9 * This code is free software; you can redistribute it and/or modify it
53.10 @@ -34,10 +34,10 @@
53.11
53.12 void prune() {
53.13 super.prune();
53.14 - Iterator it = components.iterator();
53.15 + Iterator<Node> it = components.iterator();
53.16
53.17 if (it.hasNext()) {
53.18 - Node typeNode = (Node)it.next();
53.19 + Node typeNode = it.next();
53.20
53.21 if (typeNode instanceof ByteTypeNode ||
53.22 typeNode instanceof IntTypeNode) {
53.23 @@ -131,8 +131,8 @@
53.24 typeNode.genJavaRead(writer, depth, typeNode.name());
53.25 indent(writer, depth);
53.26 writer.println("switch (" + typeNode.name() + ") {");
53.27 - for (Iterator it = components.iterator(); it.hasNext();) {
53.28 - AltNode alt = (AltNode)it.next();
53.29 + for (Node node : components) {
53.30 + AltNode alt = (AltNode)node;
53.31 alt.genJavaReadsSelectCase(writer, depth+1, commonVar());
53.32 }
53.33 indent(writer, depth);
54.1 --- a/make/tools/src/build/tools/makeclasslist/MakeClasslist.java Fri Aug 05 15:35:04 2011 -0700
54.2 +++ b/make/tools/src/build/tools/makeclasslist/MakeClasslist.java Tue Aug 09 17:38:52 2011 -0700
54.3 @@ -1,5 +1,5 @@
54.4 /*
54.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
54.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
54.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
54.8 *
54.9 * This code is free software; you can redistribute it and/or modify it
54.10 @@ -38,7 +38,7 @@
54.11
54.12 public class MakeClasslist {
54.13 public static void main(String[] args) throws IOException {
54.14 - List/*<String>*/ classes = new ArrayList();
54.15 + List<String> classes = new ArrayList<>();
54.16 String origJavaHome = System.getProperty("java.home");
54.17 String javaHome = origJavaHome.toLowerCase();
54.18 if (javaHome.endsWith("jre")) {
54.19 @@ -84,10 +84,9 @@
54.20 }
54.21 }
54.22
54.23 - Set/*<String>*/ seenClasses = new HashSet();
54.24 + Set<String> seenClasses = new HashSet<>();
54.25
54.26 - for (Iterator iter = classes.iterator(); iter.hasNext(); ) {
54.27 - String str = (String) iter.next();
54.28 + for (String str : seenClasses) {
54.29 if (seenClasses.add(str)) {
54.30 System.out.println(str);
54.31 }
54.32 @@ -109,13 +108,13 @@
54.33 // completePackage(seenClasses, rtJar, "java/lang");
54.34 }
54.35
54.36 - private static void completePackage(Set seenClasses,
54.37 + private static void completePackage(Set<String> seenClasses,
54.38 JarFile jar,
54.39 String packageName) {
54.40 int len = packageName.length();
54.41 - Enumeration entries = jar.entries();
54.42 + Enumeration<JarEntry> entries = jar.entries();
54.43 while (entries.hasMoreElements()) {
54.44 - JarEntry entry = (JarEntry) entries.nextElement();
54.45 + JarEntry entry = entries.nextElement();
54.46 String name = entry.getName();
54.47 if (name.startsWith(packageName) &&
54.48 name.endsWith(".class") &&
55.1 --- a/make/tools/src/build/tools/stripproperties/StripProperties.java Fri Aug 05 15:35:04 2011 -0700
55.2 +++ b/make/tools/src/build/tools/stripproperties/StripProperties.java Tue Aug 09 17:38:52 2011 -0700
55.3 @@ -1,5 +1,5 @@
55.4 /*
55.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
55.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
55.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55.8 *
55.9 * This code is free software; you can redistribute it and/or modify it
55.10 @@ -246,7 +246,7 @@
55.11 throws IOException {
55.12 BufferedWriter awriter;
55.13 awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
55.14 - for (Enumeration e = properties.keys(); e.hasMoreElements();) {
55.15 + for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
55.16 String key = (String)e.nextElement();
55.17 String val = (String)properties.get(key);
55.18 key = saveConvert(key, true);
56.1 --- a/src/share/bin/jli_util.h Fri Aug 05 15:35:04 2011 -0700
56.2 +++ b/src/share/bin/jli_util.h Tue Aug 09 17:38:52 2011 -0700
56.3 @@ -27,6 +27,8 @@
56.4 #define _JLI_UTIL_H
56.5
56.6 #include <stdlib.h>
56.7 +#include <string.h>
56.8 +#include <stdio.h>
56.9 #include <jni.h>
56.10
56.11 void *JLI_MemAlloc(size_t size);
56.12 @@ -58,6 +60,7 @@
56.13 #define JLI_Snprintf _snprintf
56.14 #else
56.15 #include <unistd.h>
56.16 +#include <strings.h>
56.17 #define JLI_StrCaseCmp(p1, p2) strcasecmp((p1), (p2))
56.18 #define JLI_StrNCaseCmp(p1, p2, p3) strncasecmp((p1), (p2), (p3))
56.19 #define JLI_Snprintf snprintf
57.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Attribute.java Fri Aug 05 15:35:04 2011 -0700
57.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Attribute.java Tue Aug 09 17:38:52 2011 -0700
57.3 @@ -1,5 +1,5 @@
57.4 /*
57.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
57.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
57.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
57.8 *
57.9 * This code is free software; you can redistribute it and/or modify it
57.10 @@ -45,7 +45,7 @@
57.11 * attribute layouts.
57.12 * @author John Rose
57.13 */
57.14 -class Attribute implements Comparable {
57.15 +class Attribute implements Comparable<Attribute> {
57.16 // Attribute instance fields.
57.17
57.18 Layout def; // the name and format of this attr
57.19 @@ -99,8 +99,7 @@
57.20 return this == def.canon;
57.21 }
57.22
57.23 - public int compareTo(Object o) {
57.24 - Attribute that = (Attribute) o;
57.25 + public int compareTo(Attribute that) {
57.26 return this.def.compareTo(that.def);
57.27 }
57.28
57.29 @@ -447,7 +446,7 @@
57.30 * and format. The formats are specified in a "little language".
57.31 */
57.32 public static
57.33 - class Layout implements Comparable {
57.34 + class Layout implements Comparable<Layout> {
57.35 int ctype; // attribute context type, e.g., ATTR_CONTEXT_CODE
57.36 String name; // name of attribute
57.37 boolean hasRefs; // this kind of attr contains CP refs?
57.38 @@ -540,8 +539,7 @@
57.39 * 37 + layout.hashCode())
57.40 * 37 + ctype);
57.41 }
57.42 - public int compareTo(Object o) {
57.43 - Layout that = (Layout) o;
57.44 + public int compareTo(Layout that) {
57.45 int r;
57.46 r = this.name.compareTo(that.name);
57.47 if (r != 0) return r;
57.48 @@ -663,6 +661,8 @@
57.49
57.50 public static
57.51 class FormatException extends IOException {
57.52 + private static final long serialVersionUID = -2542243830788066513L;
57.53 +
57.54 private int ctype;
57.55 private String name;
57.56 String layout;
58.1 --- a/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java Fri Aug 05 15:35:04 2011 -0700
58.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java Tue Aug 09 17:38:52 2011 -0700
58.3 @@ -1704,7 +1704,7 @@
58.4 for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
58.5 assert(attrIndexLimit[i] == 0);
58.6 attrIndexLimit[i] = 32; // just for the sake of predefs.
58.7 - attrDefs.set(i, new ArrayList<Attribute.Layout>(Collections.nCopies(
58.8 + attrDefs.set(i, new ArrayList<>(Collections.nCopies(
58.9 attrIndexLimit[i], (Attribute.Layout)null)));
58.10
58.11 }
58.12 @@ -1892,7 +1892,7 @@
58.13 return testBit(archiveOptions, mask);
58.14 }
58.15
58.16 - protected List getPredefinedAttrs(int ctype) {
58.17 + protected List<Attribute.Layout> getPredefinedAttrs(int ctype) {
58.18 assert(attrIndexLimit[ctype] != 0);
58.19 List<Attribute.Layout> res = new ArrayList<>(attrIndexLimit[ctype]);
58.20 // Remove nulls and non-predefs.
58.21 @@ -2649,7 +2649,7 @@
58.22
58.23 // Utilities for reallocating:
58.24 protected static Object[] realloc(Object[] a, int len) {
58.25 - java.lang.Class elt = a.getClass().getComponentType();
58.26 + java.lang.Class<?> elt = a.getClass().getComponentType();
58.27 Object[] na = (Object[]) java.lang.reflect.Array.newInstance(elt, len);
58.28 System.arraycopy(a, 0, na, 0, Math.min(a.length, len));
58.29 return na;
59.1 --- a/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java Fri Aug 05 15:35:04 2011 -0700
59.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/ClassReader.java Tue Aug 09 17:38:52 2011 -0700
59.3 @@ -1,5 +1,5 @@
59.4 /*
59.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
59.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
59.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
59.8 *
59.9 * This code is free software; you can redistribute it and/or modify it
59.10 @@ -52,7 +52,7 @@
59.11 long inPos;
59.12 DataInputStream in;
59.13 Map<Attribute.Layout, Attribute> attrDefs;
59.14 - Map attrCommands;
59.15 + Map<Attribute.Layout, String> attrCommands;
59.16 String unknownAttrCommand = "error";;
59.17
59.18 ClassReader(Class cls, InputStream in) throws IOException {
59.19 @@ -82,7 +82,7 @@
59.20 this.attrDefs = attrDefs;
59.21 }
59.22
59.23 - public void setAttrCommands(Map attrCommands) {
59.24 + public void setAttrCommands(Map<Attribute.Layout, String> attrCommands) {
59.25 this.attrCommands = attrCommands;
59.26 }
59.27
59.28 @@ -348,8 +348,8 @@
59.29 int length = readInt();
59.30 // See if there is a special command that applies.
59.31 if (attrCommands != null) {
59.32 - Object lkey = Attribute.keyForLookup(ctype, name);
59.33 - String cmd = (String) attrCommands.get(lkey);
59.34 + Attribute.Layout lkey = Attribute.keyForLookup(ctype, name);
59.35 + String cmd = attrCommands.get(lkey);
59.36 if (cmd != null) {
59.37 switch (cmd) {
59.38 case "pass":
59.39 @@ -483,6 +483,8 @@
59.40 }
59.41
59.42 static class ClassFormatException extends IOException {
59.43 + private static final long serialVersionUID = -3564121733989501833L;
59.44 +
59.45 public ClassFormatException(String message) {
59.46 super(message);
59.47 }
60.1 --- a/src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java Fri Aug 05 15:35:04 2011 -0700
60.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java Tue Aug 09 17:38:52 2011 -0700
60.3 @@ -1,5 +1,5 @@
60.4 /*
60.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
60.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
60.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
60.8 *
60.9 * This code is free software; you can redistribute it and/or modify it
60.10 @@ -36,7 +36,6 @@
60.11 import java.io.DataOutputStream;
60.12 import java.io.IOException;
60.13 import java.io.OutputStream;
60.14 -import java.util.Iterator;
60.15 import java.util.List;
60.16 import static com.sun.java.util.jar.pack.Constants.*;
60.17 /**
60.18 @@ -165,14 +164,13 @@
60.19 }
60.20
60.21 void writeMembers(boolean doMethods) throws IOException {
60.22 - List mems;
60.23 + List<? extends Class.Member> mems;
60.24 if (!doMethods)
60.25 mems = cls.getFields();
60.26 else
60.27 mems = cls.getMethods();
60.28 writeShort(mems.size());
60.29 - for (Iterator i = mems.iterator(); i.hasNext(); ) {
60.30 - Class.Member m = (Class.Member) i.next();
60.31 + for (Class.Member m : mems) {
60.32 writeMember(m, doMethods);
60.33 }
60.34 }
61.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Code.java Fri Aug 05 15:35:04 2011 -0700
61.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Code.java Tue Aug 09 17:38:52 2011 -0700
61.3 @@ -1,5 +1,5 @@
61.4 /*
61.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
61.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
61.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
61.8 *
61.9 * This code is free software; you can redistribute it and/or modify it
61.10 @@ -125,7 +125,7 @@
61.11 return expandInstructionMap(getInsnMap());
61.12 }
61.13
61.14 - void addFixups(Collection moreFixups) {
61.15 + void addFixups(Collection<Fixups.Fixup> moreFixups) {
61.16 if (fixups == null) {
61.17 fixups = new Fixups(bytes);
61.18 }
62.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Coding.java Fri Aug 05 15:35:04 2011 -0700
62.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Coding.java Tue Aug 09 17:38:52 2011 -0700
62.3 @@ -1,5 +1,5 @@
62.4 /*
62.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
62.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
62.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
62.8 *
62.9 * This code is free software; you can redistribute it and/or modify it
62.10 @@ -37,7 +37,7 @@
62.11 * varying degrees of length variability, and varying amounts of signed-ness.
62.12 * @author John Rose
62.13 */
62.14 -class Coding implements Comparable, CodingMethod, Histogram.BitMetric {
62.15 +class Coding implements Comparable<Coding>, CodingMethod, Histogram.BitMetric {
62.16 /*
62.17 Coding schema for single integers, parameterized by (B,H,S):
62.18
62.19 @@ -605,8 +605,7 @@
62.20 public int byteMin(int b) { return byteMin[b-1]; }
62.21 public int byteMax(int b) { return byteMax[b-1]; }
62.22
62.23 - public int compareTo(Object x) {
62.24 - Coding that = (Coding) x;
62.25 + public int compareTo(Coding that) {
62.26 int dkey = this.del - that.del;
62.27 if (dkey == 0)
62.28 dkey = this.B - that.B;
63.1 --- a/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Fri Aug 05 15:35:04 2011 -0700
63.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Tue Aug 09 17:38:52 2011 -0700
63.3 @@ -1,5 +1,5 @@
63.4 /*
63.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
63.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
63.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
63.8 *
63.9 * This code is free software; you can redistribute it and/or modify it
63.10 @@ -72,7 +72,7 @@
63.11 return e;
63.12 }
63.13 /** Factory for literal constants (String, Integer, etc.). */
63.14 - public static synchronized LiteralEntry getLiteralEntry(Comparable value) {
63.15 + public static synchronized LiteralEntry getLiteralEntry(Comparable<?> value) {
63.16 Map<Object, LiteralEntry> literalEntries = Utils.getLiteralEntries();
63.17 LiteralEntry e = literalEntries.get(value);
63.18 if (e == null) {
63.19 @@ -140,7 +140,7 @@
63.20
63.21 /** Entries in the constant pool. */
63.22 public static abstract
63.23 - class Entry implements Comparable {
63.24 + class Entry implements Comparable<Object> {
63.25 protected final byte tag; // a CONSTANT_foo code
63.26 protected int valueHash; // cached hashCode
63.27
63.28 @@ -257,7 +257,7 @@
63.29 super(tag);
63.30 }
63.31
63.32 - public abstract Comparable literalValue();
63.33 + public abstract Comparable<?> literalValue();
63.34 }
63.35
63.36 public static
63.37 @@ -280,15 +280,17 @@
63.38 public int compareTo(Object o) {
63.39 int x = superCompareTo(o);
63.40 if (x == 0) {
63.41 - x = ((Comparable)value).compareTo(((NumberEntry)o).value);
63.42 + @SuppressWarnings("unchecked")
63.43 + Comparable<Number> compValue = (Comparable<Number>)value;
63.44 + x = compValue.compareTo(((NumberEntry)o).value);
63.45 }
63.46 return x;
63.47 }
63.48 public Number numberValue() {
63.49 return value;
63.50 }
63.51 - public Comparable literalValue() {
63.52 - return (Comparable) value;
63.53 + public Comparable<?> literalValue() {
63.54 + return (Comparable<?>) value;
63.55 }
63.56 public String stringValue() {
63.57 return value.toString();
63.58 @@ -319,7 +321,7 @@
63.59 }
63.60 return x;
63.61 }
63.62 - public Comparable literalValue() {
63.63 + public Comparable<?> literalValue() {
63.64 return ref.stringValue();
63.65 }
63.66 public String stringValue() {
63.67 @@ -728,7 +730,7 @@
63.68
63.69 /** An Index is a mapping between CP entries and small integers. */
63.70 public static final
63.71 - class Index extends AbstractList {
63.72 + class Index extends AbstractList<Entry> {
63.73 protected String debugName;
63.74 protected Entry[] cpMap;
63.75 protected boolean flattenSigs;
63.76 @@ -758,7 +760,7 @@
63.77 public int size() {
63.78 return cpMap.length;
63.79 }
63.80 - public Object get(int i) {
63.81 + public Entry get(int i) {
63.82 return cpMap[i];
63.83 }
63.84 public Entry getEntry(int i) {
63.85 @@ -803,13 +805,7 @@
63.86 assert(index >= 0);
63.87 return index;
63.88 }
63.89 - public boolean contains(Object e) {
63.90 - return findIndexOf((Entry)e) >= 0;
63.91 - }
63.92 - public int indexOf(Object e) {
63.93 - return findIndexOf((Entry)e);
63.94 - }
63.95 - public int lastIndexOf(Object e) {
63.96 + public int lastIndexOf(Entry e) {
63.97 return indexOf(e);
63.98 }
63.99
63.100 @@ -862,14 +858,14 @@
63.101 indexValue[probe] = i;
63.102 }
63.103 }
63.104 - public Object[] toArray(Object[] a) {
63.105 + public Entry[] toArray(Entry[] a) {
63.106 int sz = size();
63.107 if (a.length < sz) return super.toArray(a);
63.108 System.arraycopy(cpMap, 0, a, 0, sz);
63.109 if (a.length > sz) a[sz] = null;
63.110 return a;
63.111 }
63.112 - public Object[] toArray() {
63.113 + public Entry[] toArray() {
63.114 return toArray(new Entry[size()]);
63.115 }
63.116 public Object clone() {
64.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Constants.java Fri Aug 05 15:35:04 2011 -0700
64.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Constants.java Tue Aug 09 17:38:52 2011 -0700
64.3 @@ -1,5 +1,5 @@
64.4 /*
64.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
64.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
64.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
64.8 *
64.9 * This code is free software; you can redistribute it and/or modify it
64.10 @@ -153,11 +153,11 @@
64.11 public static final int NO_MODTIME = 0; // null modtime value
64.12
64.13 // some comstantly empty containers
64.14 - public final static int[] noInts = {};
64.15 - public final static byte[] noBytes = {};
64.16 - public final static Object[] noValues = {};
64.17 - public final static String[] noStrings = {};
64.18 - public final static List emptyList = Arrays.asList(noValues);
64.19 + public final static int[] noInts = {};
64.20 + public final static byte[] noBytes = {};
64.21 + public final static Object[] noValues = {};
64.22 + public final static String[] noStrings = {};
64.23 + public final static List<Object> emptyList = Arrays.asList(noValues);
64.24
64.25 // meta-coding
64.26 public final static int
65.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Fixups.java Fri Aug 05 15:35:04 2011 -0700
65.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Fixups.java Tue Aug 09 17:38:52 2011 -0700
65.3 @@ -1,5 +1,5 @@
65.4 /*
65.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
65.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
65.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
65.8 *
65.9 * This code is free software; you can redistribute it and/or modify it
65.10 @@ -42,7 +42,7 @@
65.11 *
65.12 * @author John Rose
65.13 */
65.14 -final class Fixups extends AbstractCollection {
65.15 +final class Fixups extends AbstractCollection<Fixups.Fixup> {
65.16 byte[] bytes; // the subject of the relocations
65.17 int head; // desc locating first reloc
65.18 int tail; // desc locating last reloc
65.19 @@ -66,11 +66,11 @@
65.20 // If there are no bytes, all descs are kept in bigDescs.
65.21 this((byte[])null);
65.22 }
65.23 - Fixups(byte[] bytes, Collection fixups) {
65.24 + Fixups(byte[] bytes, Collection<Fixup> fixups) {
65.25 this(bytes);
65.26 addAll(fixups);
65.27 }
65.28 - Fixups(Collection fixups) {
65.29 + Fixups(Collection<Fixup> fixups) {
65.30 this((byte[])null);
65.31 addAll(fixups);
65.32 }
65.33 @@ -108,8 +108,7 @@
65.34 public void clear() {
65.35 if (bytes != null) {
65.36 // Clean the bytes:
65.37 - for (Iterator i = iterator(); i.hasNext(); ) {
65.38 - Fixup fx = (Fixup) i.next();
65.39 + for (Fixup fx : this) {
65.40 //System.out.println("clean "+fx);
65.41 storeIndex(fx.location(), fx.format(), 0);
65.42 }
65.43 @@ -124,15 +123,14 @@
65.44 return bytes;
65.45 }
65.46
65.47 - @SuppressWarnings("unchecked")
65.48 public void setBytes(byte[] newBytes) {
65.49 if (bytes == newBytes) return;
65.50 - ArrayList old = null;
65.51 - assert((old = new ArrayList(this)) != null);
65.52 + ArrayList<Fixup> old = null;
65.53 + assert((old = new ArrayList<>(this)) != null);
65.54 if (bytes == null || newBytes == null) {
65.55 // One or the other representations is deficient.
65.56 // Construct a checkpoint.
65.57 - ArrayList save = new ArrayList(this);
65.58 + ArrayList<Fixup> save = new ArrayList<>(this);
65.59 clear();
65.60 bytes = newBytes;
65.61 addAll(save);
65.62 @@ -140,7 +138,7 @@
65.63 // assume newBytes is some sort of bitwise copy of the old bytes
65.64 bytes = newBytes;
65.65 }
65.66 - assert(old.equals(new ArrayList(this)));
65.67 + assert(old.equals(new ArrayList<>(this)));
65.68 }
65.69
65.70 static final int LOC_SHIFT = 1;
65.71 @@ -236,7 +234,7 @@
65.72
65.73 /** Simple and necessary tuple to present each fixup. */
65.74 public static
65.75 - class Fixup implements Comparable {
65.76 + class Fixup implements Comparable<Fixup> {
65.77 int desc; // location and format of reloc
65.78 Entry entry; // which entry to plug into the bytes
65.79 Fixup(int desc, Entry entry) {
65.80 @@ -254,9 +252,6 @@
65.81 // Ordering depends only on location.
65.82 return this.location() - that.location();
65.83 }
65.84 - public int compareTo(Object that) {
65.85 - return compareTo((Fixup)that);
65.86 - }
65.87 public boolean equals(Object x) {
65.88 if (!(x instanceof Fixup)) return false;
65.89 Fixup that = (Fixup) x;
65.90 @@ -268,13 +263,13 @@
65.91 }
65.92
65.93 private
65.94 - class Itr implements Iterator {
65.95 + class Itr implements Iterator<Fixup> {
65.96 int index = 0; // index into entries
65.97 int bigIndex = BIGSIZE+1; // index into bigDescs
65.98 int next = head; // desc pointing to next fixup
65.99 public boolean hasNext() { return index < size; }
65.100 public void remove() { throw new UnsupportedOperationException(); }
65.101 - public Object next() {
65.102 + public Fixup next() {
65.103 int thisIndex = index;
65.104 return new Fixup(nextDesc(), entries[thisIndex]);
65.105 }
65.106 @@ -298,7 +293,7 @@
65.107 }
65.108 }
65.109
65.110 - public Iterator iterator() {
65.111 + public Iterator<Fixup> iterator() {
65.112 return new Itr();
65.113 }
65.114 public void add(int location, int format, Entry entry) {
65.115 @@ -308,11 +303,8 @@
65.116 addDesc(f.desc, f.entry);
65.117 return true;
65.118 }
65.119 - public boolean add(Object fixup) {
65.120 - return add((Fixup) fixup);
65.121 - }
65.122 - @SuppressWarnings("unchecked")
65.123 - public boolean addAll(Collection c) {
65.124 +
65.125 + public boolean addAll(Collection<? extends Fixup> c) {
65.126 if (c instanceof Fixups) {
65.127 // Use knowledge of Itr structure to avoid building little structs.
65.128 Fixups that = (Fixups) c;
65.129 @@ -453,8 +445,7 @@
65.130 void finishRefs(ConstantPool.Index ix) {
65.131 if (isEmpty())
65.132 return;
65.133 - for (Iterator i = iterator(); i.hasNext(); ) {
65.134 - Fixup fx = (Fixup) i.next();
65.135 + for (Fixup fx : this) {
65.136 int index = ix.indexOf(fx.entry);
65.137 //System.out.println("finish "+fx+" = "+index);
65.138 // Note that the iterator has already fetched the
66.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Instruction.java Fri Aug 05 15:35:04 2011 -0700
66.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Instruction.java Tue Aug 09 17:38:52 2011 -0700
66.3 @@ -1,5 +1,5 @@
66.4 /*
66.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
66.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
66.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66.8 *
66.9 * This code is free software; you can redistribute it and/or modify it
66.10 @@ -657,6 +657,8 @@
66.11 }
66.12 }
66.13 static class FormatException extends IOException {
66.14 + private static final long serialVersionUID = 3175572275651367015L;
66.15 +
66.16 FormatException(String message) {
66.17 super(message);
66.18 }
67.1 --- a/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Fri Aug 05 15:35:04 2011 -0700
67.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Tue Aug 09 17:38:52 2011 -0700
67.3 @@ -292,7 +292,7 @@
67.4 }
67.5
67.6 ZipEntry z = new ZipEntry(name);
67.7 - z.setTime( (long)mtime * 1000);
67.8 + z.setTime(mtime * 1000);
67.9
67.10 if (size == 0) {
67.11 z.setMethod(ZipOutputStream.STORED);
68.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Package.java Fri Aug 05 15:35:04 2011 -0700
68.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Package.java Tue Aug 09 17:38:52 2011 -0700
68.3 @@ -1,5 +1,5 @@
68.4 /*
68.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
68.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
68.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
68.8 *
68.9 * This code is free software; you can redistribute it and/or modify it
68.10 @@ -188,7 +188,7 @@
68.11 }
68.12
68.13 public final
68.14 - class Class extends Attribute.Holder implements Comparable {
68.15 + class Class extends Attribute.Holder implements Comparable<Class> {
68.16 public Package getPackage() { return Package.this; }
68.17
68.18 // Optional file characteristics and data source (a "class stub")
68.19 @@ -247,8 +247,7 @@
68.20 }
68.21
68.22 // Note: equals and hashCode are identity-based.
68.23 - public int compareTo(Object o) {
68.24 - Class that = (Class)o;
68.25 + public int compareTo(Class that) {
68.26 String n0 = this.getName();
68.27 String n1 = that.getName();
68.28 return n0.compareTo(n1);
68.29 @@ -488,7 +487,7 @@
68.30 }
68.31
68.32 public abstract
68.33 - class Member extends Attribute.Holder implements Comparable {
68.34 + class Member extends Attribute.Holder implements Comparable<Member> {
68.35 DescriptorEntry descriptor;
68.36
68.37 protected Member(int flags, DescriptorEntry descriptor) {
68.38 @@ -549,7 +548,7 @@
68.39 return descriptor.getLiteralTag();
68.40 }
68.41
68.42 - public int compareTo(Object o) {
68.43 + public int compareTo(Member o) {
68.44 Field that = (Field)o;
68.45 return this.order - that.order;
68.46 }
68.47 @@ -582,7 +581,7 @@
68.48 }
68.49
68.50 // Sort methods in a canonical order (by type, then by name).
68.51 - public int compareTo(Object o) {
68.52 + public int compareTo(Member o) {
68.53 Method that = (Method)o;
68.54 return this.getDescriptor().compareTo(that.getDescriptor());
68.55 }
68.56 @@ -608,11 +607,10 @@
68.57 public void trimToSize() {
68.58 super.trimToSize();
68.59 for (int isM = 0; isM <= 1; isM++) {
68.60 - ArrayList members = (isM == 0) ? fields : methods;
68.61 + ArrayList<? extends Member> members = (isM == 0) ? fields : methods;
68.62 if (members == null) continue;
68.63 members.trimToSize();
68.64 - for (Iterator i = members.iterator(); i.hasNext(); ) {
68.65 - Member m = (Member)i.next();
68.66 + for (Member m : members) {
68.67 m.trimToSize();
68.68 }
68.69 }
68.70 @@ -625,10 +623,9 @@
68.71 if ("InnerClass".equals(attrName))
68.72 innerClasses = null;
68.73 for (int isM = 0; isM <= 1; isM++) {
68.74 - ArrayList members = (isM == 0) ? fields : methods;
68.75 + ArrayList<? extends Member> members = (isM == 0) ? fields : methods;
68.76 if (members == null) continue;
68.77 - for (Iterator i = members.iterator(); i.hasNext(); ) {
68.78 - Member m = (Member)i.next();
68.79 + for (Member m : members) {
68.80 m.strip(attrName);
68.81 }
68.82 }
68.83 @@ -641,10 +638,9 @@
68.84 refs.add(superClass);
68.85 refs.addAll(Arrays.asList(interfaces));
68.86 for (int isM = 0; isM <= 1; isM++) {
68.87 - ArrayList members = (isM == 0) ? fields : methods;
68.88 + ArrayList<? extends Member> members = (isM == 0) ? fields : methods;
68.89 if (members == null) continue;
68.90 - for (Iterator i = members.iterator(); i.hasNext(); ) {
68.91 - Member m = (Member)i.next();
68.92 + for (Member m : members) {
68.93 boolean ok = false;
68.94 try {
68.95 m.visitRefs(mode, refs);
68.96 @@ -747,13 +743,13 @@
68.97 return classStubs;
68.98 }
68.99
68.100 - public final class File implements Comparable {
68.101 + public final class File implements Comparable<File> {
68.102 String nameString; // true name of this file
68.103 Utf8Entry name;
68.104 int modtime = NO_MODTIME;
68.105 int options = 0; // random flag bits, such as deflate_hint
68.106 Class stubClass; // if this is a stub, here's the class
68.107 - ArrayList prepend = new ArrayList(); // list of byte[]
68.108 + ArrayList<byte[]> prepend = new ArrayList<>(); // list of byte[]
68.109 java.io.ByteArrayOutputStream append = new ByteArrayOutputStream();
68.110
68.111 File(Utf8Entry name) {
68.112 @@ -798,8 +794,7 @@
68.113 return nameString.hashCode();
68.114 }
68.115 // Simple alphabetic sort. PackageWriter uses a better comparator.
68.116 - public int compareTo(Object o) {
68.117 - File that = (File)o;
68.118 + public int compareTo(File that) {
68.119 return this.nameString.compareTo(that.nameString);
68.120 }
68.121 public String toString() {
68.122 @@ -834,8 +829,7 @@
68.123 public long getFileLength() {
68.124 long len = 0;
68.125 if (prepend == null || append == null) return 0;
68.126 - for (Iterator i = prepend.iterator(); i.hasNext(); ) {
68.127 - byte[] block = (byte[]) i.next();
68.128 + for (byte[] block : prepend) {
68.129 len += block.length;
68.130 }
68.131 len += append.size();
68.132 @@ -843,8 +837,7 @@
68.133 }
68.134 public void writeTo(OutputStream out) throws IOException {
68.135 if (prepend == null || append == null) return;
68.136 - for (Iterator i = prepend.iterator(); i.hasNext(); ) {
68.137 - byte[] block = (byte[]) i.next();
68.138 + for (byte[] block : prepend) {
68.139 out.write(block);
68.140 }
68.141 append.writeTo(out);
68.142 @@ -860,8 +853,7 @@
68.143 InputStream in = new ByteArrayInputStream(append.toByteArray());
68.144 if (prepend.isEmpty()) return in;
68.145 List<InputStream> isa = new ArrayList<>(prepend.size()+1);
68.146 - for (Iterator i = prepend.iterator(); i.hasNext(); ) {
68.147 - byte[] bytes = (byte[]) i.next();
68.148 + for (byte[] bytes : prepend) {
68.149 isa.add(new ByteArrayInputStream(bytes));
68.150 }
68.151 isa.add(in);
68.152 @@ -926,7 +918,7 @@
68.153 }
68.154
68.155 static
68.156 - class InnerClass implements Comparable {
68.157 + class InnerClass implements Comparable<InnerClass> {
68.158 final ClassEntry thisClass;
68.159 final ClassEntry outerClass;
68.160 final Utf8Entry name;
68.161 @@ -977,8 +969,7 @@
68.162 public int hashCode() {
68.163 return thisClass.hashCode();
68.164 }
68.165 - public int compareTo(Object o) {
68.166 - InnerClass that = (InnerClass)o;
68.167 + public int compareTo(InnerClass that) {
68.168 return this.thisClass.compareTo(that.thisClass);
68.169 }
68.170
68.171 @@ -1108,7 +1099,7 @@
68.172 return ConstantPool.getUtf8Entry(s);
68.173 }
68.174
68.175 - static LiteralEntry getRefLiteral(Comparable s) {
68.176 + static LiteralEntry getRefLiteral(Comparable<?> s) {
68.177 return ConstantPool.getLiteralEntry(s);
68.178 }
68.179
68.180 @@ -1199,7 +1190,6 @@
68.181 // compress better. It also moves classes to the end of the
68.182 // file order. It also removes JAR directory entries, which
68.183 // are useless.
68.184 - @SuppressWarnings("unchecked")
68.185 void reorderFiles(boolean keepClassOrder, boolean stripDirectories) {
68.186 // First reorder the classes, if that is allowed.
68.187 if (!keepClassOrder) {
68.188 @@ -1226,10 +1216,8 @@
68.189 // This keeps files of similar format near each other.
68.190 // Put class files at the end, keeping their fixed order.
68.191 // Be sure the JAR file's required manifest stays at the front. (4893051)
68.192 - Collections.sort(files, new Comparator() {
68.193 - public int compare(Object o0, Object o1) {
68.194 - File r0 = (File) o0;
68.195 - File r1 = (File) o1;
68.196 + Collections.sort(files, new Comparator<File>() {
68.197 + public int compare(File r0, File r1) {
68.198 // Get the file name.
68.199 String f0 = r0.nameString;
68.200 String f1 = r1.nameString;
69.1 --- a/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java Fri Aug 05 15:35:04 2011 -0700
69.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java Tue Aug 09 17:38:52 2011 -0700
69.3 @@ -750,7 +750,7 @@
69.4 file_options.readFrom(in);
69.5 file_bits.setInputStreamFrom(in);
69.6
69.7 - Iterator nextClass = pkg.getClasses().iterator();
69.8 + Iterator<Class> nextClass = pkg.getClasses().iterator();
69.9
69.10 // Compute file lengths before reading any file bits.
69.11 long totalFileLength = 0;
69.12 @@ -790,14 +790,14 @@
69.13 pkg.addFile(file);
69.14 if (file.isClassStub()) {
69.15 assert(file.getFileLength() == 0);
69.16 - Class cls = (Class) nextClass.next();
69.17 + Class cls = nextClass.next();
69.18 cls.initFile(file);
69.19 }
69.20 }
69.21
69.22 // Do the rest of the classes.
69.23 while (nextClass.hasNext()) {
69.24 - Class cls = (Class) nextClass.next();
69.25 + Class cls = nextClass.next();
69.26 cls.initFile(null); // implicitly initialize to a trivial one
69.27 cls.file.modtime = pkg.default_modtime;
69.28 }
69.29 @@ -1006,14 +1006,14 @@
69.30 if (k >= 0)
69.31 return k;
69.32 if (e.tag == CONSTANT_Utf8) {
69.33 - Entry se = (Entry) utf8Signatures.get(e);
69.34 + Entry se = utf8Signatures.get(e);
69.35 return pkg.cp.untypedIndexOf(se);
69.36 }
69.37 return -1;
69.38 }
69.39
69.40 Comparator<Entry> entryOutputOrder = new Comparator<Entry>() {
69.41 - public int compare(Entry e0, Entry e1) {
69.42 + public int compare(Entry e0, Entry e1) {
69.43 int k0 = getOutputIndex(e0);
69.44 int k1 = getOutputIndex(e1);
69.45 if (k0 >= 0 && k1 >= 0)
69.46 @@ -1332,7 +1332,8 @@
69.47 // classes, fields, methods, and codes.
69.48 // The holders is a global list, already collected,
69.49 // of attribute "customers".
69.50 - void countAndReadAttrs(int ctype, Collection holders) throws IOException {
69.51 + void countAndReadAttrs(int ctype, Collection<? extends Attribute.Holder> holders)
69.52 + throws IOException {
69.53 // class_attr_bands:
69.54 // *class_flags :UNSIGNED5
69.55 // *class_attr_count :UNSIGNED5
69.56 @@ -1386,7 +1387,8 @@
69.57
69.58 // Read flags and count the attributes that are to be placed
69.59 // on the given holders.
69.60 - void countAttrs(int ctype, Collection holders) throws IOException {
69.61 + void countAttrs(int ctype, Collection<? extends Attribute.Holder> holders)
69.62 + throws IOException {
69.63 // Here, xxx stands for one of class, field, method, code.
69.64 MultiBand xxx_attr_bands = attrBands[ctype];
69.65 long flagMask = attrFlagMask[ctype];
69.66 @@ -1414,8 +1416,7 @@
69.67 xxx_flags_lo.expectLength(holders.size());
69.68 xxx_flags_lo.readFrom(in);
69.69 assert((flagMask & overflowMask) == overflowMask);
69.70 - for (Iterator i = holders.iterator(); i.hasNext(); ) {
69.71 - Attribute.Holder h = (Attribute.Holder) i.next();
69.72 + for (Attribute.Holder h : holders) {
69.73 int flags = xxx_flags_lo.getInt();
69.74 h.flags = flags;
69.75 if ((flags & overflowMask) != 0)
69.76 @@ -1433,8 +1434,7 @@
69.77 // (class/field/method/code), and also we accumulate (b) a total
69.78 // count for each attribute type.
69.79 int[] totalCounts = new int[defs.length];
69.80 - for (Iterator i = holders.iterator(); i.hasNext(); ) {
69.81 - Attribute.Holder h = (Attribute.Holder) i.next();
69.82 + for (Attribute.Holder h : holders) {
69.83 assert(h.attributes == null);
69.84 // System.out.println("flags="+h.flags+" using fm="+flagMask);
69.85 long attrBits = ((h.flags & flagMask) << 32) >>> 32;
69.86 @@ -1582,13 +1582,12 @@
69.87 ATTR_CONTEXT_NAME[ctype]+" attribute");
69.88 }
69.89
69.90 - @SuppressWarnings("unchecked")
69.91 - void readAttrs(int ctype, Collection holders) throws IOException {
69.92 + void readAttrs(int ctype, Collection<? extends Attribute.Holder> holders)
69.93 + throws IOException {
69.94 // Decode band values into attributes.
69.95 Set<Attribute.Layout> sawDefs = new HashSet<>();
69.96 ByteArrayOutputStream buf = new ByteArrayOutputStream();
69.97 - for (Iterator i = holders.iterator(); i.hasNext(); ) {
69.98 - final Attribute.Holder h = (Attribute.Holder) i.next();
69.99 + for (final Attribute.Holder h : holders) {
69.100 if (h.attributes == null) continue;
69.101 for (ListIterator<Attribute> j = h.attributes.listIterator(); j.hasNext(); ) {
69.102 Attribute a = j.next();
70.1 --- a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Fri Aug 05 15:35:04 2011 -0700
70.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Tue Aug 09 17:38:52 2011 -0700
70.3 @@ -720,7 +720,6 @@
70.4 Utils.log.info("Wrote "+numFiles+" resource files");
70.5 }
70.6
70.7 - @SuppressWarnings("unchecked")
70.8 void collectAttributeLayouts() {
70.9 maxFlags = new int[ATTR_CONTEXT_LIMIT];
70.10 allLayouts = new FixedList<>(ATTR_CONTEXT_LIMIT);
70.11 @@ -781,26 +780,27 @@
70.12 avHiBits &= (1L<<attrIndexLimit[i])-1;
70.13 int nextLoBit = 0;
70.14 Map<Attribute.Layout, int[]> defMap = allLayouts.get(i);
70.15 - Map.Entry[] layoutsAndCounts = new Map.Entry[defMap.size()];
70.16 + @SuppressWarnings({ "unchecked", "rawtypes" })
70.17 + Map.Entry<Attribute.Layout, int[]>[] layoutsAndCounts =
70.18 + new Map.Entry[defMap.size()];
70.19 defMap.entrySet().toArray(layoutsAndCounts);
70.20 // Sort by count, most frequent first.
70.21 // Predefs. participate in this sort, though it does not matter.
70.22 - Arrays.sort(layoutsAndCounts, new Comparator<Object>() {
70.23 - public int compare(Object o0, Object o1) {
70.24 - Map.Entry e0 = (Map.Entry) o0;
70.25 - Map.Entry e1 = (Map.Entry) o1;
70.26 + Arrays.sort(layoutsAndCounts,
70.27 + new Comparator<Map.Entry<Attribute.Layout, int[]>>() {
70.28 + public int compare(Map.Entry<Attribute.Layout, int[]> e0,
70.29 + Map.Entry<Attribute.Layout, int[]> e1) {
70.30 // Primary sort key is count, reversed.
70.31 - int r = - ( ((int[])e0.getValue())[0]
70.32 - - ((int[])e1.getValue())[0] );
70.33 + int r = -(e0.getValue()[0] - e1.getValue()[0]);
70.34 if (r != 0) return r;
70.35 - return ((Comparable)e0.getKey()).compareTo(e1.getKey());
70.36 + return e0.getKey().compareTo(e1.getKey());
70.37 }
70.38 });
70.39 attrCounts[i] = new int[attrIndexLimit[i]+layoutsAndCounts.length];
70.40 for (int j = 0; j < layoutsAndCounts.length; j++) {
70.41 - Map.Entry e = layoutsAndCounts[j];
70.42 - Attribute.Layout def = (Attribute.Layout) e.getKey();
70.43 - int count = ((int[])e.getValue())[0];
70.44 + Map.Entry<Attribute.Layout, int[]> e = layoutsAndCounts[j];
70.45 + Attribute.Layout def = e.getKey();
70.46 + int count = e.getValue()[0];
70.47 int index;
70.48 Integer predefIndex = attrIndexTable.get(def);
70.49 if (predefIndex != null) {
70.50 @@ -881,7 +881,6 @@
70.51
70.52 Attribute.Layout[] attrDefsWritten;
70.53
70.54 - @SuppressWarnings("unchecked")
70.55 void writeAttrDefs() throws IOException {
70.56 List<Object[]> defList = new ArrayList<>();
70.57 for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
70.58 @@ -906,20 +905,19 @@
70.59 int numAttrDefs = defList.size();
70.60 Object[][] defs = new Object[numAttrDefs][];
70.61 defList.toArray(defs);
70.62 - Arrays.sort(defs, new Comparator() {
70.63 - public int compare(Object o0, Object o1) {
70.64 - Object[] a0 = (Object[]) o0;
70.65 - Object[] a1 = (Object[]) o1;
70.66 + Arrays.sort(defs, new Comparator<Object[]>() {
70.67 + public int compare(Object[] a0, Object[] a1) {
70.68 // Primary sort key is attr def header.
70.69 + @SuppressWarnings("unchecked")
70.70 int r = ((Comparable)a0[0]).compareTo(a1[0]);
70.71 if (r != 0) return r;
70.72 - Object ind0 = attrIndexTable.get(a0[1]);
70.73 - Object ind1 = attrIndexTable.get(a1[1]);
70.74 + Integer ind0 = attrIndexTable.get(a0[1]);
70.75 + Integer ind1 = attrIndexTable.get(a1[1]);
70.76 // Secondary sort key is attribute index.
70.77 // (This must be so, in order to keep overflow attr order.)
70.78 assert(ind0 != null);
70.79 assert(ind1 != null);
70.80 - return ((Comparable)ind0).compareTo(ind1);
70.81 + return ind0.compareTo(ind1);
70.82 }
70.83 });
70.84 attrDefsWritten = new Attribute.Layout[numAttrDefs];
71.1 --- a/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java Fri Aug 05 15:35:04 2011 -0700
71.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java Tue Aug 09 17:38:52 2011 -0700
71.3 @@ -1,5 +1,5 @@
71.4 /*
71.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
71.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
71.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
71.8 *
71.9 * This code is free software; you can redistribute it and/or modify it
71.10 @@ -69,8 +69,7 @@
71.11 * Get the set of options for the pack and unpack engines.
71.12 * @return A sorted association of option key strings to option values.
71.13 */
71.14 - @SuppressWarnings("unchecked")
71.15 - public SortedMap properties() {
71.16 + public SortedMap<String, String> properties() {
71.17 return props;
71.18 }
71.19
71.20 @@ -157,7 +156,6 @@
71.21
71.22 // All the worker bees.....
71.23 // The packer worker.
71.24 - @SuppressWarnings("unchecked")
71.25 private class DoPack {
71.26 final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
71.27
71.28 @@ -199,9 +197,8 @@
71.29 };
71.30 for (int i = 0; i < ctypes.length; i++) {
71.31 String pfx = keys[i];
71.32 - Map<Object, Object> map = props.prefixMap(pfx);
71.33 - for (Object k : map.keySet()) {
71.34 - String key = (String)k;
71.35 + Map<String, String> map = props.prefixMap(pfx);
71.36 + for (String key : map.keySet()) {
71.37 assert(key.startsWith(pfx));
71.38 String name = key.substring(pfx.length());
71.39 String layout = props.getProperty(key);
72.1 --- a/src/share/classes/com/sun/java/util/jar/pack/PropMap.java Fri Aug 05 15:35:04 2011 -0700
72.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/PropMap.java Tue Aug 09 17:38:52 2011 -0700
72.3 @@ -27,7 +27,6 @@
72.4
72.5 import java.beans.PropertyChangeListener;
72.6 import java.beans.PropertyChangeEvent;
72.7 -import java.io.BufferedInputStream;
72.8 import java.io.IOException;
72.9 import java.io.InputStream;
72.10 import java.io.PrintStream;
72.11 @@ -47,8 +46,8 @@
72.12 * Control block for publishing Pack200 options to the other classes.
72.13 */
72.14
72.15 -final class PropMap implements SortedMap<Object, Object> {
72.16 - private final TreeMap<Object, Object> theMap = new TreeMap<>();;
72.17 +final class PropMap implements SortedMap<String, String> {
72.18 + private final TreeMap<String, String> theMap = new TreeMap<>();;
72.19 private final List<PropertyChangeListener> listenerList = new ArrayList<>(1);
72.20
72.21 void addListener(PropertyChangeListener listener) {
72.22 @@ -68,12 +67,12 @@
72.23 }
72.24
72.25 // Override:
72.26 - public Object put(Object key, Object value) {
72.27 - Object oldValue = theMap.put(key, value);
72.28 + public String put(String key, String value) {
72.29 + String oldValue = theMap.put(key, value);
72.30 if (value != oldValue && !listenerList.isEmpty()) {
72.31 // Post the property change event.
72.32 PropertyChangeEvent event =
72.33 - new PropertyChangeEvent(this, (String) key,
72.34 + new PropertyChangeEvent(this, key,
72.35 oldValue, value);
72.36 for (PropertyChangeListener listener : listenerList) {
72.37 listener.propertyChange(event);
72.38 @@ -85,7 +84,7 @@
72.39 // All this other stuff is private to the current package.
72.40 // Outide clients of Pack200 do not need to use it; they can
72.41 // get by with generic SortedMap functionality.
72.42 - private static Map<Object, Object> defaultProps;
72.43 + private static Map<String, String> defaultProps;
72.44 static {
72.45 Properties props = new Properties();
72.46
72.47 @@ -141,7 +140,9 @@
72.48 }
72.49 }
72.50
72.51 - defaultProps = (new HashMap<>(props)); // shrink to fit
72.52 + @SuppressWarnings({"unchecked", "rawtypes"})
72.53 + HashMap<String, String> temp = new HashMap(props); // shrink to fit
72.54 + defaultProps = temp;
72.55 }
72.56
72.57 PropMap() {
72.58 @@ -151,7 +152,7 @@
72.59 // Return a view of this map which includes only properties
72.60 // that begin with the given prefix. This is easy because
72.61 // the map is sorted, and has a subMap accessor.
72.62 - SortedMap<Object, Object> prefixMap(String prefix) {
72.63 + SortedMap<String, String> prefixMap(String prefix) {
72.64 int len = prefix.length();
72.65 if (len == 0)
72.66 return this;
72.67 @@ -162,7 +163,7 @@
72.68 }
72.69
72.70 String getProperty(String s) {
72.71 - return (String) get(s);
72.72 + return get(s);
72.73 }
72.74 String getProperty(String s, String defaultVal) {
72.75 String val = getProperty(s);
72.76 @@ -171,13 +172,13 @@
72.77 return val;
72.78 }
72.79 String setProperty(String s, String val) {
72.80 - return (String) put(s, val);
72.81 + return put(s, val);
72.82 }
72.83
72.84 // Get sequence of props for "prefix", and "prefix.*".
72.85 - List getProperties(String prefix) {
72.86 - Collection<Object> values = prefixMap(prefix).values();
72.87 - List<Object> res = new ArrayList<>(values.size());
72.88 + List<String> getProperties(String prefix) {
72.89 + Collection<String> values = prefixMap(prefix).values();
72.90 + List<String> res = new ArrayList<>(values.size());
72.91 res.addAll(values);
72.92 while (res.remove(null));
72.93 return res;
72.94 @@ -241,8 +242,8 @@
72.95 }
72.96 void list(PrintWriter out) {
72.97 out.println("#"+Utils.PACK_ZIP_ARCHIVE_MARKER_COMMENT+"[");
72.98 - Set defaults = defaultProps.entrySet();
72.99 - for (Map.Entry e : theMap.entrySet()) {
72.100 + Set<Map.Entry<String, String>> defaults = defaultProps.entrySet();
72.101 + for (Map.Entry<String, String> e : theMap.entrySet()) {
72.102 if (defaults.contains(e)) continue;
72.103 out.println(" " + e.getKey() + " = " + e.getValue());
72.104 }
72.105 @@ -270,18 +271,17 @@
72.106 }
72.107
72.108 @Override
72.109 - public Object get(Object key) {
72.110 + public String get(Object key) {
72.111 return theMap.get(key);
72.112 }
72.113
72.114 @Override
72.115 - public Object remove(Object key) {
72.116 + public String remove(Object key) {
72.117 return theMap.remove(key);
72.118 }
72.119
72.120 @Override
72.121 - @SuppressWarnings("unchecked")
72.122 - public void putAll(Map m) {
72.123 + public void putAll(Map<? extends String, ? extends String> m) {
72.124 theMap.putAll(m);
72.125 }
72.126
72.127 @@ -291,48 +291,47 @@
72.128 }
72.129
72.130 @Override
72.131 - public Set<Object> keySet() {
72.132 + public Set<String> keySet() {
72.133 return theMap.keySet();
72.134 }
72.135
72.136 @Override
72.137 - public Collection<Object> values() {
72.138 + public Collection<String> values() {
72.139 return theMap.values();
72.140 }
72.141
72.142 @Override
72.143 - public Set<Map.Entry<Object, Object>> entrySet() {
72.144 + public Set<Map.Entry<String, String>> entrySet() {
72.145 return theMap.entrySet();
72.146 }
72.147
72.148 @Override
72.149 - @SuppressWarnings("unchecked")
72.150 - public Comparator<Object> comparator() {
72.151 - return (Comparator<Object>) theMap.comparator();
72.152 + public Comparator<? super String> comparator() {
72.153 + return theMap.comparator();
72.154 }
72.155
72.156 @Override
72.157 - public SortedMap<Object, Object> subMap(Object fromKey, Object toKey) {
72.158 + public SortedMap<String, String> subMap(String fromKey, String toKey) {
72.159 return theMap.subMap(fromKey, toKey);
72.160 }
72.161
72.162 @Override
72.163 - public SortedMap<Object, Object> headMap(Object toKey) {
72.164 + public SortedMap<String, String> headMap(String toKey) {
72.165 return theMap.headMap(toKey);
72.166 }
72.167
72.168 @Override
72.169 - public SortedMap<Object, Object> tailMap(Object fromKey) {
72.170 + public SortedMap<String, String> tailMap(String fromKey) {
72.171 return theMap.tailMap(fromKey);
72.172 }
72.173
72.174 @Override
72.175 - public Object firstKey() {
72.176 + public String firstKey() {
72.177 return theMap.firstKey();
72.178 }
72.179
72.180 @Override
72.181 - public Object lastKey() {
72.182 + public String lastKey() {
72.183 return theMap.lastKey();
72.184 }
72.185 }
73.1 --- a/src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java Fri Aug 05 15:35:04 2011 -0700
73.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java Tue Aug 09 17:38:52 2011 -0700
73.3 @@ -1,5 +1,5 @@
73.4 /*
73.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
73.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
73.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
73.8 *
73.9 * This code is free software; you can redistribute it and/or modify it
73.10 @@ -67,7 +67,7 @@
73.11 props = new PropMap();
73.12 }
73.13
73.14 - SortedMap<Object, Object> getPropMap() {
73.15 + SortedMap<String, String> getPropMap() {
73.16 return props;
73.17 }
73.18
74.1 --- a/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java Fri Aug 05 15:35:04 2011 -0700
74.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java Tue Aug 09 17:38:52 2011 -0700
74.3 @@ -81,8 +81,7 @@
74.4 * Get the set of options for the pack and unpack engines.
74.5 * @return A sorted association of option key strings to option values.
74.6 */
74.7 - @SuppressWarnings("unchecked")
74.8 - public SortedMap properties() {
74.9 + public SortedMap<String, String> properties() {
74.10 return props;
74.11 }
74.12
75.1 --- a/src/share/classes/com/sun/java/util/jar/pack/Utils.java Fri Aug 05 15:35:04 2011 -0700
75.2 +++ b/src/share/classes/com/sun/java/util/jar/pack/Utils.java Tue Aug 09 17:38:52 2011 -0700
75.3 @@ -253,8 +253,8 @@
75.4 }
75.5 static void copyJarFile(JarFile in, JarOutputStream out) throws IOException {
75.6 byte[] buffer = new byte[1 << 14];
75.7 - for (Enumeration e = in.entries(); e.hasMoreElements(); ) {
75.8 - JarEntry je = (JarEntry) e.nextElement();
75.9 + for (Enumeration<JarEntry> e = in.entries(); e.hasMoreElements(); ) {
75.10 + JarEntry je = e.nextElement();
75.11 out.putNextEntry(je);
75.12 InputStream ein = in.getInputStream(je);
75.13 for (int nr; 0 < (nr = ein.read(buffer)); ) {
76.1 --- a/src/share/classes/com/sun/jndi/ldap/Filter.java Fri Aug 05 15:35:04 2011 -0700
76.2 +++ b/src/share/classes/com/sun/jndi/ldap/Filter.java Tue Aug 09 17:38:52 2011 -0700
76.3 @@ -1,5 +1,5 @@
76.4 /*
76.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
76.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
76.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
76.8 *
76.9 * This code is free software; you can redistribute it and/or modify it
76.10 @@ -632,15 +632,17 @@
76.11 }
76.12 }
76.13
76.14 + // The complex filter types look like:
76.15 + // "&(type=val)(type=val)"
76.16 + // "|(type=val)(type=val)"
76.17 + // "!(type=val)"
76.18 + //
76.19 + // The filtOffset[0] pointing to the '&', '|', or '!'.
76.20 + //
76.21 private static void encodeComplexFilter(BerEncoder ber, byte[] filter,
76.22 int filterType, int filtOffset[], int filtEnd)
76.23 throws IOException, NamingException {
76.24
76.25 - //
76.26 - // We have a complex filter of type "&(type=val)(type=val)"
76.27 - // with filtOffset[0] pointing to the &
76.28 - //
76.29 -
76.30 if (dbg) {
76.31 dprint("encComplexFilter: ", filter, filtOffset[0], filtEnd);
76.32 dprint(", type: " + Integer.toString(filterType, 16));
76.33 @@ -652,7 +654,7 @@
76.34 ber.beginSeq(filterType);
76.35
76.36 int[] parens = findRightParen(filter, filtOffset, filtEnd);
76.37 - encodeFilterList(ber, filter, parens[0], parens[1]);
76.38 + encodeFilterList(ber, filter, filterType, parens[0], parens[1]);
76.39
76.40 ber.endSeq();
76.41
76.42 @@ -706,7 +708,7 @@
76.43 // Encode filter list of type "(filter1)(filter2)..."
76.44 //
76.45 private static void encodeFilterList(BerEncoder ber, byte[] filter,
76.46 - int start, int end) throws IOException, NamingException {
76.47 + int filterType, int start, int end) throws IOException, NamingException {
76.48
76.49 if (dbg) {
76.50 dprint("encFilterList: ", filter, start, end);
76.51 @@ -714,12 +716,16 @@
76.52 }
76.53
76.54 int filtOffset[] = new int[1];
76.55 -
76.56 - for (filtOffset[0] = start; filtOffset[0] < end;
76.57 - filtOffset[0]++) {
76.58 + int listNumber = 0;
76.59 + for (filtOffset[0] = start; filtOffset[0] < end; filtOffset[0]++) {
76.60 if (Character.isSpaceChar((char)filter[filtOffset[0]]))
76.61 continue;
76.62
76.63 + if ((filterType == LDAP_FILTER_NOT) && (listNumber > 0)) {
76.64 + throw new InvalidSearchFilterException(
76.65 + "Filter (!) cannot be followed by more than one filters");
76.66 + }
76.67 +
76.68 if (filter[filtOffset[0]] == '(') {
76.69 continue;
76.70 }
76.71 @@ -733,6 +739,8 @@
76.72 newfilter[0] = (byte)'(';
76.73 newfilter[len+1] = (byte)')';
76.74 encodeFilter(ber, newfilter, 0, newfilter.length);
76.75 +
76.76 + listNumber++;
76.77 }
76.78
76.79 if (dbg) {
77.1 --- a/src/share/classes/java/lang/Class.java Fri Aug 05 15:35:04 2011 -0700
77.2 +++ b/src/share/classes/java/lang/Class.java Tue Aug 09 17:38:52 2011 -0700
77.3 @@ -31,7 +31,6 @@
77.4 import java.lang.reflect.Field;
77.5 import java.lang.reflect.Method;
77.6 import java.lang.reflect.Constructor;
77.7 -import java.lang.reflect.GenericDeclaration;
77.8 import java.lang.reflect.Modifier;
77.9 import java.lang.reflect.Type;
77.10 import java.lang.reflect.TypeVariable;
77.11 @@ -45,10 +44,7 @@
77.12 import java.util.Arrays;
77.13 import java.util.Collection;
77.14 import java.util.HashSet;
77.15 -import java.util.Iterator;
77.16 import java.util.List;
77.17 -import java.util.LinkedList;
77.18 -import java.util.LinkedHashSet;
77.19 import java.util.Set;
77.20 import java.util.Map;
77.21 import java.util.HashMap;
77.22 @@ -56,7 +52,6 @@
77.23 import sun.reflect.ConstantPool;
77.24 import sun.reflect.Reflection;
77.25 import sun.reflect.ReflectionFactory;
77.26 -import sun.reflect.SignatureIterator;
77.27 import sun.reflect.generics.factory.CoreReflectionFactory;
77.28 import sun.reflect.generics.factory.GenericsFactory;
77.29 import sun.reflect.generics.repository.ClassRepository;
77.30 @@ -354,7 +349,8 @@
77.31 });
77.32 cachedConstructor = c;
77.33 } catch (NoSuchMethodException e) {
77.34 - throw new InstantiationException(getName());
77.35 + throw (InstantiationException)
77.36 + new InstantiationException(getName()).initCause(e);
77.37 }
77.38 }
77.39 Constructor<T> tmpConstructor = cachedConstructor;
77.40 @@ -978,7 +974,8 @@
77.41 descriptor = (String) enclosingInfo[2];
77.42 assert((name != null && descriptor != null) || name == descriptor);
77.43 } catch (ClassCastException cce) {
77.44 - throw new InternalError("Invalid type in enclosing method information");
77.45 + throw (InternalError)
77.46 + new InternalError("Invalid type in enclosing method information").initCause(cce);
77.47 }
77.48 }
77.49
77.50 @@ -1244,7 +1241,8 @@
77.51 try {
77.52 return getName().substring(enclosingClass.getName().length());
77.53 } catch (IndexOutOfBoundsException ex) {
77.54 - throw new InternalError("Malformed class name");
77.55 + throw (InternalError)
77.56 + new InternalError("Malformed class name").initCause(ex);
77.57 }
77.58 }
77.59
77.60 @@ -2559,7 +2557,7 @@
77.61 // Start by fetching public declared methods
77.62 MethodArray methods = new MethodArray();
77.63 {
77.64 - Method[] tmp = privateGetDeclaredMethods(true);
77.65 + Method[] tmp = privateGetDeclaredMethods(true);
77.66 methods.addAll(tmp);
77.67 }
77.68 // Now recur over superclass and direct superinterfaces.
77.69 @@ -2909,6 +2907,7 @@
77.70 return null;
77.71 }
77.72
77.73 + // Doesn't use Boolean.getBoolean to avoid class init.
77.74 String val =
77.75 System.getProperty("sun.reflect.noCaches");
77.76 if (val != null && val.equals("true")) {
77.77 @@ -2958,9 +2957,8 @@
77.78 }
77.79 // These can happen when users concoct enum-like classes
77.80 // that don't comply with the enum spec.
77.81 - catch (InvocationTargetException ex) { return null; }
77.82 - catch (NoSuchMethodException ex) { return null; }
77.83 - catch (IllegalAccessException ex) { return null; }
77.84 + catch (InvocationTargetException | NoSuchMethodException |
77.85 + IllegalAccessException ex) { return null; }
77.86 }
77.87 return enumConstants;
77.88 }
78.1 --- a/src/share/classes/java/lang/Math.java Fri Aug 05 15:35:04 2011 -0700
78.2 +++ b/src/share/classes/java/lang/Math.java Tue Aug 09 17:38:52 2011 -0700
78.3 @@ -50,34 +50,34 @@
78.4 *
78.5 * <p>The quality of implementation specifications concern two
78.6 * properties, accuracy of the returned result and monotonicity of the
78.7 - * method. Accuracy of the floating-point {@code Math} methods
78.8 - * is measured in terms of <i>ulps</i>, units in the last place. For
78.9 - * a given floating-point format, an ulp of a specific real number
78.10 - * value is the distance between the two floating-point values
78.11 - * bracketing that numerical value. When discussing the accuracy of a
78.12 - * method as a whole rather than at a specific argument, the number of
78.13 - * ulps cited is for the worst-case error at any argument. If a
78.14 - * method always has an error less than 0.5 ulps, the method always
78.15 - * returns the floating-point number nearest the exact result; such a
78.16 - * method is <i>correctly rounded</i>. A correctly rounded method is
78.17 - * generally the best a floating-point approximation can be; however,
78.18 - * it is impractical for many floating-point methods to be correctly
78.19 - * rounded. Instead, for the {@code Math} class, a larger error
78.20 - * bound of 1 or 2 ulps is allowed for certain methods. Informally,
78.21 - * with a 1 ulp error bound, when the exact result is a representable
78.22 - * number, the exact result should be returned as the computed result;
78.23 - * otherwise, either of the two floating-point values which bracket
78.24 - * the exact result may be returned. For exact results large in
78.25 - * magnitude, one of the endpoints of the bracket may be infinite.
78.26 - * Besides accuracy at individual arguments, maintaining proper
78.27 - * relations between the method at different arguments is also
78.28 - * important. Therefore, most methods with more than 0.5 ulp errors
78.29 - * are required to be <i>semi-monotonic</i>: whenever the mathematical
78.30 - * function is non-decreasing, so is the floating-point approximation,
78.31 - * likewise, whenever the mathematical function is non-increasing, so
78.32 - * is the floating-point approximation. Not all approximations that
78.33 - * have 1 ulp accuracy will automatically meet the monotonicity
78.34 - * requirements.
78.35 + * method. Accuracy of the floating-point {@code Math} methods is
78.36 + * measured in terms of <i>ulps</i>, units in the last place. For a
78.37 + * given floating-point format, an {@linkplain #ulp(double) ulp} of a
78.38 + * specific real number value is the distance between the two
78.39 + * floating-point values bracketing that numerical value. When
78.40 + * discussing the accuracy of a method as a whole rather than at a
78.41 + * specific argument, the number of ulps cited is for the worst-case
78.42 + * error at any argument. If a method always has an error less than
78.43 + * 0.5 ulps, the method always returns the floating-point number
78.44 + * nearest the exact result; such a method is <i>correctly
78.45 + * rounded</i>. A correctly rounded method is generally the best a
78.46 + * floating-point approximation can be; however, it is impractical for
78.47 + * many floating-point methods to be correctly rounded. Instead, for
78.48 + * the {@code Math} class, a larger error bound of 1 or 2 ulps is
78.49 + * allowed for certain methods. Informally, with a 1 ulp error bound,
78.50 + * when the exact result is a representable number, the exact result
78.51 + * should be returned as the computed result; otherwise, either of the
78.52 + * two floating-point values which bracket the exact result may be
78.53 + * returned. For exact results large in magnitude, one of the
78.54 + * endpoints of the bracket may be infinite. Besides accuracy at
78.55 + * individual arguments, maintaining proper relations between the
78.56 + * method at different arguments is also important. Therefore, most
78.57 + * methods with more than 0.5 ulp errors are required to be
78.58 + * <i>semi-monotonic</i>: whenever the mathematical function is
78.59 + * non-decreasing, so is the floating-point approximation, likewise,
78.60 + * whenever the mathematical function is non-increasing, so is the
78.61 + * floating-point approximation. Not all approximations that have 1
78.62 + * ulp accuracy will automatically meet the monotonicity requirements.
78.63 *
78.64 * @author unascribed
78.65 * @author Joseph D. Darcy
78.66 @@ -940,11 +940,11 @@
78.67 }
78.68
78.69 /**
78.70 - * Returns the size of an ulp of the argument. An ulp of a
78.71 - * {@code double} value is the positive distance between this
78.72 - * floating-point value and the {@code double} value next
78.73 - * larger in magnitude. Note that for non-NaN <i>x</i>,
78.74 - * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
78.75 + * Returns the size of an ulp of the argument. An ulp, unit in
78.76 + * the last place, of a {@code double} value is the positive
78.77 + * distance between this floating-point value and the {@code
78.78 + * double} value next larger in magnitude. Note that for non-NaN
78.79 + * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
78.80 *
78.81 * <p>Special Cases:
78.82 * <ul>
78.83 @@ -967,11 +967,11 @@
78.84 }
78.85
78.86 /**
78.87 - * Returns the size of an ulp of the argument. An ulp of a
78.88 - * {@code float} value is the positive distance between this
78.89 - * floating-point value and the {@code float} value next
78.90 - * larger in magnitude. Note that for non-NaN <i>x</i>,
78.91 - * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
78.92 + * Returns the size of an ulp of the argument. An ulp, unit in
78.93 + * the last place, of a {@code float} value is the positive
78.94 + * distance between this floating-point value and the {@code
78.95 + * float} value next larger in magnitude. Note that for non-NaN
78.96 + * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
78.97 *
78.98 * <p>Special Cases:
78.99 * <ul>
79.1 --- a/src/share/classes/java/lang/StrictMath.java Fri Aug 05 15:35:04 2011 -0700
79.2 +++ b/src/share/classes/java/lang/StrictMath.java Tue Aug 09 17:38:52 2011 -0700
79.3 @@ -932,11 +932,11 @@
79.4 }
79.5
79.6 /**
79.7 - * Returns the size of an ulp of the argument. An ulp of a
79.8 - * {@code double} value is the positive distance between this
79.9 - * floating-point value and the {@code double} value next
79.10 - * larger in magnitude. Note that for non-NaN <i>x</i>,
79.11 - * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
79.12 + * Returns the size of an ulp of the argument. An ulp, unit in
79.13 + * the last place, of a {@code double} value is the positive
79.14 + * distance between this floating-point value and the {@code
79.15 + * double} value next larger in magnitude. Note that for non-NaN
79.16 + * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
79.17 *
79.18 * <p>Special Cases:
79.19 * <ul>
79.20 @@ -959,11 +959,11 @@
79.21 }
79.22
79.23 /**
79.24 - * Returns the size of an ulp of the argument. An ulp of a
79.25 - * {@code float} value is the positive distance between this
79.26 - * floating-point value and the {@code float} value next
79.27 - * larger in magnitude. Note that for non-NaN <i>x</i>,
79.28 - * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
79.29 + * Returns the size of an ulp of the argument. An ulp, unit in
79.30 + * the last place, of a {@code float} value is the positive
79.31 + * distance between this floating-point value and the {@code
79.32 + * float} value next larger in magnitude. Note that for non-NaN
79.33 + * <i>x</i>, <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
79.34 *
79.35 * <p>Special Cases:
79.36 * <ul>
80.1 --- a/src/share/classes/java/lang/reflect/Constructor.java Fri Aug 05 15:35:04 2011 -0700
80.2 +++ b/src/share/classes/java/lang/reflect/Constructor.java Tue Aug 09 17:38:52 2011 -0700
80.3 @@ -1,5 +1,5 @@
80.4 /*
80.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
80.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
80.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
80.8 *
80.9 * This code is free software; you can redistribute it and/or modify it
80.10 @@ -27,13 +27,12 @@
80.11
80.12 import sun.reflect.ConstructorAccessor;
80.13 import sun.reflect.Reflection;
80.14 +import sun.reflect.annotation.AnnotationParser;
80.15 import sun.reflect.generics.repository.ConstructorRepository;
80.16 import sun.reflect.generics.factory.CoreReflectionFactory;
80.17 import sun.reflect.generics.factory.GenericsFactory;
80.18 import sun.reflect.generics.scope.ConstructorScope;
80.19 import java.lang.annotation.Annotation;
80.20 -import java.util.Map;
80.21 -import sun.reflect.annotation.AnnotationParser;
80.22 import java.lang.annotation.AnnotationFormatError;
80.23 import java.lang.reflect.Modifier;
80.24
80.25 @@ -57,11 +56,7 @@
80.26 * @author Kenneth Russell
80.27 * @author Nakul Saraiya
80.28 */
80.29 -public final
80.30 - class Constructor<T> extends AccessibleObject implements
80.31 - GenericDeclaration,
80.32 - Member {
80.33 -
80.34 +public final class Constructor<T> extends Executable {
80.35 private Class<T> clazz;
80.36 private int slot;
80.37 private Class<?>[] parameterTypes;
80.38 @@ -82,7 +77,8 @@
80.39 }
80.40
80.41 // Accessor for generic info repository
80.42 - private ConstructorRepository getGenericInfo() {
80.43 + @Override
80.44 + ConstructorRepository getGenericInfo() {
80.45 // lazily initialize repository if necessary
80.46 if (genericInfo == null) {
80.47 // create and cache generic info repository
80.48 @@ -111,8 +107,7 @@
80.49 int slot,
80.50 String signature,
80.51 byte[] annotations,
80.52 - byte[] parameterAnnotations)
80.53 - {
80.54 + byte[] parameterAnnotations) {
80.55 this.clazz = declaringClass;
80.56 this.parameterTypes = parameterTypes;
80.57 this.exceptionTypes = checkedExceptions;
80.58 @@ -137,21 +132,31 @@
80.59 // objects be fabricated for each reflective call on Class
80.60 // objects.)
80.61 Constructor<T> res = new Constructor<>(clazz,
80.62 - parameterTypes,
80.63 - exceptionTypes, modifiers, slot,
80.64 - signature,
80.65 - annotations,
80.66 - parameterAnnotations);
80.67 + parameterTypes,
80.68 + exceptionTypes, modifiers, slot,
80.69 + signature,
80.70 + annotations,
80.71 + parameterAnnotations);
80.72 res.root = this;
80.73 // Might as well eagerly propagate this if already present
80.74 res.constructorAccessor = constructorAccessor;
80.75 return res;
80.76 }
80.77
80.78 + @Override
80.79 + boolean hasGenericInformation() {
80.80 + return (getSignature() != null);
80.81 + }
80.82 +
80.83 + @Override
80.84 + byte[] getAnnotationBytes() {
80.85 + return annotations;
80.86 + }
80.87 +
80.88 /**
80.89 - * Returns the {@code Class} object representing the class that declares
80.90 - * the constructor represented by this {@code Constructor} object.
80.91 + * {@inheritDoc}
80.92 */
80.93 + @Override
80.94 public Class<T> getDeclaringClass() {
80.95 return clazz;
80.96 }
80.97 @@ -160,36 +165,25 @@
80.98 * Returns the name of this constructor, as a string. This is
80.99 * the binary name of the constructor's declaring class.
80.100 */
80.101 + @Override
80.102 public String getName() {
80.103 return getDeclaringClass().getName();
80.104 }
80.105
80.106 /**
80.107 - * Returns the Java language modifiers for the constructor
80.108 - * represented by this {@code Constructor} object, as an integer. The
80.109 - * {@code Modifier} class should be used to decode the modifiers.
80.110 - *
80.111 - * @see Modifier
80.112 + * {@inheritDoc}
80.113 */
80.114 + @Override
80.115 public int getModifiers() {
80.116 return modifiers;
80.117 }
80.118
80.119 /**
80.120 - * Returns an array of {@code TypeVariable} objects that represent the
80.121 - * type variables declared by the generic declaration represented by this
80.122 - * {@code GenericDeclaration} object, in declaration order. Returns an
80.123 - * array of length 0 if the underlying generic declaration declares no type
80.124 - * variables.
80.125 - *
80.126 - * @return an array of {@code TypeVariable} objects that represent
80.127 - * the type variables declared by this generic declaration
80.128 - * @throws GenericSignatureFormatError if the generic
80.129 - * signature of this generic declaration does not conform to
80.130 - * the format specified in
80.131 - * <cite>The Java™ Virtual Machine Specification</cite>
80.132 + * {@inheritDoc}
80.133 + * @throws GenericSignatureFormatError {@inheritDoc}
80.134 * @since 1.5
80.135 */
80.136 + @Override
80.137 public TypeVariable<Constructor<T>>[] getTypeParameters() {
80.138 if (getSignature() != null) {
80.139 return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
80.140 @@ -199,98 +193,45 @@
80.141
80.142
80.143 /**
80.144 - * Returns an array of {@code Class} objects that represent the formal
80.145 - * parameter types, in declaration order, of the constructor
80.146 - * represented by this {@code Constructor} object. Returns an array of
80.147 - * length 0 if the underlying constructor takes no parameters.
80.148 - *
80.149 - * @return the parameter types for the constructor this object
80.150 - * represents
80.151 + * {@inheritDoc}
80.152 */
80.153 + @Override
80.154 public Class<?>[] getParameterTypes() {
80.155 return (Class<?>[]) parameterTypes.clone();
80.156 }
80.157
80.158 + /**
80.159 + * {@inheritDoc}
80.160 + * @throws GenericSignatureFormatError {@inheritDoc}
80.161 + * @throws TypeNotPresentException {@inheritDoc}
80.162 + * @throws MalformedParameterizedTypeException {@inheritDoc}
80.163 + * @since 1.5
80.164 + */
80.165 + @Override
80.166 + public Type[] getGenericParameterTypes() {
80.167 + return super.getGenericParameterTypes();
80.168 + }
80.169
80.170 /**
80.171 - * Returns an array of {@code Type} objects that represent the formal
80.172 - * parameter types, in declaration order, of the method represented by
80.173 - * this {@code Constructor} object. Returns an array of length 0 if the
80.174 - * underlying method takes no parameters.
80.175 - *
80.176 - * <p>If a formal parameter type is a parameterized type,
80.177 - * the {@code Type} object returned for it must accurately reflect
80.178 - * the actual type parameters used in the source code.
80.179 - *
80.180 - * <p>If a formal parameter type is a type variable or a parameterized
80.181 - * type, it is created. Otherwise, it is resolved.
80.182 - *
80.183 - * @return an array of {@code Type}s that represent the formal
80.184 - * parameter types of the underlying method, in declaration order
80.185 - * @throws GenericSignatureFormatError
80.186 - * if the generic method signature does not conform to the format
80.187 - * specified in
80.188 - * <cite>The Java™ Virtual Machine Specification</cite>
80.189 - * @throws TypeNotPresentException if any of the parameter
80.190 - * types of the underlying method refers to a non-existent type
80.191 - * declaration
80.192 - * @throws MalformedParameterizedTypeException if any of
80.193 - * the underlying method's parameter types refer to a parameterized
80.194 - * type that cannot be instantiated for any reason
80.195 - * @since 1.5
80.196 + * {@inheritDoc}
80.197 */
80.198 - public Type[] getGenericParameterTypes() {
80.199 - if (getSignature() != null)
80.200 - return getGenericInfo().getParameterTypes();
80.201 - else
80.202 - return getParameterTypes();
80.203 - }
80.204 -
80.205 -
80.206 - /**
80.207 - * Returns an array of {@code Class} objects that represent the types
80.208 - * of exceptions declared to be thrown by the underlying constructor
80.209 - * represented by this {@code Constructor} object. Returns an array of
80.210 - * length 0 if the constructor declares no exceptions in its {@code throws} clause.
80.211 - *
80.212 - * @return the exception types declared as being thrown by the
80.213 - * constructor this object represents
80.214 - */
80.215 + @Override
80.216 public Class<?>[] getExceptionTypes() {
80.217 return (Class<?>[])exceptionTypes.clone();
80.218 }
80.219
80.220
80.221 /**
80.222 - * Returns an array of {@code Type} objects that represent the
80.223 - * exceptions declared to be thrown by this {@code Constructor} object.
80.224 - * Returns an array of length 0 if the underlying method declares
80.225 - * no exceptions in its {@code throws} clause.
80.226 - *
80.227 - * <p>If an exception type is a type variable or a parameterized
80.228 - * type, it is created. Otherwise, it is resolved.
80.229 - *
80.230 - * @return an array of Types that represent the exception types
80.231 - * thrown by the underlying method
80.232 - * @throws GenericSignatureFormatError
80.233 - * if the generic method signature does not conform to the format
80.234 - * specified in
80.235 - * <cite>The Java™ Virtual Machine Specification</cite>
80.236 - * @throws TypeNotPresentException if the underlying method's
80.237 - * {@code throws} clause refers to a non-existent type declaration
80.238 - * @throws MalformedParameterizedTypeException if
80.239 - * the underlying method's {@code throws} clause refers to a
80.240 - * parameterized type that cannot be instantiated for any reason
80.241 + * {@inheritDoc}
80.242 + * @throws GenericSignatureFormatError {@inheritDoc}
80.243 + * @throws TypeNotPresentException {@inheritDoc}
80.244 + * @throws MalformedParameterizedTypeException {@inheritDoc}
80.245 * @since 1.5
80.246 */
80.247 - public Type[] getGenericExceptionTypes() {
80.248 - Type[] result;
80.249 - if (getSignature() != null &&
80.250 - ( (result = getGenericInfo().getExceptionTypes()).length > 0 ))
80.251 - return result;
80.252 - else
80.253 - return getExceptionTypes();
80.254 - }
80.255 + @Override
80.256 + public Type[] getGenericExceptionTypes() {
80.257 + return super.getGenericExceptionTypes();
80.258 + }
80.259
80.260 /**
80.261 * Compares this {@code Constructor} against the specified object.
80.262 @@ -302,16 +243,7 @@
80.263 if (obj != null && obj instanceof Constructor) {
80.264 Constructor<?> other = (Constructor<?>)obj;
80.265 if (getDeclaringClass() == other.getDeclaringClass()) {
80.266 - /* Avoid unnecessary cloning */
80.267 - Class<?>[] params1 = parameterTypes;
80.268 - Class<?>[] params2 = other.parameterTypes;
80.269 - if (params1.length == params2.length) {
80.270 - for (int i = 0; i < params1.length; i++) {
80.271 - if (params1[i] != params2[i])
80.272 - return false;
80.273 - }
80.274 - return true;
80.275 - }
80.276 + return equalParamTypes(parameterTypes, other.parameterTypes);
80.277 }
80.278 }
80.279 return false;
80.280 @@ -342,34 +274,14 @@
80.281 * constructor has default (package) access.
80.282 */
80.283 public String toString() {
80.284 - try {
80.285 - StringBuffer sb = new StringBuffer();
80.286 - int mod = getModifiers() & Modifier.constructorModifiers();
80.287 - if (mod != 0) {
80.288 - sb.append(Modifier.toString(mod) + " ");
80.289 - }
80.290 - sb.append(Field.getTypeName(getDeclaringClass()));
80.291 - sb.append("(");
80.292 - Class<?>[] params = parameterTypes; // avoid clone
80.293 - for (int j = 0; j < params.length; j++) {
80.294 - sb.append(Field.getTypeName(params[j]));
80.295 - if (j < (params.length - 1))
80.296 - sb.append(",");
80.297 - }
80.298 - sb.append(")");
80.299 - Class<?>[] exceptions = exceptionTypes; // avoid clone
80.300 - if (exceptions.length > 0) {
80.301 - sb.append(" throws ");
80.302 - for (int k = 0; k < exceptions.length; k++) {
80.303 - sb.append(exceptions[k].getName());
80.304 - if (k < (exceptions.length - 1))
80.305 - sb.append(",");
80.306 - }
80.307 - }
80.308 - return sb.toString();
80.309 - } catch (Exception e) {
80.310 - return "<" + e + ">";
80.311 - }
80.312 + return sharedToString(Modifier.constructorModifiers(),
80.313 + parameterTypes,
80.314 + exceptionTypes);
80.315 + }
80.316 +
80.317 + @Override
80.318 + void specificToStringHeader(StringBuilder sb) {
80.319 + sb.append(Field.getTypeName(getDeclaringClass()));
80.320 }
80.321
80.322 /**
80.323 @@ -405,56 +317,14 @@
80.324 *
80.325 * @since 1.5
80.326 */
80.327 + @Override
80.328 public String toGenericString() {
80.329 - try {
80.330 - StringBuilder sb = new StringBuilder();
80.331 - int mod = getModifiers() & Modifier.constructorModifiers();
80.332 - if (mod != 0) {
80.333 - sb.append(Modifier.toString(mod) + " ");
80.334 - }
80.335 - TypeVariable<?>[] typeparms = getTypeParameters();
80.336 - if (typeparms.length > 0) {
80.337 - boolean first = true;
80.338 - sb.append("<");
80.339 - for(TypeVariable<?> typeparm: typeparms) {
80.340 - if (!first)
80.341 - sb.append(",");
80.342 - // Class objects can't occur here; no need to test
80.343 - // and call Class.getName().
80.344 - sb.append(typeparm.toString());
80.345 - first = false;
80.346 - }
80.347 - sb.append("> ");
80.348 - }
80.349 - sb.append(Field.getTypeName(getDeclaringClass()));
80.350 - sb.append("(");
80.351 - Type[] params = getGenericParameterTypes();
80.352 - for (int j = 0; j < params.length; j++) {
80.353 - String param = (params[j] instanceof Class<?>)?
80.354 - Field.getTypeName((Class<?>)params[j]):
80.355 - (params[j].toString());
80.356 - if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
80.357 - param = param.replaceFirst("\\[\\]$", "...");
80.358 - sb.append(param);
80.359 - if (j < (params.length - 1))
80.360 - sb.append(",");
80.361 - }
80.362 - sb.append(")");
80.363 - Type[] exceptions = getGenericExceptionTypes();
80.364 - if (exceptions.length > 0) {
80.365 - sb.append(" throws ");
80.366 - for (int k = 0; k < exceptions.length; k++) {
80.367 - sb.append((exceptions[k] instanceof Class)?
80.368 - ((Class<?>)exceptions[k]).getName():
80.369 - exceptions[k].toString());
80.370 - if (k < (exceptions.length - 1))
80.371 - sb.append(",");
80.372 - }
80.373 - }
80.374 - return sb.toString();
80.375 - } catch (Exception e) {
80.376 - return "<" + e + ">";
80.377 - }
80.378 + return sharedToGenericString(Modifier.constructorModifiers());
80.379 + }
80.380 +
80.381 + @Override
80.382 + void specificToGenericStringHeader(StringBuilder sb) {
80.383 + specificToStringHeader(sb);
80.384 }
80.385
80.386 /**
80.387 @@ -526,29 +396,21 @@
80.388 }
80.389
80.390 /**
80.391 - * Returns {@code true} if this constructor was declared to take
80.392 - * a variable number of arguments; returns {@code false}
80.393 - * otherwise.
80.394 - *
80.395 - * @return {@code true} if an only if this constructor was declared to
80.396 - * take a variable number of arguments.
80.397 + * {@inheritDoc}
80.398 * @since 1.5
80.399 */
80.400 + @Override
80.401 public boolean isVarArgs() {
80.402 - return (getModifiers() & Modifier.VARARGS) != 0;
80.403 + return super.isVarArgs();
80.404 }
80.405
80.406 /**
80.407 - * Returns {@code true} if this constructor is a synthetic
80.408 - * constructor; returns {@code false} otherwise.
80.409 - *
80.410 - * @return true if and only if this constructor is a synthetic
80.411 - * constructor as defined by
80.412 - * <cite>The Java™ Language Specification</cite>.
80.413 + * {@inheritDoc}
80.414 * @since 1.5
80.415 */
80.416 + @Override
80.417 public boolean isSynthetic() {
80.418 - return Modifier.isSynthetic(getModifiers());
80.419 + return super.isSynthetic();
80.420 }
80.421
80.422 // NOTE that there is no synchronization used here. It is correct
80.423 @@ -592,9 +454,9 @@
80.424 return slot;
80.425 }
80.426
80.427 - String getSignature() {
80.428 - return signature;
80.429 - }
80.430 + String getSignature() {
80.431 + return signature;
80.432 + }
80.433
80.434 byte[] getRawAnnotations() {
80.435 return annotations;
80.436 @@ -604,80 +466,50 @@
80.437 return parameterAnnotations;
80.438 }
80.439
80.440 +
80.441 /**
80.442 - * @throws NullPointerException {@inheritDoc}
80.443 + * {@inheritDoc}
80.444 + * @throws NullPointerException {@inheritDoc}
80.445 * @since 1.5
80.446 */
80.447 public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
80.448 - if (annotationClass == null)
80.449 - throw new NullPointerException();
80.450 -
80.451 - return (T) declaredAnnotations().get(annotationClass);
80.452 + return super.getAnnotation(annotationClass);
80.453 }
80.454
80.455 /**
80.456 + * {@inheritDoc}
80.457 * @since 1.5
80.458 */
80.459 public Annotation[] getDeclaredAnnotations() {
80.460 - return AnnotationParser.toArray(declaredAnnotations());
80.461 - }
80.462 -
80.463 - private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
80.464 -
80.465 - private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
80.466 - if (declaredAnnotations == null) {
80.467 - declaredAnnotations = AnnotationParser.parseAnnotations(
80.468 - annotations, sun.misc.SharedSecrets.getJavaLangAccess().
80.469 - getConstantPool(getDeclaringClass()),
80.470 - getDeclaringClass());
80.471 - }
80.472 - return declaredAnnotations;
80.473 + return super.getDeclaredAnnotations();
80.474 }
80.475
80.476 /**
80.477 - * Returns an array of arrays that represent the annotations on the formal
80.478 - * parameters, in declaration order, of the method represented by
80.479 - * this {@code Constructor} object. (Returns an array of length zero if the
80.480 - * underlying method is parameterless. If the method has one or more
80.481 - * parameters, a nested array of length zero is returned for each parameter
80.482 - * with no annotations.) The annotation objects contained in the returned
80.483 - * arrays are serializable. The caller of this method is free to modify
80.484 - * the returned arrays; it will have no effect on the arrays returned to
80.485 - * other callers.
80.486 - *
80.487 - * @return an array of arrays that represent the annotations on the formal
80.488 - * parameters, in declaration order, of the method represented by this
80.489 - * Constructor object
80.490 + * {@inheritDoc}
80.491 * @since 1.5
80.492 */
80.493 + @Override
80.494 public Annotation[][] getParameterAnnotations() {
80.495 - int numParameters = parameterTypes.length;
80.496 - if (parameterAnnotations == null)
80.497 - return new Annotation[numParameters][0];
80.498 + return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
80.499 + }
80.500
80.501 - Annotation[][] result = AnnotationParser.parseParameterAnnotations(
80.502 - parameterAnnotations,
80.503 - sun.misc.SharedSecrets.getJavaLangAccess().
80.504 - getConstantPool(getDeclaringClass()),
80.505 - getDeclaringClass());
80.506 - if (result.length != numParameters) {
80.507 - Class<?> declaringClass = getDeclaringClass();
80.508 - if (declaringClass.isEnum() ||
80.509 - declaringClass.isAnonymousClass() ||
80.510 - declaringClass.isLocalClass() )
80.511 - ; // Can't do reliable parameter counting
80.512 - else {
80.513 - if (!declaringClass.isMemberClass() || // top-level
80.514 - // Check for the enclosing instance parameter for
80.515 - // non-static member classes
80.516 - (declaringClass.isMemberClass() &&
80.517 - ((declaringClass.getModifiers() & Modifier.STATIC) == 0) &&
80.518 - result.length + 1 != numParameters) ) {
80.519 - throw new AnnotationFormatError(
80.520 - "Parameter annotations don't match number of parameters");
80.521 - }
80.522 + @Override
80.523 + void handleParameterNumberMismatch(int resultLength, int numParameters) {
80.524 + Class<?> declaringClass = getDeclaringClass();
80.525 + if (declaringClass.isEnum() ||
80.526 + declaringClass.isAnonymousClass() ||
80.527 + declaringClass.isLocalClass() )
80.528 + return ; // Can't do reliable parameter counting
80.529 + else {
80.530 + if (!declaringClass.isMemberClass() || // top-level
80.531 + // Check for the enclosing instance parameter for
80.532 + // non-static member classes
80.533 + (declaringClass.isMemberClass() &&
80.534 + ((declaringClass.getModifiers() & Modifier.STATIC) == 0) &&
80.535 + resultLength + 1 != numParameters) ) {
80.536 + throw new AnnotationFormatError(
80.537 + "Parameter annotations don't match number of parameters");
80.538 }
80.539 }
80.540 - return result;
80.541 }
80.542 }
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/src/share/classes/java/lang/reflect/Executable.java Tue Aug 09 17:38:52 2011 -0700
81.3 @@ -0,0 +1,396 @@
81.4 +/*
81.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
81.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
81.7 + *
81.8 + * This code is free software; you can redistribute it and/or modify it
81.9 + * under the terms of the GNU General Public License version 2 only, as
81.10 + * published by the Free Software Foundation. Oracle designates this
81.11 + * particular file as subject to the "Classpath" exception as provided
81.12 + * by Oracle in the LICENSE file that accompanied this code.
81.13 + *
81.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
81.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
81.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
81.17 + * version 2 for more details (a copy is included in the LICENSE file that
81.18 + * accompanied this code).
81.19 + *
81.20 + * You should have received a copy of the GNU General Public License version
81.21 + * 2 along with this work; if not, write to the Free Software Foundation,
81.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
81.23 + *
81.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
81.25 + * or visit www.oracle.com if you need additional information or have any
81.26 + * questions.
81.27 + */
81.28 +
81.29 +package java.lang.reflect;
81.30 +
81.31 +import java.lang.annotation.*;
81.32 +import java.util.Map;
81.33 +import sun.reflect.annotation.AnnotationParser;
81.34 +import sun.reflect.generics.repository.ConstructorRepository;
81.35 +import sun.reflect.generics.factory.CoreReflectionFactory;
81.36 +import sun.reflect.generics.factory.GenericsFactory;
81.37 +import sun.reflect.generics.scope.ConstructorScope;
81.38 +
81.39 +/**
81.40 + * A shared superclass for the common functionality of {@link Method}
81.41 + * and {@link Constructor}.
81.42 + *
81.43 + * @since 1.8
81.44 + */
81.45 +public abstract class Executable extends AccessibleObject
81.46 + implements Member, GenericDeclaration {
81.47 + /*
81.48 + * Only grant package-visibility to the constructor.
81.49 + */
81.50 + Executable() {}
81.51 +
81.52 + /**
81.53 + * Accessor method to allow code sharing
81.54 + */
81.55 + abstract byte[] getAnnotationBytes();
81.56 +
81.57 + /**
81.58 + * Does the Executable have generic information.
81.59 + */
81.60 + abstract boolean hasGenericInformation();
81.61 +
81.62 + abstract ConstructorRepository getGenericInfo();
81.63 +
81.64 + boolean equalParamTypes(Class<?>[] params1, Class<?>[] params2) {
81.65 + /* Avoid unnecessary cloning */
81.66 + if (params1.length == params2.length) {
81.67 + for (int i = 0; i < params1.length; i++) {
81.68 + if (params1[i] != params2[i])
81.69 + return false;
81.70 + }
81.71 + return true;
81.72 + }
81.73 + return false;
81.74 + }
81.75 +
81.76 + Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) {
81.77 + return AnnotationParser.parseParameterAnnotations(
81.78 + parameterAnnotations,
81.79 + sun.misc.SharedSecrets.getJavaLangAccess().
81.80 + getConstantPool(getDeclaringClass()),
81.81 + getDeclaringClass());
81.82 + }
81.83 +
81.84 + void separateWithCommas(Class<?>[] types, StringBuilder sb) {
81.85 + for (int j = 0; j < types.length; j++) {
81.86 + sb.append(Field.getTypeName(types[j]));
81.87 + if (j < (types.length - 1))
81.88 + sb.append(",");
81.89 + }
81.90 +
81.91 + }
81.92 +
81.93 + void printModifiersIfNonzero(StringBuilder sb, int mask) {
81.94 + int mod = getModifiers() & mask;
81.95 + if (mod != 0) {
81.96 + sb.append(Modifier.toString(mod)).append(' ');
81.97 + }
81.98 + }
81.99 +
81.100 + String sharedToString(int modifierMask,
81.101 + Class<?>[] parameterTypes,
81.102 + Class<?>[] exceptionTypes) {
81.103 + try {
81.104 + StringBuilder sb = new StringBuilder();
81.105 +
81.106 + printModifiersIfNonzero(sb, modifierMask);
81.107 + specificToStringHeader(sb);
81.108 +
81.109 + sb.append('(');
81.110 + separateWithCommas(parameterTypes, sb);
81.111 + sb.append(')');
81.112 + if (exceptionTypes.length > 0) {
81.113 + sb.append(" throws ");
81.114 + separateWithCommas(exceptionTypes, sb);
81.115 + }
81.116 + return sb.toString();
81.117 + } catch (Exception e) {
81.118 + return "<" + e + ">";
81.119 + }
81.120 + }
81.121 +
81.122 + /**
81.123 + * Generate toString header information specific to a method or
81.124 + * constructor.
81.125 + */
81.126 + abstract void specificToStringHeader(StringBuilder sb);
81.127 +
81.128 + String sharedToGenericString(int modifierMask) {
81.129 + try {
81.130 + StringBuilder sb = new StringBuilder();
81.131 +
81.132 + printModifiersIfNonzero(sb, modifierMask);
81.133 +
81.134 + TypeVariable<?>[] typeparms = getTypeParameters();
81.135 + if (typeparms.length > 0) {
81.136 + boolean first = true;
81.137 + sb.append('<');
81.138 + for(TypeVariable<?> typeparm: typeparms) {
81.139 + if (!first)
81.140 + sb.append(',');
81.141 + // Class objects can't occur here; no need to test
81.142 + // and call Class.getName().
81.143 + sb.append(typeparm.toString());
81.144 + first = false;
81.145 + }
81.146 + sb.append("> ");
81.147 + }
81.148 +
81.149 + specificToGenericStringHeader(sb);
81.150 +
81.151 + sb.append('(');
81.152 + Type[] params = getGenericParameterTypes();
81.153 + for (int j = 0; j < params.length; j++) {
81.154 + String param = (params[j] instanceof Class)?
81.155 + Field.getTypeName((Class)params[j]):
81.156 + (params[j].toString());
81.157 + if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
81.158 + param = param.replaceFirst("\\[\\]$", "...");
81.159 + sb.append(param);
81.160 + if (j < (params.length - 1))
81.161 + sb.append(',');
81.162 + }
81.163 + sb.append(')');
81.164 + Type[] exceptions = getGenericExceptionTypes();
81.165 + if (exceptions.length > 0) {
81.166 + sb.append(" throws ");
81.167 + for (int k = 0; k < exceptions.length; k++) {
81.168 + sb.append((exceptions[k] instanceof Class)?
81.169 + ((Class)exceptions[k]).getName():
81.170 + exceptions[k].toString());
81.171 + if (k < (exceptions.length - 1))
81.172 + sb.append(',');
81.173 + }
81.174 + }
81.175 + return sb.toString();
81.176 + } catch (Exception e) {
81.177 + return "<" + e + ">";
81.178 + }
81.179 + }
81.180 +
81.181 + /**
81.182 + * Generate toGenericString header information specific to a
81.183 + * method or constructor.
81.184 + */
81.185 + abstract void specificToGenericStringHeader(StringBuilder sb);
81.186 +
81.187 + /**
81.188 + * Returns the {@code Class} object representing the class or interface
81.189 + * that declares the method represented by this executable object.
81.190 + */
81.191 + public abstract Class<?> getDeclaringClass();
81.192 +
81.193 + /**
81.194 + * Returns the name of the executable represented by this object.
81.195 + */
81.196 + public abstract String getName();
81.197 +
81.198 + /**
81.199 + * Returns the Java language {@linkplain Modifier modifiers} for
81.200 + * the executable represented by this object.
81.201 + */
81.202 + public abstract int getModifiers();
81.203 +
81.204 + /**
81.205 + * Returns an array of {@code TypeVariable} objects that represent the
81.206 + * type variables declared by the generic declaration represented by this
81.207 + * {@code GenericDeclaration} object, in declaration order. Returns an
81.208 + * array of length 0 if the underlying generic declaration declares no type
81.209 + * variables.
81.210 + *
81.211 + * @return an array of {@code TypeVariable} objects that represent
81.212 + * the type variables declared by this generic declaration
81.213 + * @throws GenericSignatureFormatError if the generic
81.214 + * signature of this generic declaration does not conform to
81.215 + * the format specified in
81.216 + * <cite>The Java™ Virtual Machine Specification</cite>
81.217 + */
81.218 + public abstract TypeVariable<?>[] getTypeParameters();
81.219 +
81.220 + /**
81.221 + * Returns an array of {@code Class} objects that represent the formal
81.222 + * parameter types, in declaration order, of the executable
81.223 + * represented by this object. Returns an array of length
81.224 + * 0 if the underlying method takes no parameters.
81.225 + *
81.226 + * @return the parameter types for the method this object
81.227 + * represents
81.228 + */
81.229 + public abstract Class<?>[] getParameterTypes();
81.230 +
81.231 + /**
81.232 + * Returns an array of {@code Type} objects that represent the formal
81.233 + * parameter types, in declaration order, of the method represented by
81.234 + * this executable object. Returns an array of length 0 if the
81.235 + * underlying method takes no parameters.
81.236 + *
81.237 + * <p>If a formal parameter type is a parameterized type,
81.238 + * the {@code Type} object returned for it must accurately reflect
81.239 + * the actual type parameters used in the source code.
81.240 + *
81.241 + * <p>If a formal parameter type is a type variable or a parameterized
81.242 + * type, it is created. Otherwise, it is resolved.
81.243 + *
81.244 + * @return an array of {@code Type}s that represent the formal
81.245 + * parameter types of the underlying method, in declaration order
81.246 + * @throws GenericSignatureFormatError
81.247 + * if the generic method signature does not conform to the format
81.248 + * specified in
81.249 + * <cite>The Java™ Virtual Machine Specification</cite>
81.250 + * @throws TypeNotPresentException if any of the parameter
81.251 + * types of the underlying method refers to a non-existent type
81.252 + * declaration
81.253 + * @throws MalformedParameterizedTypeException if any of
81.254 + * the underlying method's parameter types refer to a parameterized
81.255 + * type that cannot be instantiated for any reason
81.256 + */
81.257 + public Type[] getGenericParameterTypes() {
81.258 + if (hasGenericInformation())
81.259 + return getGenericInfo().getParameterTypes();
81.260 + else
81.261 + return getParameterTypes();
81.262 + }
81.263 +
81.264 + /**
81.265 + * Returns an array of {@code Class} objects that represent the
81.266 + * types of exceptions declared to be thrown by the underlying
81.267 + * executable represented by this object. Returns an array of
81.268 + * length 0 if the executable declares no exceptions in its {@code
81.269 + * throws} clause.
81.270 + *
81.271 + * @return the exception types declared as being thrown by the
81.272 + * executable this object represents
81.273 + */
81.274 + public abstract Class<?>[] getExceptionTypes();
81.275 +
81.276 + /**
81.277 + * Returns an array of {@code Type} objects that represent the
81.278 + * exceptions declared to be thrown by this executable object.
81.279 + * Returns an array of length 0 if the underlying executable declares
81.280 + * no exceptions in its {@code throws} clause.
81.281 + *
81.282 + * <p>If an exception type is a type variable or a parameterized
81.283 + * type, it is created. Otherwise, it is resolved.
81.284 + *
81.285 + * @return an array of Types that represent the exception types
81.286 + * thrown by the underlying method
81.287 + * @throws GenericSignatureFormatError
81.288 + * if the generic method signature does not conform to the format
81.289 + * specified in
81.290 + * <cite>The Java™ Virtual Machine Specification</cite>
81.291 + * @throws TypeNotPresentException if the underlying method's
81.292 + * {@code throws} clause refers to a non-existent type declaration
81.293 + * @throws MalformedParameterizedTypeException if
81.294 + * the underlying method's {@code throws} clause refers to a
81.295 + * parameterized type that cannot be instantiated for any reason
81.296 + */
81.297 + public Type[] getGenericExceptionTypes() {
81.298 + Type[] result;
81.299 + if (hasGenericInformation() &&
81.300 + ((result = getGenericInfo().getExceptionTypes()).length > 0))
81.301 + return result;
81.302 + else
81.303 + return getExceptionTypes();
81.304 + }
81.305 +
81.306 + /**
81.307 + * Returns a string describing this {@code Executable}, including
81.308 + * any type parameters.
81.309 + */
81.310 + public abstract String toGenericString();
81.311 +
81.312 + /**
81.313 + * Returns {@code true} if this executable was declared to take a
81.314 + * variable number of arguments; returns {@code false} otherwise.
81.315 + *
81.316 + * @return {@code true} if an only if this executable was declared
81.317 + * to take a variable number of arguments.
81.318 + */
81.319 + public boolean isVarArgs() {
81.320 + return (getModifiers() & Modifier.VARARGS) != 0;
81.321 + }
81.322 +
81.323 + /**
81.324 + * Returns {@code true} if this executable is a synthetic
81.325 + * construct; returns {@code false} otherwise.
81.326 + *
81.327 + * @return true if and only if this executable is a synthetic
81.328 + * construct as defined by
81.329 + * <cite>The Java™ Language Specification</cite>.
81.330 + */
81.331 + public boolean isSynthetic() {
81.332 + return Modifier.isSynthetic(getModifiers());
81.333 + }
81.334 +
81.335 + /**
81.336 + * Returns an array of arrays that represent the annotations on
81.337 + * the formal parameters, in declaration order, of the executable
81.338 + * represented by this object. (Returns an array of length zero if
81.339 + * the underlying method is parameterless. If the executable has
81.340 + * one or more parameters, a nested array of length zero is
81.341 + * returned for each parameter with no annotations.) The
81.342 + * annotation objects contained in the returned arrays are
81.343 + * serializable. The caller of this method is free to modify the
81.344 + * returned arrays; it will have no effect on the arrays returned
81.345 + * to other callers.
81.346 + *
81.347 + * @return an array of arrays that represent the annotations on the formal
81.348 + * parameters, in declaration order, of the exectuable represented by this
81.349 + * object
81.350 + */
81.351 + public abstract Annotation[][] getParameterAnnotations();
81.352 +
81.353 + Annotation[][] sharedGetParameterAnnotations(Class<?>[] parameterTypes,
81.354 + byte[] parameterAnnotations) {
81.355 + int numParameters = parameterTypes.length;
81.356 + if (parameterAnnotations == null)
81.357 + return new Annotation[numParameters][0];
81.358 +
81.359 + Annotation[][] result = parseParameterAnnotations(parameterAnnotations);
81.360 +
81.361 + if (result.length != numParameters)
81.362 + handleParameterNumberMismatch(result.length, numParameters);
81.363 + return result;
81.364 + }
81.365 +
81.366 + abstract void handleParameterNumberMismatch(int resultLength, int numParameters);
81.367 +
81.368 + /**
81.369 + * {@inheritDoc}
81.370 + * @throws NullPointerException {@inheritDoc}
81.371 + */
81.372 + @SuppressWarnings("unchecked")
81.373 + public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
81.374 + if (annotationClass == null)
81.375 + throw new NullPointerException();
81.376 +
81.377 + return (T) declaredAnnotations().get(annotationClass);
81.378 + }
81.379 +
81.380 + /**
81.381 + * {@inheritDoc}
81.382 + */
81.383 + public Annotation[] getDeclaredAnnotations() {
81.384 + return AnnotationParser.toArray(declaredAnnotations());
81.385 + }
81.386 +
81.387 + private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
81.388 +
81.389 + private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
81.390 + if (declaredAnnotations == null) {
81.391 + declaredAnnotations = AnnotationParser.parseAnnotations(
81.392 + getAnnotationBytes(),
81.393 + sun.misc.SharedSecrets.getJavaLangAccess().
81.394 + getConstantPool(getDeclaringClass()),
81.395 + getDeclaringClass());
81.396 + }
81.397 + return declaredAnnotations;
81.398 + }
81.399 +}
82.1 --- a/src/share/classes/java/lang/reflect/Method.java Fri Aug 05 15:35:04 2011 -0700
82.2 +++ b/src/share/classes/java/lang/reflect/Method.java Tue Aug 09 17:38:52 2011 -0700
82.3 @@ -1,5 +1,5 @@
82.4 /*
82.5 - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
82.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
82.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
82.8 *
82.9 * This code is free software; you can redistribute it and/or modify it
82.10 @@ -36,7 +36,6 @@
82.11 import java.lang.annotation.Annotation;
82.12 import java.lang.annotation.AnnotationFormatError;
82.13 import java.nio.ByteBuffer;
82.14 -import java.util.Map;
82.15
82.16 /**
82.17 * A {@code Method} provides information about, and access to, a single method
82.18 @@ -58,9 +57,7 @@
82.19 * @author Kenneth Russell
82.20 * @author Nakul Saraiya
82.21 */
82.22 -public final
82.23 - class Method extends AccessibleObject implements GenericDeclaration,
82.24 - Member {
82.25 +public final class Method extends Executable {
82.26 private Class<?> clazz;
82.27 private int slot;
82.28 // This is guaranteed to be interned by the VM in the 1.4
82.29 @@ -83,8 +80,8 @@
82.30 // potentially many Method objects pointing to it.)
82.31 private Method root;
82.32
82.33 - // Generics infrastructure
82.34
82.35 + // Generics infrastructure
82.36 private String getGenericSignature() {return signature;}
82.37
82.38 // Accessor for factory
82.39 @@ -94,7 +91,8 @@
82.40 }
82.41
82.42 // Accessor for generic info repository
82.43 - private MethodRepository getGenericInfo() {
82.44 + @Override
82.45 + MethodRepository getGenericInfo() {
82.46 // lazily initialize repository if necessary
82.47 if (genericInfo == null) {
82.48 // create and cache generic info repository
82.49 @@ -119,8 +117,7 @@
82.50 String signature,
82.51 byte[] annotations,
82.52 byte[] parameterAnnotations,
82.53 - byte[] annotationDefault)
82.54 - {
82.55 + byte[] annotationDefault) {
82.56 this.clazz = declaringClass;
82.57 this.name = name;
82.58 this.parameterTypes = parameterTypes;
82.59 @@ -156,10 +153,20 @@
82.60 return res;
82.61 }
82.62
82.63 + @Override
82.64 + boolean hasGenericInformation() {
82.65 + return (getGenericSignature() != null);
82.66 + }
82.67 +
82.68 + @Override
82.69 + byte[] getAnnotationBytes() {
82.70 + return annotations;
82.71 + }
82.72 +
82.73 /**
82.74 - * Returns the {@code Class} object representing the class or interface
82.75 - * that declares the method represented by this {@code Method} object.
82.76 + * {@inheritDoc}
82.77 */
82.78 + @Override
82.79 public Class<?> getDeclaringClass() {
82.80 return clazz;
82.81 }
82.82 @@ -168,36 +175,25 @@
82.83 * Returns the name of the method represented by this {@code Method}
82.84 * object, as a {@code String}.
82.85 */
82.86 + @Override
82.87 public String getName() {
82.88 return name;
82.89 }
82.90
82.91 /**
82.92 - * Returns the Java language modifiers for the method represented
82.93 - * by this {@code Method} object, as an integer. The {@code Modifier} class should
82.94 - * be used to decode the modifiers.
82.95 - *
82.96 - * @see Modifier
82.97 + * {@inheritDoc}
82.98 */
82.99 + @Override
82.100 public int getModifiers() {
82.101 return modifiers;
82.102 }
82.103
82.104 /**
82.105 - * Returns an array of {@code TypeVariable} objects that represent the
82.106 - * type variables declared by the generic declaration represented by this
82.107 - * {@code GenericDeclaration} object, in declaration order. Returns an
82.108 - * array of length 0 if the underlying generic declaration declares no type
82.109 - * variables.
82.110 - *
82.111 - * @return an array of {@code TypeVariable} objects that represent
82.112 - * the type variables declared by this generic declaration
82.113 - * @throws GenericSignatureFormatError if the generic
82.114 - * signature of this generic declaration does not conform to
82.115 - * the format specified in
82.116 - * <cite>The Java™ Virtual Machine Specification</cite>
82.117 + * {@inheritDoc}
82.118 + * @throws GenericSignatureFormatError {@inheritDoc}
82.119 * @since 1.5
82.120 */
82.121 + @Override
82.122 public TypeVariable<Method>[] getTypeParameters() {
82.123 if (getGenericSignature() != null)
82.124 return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
82.125 @@ -245,99 +241,45 @@
82.126 } else { return getReturnType();}
82.127 }
82.128
82.129 -
82.130 /**
82.131 - * Returns an array of {@code Class} objects that represent the formal
82.132 - * parameter types, in declaration order, of the method
82.133 - * represented by this {@code Method} object. Returns an array of length
82.134 - * 0 if the underlying method takes no parameters.
82.135 - *
82.136 - * @return the parameter types for the method this object
82.137 - * represents
82.138 + * {@inheritDoc}
82.139 */
82.140 + @Override
82.141 public Class<?>[] getParameterTypes() {
82.142 return (Class<?>[]) parameterTypes.clone();
82.143 }
82.144
82.145 /**
82.146 - * Returns an array of {@code Type} objects that represent the formal
82.147 - * parameter types, in declaration order, of the method represented by
82.148 - * this {@code Method} object. Returns an array of length 0 if the
82.149 - * underlying method takes no parameters.
82.150 - *
82.151 - * <p>If a formal parameter type is a parameterized type,
82.152 - * the {@code Type} object returned for it must accurately reflect
82.153 - * the actual type parameters used in the source code.
82.154 - *
82.155 - * <p>If a formal parameter type is a type variable or a parameterized
82.156 - * type, it is created. Otherwise, it is resolved.
82.157 - *
82.158 - * @return an array of Types that represent the formal
82.159 - * parameter types of the underlying method, in declaration order
82.160 - * @throws GenericSignatureFormatError
82.161 - * if the generic method signature does not conform to the format
82.162 - * specified in
82.163 - * <cite>The Java™ Virtual Machine Specification</cite>
82.164 - * @throws TypeNotPresentException if any of the parameter
82.165 - * types of the underlying method refers to a non-existent type
82.166 - * declaration
82.167 - * @throws MalformedParameterizedTypeException if any of
82.168 - * the underlying method's parameter types refer to a parameterized
82.169 - * type that cannot be instantiated for any reason
82.170 + * {@inheritDoc}
82.171 + * @throws GenericSignatureFormatError {@inheritDoc}
82.172 + * @throws TypeNotPresentException {@inheritDoc}
82.173 + * @throws MalformedParameterizedTypeException {@inheritDoc}
82.174 * @since 1.5
82.175 */
82.176 + @Override
82.177 public Type[] getGenericParameterTypes() {
82.178 - if (getGenericSignature() != null)
82.179 - return getGenericInfo().getParameterTypes();
82.180 - else
82.181 - return getParameterTypes();
82.182 + return super.getGenericParameterTypes();
82.183 }
82.184
82.185 -
82.186 /**
82.187 - * Returns an array of {@code Class} objects that represent
82.188 - * the types of the exceptions declared to be thrown
82.189 - * by the underlying method
82.190 - * represented by this {@code Method} object. Returns an array of length
82.191 - * 0 if the method declares no exceptions in its {@code throws} clause.
82.192 - *
82.193 - * @return the exception types declared as being thrown by the
82.194 - * method this object represents
82.195 + * {@inheritDoc}
82.196 */
82.197 + @Override
82.198 public Class<?>[] getExceptionTypes() {
82.199 return (Class<?>[]) exceptionTypes.clone();
82.200 }
82.201
82.202 /**
82.203 - * Returns an array of {@code Type} objects that represent the
82.204 - * exceptions declared to be thrown by this {@code Method} object.
82.205 - * Returns an array of length 0 if the underlying method declares
82.206 - * no exceptions in its {@code throws} clause.
82.207 - *
82.208 - * <p>If an exception type is a type variable or a parameterized
82.209 - * type, it is created. Otherwise, it is resolved.
82.210 - *
82.211 - * @return an array of Types that represent the exception types
82.212 - * thrown by the underlying method
82.213 - * @throws GenericSignatureFormatError
82.214 - * if the generic method signature does not conform to the format
82.215 - * specified in
82.216 - * <cite>The Java™ Virtual Machine Specification</cite>
82.217 - * @throws TypeNotPresentException if the underlying method's
82.218 - * {@code throws} clause refers to a non-existent type declaration
82.219 - * @throws MalformedParameterizedTypeException if
82.220 - * the underlying method's {@code throws} clause refers to a
82.221 - * parameterized type that cannot be instantiated for any reason
82.222 + * {@inheritDoc}
82.223 + * @throws GenericSignatureFormatError {@inheritDoc}
82.224 + * @throws TypeNotPresentException {@inheritDoc}
82.225 + * @throws MalformedParameterizedTypeException {@inheritDoc}
82.226 * @since 1.5
82.227 */
82.228 - public Type[] getGenericExceptionTypes() {
82.229 - Type[] result;
82.230 - if (getGenericSignature() != null &&
82.231 - ((result = getGenericInfo().getExceptionTypes()).length > 0))
82.232 - return result;
82.233 - else
82.234 - return getExceptionTypes();
82.235 - }
82.236 + @Override
82.237 + public Type[] getGenericExceptionTypes() {
82.238 + return super.getGenericExceptionTypes();
82.239 + }
82.240
82.241 /**
82.242 * Compares this {@code Method} against the specified object. Returns
82.243 @@ -352,16 +294,7 @@
82.244 && (getName() == other.getName())) {
82.245 if (!returnType.equals(other.getReturnType()))
82.246 return false;
82.247 - /* Avoid unnecessary cloning */
82.248 - Class<?>[] params1 = parameterTypes;
82.249 - Class<?>[] params2 = other.parameterTypes;
82.250 - if (params1.length == params2.length) {
82.251 - for (int i = 0; i < params1.length; i++) {
82.252 - if (params1[i] != params2[i])
82.253 - return false;
82.254 - }
82.255 - return true;
82.256 - }
82.257 + return equalParamTypes(parameterTypes, other.parameterTypes);
82.258 }
82.259 }
82.260 return false;
82.261 @@ -399,35 +332,16 @@
82.262 * {@code synchronized}, {@code native}, {@code strictfp}.
82.263 */
82.264 public String toString() {
82.265 - try {
82.266 - StringBuilder sb = new StringBuilder();
82.267 - int mod = getModifiers() & Modifier.methodModifiers();
82.268 - if (mod != 0) {
82.269 - sb.append(Modifier.toString(mod)).append(' ');
82.270 - }
82.271 - sb.append(Field.getTypeName(getReturnType())).append(' ');
82.272 - sb.append(Field.getTypeName(getDeclaringClass())).append('.');
82.273 - sb.append(getName()).append('(');
82.274 - Class<?>[] params = parameterTypes; // avoid clone
82.275 - for (int j = 0; j < params.length; j++) {
82.276 - sb.append(Field.getTypeName(params[j]));
82.277 - if (j < (params.length - 1))
82.278 - sb.append(',');
82.279 - }
82.280 - sb.append(')');
82.281 - Class<?>[] exceptions = exceptionTypes; // avoid clone
82.282 - if (exceptions.length > 0) {
82.283 - sb.append(" throws ");
82.284 - for (int k = 0; k < exceptions.length; k++) {
82.285 - sb.append(exceptions[k].getName());
82.286 - if (k < (exceptions.length - 1))
82.287 - sb.append(',');
82.288 - }
82.289 - }
82.290 - return sb.toString();
82.291 - } catch (Exception e) {
82.292 - return "<" + e + ">";
82.293 - }
82.294 + return sharedToString(Modifier.methodModifiers(),
82.295 + parameterTypes,
82.296 + exceptionTypes);
82.297 + }
82.298 +
82.299 + @Override
82.300 + void specificToStringHeader(StringBuilder sb) {
82.301 + sb.append(Field.getTypeName(getReturnType())).append(' ');
82.302 + sb.append(Field.getTypeName(getDeclaringClass())).append('.');
82.303 + sb.append(getName());
82.304 }
82.305
82.306 /**
82.307 @@ -468,62 +382,20 @@
82.308 *
82.309 * @since 1.5
82.310 */
82.311 + @Override
82.312 public String toGenericString() {
82.313 - try {
82.314 - StringBuilder sb = new StringBuilder();
82.315 - int mod = getModifiers() & Modifier.methodModifiers();
82.316 - if (mod != 0) {
82.317 - sb.append(Modifier.toString(mod)).append(' ');
82.318 - }
82.319 - TypeVariable<?>[] typeparms = getTypeParameters();
82.320 - if (typeparms.length > 0) {
82.321 - boolean first = true;
82.322 - sb.append('<');
82.323 - for(TypeVariable<?> typeparm: typeparms) {
82.324 - if (!first)
82.325 - sb.append(',');
82.326 - // Class objects can't occur here; no need to test
82.327 - // and call Class.getName().
82.328 - sb.append(typeparm.toString());
82.329 - first = false;
82.330 - }
82.331 - sb.append("> ");
82.332 - }
82.333 + return sharedToGenericString(Modifier.methodModifiers());
82.334 + }
82.335
82.336 - Type genRetType = getGenericReturnType();
82.337 - sb.append( ((genRetType instanceof Class<?>)?
82.338 - Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
82.339 - .append(' ');
82.340 + @Override
82.341 + void specificToGenericStringHeader(StringBuilder sb) {
82.342 + Type genRetType = getGenericReturnType();
82.343 + sb.append( ((genRetType instanceof Class<?>)?
82.344 + Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
82.345 + .append(' ');
82.346
82.347 - sb.append(Field.getTypeName(getDeclaringClass())).append('.');
82.348 - sb.append(getName()).append('(');
82.349 - Type[] params = getGenericParameterTypes();
82.350 - for (int j = 0; j < params.length; j++) {
82.351 - String param = (params[j] instanceof Class)?
82.352 - Field.getTypeName((Class)params[j]):
82.353 - (params[j].toString());
82.354 - if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
82.355 - param = param.replaceFirst("\\[\\]$", "...");
82.356 - sb.append(param);
82.357 - if (j < (params.length - 1))
82.358 - sb.append(',');
82.359 - }
82.360 - sb.append(')');
82.361 - Type[] exceptions = getGenericExceptionTypes();
82.362 - if (exceptions.length > 0) {
82.363 - sb.append(" throws ");
82.364 - for (int k = 0; k < exceptions.length; k++) {
82.365 - sb.append((exceptions[k] instanceof Class)?
82.366 - ((Class)exceptions[k]).getName():
82.367 - exceptions[k].toString());
82.368 - if (k < (exceptions.length - 1))
82.369 - sb.append(',');
82.370 - }
82.371 - }
82.372 - return sb.toString();
82.373 - } catch (Exception e) {
82.374 - return "<" + e + ">";
82.375 - }
82.376 + sb.append(Field.getTypeName(getDeclaringClass())).append('.');
82.377 + sb.append(getName());
82.378 }
82.379
82.380 /**
82.381 @@ -614,28 +486,21 @@
82.382 }
82.383
82.384 /**
82.385 - * Returns {@code true} if this method was declared to take
82.386 - * a variable number of arguments; returns {@code false}
82.387 - * otherwise.
82.388 - *
82.389 - * @return {@code true} if an only if this method was declared to
82.390 - * take a variable number of arguments.
82.391 + * {@inheritDoc}
82.392 * @since 1.5
82.393 */
82.394 + @Override
82.395 public boolean isVarArgs() {
82.396 - return (getModifiers() & Modifier.VARARGS) != 0;
82.397 + return super.isVarArgs();
82.398 }
82.399
82.400 /**
82.401 - * Returns {@code true} if this method is a synthetic
82.402 - * method; returns {@code false} otherwise.
82.403 - *
82.404 - * @return true if and only if this method is a synthetic
82.405 - * method as defined by the Java Language Specification.
82.406 + * {@inheritDoc}
82.407 * @since 1.5
82.408 */
82.409 + @Override
82.410 public boolean isSynthetic() {
82.411 - return Modifier.isSynthetic(getModifiers());
82.412 + return super.isSynthetic();
82.413 }
82.414
82.415 // NOTE that there is no synchronization used here. It is correct
82.416 @@ -675,36 +540,6 @@
82.417 }
82.418
82.419 /**
82.420 - * @throws NullPointerException {@inheritDoc}
82.421 - * @since 1.5
82.422 - */
82.423 - public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
82.424 - if (annotationClass == null)
82.425 - throw new NullPointerException();
82.426 -
82.427 - return (T) declaredAnnotations().get(annotationClass);
82.428 - }
82.429 -
82.430 - /**
82.431 - * @since 1.5
82.432 - */
82.433 - public Annotation[] getDeclaredAnnotations() {
82.434 - return AnnotationParser.toArray(declaredAnnotations());
82.435 - }
82.436 -
82.437 - private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
82.438 -
82.439 - private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
82.440 - if (declaredAnnotations == null) {
82.441 - declaredAnnotations = AnnotationParser.parseAnnotations(
82.442 - annotations, sun.misc.SharedSecrets.getJavaLangAccess().
82.443 - getConstantPool(getDeclaringClass()),
82.444 - getDeclaringClass());
82.445 - }
82.446 - return declaredAnnotations;
82.447 - }
82.448 -
82.449 - /**
82.450 * Returns the default value for the annotation member represented by
82.451 * this {@code Method} instance. If the member is of a primitive type,
82.452 * an instance of the corresponding wrapper type is returned. Returns
82.453 @@ -734,34 +569,33 @@
82.454 }
82.455
82.456 /**
82.457 - * Returns an array of arrays that represent the annotations on the formal
82.458 - * parameters, in declaration order, of the method represented by
82.459 - * this {@code Method} object. (Returns an array of length zero if the
82.460 - * underlying method is parameterless. If the method has one or more
82.461 - * parameters, a nested array of length zero is returned for each parameter
82.462 - * with no annotations.) The annotation objects contained in the returned
82.463 - * arrays are serializable. The caller of this method is free to modify
82.464 - * the returned arrays; it will have no effect on the arrays returned to
82.465 - * other callers.
82.466 - *
82.467 - * @return an array of arrays that represent the annotations on the formal
82.468 - * parameters, in declaration order, of the method represented by this
82.469 - * Method object
82.470 + * {@inheritDoc}
82.471 + * @throws NullPointerException {@inheritDoc}
82.472 * @since 1.5
82.473 */
82.474 + public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
82.475 + return super.getAnnotation(annotationClass);
82.476 + }
82.477 +
82.478 + /**
82.479 + * {@inheritDoc}
82.480 + * @since 1.5
82.481 + */
82.482 + public Annotation[] getDeclaredAnnotations() {
82.483 + return super.getDeclaredAnnotations();
82.484 + }
82.485 +
82.486 + /**
82.487 + * {@inheritDoc}
82.488 + * @since 1.5
82.489 + */
82.490 + @Override
82.491 public Annotation[][] getParameterAnnotations() {
82.492 - int numParameters = parameterTypes.length;
82.493 - if (parameterAnnotations == null)
82.494 - return new Annotation[numParameters][0];
82.495 + return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
82.496 + }
82.497
82.498 - Annotation[][] result = AnnotationParser.parseParameterAnnotations(
82.499 - parameterAnnotations,
82.500 - sun.misc.SharedSecrets.getJavaLangAccess().
82.501 - getConstantPool(getDeclaringClass()),
82.502 - getDeclaringClass());
82.503 - if (result.length != numParameters)
82.504 - throw new java.lang.annotation.AnnotationFormatError(
82.505 - "Parameter annotations don't match number of parameters");
82.506 - return result;
82.507 + @Override
82.508 + void handleParameterNumberMismatch(int resultLength, int numParameters) {
82.509 + throw new AnnotationFormatError("Parameter annotations don't match number of parameters");
82.510 }
82.511 }
83.1 --- a/src/share/classes/java/net/DatagramSocket.java Fri Aug 05 15:35:04 2011 -0700
83.2 +++ b/src/share/classes/java/net/DatagramSocket.java Tue Aug 09 17:38:52 2011 -0700
83.3 @@ -176,13 +176,7 @@
83.4 public DatagramSocket() throws SocketException {
83.5 // create a datagram socket.
83.6 createImpl();
83.7 - try {
83.8 - bind(new InetSocketAddress(0));
83.9 - } catch (SocketException se) {
83.10 - throw se;
83.11 - } catch(IOException e) {
83.12 - throw new SocketException(e.getMessage());
83.13 - }
83.14 + bind(new InetSocketAddress(0));
83.15 }
83.16
83.17 /**
84.1 --- a/src/share/classes/java/net/ServerSocket.java Fri Aug 05 15:35:04 2011 -0700
84.2 +++ b/src/share/classes/java/net/ServerSocket.java Tue Aug 09 17:38:52 2011 -0700
84.3 @@ -716,7 +716,6 @@
84.4 if (!isBound())
84.5 return "ServerSocket[unbound]";
84.6 return "ServerSocket[addr=" + impl.getInetAddress() +
84.7 - ",port=" + impl.getPort() +
84.8 ",localport=" + impl.getLocalPort() + "]";
84.9 }
84.10
85.1 --- a/src/share/classes/java/net/SocketPermission.java Fri Aug 05 15:35:04 2011 -0700
85.2 +++ b/src/share/classes/java/net/SocketPermission.java Tue Aug 09 17:38:52 2011 -0700
85.3 @@ -956,10 +956,16 @@
85.4 String thisHost = hostname;
85.5 String thatHost = that.hostname;
85.6
85.7 - if (thisHost == null)
85.8 + if (thisHost == null) {
85.9 return false;
85.10 - else
85.11 + } else if (this.wildcard) {
85.12 + final int cnameLength = this.cname.length();
85.13 + return thatHost.regionMatches(true,
85.14 + (thatHost.length() - cnameLength),
85.15 + this.cname, 0, cnameLength);
85.16 + } else {
85.17 return thisHost.equalsIgnoreCase(thatHost);
85.18 + }
85.19 }
85.20
85.21 /**
86.1 --- a/src/share/classes/java/nio/X-Buffer.java.template Fri Aug 05 15:35:04 2011 -0700
86.2 +++ b/src/share/classes/java/nio/X-Buffer.java.template Tue Aug 09 17:38:52 2011 -0700
86.3 @@ -1,5 +1,5 @@
86.4 /*
86.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
86.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
86.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
86.8 *
86.9 * This code is free software; you can redistribute it and/or modify it
86.10 @@ -1080,7 +1080,11 @@
86.11 int h = 1;
86.12 int p = position();
86.13 for (int i = limit() - 1; i >= p; i--)
86.14 +#if[int]
86.15 + h = 31 * h + get(i);
86.16 +#else[int]
86.17 h = 31 * h + (int)get(i);
86.18 +#end[int]
86.19 return h;
86.20 }
86.21
87.1 --- a/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Fri Aug 05 15:35:04 2011 -0700
87.2 +++ b/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Tue Aug 09 17:38:52 2011 -0700
87.3 @@ -248,6 +248,7 @@
87.4 return provider.newAsynchronousFileChannel(file, options, executor, attrs);
87.5 }
87.6
87.7 + @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
87.8 private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
87.9
87.10 /**
88.1 --- a/src/share/classes/java/nio/channels/FileChannel.java Fri Aug 05 15:35:04 2011 -0700
88.2 +++ b/src/share/classes/java/nio/channels/FileChannel.java Tue Aug 09 17:38:52 2011 -0700
88.3 @@ -287,6 +287,7 @@
88.4 return provider.newFileChannel(path, options, attrs);
88.5 }
88.6
88.7 + @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
88.8 private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
88.9
88.10 /**
89.1 --- a/src/share/classes/java/nio/charset/Charset.java Fri Aug 05 15:35:04 2011 -0700
89.2 +++ b/src/share/classes/java/nio/charset/Charset.java Tue Aug 09 17:38:52 2011 -0700
89.3 @@ -1,5 +1,5 @@
89.4 /*
89.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
89.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
89.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
89.8 *
89.9 * This code is free software; you can redistribute it and/or modify it
89.10 @@ -29,7 +29,6 @@
89.11 import java.nio.CharBuffer;
89.12 import java.nio.charset.spi.CharsetProvider;
89.13 import java.security.AccessController;
89.14 -import java.security.AccessControlException;
89.15 import java.security.PrivilegedAction;
89.16 import java.util.Collections;
89.17 import java.util.HashSet;
89.18 @@ -339,15 +338,15 @@
89.19 // those whose lookup or instantiation causes a security exception to be
89.20 // thrown. Should be invoked with full privileges.
89.21 //
89.22 - private static Iterator providers() {
89.23 - return new Iterator() {
89.24 + private static Iterator<CharsetProvider> providers() {
89.25 + return new Iterator<CharsetProvider>() {
89.26
89.27 ClassLoader cl = ClassLoader.getSystemClassLoader();
89.28 ServiceLoader<CharsetProvider> sl =
89.29 ServiceLoader.load(CharsetProvider.class, cl);
89.30 Iterator<CharsetProvider> i = sl.iterator();
89.31
89.32 - Object next = null;
89.33 + CharsetProvider next = null;
89.34
89.35 private boolean getNext() {
89.36 while (next == null) {
89.37 @@ -370,10 +369,10 @@
89.38 return getNext();
89.39 }
89.40
89.41 - public Object next() {
89.42 + public CharsetProvider next() {
89.43 if (!getNext())
89.44 throw new NoSuchElementException();
89.45 - Object n = next;
89.46 + CharsetProvider n = next;
89.47 next = null;
89.48 return n;
89.49 }
89.50 @@ -386,7 +385,8 @@
89.51 }
89.52
89.53 // Thread-local gate to prevent recursive provider lookups
89.54 - private static ThreadLocal<ThreadLocal> gate = new ThreadLocal<ThreadLocal>();
89.55 + private static ThreadLocal<ThreadLocal<?>> gate =
89.56 + new ThreadLocal<ThreadLocal<?>>();
89.57
89.58 private static Charset lookupViaProviders(final String charsetName) {
89.59
89.60 @@ -410,8 +410,9 @@
89.61 return AccessController.doPrivileged(
89.62 new PrivilegedAction<Charset>() {
89.63 public Charset run() {
89.64 - for (Iterator i = providers(); i.hasNext();) {
89.65 - CharsetProvider cp = (CharsetProvider)i.next();
89.66 + for (Iterator<CharsetProvider> i = providers();
89.67 + i.hasNext();) {
89.68 + CharsetProvider cp = i.next();
89.69 Charset cs = cp.charsetForName(charsetName);
89.70 if (cs != null)
89.71 return cs;
89.72 @@ -588,8 +589,8 @@
89.73 new TreeMap<String,Charset>(
89.74 ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
89.75 put(standardProvider.charsets(), m);
89.76 - for (Iterator i = providers(); i.hasNext();) {
89.77 - CharsetProvider cp = (CharsetProvider)i.next();
89.78 + for (Iterator<CharsetProvider> i = providers(); i.hasNext();) {
89.79 + CharsetProvider cp = i.next();
89.80 put(cp.charsets(), m);
89.81 }
89.82 return Collections.unmodifiableSortedMap(m);
90.1 --- a/src/share/classes/java/security/KeyStore.java Fri Aug 05 15:35:04 2011 -0700
90.2 +++ b/src/share/classes/java/security/KeyStore.java Tue Aug 09 17:38:52 2011 -0700
90.3 @@ -113,14 +113,8 @@
90.4 * // get user password and file input stream
90.5 * char[] password = getPassword();
90.6 *
90.7 - * java.io.FileInputStream fis = null;
90.8 - * try {
90.9 - * fis = new java.io.FileInputStream("keyStoreName");
90.10 + * try (FileInputStream fis = new FileInputStream("keyStoreName")) {
90.11 * ks.load(fis, password);
90.12 - * } finally {
90.13 - * if (fis != null) {
90.14 - * fis.close();
90.15 - * }
90.16 * }
90.17 * </pre>
90.18 *
90.19 @@ -146,14 +140,8 @@
90.20 * ks.setEntry("secretKeyAlias", skEntry, protParam);
90.21 *
90.22 * // store away the keystore
90.23 - * java.io.FileOutputStream fos = null;
90.24 - * try {
90.25 - * fos = new java.io.FileOutputStream("newKeyStoreName");
90.26 + * try (FileOutputStream fos = new FileOutputStream("newKeyStoreName")) {
90.27 * ks.store(fos, password);
90.28 - * } finally {
90.29 - * if (fos != null) {
90.30 - * fos.close();
90.31 - * }
90.32 * }
90.33 * </pre>
90.34 *
91.1 --- a/src/share/classes/java/security/cert/X509CRL.java Fri Aug 05 15:35:04 2011 -0700
91.2 +++ b/src/share/classes/java/security/cert/X509CRL.java Tue Aug 09 17:38:52 2011 -0700
91.3 @@ -1,5 +1,5 @@
91.4 /*
91.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
91.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
91.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
91.8 *
91.9 * This code is free software; you can redistribute it and/or modify it
91.10 @@ -94,15 +94,9 @@
91.11 * CRLs are instantiated using a certificate factory. The following is an
91.12 * example of how to instantiate an X.509 CRL:
91.13 * <pre><code>
91.14 - * InputStream inStream = null;
91.15 - * try {
91.16 - * inStream = new FileInputStream("fileName-of-crl");
91.17 + * try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
91.18 * CertificateFactory cf = CertificateFactory.getInstance("X.509");
91.19 * X509CRL crl = (X509CRL)cf.generateCRL(inStream);
91.20 - * } finally {
91.21 - * if (inStream != null) {
91.22 - * inStream.close();
91.23 - * }
91.24 * }
91.25 * </code></pre>
91.26 *
92.1 --- a/src/share/classes/java/security/cert/X509Certificate.java Fri Aug 05 15:35:04 2011 -0700
92.2 +++ b/src/share/classes/java/security/cert/X509Certificate.java Tue Aug 09 17:38:52 2011 -0700
92.3 @@ -1,5 +1,5 @@
92.4 /*
92.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
92.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
92.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
92.8 *
92.9 * This code is free software; you can redistribute it and/or modify it
92.10 @@ -89,15 +89,9 @@
92.11 * Certificates are instantiated using a certificate factory. The following is
92.12 * an example of how to instantiate an X.509 certificate:
92.13 * <pre>
92.14 - * InputStream inStream = null;
92.15 - * try {
92.16 - * inStream = new FileInputStream("fileName-of-cert");
92.17 + * try (InputStream inStream = new FileInputStream("fileName-of-cert")) {
92.18 * CertificateFactory cf = CertificateFactory.getInstance("X.509");
92.19 * X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
92.20 - * } finally {
92.21 - * if (inStream != null) {
92.22 - * inStream.close();
92.23 - * }
92.24 * }
92.25 * </pre>
92.26 *
93.1 --- a/src/share/classes/java/security/cert/X509Extension.java Fri Aug 05 15:35:04 2011 -0700
93.2 +++ b/src/share/classes/java/security/cert/X509Extension.java Tue Aug 09 17:38:52 2011 -0700
93.3 @@ -1,5 +1,5 @@
93.4 /*
93.5 - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
93.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
93.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
93.8 *
93.9 * This code is free software; you can redistribute it and/or modify it
93.10 @@ -85,16 +85,10 @@
93.11 * Here is sample code to get a Set of critical extensions from an
93.12 * X509Certificate and print the OIDs:
93.13 * <pre><code>
93.14 - * InputStream inStrm = null;
93.15 * X509Certificate cert = null;
93.16 - * try {
93.17 - * inStrm = new FileInputStream("DER-encoded-Cert");
93.18 + * try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
93.19 * CertificateFactory cf = CertificateFactory.getInstance("X.509");
93.20 * cert = (X509Certificate)cf.generateCertificate(inStrm);
93.21 - * } finally {
93.22 - * if (inStrm != null) {
93.23 - * inStrm.close();
93.24 - * }
93.25 * }<p>
93.26 *
93.27 * Set<String> critSet = cert.getCriticalExtensionOIDs();
93.28 @@ -120,23 +114,16 @@
93.29 * Here is sample code to get a Set of non-critical extensions from an
93.30 * X509CRL revoked certificate entry and print the OIDs:
93.31 * <pre><code>
93.32 - * InputStream inStrm = null;
93.33 * CertificateFactory cf = null;
93.34 * X509CRL crl = null;
93.35 - * try {
93.36 - * inStrm = new FileInputStream("DER-encoded-CRL");
93.37 + * try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
93.38 * cf = CertificateFactory.getInstance("X.509");
93.39 * crl = (X509CRL)cf.generateCRL(inStrm);
93.40 - * } finally {
93.41 - * if (inStrm != null) {
93.42 - * inStrm.close();
93.43 - * }
93.44 * }<p>
93.45 *
93.46 * byte[] certData = <DER-encoded certificate data>
93.47 * ByteArrayInputStream bais = new ByteArrayInputStream(certData);
93.48 * X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
93.49 - * bais.close();
93.50 * X509CRLEntry badCert =
93.51 * crl.getRevokedCertificate(cert.getSerialNumber());<p>
93.52 *
94.1 --- a/src/share/classes/sun/launcher/LauncherHelper.java Fri Aug 05 15:35:04 2011 -0700
94.2 +++ b/src/share/classes/sun/launcher/LauncherHelper.java Tue Aug 09 17:38:52 2011 -0700
94.3 @@ -396,7 +396,11 @@
94.4 if (mainAttrs == null) {
94.5 abort(ostream, null, "java.launcher.jar.error3", jarname);
94.6 }
94.7 - return mainAttrs.getValue(MAIN_CLASS).trim();
94.8 + String mainValue = mainAttrs.getValue(MAIN_CLASS);
94.9 + if (mainValue == null) {
94.10 + abort(ostream, null, "java.launcher.jar.error3", jarname);
94.11 + }
94.12 + return mainValue.trim();
94.13 } finally {
94.14 if (jarFile != null) {
94.15 jarFile.close();
95.1 --- a/src/share/classes/sun/launcher/resources/launcher.properties Fri Aug 05 15:35:04 2011 -0700
95.2 +++ b/src/share/classes/sun/launcher/resources/launcher.properties Tue Aug 09 17:38:52 2011 -0700
95.3 @@ -72,7 +72,7 @@
95.4 \ load Java programming language agent, see java.lang.instrument\n\
95.5 \ -splash:<imagepath>\n\
95.6 \ show splash screen with specified image\n\
95.7 -See http://java.sun.com/javase/reference for more details.
95.8 +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
95.9
95.10 # Translators please note do not translate the options themselves
95.11 java.launcher.X.usage=\
96.1 --- a/src/share/classes/sun/net/httpserver/ServerConfig.java Fri Aug 05 15:35:04 2011 -0700
96.2 +++ b/src/share/classes/sun/net/httpserver/ServerConfig.java Tue Aug 09 17:38:52 2011 -0700
96.3 @@ -1,5 +1,5 @@
96.4 /*
96.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
96.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
96.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
96.8 *
96.9 * This code is free software; you can redistribute it and/or modify it
96.10 @@ -25,8 +25,6 @@
96.11
96.12 package sun.net.httpserver;
96.13
96.14 -import com.sun.net.httpserver.*;
96.15 -import com.sun.net.httpserver.spi.*;
96.16 import java.util.logging.Logger;
96.17 import java.security.PrivilegedAction;
96.18
96.19 @@ -59,48 +57,46 @@
96.20 static long maxReqTime;
96.21 static long maxRspTime;
96.22 static long timerMillis;
96.23 - static boolean debug = false;
96.24 + static boolean debug;
96.25 +
96.26 + // the value of the TCP_NODELAY socket-level option
96.27 + static boolean noDelay;
96.28
96.29 static {
96.30 + java.security.AccessController.doPrivileged(
96.31 + new PrivilegedAction<Void>() {
96.32 + @Override
96.33 + public Void run () {
96.34 + idleInterval = Long.getLong("sun.net.httpserver.idleInterval",
96.35 + DEFAULT_IDLE_INTERVAL) * 1000;
96.36
96.37 - idleInterval = ((Long)java.security.AccessController.doPrivileged(
96.38 - new sun.security.action.GetLongAction(
96.39 - "sun.net.httpserver.idleInterval",
96.40 - DEFAULT_IDLE_INTERVAL))).longValue() * 1000;
96.41 + clockTick = Integer.getInteger("sun.net.httpserver.clockTick",
96.42 + DEFAULT_CLOCK_TICK);
96.43
96.44 - clockTick = ((Integer)java.security.AccessController.doPrivileged(
96.45 - new sun.security.action.GetIntegerAction(
96.46 - "sun.net.httpserver.clockTick",
96.47 - DEFAULT_CLOCK_TICK))).intValue();
96.48 + maxIdleConnections = Integer.getInteger(
96.49 + "sun.net.httpserver.maxIdleConnections",
96.50 + DEFAULT_MAX_IDLE_CONNECTIONS);
96.51
96.52 - maxIdleConnections = ((Integer)java.security.AccessController.doPrivileged(
96.53 - new sun.security.action.GetIntegerAction(
96.54 - "sun.net.httpserver.maxIdleConnections",
96.55 - DEFAULT_MAX_IDLE_CONNECTIONS))).intValue();
96.56 + drainAmount = Long.getLong("sun.net.httpserver.drainAmount",
96.57 + DEFAULT_DRAIN_AMOUNT);
96.58
96.59 - drainAmount = ((Long)java.security.AccessController.doPrivileged(
96.60 - new sun.security.action.GetLongAction(
96.61 - "sun.net.httpserver.drainAmount",
96.62 - DEFAULT_DRAIN_AMOUNT))).longValue();
96.63 + maxReqTime = Long.getLong("sun.net.httpserver.maxReqTime",
96.64 + DEFAULT_MAX_REQ_TIME);
96.65
96.66 - maxReqTime = ((Long)java.security.AccessController.doPrivileged(
96.67 - new sun.security.action.GetLongAction(
96.68 - "sun.net.httpserver.maxReqTime",
96.69 - DEFAULT_MAX_REQ_TIME))).longValue();
96.70 + maxRspTime = Long.getLong("sun.net.httpserver.maxRspTime",
96.71 + DEFAULT_MAX_RSP_TIME);
96.72
96.73 - maxRspTime = ((Long)java.security.AccessController.doPrivileged(
96.74 - new sun.security.action.GetLongAction(
96.75 - "sun.net.httpserver.maxRspTime",
96.76 - DEFAULT_MAX_RSP_TIME))).longValue();
96.77 + timerMillis = Long.getLong("sun.net.httpserver.timerMillis",
96.78 + DEFAULT_TIMER_MILLIS);
96.79
96.80 - timerMillis = ((Long)java.security.AccessController.doPrivileged(
96.81 - new sun.security.action.GetLongAction(
96.82 - "sun.net.httpserver.timerMillis",
96.83 - DEFAULT_TIMER_MILLIS))).longValue();
96.84 + debug = Boolean.getBoolean("sun.net.httpserver.debug");
96.85
96.86 - debug = ((Boolean)java.security.AccessController.doPrivileged(
96.87 - new sun.security.action.GetBooleanAction(
96.88 - "sun.net.httpserver.debug"))).booleanValue();
96.89 + noDelay = Boolean.getBoolean("sun.net.httpserver.nodelay");
96.90 +
96.91 + return null;
96.92 + }
96.93 + });
96.94 +
96.95 }
96.96
96.97
96.98 @@ -172,4 +168,8 @@
96.99 static long getTimerMillis () {
96.100 return timerMillis;
96.101 }
96.102 +
96.103 + static boolean noDelay() {
96.104 + return noDelay;
96.105 + }
96.106 }
97.1 --- a/src/share/classes/sun/net/httpserver/ServerImpl.java Fri Aug 05 15:35:04 2011 -0700
97.2 +++ b/src/share/classes/sun/net/httpserver/ServerImpl.java Tue Aug 09 17:38:52 2011 -0700
97.3 @@ -27,8 +27,6 @@
97.4
97.5 import java.net.*;
97.6 import java.io.*;
97.7 -import java.nio.*;
97.8 -import java.security.*;
97.9 import java.nio.channels.*;
97.10 import java.util.*;
97.11 import java.util.concurrent.*;
97.12 @@ -36,7 +34,6 @@
97.13 import java.util.logging.Level;
97.14 import javax.net.ssl.*;
97.15 import com.sun.net.httpserver.*;
97.16 -import com.sun.net.httpserver.spi.*;
97.17 import sun.net.httpserver.HttpConnection.State;
97.18
97.19 /**
97.20 @@ -358,6 +355,12 @@
97.21 continue;
97.22 }
97.23 SocketChannel chan = schan.accept();
97.24 +
97.25 + // Set TCP_NODELAY, if appropriate
97.26 + if (ServerConfig.noDelay()) {
97.27 + chan.socket().setTcpNoDelay(true);
97.28 + }
97.29 +
97.30 if (chan == null) {
97.31 continue; /* cancel something ? */
97.32 }
98.1 --- a/src/share/classes/sun/net/www/http/HttpClient.java Fri Aug 05 15:35:04 2011 -0700
98.2 +++ b/src/share/classes/sun/net/www/http/HttpClient.java Tue Aug 09 17:38:52 2011 -0700
98.3 @@ -599,7 +599,9 @@
98.4 cachedHttpClient = false;
98.5 if (!failedOnce && requests != null) {
98.6 failedOnce = true;
98.7 - if (httpuc.getRequestMethod().equals("POST") && (!retryPostProp || streaming)) {
98.8 + if (getRequestMethod().equals("CONNECT") ||
98.9 + (httpuc.getRequestMethod().equals("POST") &&
98.10 + (!retryPostProp || streaming))) {
98.11 // do not retry the request
98.12 } else {
98.13 // try once more
98.14 @@ -706,7 +708,9 @@
98.15 } else if (nread != 8) {
98.16 if (!failedOnce && requests != null) {
98.17 failedOnce = true;
98.18 - if (httpuc.getRequestMethod().equals("POST") && (!retryPostProp || streaming)) {
98.19 + if (getRequestMethod().equals("CONNECT") ||
98.20 + (httpuc.getRequestMethod().equals("POST") &&
98.21 + (!retryPostProp || streaming))) {
98.22 // do not retry the request
98.23 } else {
98.24 closeServer();
98.25 @@ -891,6 +895,16 @@
98.26 return cacheRequest;
98.27 }
98.28
98.29 + String getRequestMethod() {
98.30 + if (requests != null) {
98.31 + String requestLine = requests.getKey(0);
98.32 + if (requestLine != null) {
98.33 + return requestLine.split("\\s+")[0];
98.34 + }
98.35 + }
98.36 + return "";
98.37 + }
98.38 +
98.39 @Override
98.40 protected void finalize() throws Throwable {
98.41 // This should do nothing. The stream finalizer will
99.1 --- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Aug 05 15:35:04 2011 -0700
99.2 +++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue Aug 09 17:38:52 2011 -0700
99.3 @@ -1880,14 +1880,7 @@
99.4 private void sendCONNECTRequest() throws IOException {
99.5 int port = url.getPort();
99.6
99.7 - // setRequests == true indicates the std. request headers
99.8 - // have been set in (previous) requests.
99.9 - // so the first one must be the http method (GET, etc.).
99.10 - // we need to set it to CONNECT soon, remove this one first.
99.11 - // otherwise, there may have 2 http methods in headers
99.12 - if (setRequests) requests.set(0, null, null);
99.13 -
99.14 - requests.prepend(HTTP_CONNECT + " " + connectRequestURI(url)
99.15 + requests.set(0, HTTP_CONNECT + " " + connectRequestURI(url)
99.16 + " " + httpVersion, null);
99.17 requests.setIfNotSet("User-Agent", userAgent);
99.18
99.19 @@ -1912,8 +1905,6 @@
99.20 }
99.21
99.22 http.writeRequests(requests, null);
99.23 - // remove CONNECT header
99.24 - requests.set(0, null, null);
99.25 }
99.26
99.27 /**
100.1 --- a/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java Fri Aug 05 15:35:04 2011 -0700
100.2 +++ b/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java Tue Aug 09 17:38:52 2011 -0700
100.3 @@ -1,5 +1,5 @@
100.4 /*
100.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
100.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
100.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
100.8 *
100.9 * This code is free software; you can redistribute it and/or modify it
100.10 @@ -390,8 +390,10 @@
100.11
100.12 protected void receive(DatagramPacket p) throws IOException {}
100.13
100.14 + @Deprecated
100.15 protected void setTTL(byte ttl) throws IOException {}
100.16
100.17 + @Deprecated
100.18 protected byte getTTL() throws IOException { return 0; }
100.19
100.20 protected void setTimeToLive(int ttl) throws IOException {}
101.1 --- a/src/share/classes/sun/nio/ch/Reflect.java Fri Aug 05 15:35:04 2011 -0700
101.2 +++ b/src/share/classes/sun/nio/ch/Reflect.java Tue Aug 09 17:38:52 2011 -0700
101.3 @@ -1,5 +1,5 @@
101.4 /*
101.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
101.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
101.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
101.8 *
101.9 * This code is free software; you can redistribute it and/or modify it
101.10 @@ -50,29 +50,25 @@
101.11 }});
101.12 }
101.13
101.14 - static Constructor lookupConstructor(String className,
101.15 - Class[] paramTypes)
101.16 + static Constructor<?> lookupConstructor(String className,
101.17 + Class<?>[] paramTypes)
101.18 {
101.19 try {
101.20 Class<?> cl = Class.forName(className);
101.21 Constructor<?> c = cl.getDeclaredConstructor(paramTypes);
101.22 setAccessible(c);
101.23 return c;
101.24 - } catch (ClassNotFoundException x) {
101.25 - throw new ReflectionError(x);
101.26 - } catch (NoSuchMethodException x) {
101.27 + } catch (ClassNotFoundException | NoSuchMethodException x) {
101.28 throw new ReflectionError(x);
101.29 }
101.30 }
101.31
101.32 - static Object invoke(Constructor c, Object[] args) {
101.33 + static Object invoke(Constructor<?> c, Object[] args) {
101.34 try {
101.35 return c.newInstance(args);
101.36 - } catch (InstantiationException x) {
101.37 - throw new ReflectionError(x);
101.38 - } catch (IllegalAccessException x) {
101.39 - throw new ReflectionError(x);
101.40 - } catch (InvocationTargetException x) {
101.41 + } catch (InstantiationException |
101.42 + IllegalAccessException |
101.43 + InvocationTargetException x) {
101.44 throw new ReflectionError(x);
101.45 }
101.46 }
101.47 @@ -86,9 +82,7 @@
101.48 Method m = cl.getDeclaredMethod(methodName, paramTypes);
101.49 setAccessible(m);
101.50 return m;
101.51 - } catch (ClassNotFoundException x) {
101.52 - throw new ReflectionError(x);
101.53 - } catch (NoSuchMethodException x) {
101.54 + } catch (ClassNotFoundException | NoSuchMethodException x) {
101.55 throw new ReflectionError(x);
101.56 }
101.57 }
101.58 @@ -96,9 +90,7 @@
101.59 static Object invoke(Method m, Object ob, Object[] args) {
101.60 try {
101.61 return m.invoke(ob, args);
101.62 - } catch (IllegalAccessException x) {
101.63 - throw new ReflectionError(x);
101.64 - } catch (InvocationTargetException x) {
101.65 + } catch (IllegalAccessException | InvocationTargetException x) {
101.66 throw new ReflectionError(x);
101.67 }
101.68 }
101.69 @@ -119,13 +111,11 @@
101.70
101.71 static Field lookupField(String className, String fieldName) {
101.72 try {
101.73 - Class cl = Class.forName(className);
101.74 + Class<?> cl = Class.forName(className);
101.75 Field f = cl.getDeclaredField(fieldName);
101.76 setAccessible(f);
101.77 return f;
101.78 - } catch (ClassNotFoundException x) {
101.79 - throw new ReflectionError(x);
101.80 - } catch (NoSuchFieldException x) {
101.81 + } catch (ClassNotFoundException | NoSuchFieldException x) {
101.82 throw new ReflectionError(x);
101.83 }
101.84 }
102.1 --- a/src/share/classes/sun/nio/ch/SelectorImpl.java Fri Aug 05 15:35:04 2011 -0700
102.2 +++ b/src/share/classes/sun/nio/ch/SelectorImpl.java Tue Aug 09 17:38:52 2011 -0700
102.3 @@ -1,5 +1,5 @@
102.4 /*
102.5 - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
102.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
102.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
102.8 *
102.9 * This code is free software; you can redistribute it and/or modify it
102.10 @@ -30,7 +30,6 @@
102.11 import java.nio.channels.spi.*;
102.12 import java.net.SocketException;
102.13 import java.util.*;
102.14 -import sun.misc.*;
102.15
102.16
102.17 /**
102.18 @@ -140,19 +139,16 @@
102.19
102.20 void processDeregisterQueue() throws IOException {
102.21 // Precondition: Synchronized on this, keys, and selectedKeys
102.22 - Set cks = cancelledKeys();
102.23 + Set<SelectionKey> cks = cancelledKeys();
102.24 synchronized (cks) {
102.25 if (!cks.isEmpty()) {
102.26 - Iterator i = cks.iterator();
102.27 + Iterator<SelectionKey> i = cks.iterator();
102.28 while (i.hasNext()) {
102.29 SelectionKeyImpl ski = (SelectionKeyImpl)i.next();
102.30 try {
102.31 implDereg(ski);
102.32 } catch (SocketException se) {
102.33 - IOException ioe = new IOException(
102.34 - "Error deregistering key");
102.35 - ioe.initCause(se);
102.36 - throw ioe;
102.37 + throw new IOException("Error deregistering key", se);
102.38 } finally {
102.39 i.remove();
102.40 }
103.1 --- a/src/share/classes/sun/nio/ch/Util.java Fri Aug 05 15:35:04 2011 -0700
103.2 +++ b/src/share/classes/sun/nio/ch/Util.java Tue Aug 09 17:38:52 2011 -0700
103.3 @@ -1,5 +1,5 @@
103.4 /*
103.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
103.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
103.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
103.8 *
103.9 * This code is free software; you can redistribute it and/or modify it
103.10 @@ -355,27 +355,24 @@
103.11 return pageSize;
103.12 }
103.13
103.14 - private static volatile Constructor directByteBufferConstructor = null;
103.15 + private static volatile Constructor<?> directByteBufferConstructor = null;
103.16
103.17 private static void initDBBConstructor() {
103.18 AccessController.doPrivileged(new PrivilegedAction<Void>() {
103.19 public Void run() {
103.20 try {
103.21 Class<?> cl = Class.forName("java.nio.DirectByteBuffer");
103.22 - Constructor ctor = cl.getDeclaredConstructor(
103.23 + Constructor<?> ctor = cl.getDeclaredConstructor(
103.24 new Class[] { int.class,
103.25 long.class,
103.26 FileDescriptor.class,
103.27 Runnable.class });
103.28 ctor.setAccessible(true);
103.29 directByteBufferConstructor = ctor;
103.30 - } catch (ClassNotFoundException x) {
103.31 - throw new InternalError();
103.32 - } catch (NoSuchMethodException x) {
103.33 - throw new InternalError();
103.34 - } catch (IllegalArgumentException x) {
103.35 - throw new InternalError();
103.36 - } catch (ClassCastException x) {
103.37 + } catch (ClassNotFoundException |
103.38 + NoSuchMethodException |
103.39 + IllegalArgumentException |
103.40 + ClassCastException x) {
103.41 throw new InternalError();
103.42 }
103.43 return null;
103.44 @@ -395,37 +392,32 @@
103.45 new Long(addr),
103.46 fd,
103.47 unmapper });
103.48 - } catch (InstantiationException e) {
103.49 - throw new InternalError();
103.50 - } catch (IllegalAccessException e) {
103.51 - throw new InternalError();
103.52 - } catch (InvocationTargetException e) {
103.53 + } catch (InstantiationException |
103.54 + IllegalAccessException |
103.55 + InvocationTargetException e) {
103.56 throw new InternalError();
103.57 }
103.58 return dbb;
103.59 }
103.60
103.61 - private static volatile Constructor directByteBufferRConstructor = null;
103.62 + private static volatile Constructor<?> directByteBufferRConstructor = null;
103.63
103.64 private static void initDBBRConstructor() {
103.65 AccessController.doPrivileged(new PrivilegedAction<Void>() {
103.66 public Void run() {
103.67 try {
103.68 Class<?> cl = Class.forName("java.nio.DirectByteBufferR");
103.69 - Constructor ctor = cl.getDeclaredConstructor(
103.70 + Constructor<?> ctor = cl.getDeclaredConstructor(
103.71 new Class[] { int.class,
103.72 long.class,
103.73 FileDescriptor.class,
103.74 Runnable.class });
103.75 ctor.setAccessible(true);
103.76 directByteBufferRConstructor = ctor;
103.77 - } catch (ClassNotFoundException x) {
103.78 - throw new InternalError();
103.79 - } catch (NoSuchMethodException x) {
103.80 - throw new InternalError();
103.81 - } catch (IllegalArgumentException x) {
103.82 - throw new InternalError();
103.83 - } catch (ClassCastException x) {
103.84 + } catch (ClassNotFoundException |
103.85 + NoSuchMethodException |
103.86 + IllegalArgumentException |
103.87 + ClassCastException x) {
103.88 throw new InternalError();
103.89 }
103.90 return null;
103.91 @@ -445,11 +437,9 @@
103.92 new Long(addr),
103.93 fd,
103.94 unmapper });
103.95 - } catch (InstantiationException e) {
103.96 - throw new InternalError();
103.97 - } catch (IllegalAccessException e) {
103.98 - throw new InternalError();
103.99 - } catch (InvocationTargetException e) {
103.100 + } catch (InstantiationException |
103.101 + IllegalAccessException |
103.102 + InvocationTargetException e) {
103.103 throw new InternalError();
103.104 }
103.105 return dbb;
104.1 --- a/src/share/classes/sun/nio/cs/FastCharsetProvider.java Fri Aug 05 15:35:04 2011 -0700
104.2 +++ b/src/share/classes/sun/nio/cs/FastCharsetProvider.java Tue Aug 09 17:38:52 2011 -0700
104.3 @@ -1,5 +1,5 @@
104.4 /*
104.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
104.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
104.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
104.8 *
104.9 * This code is free software; you can redistribute it and/or modify it
104.10 @@ -25,7 +25,6 @@
104.11
104.12 package sun.nio.cs;
104.13
104.14 -import java.lang.ref.SoftReference;
104.15 import java.nio.charset.Charset;
104.16 import java.nio.charset.spi.CharsetProvider;
104.17 import java.util.Iterator;
104.18 @@ -116,17 +115,15 @@
104.19
104.20 // Instantiate the charset and cache it
104.21 try {
104.22 - Class c = Class.forName(packagePrefix + "." + cln,
104.23 + Class<?> c = Class.forName(packagePrefix + "." + cln,
104.24 true,
104.25 this.getClass().getClassLoader());
104.26 cs = (Charset)c.newInstance();
104.27 cache.put(csn, cs);
104.28 return cs;
104.29 - } catch (ClassNotFoundException x) {
104.30 - return null;
104.31 - } catch (IllegalAccessException x) {
104.32 - return null;
104.33 - } catch (InstantiationException x) {
104.34 + } catch (ClassNotFoundException |
104.35 + IllegalAccessException |
104.36 + InstantiationException x) {
104.37 return null;
104.38 }
104.39 }
105.1 --- a/src/share/classes/sun/nio/cs/StreamDecoder.java Fri Aug 05 15:35:04 2011 -0700
105.2 +++ b/src/share/classes/sun/nio/cs/StreamDecoder.java Tue Aug 09 17:38:52 2011 -0700
105.3 @@ -1,5 +1,5 @@
105.4 /*
105.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
105.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
105.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
105.8 *
105.9 * This code is free software; you can redistribute it and/or modify it
105.10 @@ -112,6 +112,7 @@
105.11 return read0();
105.12 }
105.13
105.14 + @SuppressWarnings("fallthrough")
105.15 private int read0() throws IOException {
105.16 synchronized (lock) {
105.17
106.1 --- a/src/share/classes/sun/nio/cs/ThreadLocalCoders.java Fri Aug 05 15:35:04 2011 -0700
106.2 +++ b/src/share/classes/sun/nio/cs/ThreadLocalCoders.java Tue Aug 09 17:38:52 2011 -0700
106.3 @@ -1,5 +1,5 @@
106.4 /*
106.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
106.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
106.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
106.8 *
106.9 * This code is free software; you can redistribute it and/or modify it
106.10 @@ -26,7 +26,6 @@
106.11
106.12 package sun.nio.cs;
106.13
106.14 -import java.nio.*;
106.15 import java.nio.charset.*;
106.16
106.17
106.18 @@ -41,7 +40,7 @@
106.19 private static abstract class Cache {
106.20
106.21 // Thread-local reference to array of cached objects, in LRU order
106.22 - private ThreadLocal cache = new ThreadLocal();
106.23 + private ThreadLocal<Object[]> cache = new ThreadLocal<>();
106.24 private final int size;
106.25
106.26 Cache(int size) {
106.27 @@ -60,7 +59,7 @@
106.28 abstract boolean hasName(Object ob, Object name);
106.29
106.30 Object forName(Object name) {
106.31 - Object[] oa = (Object[])cache.get();
106.32 + Object[] oa = cache.get();
106.33 if (oa == null) {
106.34 oa = new Object[size];
106.35 cache.set(oa);
107.1 --- a/src/share/classes/sun/nio/fs/Util.java Fri Aug 05 15:35:04 2011 -0700
107.2 +++ b/src/share/classes/sun/nio/fs/Util.java Tue Aug 09 17:38:52 2011 -0700
107.3 @@ -62,6 +62,7 @@
107.4 /**
107.5 * Returns a Set containing the given elements.
107.6 */
107.7 + @SafeVarargs
107.8 static <E> Set<E> newSet(E... elements) {
107.9 HashSet<E> set = new HashSet<>();
107.10 for (E e: elements) {
107.11 @@ -74,6 +75,7 @@
107.12 * Returns a Set containing all the elements of the given Set plus
107.13 * the given elements.
107.14 */
107.15 + @SafeVarargs
107.16 static <E> Set<E> newSet(Set<E> other, E... elements) {
107.17 HashSet<E> set = new HashSet<>(other);
107.18 for (E e: elements) {
108.1 --- a/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java Fri Aug 05 15:35:04 2011 -0700
108.2 +++ b/src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java Tue Aug 09 17:38:52 2011 -0700
108.3 @@ -1,5 +1,5 @@
108.4 /*
108.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
108.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
108.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
108.8 *
108.9 * This code is free software; you can redistribute it and/or modify it
108.10 @@ -26,4 +26,6 @@
108.11 package sun.reflect.generics.reflectiveObjects;
108.12
108.13 /** Temporary class used to indicate missing functionality */
108.14 -public class NotImplementedException extends RuntimeException {}
108.15 +public class NotImplementedException extends RuntimeException {
108.16 + private static final long serialVersionUID = -9177857708926624790L;
108.17 +}
109.1 --- a/src/share/classes/sun/reflect/misc/ConstructorUtil.java Fri Aug 05 15:35:04 2011 -0700
109.2 +++ b/src/share/classes/sun/reflect/misc/ConstructorUtil.java Tue Aug 09 17:38:52 2011 -0700
109.3 @@ -1,5 +1,5 @@
109.4 /*
109.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
109.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
109.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
109.8 *
109.9 * This code is free software; you can redistribute it and/or modify it
109.10 @@ -32,13 +32,13 @@
109.11 private ConstructorUtil() {
109.12 }
109.13
109.14 - public static Constructor getConstructor(Class cls, Class[] params)
109.15 + public static Constructor<?> getConstructor(Class<?> cls, Class<?>[] params)
109.16 throws NoSuchMethodException {
109.17 ReflectUtil.checkPackageAccess(cls);
109.18 return cls.getConstructor(params);
109.19 }
109.20
109.21 - public static Constructor[] getConstructors(Class cls) {
109.22 + public static Constructor<?>[] getConstructors(Class<?> cls) {
109.23 ReflectUtil.checkPackageAccess(cls);
109.24 return cls.getConstructors();
109.25 }
110.1 --- a/src/share/classes/sun/reflect/misc/FieldUtil.java Fri Aug 05 15:35:04 2011 -0700
110.2 +++ b/src/share/classes/sun/reflect/misc/FieldUtil.java Tue Aug 09 17:38:52 2011 -0700
110.3 @@ -1,5 +1,5 @@
110.4 /*
110.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
110.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
110.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
110.8 *
110.9 * This code is free software; you can redistribute it and/or modify it
110.10 @@ -35,18 +35,18 @@
110.11 private FieldUtil() {
110.12 }
110.13
110.14 - public static Field getField(Class cls, String name)
110.15 + public static Field getField(Class<?> cls, String name)
110.16 throws NoSuchFieldException {
110.17 ReflectUtil.checkPackageAccess(cls);
110.18 return cls.getField(name);
110.19 }
110.20
110.21 - public static Field[] getFields(Class cls) {
110.22 + public static Field[] getFields(Class<?> cls) {
110.23 ReflectUtil.checkPackageAccess(cls);
110.24 return cls.getFields();
110.25 }
110.26
110.27 - public static Field[] getDeclaredFields(Class cls) {
110.28 + public static Field[] getDeclaredFields(Class<?> cls) {
110.29 ReflectUtil.checkPackageAccess(cls);
110.30 return cls.getDeclaredFields();
110.31 }
111.1 --- a/src/share/classes/sun/reflect/misc/MethodUtil.java Fri Aug 05 15:35:04 2011 -0700
111.2 +++ b/src/share/classes/sun/reflect/misc/MethodUtil.java Tue Aug 09 17:38:52 2011 -0700
111.3 @@ -1,5 +1,5 @@
111.4 /*
111.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
111.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
111.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
111.8 *
111.9 * This code is free software; you can redistribute it and/or modify it
111.10 @@ -36,17 +36,13 @@
111.11 import java.io.IOException;
111.12 import java.net.URL;
111.13 import java.net.URLConnection;
111.14 -import java.net.HttpURLConnection;
111.15 import java.lang.reflect.Method;
111.16 import java.lang.reflect.InvocationTargetException;
111.17 import java.lang.reflect.AccessibleObject;
111.18 import java.lang.reflect.Modifier;
111.19 -import java.util.Collection;
111.20 import java.util.HashMap;
111.21 import java.util.Map;
111.22 import sun.misc.IOUtils;
111.23 -import sun.net.www.ParseUtil;
111.24 -import sun.security.util.SecurityConstants;
111.25
111.26
111.27 class Trampoline {
111.28 @@ -68,13 +64,13 @@
111.29 super();
111.30 }
111.31
111.32 - public static Method getMethod(Class<?> cls, String name, Class[] args)
111.33 + public static Method getMethod(Class<?> cls, String name, Class<?>[] args)
111.34 throws NoSuchMethodException {
111.35 ReflectUtil.checkPackageAccess(cls);
111.36 return cls.getMethod(name, args);
111.37 }
111.38
111.39 - public static Method[] getMethods(Class cls) {
111.40 + public static Method[] getMethods(Class<?> cls) {
111.41 ReflectUtil.checkPackageAccess(cls);
111.42 return cls.getMethods();
111.43 }
111.44 @@ -85,7 +81,7 @@
111.45 * Class.getMethods() and walking towards Object until
111.46 * we're done.
111.47 */
111.48 - public static Method[] getPublicMethods(Class cls) {
111.49 + public static Method[] getPublicMethods(Class<?> cls) {
111.50 // compatibility for update release
111.51 if (System.getSecurityManager() == null) {
111.52 return cls.getMethods();
111.53 @@ -105,11 +101,11 @@
111.54 /*
111.55 * Process the immediate interfaces of this class or interface.
111.56 */
111.57 - private static void getInterfaceMethods(Class cls,
111.58 + private static void getInterfaceMethods(Class<?> cls,
111.59 Map<Signature, Method> sigs) {
111.60 - Class[] intfs = cls.getInterfaces();
111.61 + Class<?>[] intfs = cls.getInterfaces();
111.62 for (int i=0; i < intfs.length; i++) {
111.63 - Class intf = intfs[i];
111.64 + Class<?> intf = intfs[i];
111.65 boolean done = getInternalPublicMethods(intf, sigs);
111.66 if (!done) {
111.67 getInterfaceMethods(intf, sigs);
111.68 @@ -121,7 +117,7 @@
111.69 *
111.70 * Process the methods in this class or interface
111.71 */
111.72 - private static boolean getInternalPublicMethods(Class cls,
111.73 + private static boolean getInternalPublicMethods(Class<?> cls,
111.74 Map<Signature, Method> sigs) {
111.75 Method[] methods = null;
111.76 try {
111.77 @@ -150,7 +146,7 @@
111.78 */
111.79 boolean done = true;
111.80 for (int i=0; i < methods.length; i++) {
111.81 - Class dc = methods[i].getDeclaringClass();
111.82 + Class<?> dc = methods[i].getDeclaringClass();
111.83 if (!Modifier.isPublic(dc.getModifiers())) {
111.84 done = false;
111.85 break;
111.86 @@ -171,7 +167,7 @@
111.87 * stripping away inherited methods.
111.88 */
111.89 for (int i=0; i < methods.length; i++) {
111.90 - Class dc = methods[i].getDeclaringClass();
111.91 + Class<?> dc = methods[i].getDeclaringClass();
111.92 if (cls.equals(dc)) {
111.93 addMethod(sigs, methods[i]);
111.94 }
111.95 @@ -301,12 +297,12 @@
111.96 }
111.97
111.98
111.99 - protected synchronized Class loadClass(String name, boolean resolve)
111.100 + protected synchronized Class<?> loadClass(String name, boolean resolve)
111.101 throws ClassNotFoundException
111.102 {
111.103 // First, check if the class has already been loaded
111.104 ReflectUtil.checkPackageAccess(name);
111.105 - Class c = findLoadedClass(name);
111.106 + Class<?> c = findLoadedClass(name);
111.107 if (c == null) {
111.108 try {
111.109 c = findClass(name);
111.110 @@ -324,7 +320,7 @@
111.111 }
111.112
111.113
111.114 - protected Class findClass(final String name)
111.115 + protected Class<?> findClass(final String name)
111.116 throws ClassNotFoundException
111.117 {
111.118 if (!name.startsWith(MISC_PKG)) {
111.119 @@ -347,7 +343,7 @@
111.120 /*
111.121 * Define the proxy classes
111.122 */
111.123 - private Class defineClass(String name, URL url) throws IOException {
111.124 + private Class<?> defineClass(String name, URL url) throws IOException {
111.125 byte[] b = getBytes(url);
111.126 CodeSource cs = new CodeSource(null, (java.security.cert.Certificate[])null);
111.127 if (!name.equals(TRAMPOLINE)) {
111.128 @@ -389,7 +385,7 @@
111.129 return perms;
111.130 }
111.131
111.132 - private static Class getTrampolineClass() {
111.133 + private static Class<?> getTrampolineClass() {
111.134 try {
111.135 return Class.forName(TRAMPOLINE, true, new MethodUtil());
111.136 } catch (ClassNotFoundException e) {
112.1 --- a/src/share/classes/sun/reflect/misc/ReflectUtil.java Fri Aug 05 15:35:04 2011 -0700
112.2 +++ b/src/share/classes/sun/reflect/misc/ReflectUtil.java Tue Aug 09 17:38:52 2011 -0700
112.3 @@ -1,5 +1,5 @@
112.4 /*
112.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
112.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
112.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
112.8 *
112.9 * This code is free software; you can redistribute it and/or modify it
112.10 @@ -34,13 +34,13 @@
112.11 private ReflectUtil() {
112.12 }
112.13
112.14 - public static Class forName(String name)
112.15 + public static Class<?> forName(String name)
112.16 throws ClassNotFoundException {
112.17 checkPackageAccess(name);
112.18 return Class.forName(name);
112.19 }
112.20
112.21 - public static Object newInstance(Class cls)
112.22 + public static Object newInstance(Class<?> cls)
112.23 throws InstantiationException, IllegalAccessException {
112.24 checkPackageAccess(cls);
112.25 return cls.newInstance();
112.26 @@ -50,8 +50,8 @@
112.27 * Reflection.ensureMemberAccess is overly-restrictive
112.28 * due to a bug. We awkwardly work around it for now.
112.29 */
112.30 - public static void ensureMemberAccess(Class currentClass,
112.31 - Class memberClass,
112.32 + public static void ensureMemberAccess(Class<?> currentClass,
112.33 + Class<?> memberClass,
112.34 Object target,
112.35 int modifiers)
112.36 throws IllegalAccessException
112.37 @@ -102,8 +102,8 @@
112.38 }
112.39 }
112.40
112.41 - private static boolean isSubclassOf(Class queryClass,
112.42 - Class ofClass)
112.43 + private static boolean isSubclassOf(Class<?> queryClass,
112.44 + Class<?> ofClass)
112.45 {
112.46 while (queryClass != null) {
112.47 if (queryClass == ofClass) {
112.48 @@ -115,7 +115,7 @@
112.49 }
112.50
112.51
112.52 - public static void checkPackageAccess(Class clazz) {
112.53 + public static void checkPackageAccess(Class<?> clazz) {
112.54 checkPackageAccess(clazz.getName());
112.55 }
112.56
112.57 @@ -136,7 +136,7 @@
112.58 }
112.59 }
112.60
112.61 - public static boolean isPackageAccessible(Class clazz) {
112.62 + public static boolean isPackageAccessible(Class<?> clazz) {
112.63 try {
112.64 checkPackageAccess(clazz);
112.65 } catch (SecurityException e) {
113.1 --- a/src/share/classes/sun/security/krb5/PrincipalName.java Fri Aug 05 15:35:04 2011 -0700
113.2 +++ b/src/share/classes/sun/security/krb5/PrincipalName.java Tue Aug 09 17:38:52 2011 -0700
113.3 @@ -173,12 +173,6 @@
113.4
113.5 boolean equalsWithoutRealm(PrincipalName other) {
113.6
113.7 -
113.8 - if (nameType != KRB_NT_UNKNOWN &&
113.9 - other.nameType != KRB_NT_UNKNOWN &&
113.10 - nameType != other.nameType)
113.11 - return false;
113.12 -
113.13 if ((nameStrings != null && other.nameStrings == null) ||
113.14 (nameStrings == null && other.nameStrings != null))
113.15 return false;
114.1 --- a/src/share/classes/sun/security/ssl/SSLContextImpl.java Fri Aug 05 15:35:04 2011 -0700
114.2 +++ b/src/share/classes/sun/security/ssl/SSLContextImpl.java Tue Aug 09 17:38:52 2011 -0700
114.3 @@ -567,42 +567,46 @@
114.4 }
114.5
114.6 FileInputStream fs = null;
114.7 - if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) {
114.8 - fs = AccessController.doPrivileged(
114.9 - new PrivilegedExceptionAction<FileInputStream>() {
114.10 - public FileInputStream run() throws Exception {
114.11 - return new FileInputStream(defaultKeyStore);
114.12 - }
114.13 - });
114.14 - }
114.15 -
114.16 - String defaultKeyStorePassword = props.get("keyStorePasswd");
114.17 + KeyStore ks = null;
114.18 char[] passwd = null;
114.19 - if (defaultKeyStorePassword.length() != 0) {
114.20 - passwd = defaultKeyStorePassword.toCharArray();
114.21 - }
114.22 -
114.23 - /**
114.24 - * Try to initialize key store.
114.25 - */
114.26 - KeyStore ks = null;
114.27 - if ((defaultKeyStoreType.length()) != 0) {
114.28 - if (debug != null && Debug.isOn("defaultctx")) {
114.29 - System.out.println("init keystore");
114.30 - }
114.31 - if (defaultKeyStoreProvider.length() == 0) {
114.32 - ks = KeyStore.getInstance(defaultKeyStoreType);
114.33 - } else {
114.34 - ks = KeyStore.getInstance(defaultKeyStoreType,
114.35 - defaultKeyStoreProvider);
114.36 + try {
114.37 + if (defaultKeyStore.length() != 0 &&
114.38 + !NONE.equals(defaultKeyStore)) {
114.39 + fs = AccessController.doPrivileged(
114.40 + new PrivilegedExceptionAction<FileInputStream>() {
114.41 + public FileInputStream run() throws Exception {
114.42 + return new FileInputStream(defaultKeyStore);
114.43 + }
114.44 + });
114.45 }
114.46
114.47 - // if defaultKeyStore is NONE, fs will be null
114.48 - ks.load(fs, passwd);
114.49 - }
114.50 - if (fs != null) {
114.51 - fs.close();
114.52 - fs = null;
114.53 + String defaultKeyStorePassword = props.get("keyStorePasswd");
114.54 + if (defaultKeyStorePassword.length() != 0) {
114.55 + passwd = defaultKeyStorePassword.toCharArray();
114.56 + }
114.57 +
114.58 + /**
114.59 + * Try to initialize key store.
114.60 + */
114.61 + if ((defaultKeyStoreType.length()) != 0) {
114.62 + if (debug != null && Debug.isOn("defaultctx")) {
114.63 + System.out.println("init keystore");
114.64 + }
114.65 + if (defaultKeyStoreProvider.length() == 0) {
114.66 + ks = KeyStore.getInstance(defaultKeyStoreType);
114.67 + } else {
114.68 + ks = KeyStore.getInstance(defaultKeyStoreType,
114.69 + defaultKeyStoreProvider);
114.70 + }
114.71 +
114.72 + // if defaultKeyStore is NONE, fs will be null
114.73 + ks.load(fs, passwd);
114.74 + }
114.75 + } finally {
114.76 + if (fs != null) {
114.77 + fs.close();
114.78 + fs = null;
114.79 + }
114.80 }
114.81
114.82 /*
115.1 --- a/src/share/classes/sun/security/ssl/SSLSocketImpl.java Fri Aug 05 15:35:04 2011 -0700
115.2 +++ b/src/share/classes/sun/security/ssl/SSLSocketImpl.java Tue Aug 09 17:38:52 2011 -0700
115.3 @@ -2443,11 +2443,12 @@
115.4 entrySet, HandshakeCompletedEvent e) {
115.5
115.6 super("HandshakeCompletedNotify-Thread");
115.7 - targets = entrySet;
115.8 + targets = new HashSet<>(entrySet); // clone the entry set
115.9 event = e;
115.10 }
115.11
115.12 public void run() {
115.13 + // Don't need to synchronize, as it only runs in one thread.
115.14 for (Map.Entry<HandshakeCompletedListener,AccessControlContext>
115.15 entry : targets) {
115.16
116.1 --- a/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java Fri Aug 05 15:35:04 2011 -0700
116.2 +++ b/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java Tue Aug 09 17:38:52 2011 -0700
116.3 @@ -164,72 +164,75 @@
116.4 * If none exists, we use an empty keystore.
116.5 */
116.6
116.7 - storeFileName = props.get("trustStore");
116.8 - if (!"NONE".equals(storeFileName)) {
116.9 - if (storeFileName != null) {
116.10 - storeFile = new File(storeFileName);
116.11 - fis = getFileInputStream(storeFile);
116.12 - } else {
116.13 - String javaHome = props.get("javaHome");
116.14 - storeFile = new File(javaHome + sep + "lib" + sep
116.15 - + "security" + sep +
116.16 - "jssecacerts");
116.17 - if ((fis = getFileInputStream(storeFile)) == null) {
116.18 + try {
116.19 + storeFileName = props.get("trustStore");
116.20 + if (!"NONE".equals(storeFileName)) {
116.21 + if (storeFileName != null) {
116.22 + storeFile = new File(storeFileName);
116.23 + fis = getFileInputStream(storeFile);
116.24 + } else {
116.25 + String javaHome = props.get("javaHome");
116.26 storeFile = new File(javaHome + sep + "lib" + sep
116.27 - + "security" + sep +
116.28 - "cacerts");
116.29 - fis = getFileInputStream(storeFile);
116.30 + + "security" + sep +
116.31 + "jssecacerts");
116.32 + if ((fis = getFileInputStream(storeFile)) == null) {
116.33 + storeFile = new File(javaHome + sep + "lib" + sep
116.34 + + "security" + sep +
116.35 + "cacerts");
116.36 + fis = getFileInputStream(storeFile);
116.37 + }
116.38 + }
116.39 +
116.40 + if (fis != null) {
116.41 + storeFileName = storeFile.getPath();
116.42 + } else {
116.43 + storeFileName = "No File Available, using empty keystore.";
116.44 }
116.45 }
116.46
116.47 - if (fis != null) {
116.48 - storeFileName = storeFile.getPath();
116.49 - } else {
116.50 - storeFileName = "No File Available, using empty keystore.";
116.51 + defaultTrustStoreType = props.get("trustStoreType");
116.52 + defaultTrustStoreProvider = props.get("trustStoreProvider");
116.53 + if (debug != null && Debug.isOn(dbgname)) {
116.54 + System.out.println("trustStore is: " + storeFileName);
116.55 + System.out.println("trustStore type is : " +
116.56 + defaultTrustStoreType);
116.57 + System.out.println("trustStore provider is : " +
116.58 + defaultTrustStoreProvider);
116.59 }
116.60 - }
116.61
116.62 - defaultTrustStoreType = props.get("trustStoreType");
116.63 - defaultTrustStoreProvider = props.get("trustStoreProvider");
116.64 - if (debug != null && Debug.isOn(dbgname)) {
116.65 - System.out.println("trustStore is: " + storeFileName);
116.66 - System.out.println("trustStore type is : " +
116.67 - defaultTrustStoreType);
116.68 - System.out.println("trustStore provider is : " +
116.69 - defaultTrustStoreProvider);
116.70 - }
116.71 + /*
116.72 + * Try to initialize trust store.
116.73 + */
116.74 + if (defaultTrustStoreType.length() != 0) {
116.75 + if (debug != null && Debug.isOn(dbgname)) {
116.76 + System.out.println("init truststore");
116.77 + }
116.78 + if (defaultTrustStoreProvider.length() == 0) {
116.79 + ks = KeyStore.getInstance(defaultTrustStoreType);
116.80 + } else {
116.81 + ks = KeyStore.getInstance(defaultTrustStoreType,
116.82 + defaultTrustStoreProvider);
116.83 + }
116.84 + char[] passwd = null;
116.85 + String defaultTrustStorePassword =
116.86 + props.get("trustStorePasswd");
116.87 + if (defaultTrustStorePassword.length() != 0)
116.88 + passwd = defaultTrustStorePassword.toCharArray();
116.89
116.90 - /*
116.91 - * Try to initialize trust store.
116.92 - */
116.93 - if (defaultTrustStoreType.length() != 0) {
116.94 - if (debug != null && Debug.isOn(dbgname)) {
116.95 - System.out.println("init truststore");
116.96 - }
116.97 - if (defaultTrustStoreProvider.length() == 0) {
116.98 - ks = KeyStore.getInstance(defaultTrustStoreType);
116.99 - } else {
116.100 - ks = KeyStore.getInstance(defaultTrustStoreType,
116.101 - defaultTrustStoreProvider);
116.102 - }
116.103 - char[] passwd = null;
116.104 - String defaultTrustStorePassword = props.get("trustStorePasswd");
116.105 - if (defaultTrustStorePassword.length() != 0)
116.106 - passwd = defaultTrustStorePassword.toCharArray();
116.107 + // if trustStore is NONE, fis will be null
116.108 + ks.load(fis, passwd);
116.109
116.110 - // if trustStore is NONE, fis will be null
116.111 - ks.load(fis, passwd);
116.112 -
116.113 - // Zero out the temporary password storage
116.114 - if (passwd != null) {
116.115 - for (int i = 0; i < passwd.length; i++) {
116.116 - passwd[i] = (char)0;
116.117 + // Zero out the temporary password storage
116.118 + if (passwd != null) {
116.119 + for (int i = 0; i < passwd.length; i++) {
116.120 + passwd[i] = (char)0;
116.121 + }
116.122 }
116.123 }
116.124 - }
116.125 -
116.126 - if (fis != null) {
116.127 - fis.close();
116.128 + } finally {
116.129 + if (fis != null) {
116.130 + fis.close();
116.131 + }
116.132 }
116.133
116.134 return ks;
117.1 --- a/src/share/classes/sun/util/locale/LocaleObjectCache.java Fri Aug 05 15:35:04 2011 -0700
117.2 +++ b/src/share/classes/sun/util/locale/LocaleObjectCache.java Tue Aug 09 17:38:52 2011 -0700
117.3 @@ -66,14 +66,14 @@
117.4
117.5 CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue);
117.6
117.7 - while (value == null) {
117.8 - cleanStaleEntries();
117.9 - entry = map.putIfAbsent(key, newEntry);
117.10 - if (entry == null) {
117.11 + entry = map.putIfAbsent(key, newEntry);
117.12 + if (entry == null) {
117.13 + value = newVal;
117.14 + } else {
117.15 + value = entry.get();
117.16 + if (value == null) {
117.17 + map.put(key, newEntry);
117.18 value = newVal;
117.19 - break;
117.20 - } else {
117.21 - value = entry.get();
117.22 }
117.23 }
117.24 }
118.1 --- a/src/share/native/java/lang/fdlibm/include/fdlibm.h Fri Aug 05 15:35:04 2011 -0700
118.2 +++ b/src/share/native/java/lang/fdlibm/include/fdlibm.h Tue Aug 09 17:38:52 2011 -0700
118.3 @@ -135,22 +135,10 @@
118.4 extern double floor __P((double));
118.5 extern double fmod __P((double, double));
118.6
118.7 -extern double erf __P((double));
118.8 -extern double erfc __P((double));
118.9 -extern double gamma __P((double));
118.10 extern double hypot __P((double, double));
118.11 extern int isnan __P((double));
118.12 extern int finite __P((double));
118.13 -extern double j0 __P((double));
118.14 -extern double j1 __P((double));
118.15 -extern double jn __P((int, double));
118.16 -extern double lgamma __P((double));
118.17 -extern double y0 __P((double));
118.18 -extern double y1 __P((double));
118.19 -extern double yn __P((int, double));
118.20
118.21 -extern double acosh __P((double));
118.22 -extern double asinh __P((double));
118.23 extern double atanh __P((double));
118.24 extern double cbrt __P((double));
118.25 extern double logb __P((double));
118.26 @@ -183,19 +171,9 @@
118.27 extern double expm1 __P((double));
118.28 extern double log1p __P((double));
118.29
118.30 -/*
118.31 - * Reentrant version of gamma & lgamma; passes signgam back by reference
118.32 - * as the second argument; user must allocate space for signgam.
118.33 - */
118.34 -#ifdef _REENTRANT
118.35 -extern double gamma_r __P((double, int *));
118.36 -extern double lgamma_r __P((double, int *));
118.37 -#endif /* _REENTRANT */
118.38 -
118.39 /* ieee style elementary functions */
118.40 extern double __ieee754_sqrt __P((double));
118.41 extern double __ieee754_acos __P((double));
118.42 -extern double __ieee754_acosh __P((double));
118.43 extern double __ieee754_log __P((double));
118.44 extern double __ieee754_atanh __P((double));
118.45 extern double __ieee754_asin __P((double));
118.46 @@ -204,19 +182,9 @@
118.47 extern double __ieee754_cosh __P((double));
118.48 extern double __ieee754_fmod __P((double,double));
118.49 extern double __ieee754_pow __P((double,double));
118.50 -extern double __ieee754_lgamma_r __P((double,int *));
118.51 -extern double __ieee754_gamma_r __P((double,int *));
118.52 -extern double __ieee754_lgamma __P((double));
118.53 -extern double __ieee754_gamma __P((double));
118.54 extern double __ieee754_log10 __P((double));
118.55 extern double __ieee754_sinh __P((double));
118.56 extern double __ieee754_hypot __P((double,double));
118.57 -extern double __ieee754_j0 __P((double));
118.58 -extern double __ieee754_j1 __P((double));
118.59 -extern double __ieee754_y0 __P((double));
118.60 -extern double __ieee754_y1 __P((double));
118.61 -extern double __ieee754_jn __P((int,double));
118.62 -extern double __ieee754_yn __P((int,double));
118.63 extern double __ieee754_remainder __P((double,double));
118.64 extern int __ieee754_rem_pio2 __P((double,double*));
118.65 #ifdef _SCALB_INT
119.1 --- a/src/share/native/java/lang/fdlibm/include/jfdlibm.h Fri Aug 05 15:35:04 2011 -0700
119.2 +++ b/src/share/native/java/lang/fdlibm/include/jfdlibm.h Tue Aug 09 17:38:52 2011 -0700
119.3 @@ -64,7 +64,6 @@
119.4 #ifdef __linux__
119.5 #define __ieee754_sqrt __j__ieee754_sqrt
119.6 #define __ieee754_acos __j__ieee754_acos
119.7 -#define __ieee754_acosh __j__ieee754_acosh
119.8 #define __ieee754_log __j__ieee754_log
119.9 #define __ieee754_atanh __j__ieee754_atanh
119.10 #define __ieee754_asin __j__ieee754_asin
119.11 @@ -73,19 +72,9 @@
119.12 #define __ieee754_cosh __j__ieee754_cosh
119.13 #define __ieee754_fmod __j__ieee754_fmod
119.14 #define __ieee754_pow __j__ieee754_pow
119.15 -#define __ieee754_lgamma_r __j__ieee754_lgamma_r
119.16 -#define __ieee754_gamma_r __j__ieee754_gamma_r
119.17 -#define __ieee754_lgamma __j__ieee754_lgamma
119.18 -#define __ieee754_gamma __j__ieee754_gamma
119.19 #define __ieee754_log10 __j__ieee754_log10
119.20 #define __ieee754_sinh __j__ieee754_sinh
119.21 #define __ieee754_hypot __j__ieee754_hypot
119.22 -#define __ieee754_j0 __j__ieee754_j0
119.23 -#define __ieee754_j1 __j__ieee754_j1
119.24 -#define __ieee754_y0 __j__ieee754_y0
119.25 -#define __ieee754_y1 __j__ieee754_y1
119.26 -#define __ieee754_jn __j__ieee754_jn
119.27 -#define __ieee754_yn __j__ieee754_yn
119.28 #define __ieee754_remainder __j__ieee754_remainder
119.29 #define __ieee754_rem_pio2 __j__ieee754_rem_pio2
119.30 #define __ieee754_scalb __j__ieee754_scalb
120.1 --- a/src/share/native/java/lang/fdlibm/src/e_acosh.c Fri Aug 05 15:35:04 2011 -0700
120.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
120.3 @@ -1,77 +0,0 @@
120.4 -
120.5 -/*
120.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
120.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
120.8 - *
120.9 - * This code is free software; you can redistribute it and/or modify it
120.10 - * under the terms of the GNU General Public License version 2 only, as
120.11 - * published by the Free Software Foundation. Oracle designates this
120.12 - * particular file as subject to the "Classpath" exception as provided
120.13 - * by Oracle in the LICENSE file that accompanied this code.
120.14 - *
120.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
120.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
120.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
120.18 - * version 2 for more details (a copy is included in the LICENSE file that
120.19 - * accompanied this code).
120.20 - *
120.21 - * You should have received a copy of the GNU General Public License version
120.22 - * 2 along with this work; if not, write to the Free Software Foundation,
120.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
120.24 - *
120.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
120.26 - * or visit www.oracle.com if you need additional information or have any
120.27 - * questions.
120.28 - */
120.29 -
120.30 -/* __ieee754_acosh(x)
120.31 - * Method :
120.32 - * Based on
120.33 - * acosh(x) = log [ x + sqrt(x*x-1) ]
120.34 - * we have
120.35 - * acosh(x) := log(x)+ln2, if x is large; else
120.36 - * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
120.37 - * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
120.38 - *
120.39 - * Special cases:
120.40 - * acosh(x) is NaN with signal if x<1.
120.41 - * acosh(NaN) is NaN without signal.
120.42 - */
120.43 -
120.44 -#include "fdlibm.h"
120.45 -
120.46 -#ifdef __STDC__
120.47 -static const double
120.48 -#else
120.49 -static double
120.50 -#endif
120.51 -one = 1.0,
120.52 -ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
120.53 -
120.54 -#ifdef __STDC__
120.55 - double __ieee754_acosh(double x)
120.56 -#else
120.57 - double __ieee754_acosh(x)
120.58 - double x;
120.59 -#endif
120.60 -{
120.61 - double t;
120.62 - int hx;
120.63 - hx = __HI(x);
120.64 - if(hx<0x3ff00000) { /* x < 1 */
120.65 - return (x-x)/(x-x);
120.66 - } else if(hx >=0x41b00000) { /* x > 2**28 */
120.67 - if(hx >=0x7ff00000) { /* x is inf of NaN */
120.68 - return x+x;
120.69 - } else
120.70 - return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
120.71 - } else if(((hx-0x3ff00000)|__LO(x))==0) {
120.72 - return 0.0; /* acosh(1) = 0 */
120.73 - } else if (hx > 0x40000000) { /* 2**28 > x > 2 */
120.74 - t=x*x;
120.75 - return __ieee754_log(2.0*x-one/(x+sqrt(t-one)));
120.76 - } else { /* 1<x<2 */
120.77 - t = x-one;
120.78 - return log1p(t+sqrt(2.0*t+t*t));
120.79 - }
120.80 -}
121.1 --- a/src/share/native/java/lang/fdlibm/src/e_gamma.c Fri Aug 05 15:35:04 2011 -0700
121.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
121.3 @@ -1,45 +0,0 @@
121.4 -
121.5 -/*
121.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
121.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
121.8 - *
121.9 - * This code is free software; you can redistribute it and/or modify it
121.10 - * under the terms of the GNU General Public License version 2 only, as
121.11 - * published by the Free Software Foundation. Oracle designates this
121.12 - * particular file as subject to the "Classpath" exception as provided
121.13 - * by Oracle in the LICENSE file that accompanied this code.
121.14 - *
121.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
121.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
121.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
121.18 - * version 2 for more details (a copy is included in the LICENSE file that
121.19 - * accompanied this code).
121.20 - *
121.21 - * You should have received a copy of the GNU General Public License version
121.22 - * 2 along with this work; if not, write to the Free Software Foundation,
121.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
121.24 - *
121.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
121.26 - * or visit www.oracle.com if you need additional information or have any
121.27 - * questions.
121.28 - */
121.29 -
121.30 -/* __ieee754_gamma(x)
121.31 - * Return the logarithm of the Gamma function of x.
121.32 - *
121.33 - * Method: call __ieee754_gamma_r
121.34 - */
121.35 -
121.36 -#include "fdlibm.h"
121.37 -
121.38 -extern int signgam;
121.39 -
121.40 -#ifdef __STDC__
121.41 - double __ieee754_gamma(double x)
121.42 -#else
121.43 - double __ieee754_gamma(x)
121.44 - double x;
121.45 -#endif
121.46 -{
121.47 - return __ieee754_gamma_r(x,&signgam);
121.48 -}
122.1 --- a/src/share/native/java/lang/fdlibm/src/e_gamma_r.c Fri Aug 05 15:35:04 2011 -0700
122.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
122.3 @@ -1,44 +0,0 @@
122.4 -
122.5 -/*
122.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
122.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
122.8 - *
122.9 - * This code is free software; you can redistribute it and/or modify it
122.10 - * under the terms of the GNU General Public License version 2 only, as
122.11 - * published by the Free Software Foundation. Oracle designates this
122.12 - * particular file as subject to the "Classpath" exception as provided
122.13 - * by Oracle in the LICENSE file that accompanied this code.
122.14 - *
122.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
122.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
122.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
122.18 - * version 2 for more details (a copy is included in the LICENSE file that
122.19 - * accompanied this code).
122.20 - *
122.21 - * You should have received a copy of the GNU General Public License version
122.22 - * 2 along with this work; if not, write to the Free Software Foundation,
122.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
122.24 - *
122.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
122.26 - * or visit www.oracle.com if you need additional information or have any
122.27 - * questions.
122.28 - */
122.29 -
122.30 -/* __ieee754_gamma_r(x, signgamp)
122.31 - * Reentrant version of the logarithm of the Gamma function
122.32 - * with user provide pointer for the sign of Gamma(x).
122.33 - *
122.34 - * Method: See __ieee754_lgamma_r
122.35 - */
122.36 -
122.37 -#include "fdlibm.h"
122.38 -
122.39 -#ifdef __STDC__
122.40 - double __ieee754_gamma_r(double x, int *signgamp)
122.41 -#else
122.42 - double __ieee754_gamma_r(x,signgamp)
122.43 - double x; int *signgamp;
122.44 -#endif
122.45 -{
122.46 - return __ieee754_lgamma_r(x,signgamp);
122.47 -}
123.1 --- a/src/share/native/java/lang/fdlibm/src/e_j0.c Fri Aug 05 15:35:04 2011 -0700
123.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
123.3 @@ -1,491 +0,0 @@
123.4 -
123.5 -/*
123.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
123.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
123.8 - *
123.9 - * This code is free software; you can redistribute it and/or modify it
123.10 - * under the terms of the GNU General Public License version 2 only, as
123.11 - * published by the Free Software Foundation. Oracle designates this
123.12 - * particular file as subject to the "Classpath" exception as provided
123.13 - * by Oracle in the LICENSE file that accompanied this code.
123.14 - *
123.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
123.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
123.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
123.18 - * version 2 for more details (a copy is included in the LICENSE file that
123.19 - * accompanied this code).
123.20 - *
123.21 - * You should have received a copy of the GNU General Public License version
123.22 - * 2 along with this work; if not, write to the Free Software Foundation,
123.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
123.24 - *
123.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
123.26 - * or visit www.oracle.com if you need additional information or have any
123.27 - * questions.
123.28 - */
123.29 -
123.30 -/* __ieee754_j0(x), __ieee754_y0(x)
123.31 - * Bessel function of the first and second kinds of order zero.
123.32 - * Method -- j0(x):
123.33 - * 1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ...
123.34 - * 2. Reduce x to |x| since j0(x)=j0(-x), and
123.35 - * for x in (0,2)
123.36 - * j0(x) = 1-z/4+ z^2*R0/S0, where z = x*x;
123.37 - * (precision: |j0-1+z/4-z^2R0/S0 |<2**-63.67 )
123.38 - * for x in (2,inf)
123.39 - * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
123.40 - * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
123.41 - * as follow:
123.42 - * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
123.43 - * = 1/sqrt(2) * (cos(x) + sin(x))
123.44 - * sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4)
123.45 - * = 1/sqrt(2) * (sin(x) - cos(x))
123.46 - * (To avoid cancellation, use
123.47 - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
123.48 - * to compute the worse one.)
123.49 - *
123.50 - * 3 Special cases
123.51 - * j0(nan)= nan
123.52 - * j0(0) = 1
123.53 - * j0(inf) = 0
123.54 - *
123.55 - * Method -- y0(x):
123.56 - * 1. For x<2.
123.57 - * Since
123.58 - * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...)
123.59 - * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function.
123.60 - * We use the following function to approximate y0,
123.61 - * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2
123.62 - * where
123.63 - * U(z) = u00 + u01*z + ... + u06*z^6
123.64 - * V(z) = 1 + v01*z + ... + v04*z^4
123.65 - * with absolute approximation error bounded by 2**-72.
123.66 - * Note: For tiny x, U/V = u0 and j0(x)~1, hence
123.67 - * y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27)
123.68 - * 2. For x>=2.
123.69 - * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))
123.70 - * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
123.71 - * by the method mentioned above.
123.72 - * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0.
123.73 - */
123.74 -
123.75 -#include "fdlibm.h"
123.76 -
123.77 -#ifdef __STDC__
123.78 -static double pzero(double), qzero(double);
123.79 -#else
123.80 -static double pzero(), qzero();
123.81 -#endif
123.82 -
123.83 -#ifdef __STDC__
123.84 -static const double
123.85 -#else
123.86 -static double
123.87 -#endif
123.88 -huge = 1e300,
123.89 -one = 1.0,
123.90 -invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
123.91 -tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
123.92 - /* R0/S0 on [0, 2.00] */
123.93 -R02 = 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */
123.94 -R03 = -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */
123.95 -R04 = 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */
123.96 -R05 = -4.61832688532103189199e-09, /* 0xBE33D5E7, 0x73D63FCE */
123.97 -S01 = 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */
123.98 -S02 = 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */
123.99 -S03 = 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */
123.100 -S04 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */
123.101 -
123.102 -static double zero = 0.0;
123.103 -
123.104 -#ifdef __STDC__
123.105 - double __ieee754_j0(double x)
123.106 -#else
123.107 - double __ieee754_j0(x)
123.108 - double x;
123.109 -#endif
123.110 -{
123.111 - double z, s,c,ss,cc,r,u,v;
123.112 - int hx,ix;
123.113 -
123.114 - hx = __HI(x);
123.115 - ix = hx&0x7fffffff;
123.116 - if(ix>=0x7ff00000) return one/(x*x);
123.117 - x = fabs(x);
123.118 - if(ix >= 0x40000000) { /* |x| >= 2.0 */
123.119 - s = sin(x);
123.120 - c = cos(x);
123.121 - ss = s-c;
123.122 - cc = s+c;
123.123 - if(ix<0x7fe00000) { /* make sure x+x not overflow */
123.124 - z = -cos(x+x);
123.125 - if ((s*c)<zero) cc = z/ss;
123.126 - else ss = z/cc;
123.127 - }
123.128 - /*
123.129 - * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
123.130 - * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
123.131 - */
123.132 - if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(x);
123.133 - else {
123.134 - u = pzero(x); v = qzero(x);
123.135 - z = invsqrtpi*(u*cc-v*ss)/sqrt(x);
123.136 - }
123.137 - return z;
123.138 - }
123.139 - if(ix<0x3f200000) { /* |x| < 2**-13 */
123.140 - if(huge+x>one) { /* raise inexact if x != 0 */
123.141 - if(ix<0x3e400000) return one; /* |x|<2**-27 */
123.142 - else return one - 0.25*x*x;
123.143 - }
123.144 - }
123.145 - z = x*x;
123.146 - r = z*(R02+z*(R03+z*(R04+z*R05)));
123.147 - s = one+z*(S01+z*(S02+z*(S03+z*S04)));
123.148 - if(ix < 0x3FF00000) { /* |x| < 1.00 */
123.149 - return one + z*(-0.25+(r/s));
123.150 - } else {
123.151 - u = 0.5*x;
123.152 - return((one+u)*(one-u)+z*(r/s));
123.153 - }
123.154 -}
123.155 -
123.156 -#ifdef __STDC__
123.157 -static const double
123.158 -#else
123.159 -static double
123.160 -#endif
123.161 -u00 = -7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */
123.162 -u01 = 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */
123.163 -u02 = -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */
123.164 -u03 = 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */
123.165 -u04 = -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */
123.166 -u05 = 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */
123.167 -u06 = -3.98205194132103398453e-11, /* 0xBDC5E43D, 0x693FB3C8 */
123.168 -v01 = 1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */
123.169 -v02 = 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */
123.170 -v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */
123.171 -v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */
123.172 -
123.173 -#ifdef __STDC__
123.174 - double __ieee754_y0(double x)
123.175 -#else
123.176 - double __ieee754_y0(x)
123.177 - double x;
123.178 -#endif
123.179 -{
123.180 - double z, s,c,ss,cc,u,v;
123.181 - int hx,ix,lx;
123.182 -
123.183 - hx = __HI(x);
123.184 - ix = 0x7fffffff&hx;
123.185 - lx = __LO(x);
123.186 - /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */
123.187 - if(ix>=0x7ff00000) return one/(x+x*x);
123.188 - if((ix|lx)==0) return -one/zero;
123.189 - if(hx<0) return zero/zero;
123.190 - if(ix >= 0x40000000) { /* |x| >= 2.0 */
123.191 - /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
123.192 - * where x0 = x-pi/4
123.193 - * Better formula:
123.194 - * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
123.195 - * = 1/sqrt(2) * (sin(x) + cos(x))
123.196 - * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
123.197 - * = 1/sqrt(2) * (sin(x) - cos(x))
123.198 - * To avoid cancellation, use
123.199 - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
123.200 - * to compute the worse one.
123.201 - */
123.202 - s = sin(x);
123.203 - c = cos(x);
123.204 - ss = s-c;
123.205 - cc = s+c;
123.206 - /*
123.207 - * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
123.208 - * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
123.209 - */
123.210 - if(ix<0x7fe00000) { /* make sure x+x not overflow */
123.211 - z = -cos(x+x);
123.212 - if ((s*c)<zero) cc = z/ss;
123.213 - else ss = z/cc;
123.214 - }
123.215 - if(ix>0x48000000) z = (invsqrtpi*ss)/sqrt(x);
123.216 - else {
123.217 - u = pzero(x); v = qzero(x);
123.218 - z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
123.219 - }
123.220 - return z;
123.221 - }
123.222 - if(ix<=0x3e400000) { /* x < 2**-27 */
123.223 - return(u00 + tpi*__ieee754_log(x));
123.224 - }
123.225 - z = x*x;
123.226 - u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06)))));
123.227 - v = one+z*(v01+z*(v02+z*(v03+z*v04)));
123.228 - return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x)));
123.229 -}
123.230 -
123.231 -/* The asymptotic expansions of pzero is
123.232 - * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x.
123.233 - * For x >= 2, We approximate pzero by
123.234 - * pzero(x) = 1 + (R/S)
123.235 - * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10
123.236 - * S = 1 + pS0*s^2 + ... + pS4*s^10
123.237 - * and
123.238 - * | pzero(x)-1-R/S | <= 2 ** ( -60.26)
123.239 - */
123.240 -#ifdef __STDC__
123.241 -static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
123.242 -#else
123.243 -static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
123.244 -#endif
123.245 - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
123.246 - -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */
123.247 - -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */
123.248 - -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */
123.249 - -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */
123.250 - -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */
123.251 -};
123.252 -#ifdef __STDC__
123.253 -static const double pS8[5] = {
123.254 -#else
123.255 -static double pS8[5] = {
123.256 -#endif
123.257 - 1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */
123.258 - 3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */
123.259 - 4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */
123.260 - 1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */
123.261 - 4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */
123.262 -};
123.263 -
123.264 -#ifdef __STDC__
123.265 -static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
123.266 -#else
123.267 -static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
123.268 -#endif
123.269 - -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */
123.270 - -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */
123.271 - -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */
123.272 - -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */
123.273 - -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */
123.274 - -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */
123.275 -};
123.276 -#ifdef __STDC__
123.277 -static const double pS5[5] = {
123.278 -#else
123.279 -static double pS5[5] = {
123.280 -#endif
123.281 - 6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */
123.282 - 1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */
123.283 - 5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */
123.284 - 9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */
123.285 - 2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */
123.286 -};
123.287 -
123.288 -#ifdef __STDC__
123.289 -static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
123.290 -#else
123.291 -static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
123.292 -#endif
123.293 - -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */
123.294 - -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */
123.295 - -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */
123.296 - -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */
123.297 - -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */
123.298 - -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */
123.299 -};
123.300 -#ifdef __STDC__
123.301 -static const double pS3[5] = {
123.302 -#else
123.303 -static double pS3[5] = {
123.304 -#endif
123.305 - 3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */
123.306 - 3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */
123.307 - 1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */
123.308 - 1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */
123.309 - 1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */
123.310 -};
123.311 -
123.312 -#ifdef __STDC__
123.313 -static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
123.314 -#else
123.315 -static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
123.316 -#endif
123.317 - -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */
123.318 - -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */
123.319 - -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */
123.320 - -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */
123.321 - -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */
123.322 - -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */
123.323 -};
123.324 -#ifdef __STDC__
123.325 -static const double pS2[5] = {
123.326 -#else
123.327 -static double pS2[5] = {
123.328 -#endif
123.329 - 2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */
123.330 - 1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */
123.331 - 2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */
123.332 - 1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */
123.333 - 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */
123.334 -};
123.335 -
123.336 -#ifdef __STDC__
123.337 - static double pzero(double x)
123.338 -#else
123.339 - static double pzero(x)
123.340 - double x;
123.341 -#endif
123.342 -{
123.343 -#ifdef __STDC__
123.344 - const double *p=(void*)0,*q=(void*)0;
123.345 -#else
123.346 - double *p,*q;
123.347 -#endif
123.348 - double z,r,s;
123.349 - int ix;
123.350 - ix = 0x7fffffff&__HI(x);
123.351 - if(ix>=0x40200000) {p = pR8; q= pS8;}
123.352 - else if(ix>=0x40122E8B){p = pR5; q= pS5;}
123.353 - else if(ix>=0x4006DB6D){p = pR3; q= pS3;}
123.354 - else if(ix>=0x40000000){p = pR2; q= pS2;}
123.355 - z = one/(x*x);
123.356 - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
123.357 - s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
123.358 - return one+ r/s;
123.359 -}
123.360 -
123.361 -
123.362 -/* For x >= 8, the asymptotic expansions of qzero is
123.363 - * -1/8 s + 75/1024 s^3 - ..., where s = 1/x.
123.364 - * We approximate pzero by
123.365 - * qzero(x) = s*(-1.25 + (R/S))
123.366 - * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10
123.367 - * S = 1 + qS0*s^2 + ... + qS5*s^12
123.368 - * and
123.369 - * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22)
123.370 - */
123.371 -#ifdef __STDC__
123.372 -static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
123.373 -#else
123.374 -static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
123.375 -#endif
123.376 - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
123.377 - 7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */
123.378 - 1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */
123.379 - 5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */
123.380 - 8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */
123.381 - 3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */
123.382 -};
123.383 -#ifdef __STDC__
123.384 -static const double qS8[6] = {
123.385 -#else
123.386 -static double qS8[6] = {
123.387 -#endif
123.388 - 1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */
123.389 - 8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */
123.390 - 1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */
123.391 - 8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */
123.392 - 8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */
123.393 - -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */
123.394 -};
123.395 -
123.396 -#ifdef __STDC__
123.397 -static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
123.398 -#else
123.399 -static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
123.400 -#endif
123.401 - 1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */
123.402 - 7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */
123.403 - 5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */
123.404 - 1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */
123.405 - 1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */
123.406 - 1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */
123.407 -};
123.408 -#ifdef __STDC__
123.409 -static const double qS5[6] = {
123.410 -#else
123.411 -static double qS5[6] = {
123.412 -#endif
123.413 - 8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */
123.414 - 2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */
123.415 - 1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */
123.416 - 5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */
123.417 - 3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */
123.418 - -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */
123.419 -};
123.420 -
123.421 -#ifdef __STDC__
123.422 -static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
123.423 -#else
123.424 -static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
123.425 -#endif
123.426 - 4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */
123.427 - 7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */
123.428 - 3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */
123.429 - 4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */
123.430 - 1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */
123.431 - 1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */
123.432 -};
123.433 -#ifdef __STDC__
123.434 -static const double qS3[6] = {
123.435 -#else
123.436 -static double qS3[6] = {
123.437 -#endif
123.438 - 4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */
123.439 - 7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */
123.440 - 3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */
123.441 - 6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */
123.442 - 2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */
123.443 - -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */
123.444 -};
123.445 -
123.446 -#ifdef __STDC__
123.447 -static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
123.448 -#else
123.449 -static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
123.450 -#endif
123.451 - 1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */
123.452 - 7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */
123.453 - 1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */
123.454 - 1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */
123.455 - 3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */
123.456 - 1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */
123.457 -};
123.458 -#ifdef __STDC__
123.459 -static const double qS2[6] = {
123.460 -#else
123.461 -static double qS2[6] = {
123.462 -#endif
123.463 - 3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */
123.464 - 2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */
123.465 - 8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */
123.466 - 8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */
123.467 - 2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */
123.468 - -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */
123.469 -};
123.470 -
123.471 -#ifdef __STDC__
123.472 - static double qzero(double x)
123.473 -#else
123.474 - static double qzero(x)
123.475 - double x;
123.476 -#endif
123.477 -{
123.478 -#ifdef __STDC__
123.479 - const double *p=(void*)0,*q=(void*)0;
123.480 -#else
123.481 - double *p,*q;
123.482 -#endif
123.483 - double s,r,z;
123.484 - int ix;
123.485 - ix = 0x7fffffff&__HI(x);
123.486 - if(ix>=0x40200000) {p = qR8; q= qS8;}
123.487 - else if(ix>=0x40122E8B){p = qR5; q= qS5;}
123.488 - else if(ix>=0x4006DB6D){p = qR3; q= qS3;}
123.489 - else if(ix>=0x40000000){p = qR2; q= qS2;}
123.490 - z = one/(x*x);
123.491 - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
123.492 - s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
123.493 - return (-.125 + r/s)/x;
123.494 -}
124.1 --- a/src/share/native/java/lang/fdlibm/src/e_j1.c Fri Aug 05 15:35:04 2011 -0700
124.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
124.3 @@ -1,490 +0,0 @@
124.4 -
124.5 -/*
124.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
124.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
124.8 - *
124.9 - * This code is free software; you can redistribute it and/or modify it
124.10 - * under the terms of the GNU General Public License version 2 only, as
124.11 - * published by the Free Software Foundation. Oracle designates this
124.12 - * particular file as subject to the "Classpath" exception as provided
124.13 - * by Oracle in the LICENSE file that accompanied this code.
124.14 - *
124.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
124.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
124.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
124.18 - * version 2 for more details (a copy is included in the LICENSE file that
124.19 - * accompanied this code).
124.20 - *
124.21 - * You should have received a copy of the GNU General Public License version
124.22 - * 2 along with this work; if not, write to the Free Software Foundation,
124.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
124.24 - *
124.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
124.26 - * or visit www.oracle.com if you need additional information or have any
124.27 - * questions.
124.28 - */
124.29 -
124.30 -/* __ieee754_j1(x), __ieee754_y1(x)
124.31 - * Bessel function of the first and second kinds of order zero.
124.32 - * Method -- j1(x):
124.33 - * 1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ...
124.34 - * 2. Reduce x to |x| since j1(x)=-j1(-x), and
124.35 - * for x in (0,2)
124.36 - * j1(x) = x/2 + x*z*R0/S0, where z = x*x;
124.37 - * (precision: |j1/x - 1/2 - R0/S0 |<2**-61.51 )
124.38 - * for x in (2,inf)
124.39 - * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
124.40 - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
124.41 - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
124.42 - * as follow:
124.43 - * cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
124.44 - * = 1/sqrt(2) * (sin(x) - cos(x))
124.45 - * sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
124.46 - * = -1/sqrt(2) * (sin(x) + cos(x))
124.47 - * (To avoid cancellation, use
124.48 - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
124.49 - * to compute the worse one.)
124.50 - *
124.51 - * 3 Special cases
124.52 - * j1(nan)= nan
124.53 - * j1(0) = 0
124.54 - * j1(inf) = 0
124.55 - *
124.56 - * Method -- y1(x):
124.57 - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN
124.58 - * 2. For x<2.
124.59 - * Since
124.60 - * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...)
124.61 - * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function.
124.62 - * We use the following function to approximate y1,
124.63 - * y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2
124.64 - * where for x in [0,2] (abs err less than 2**-65.89)
124.65 - * U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4
124.66 - * V(z) = 1 + v0[0]*z + ... + v0[4]*z^5
124.67 - * Note: For tiny x, 1/x dominate y1 and hence
124.68 - * y1(tiny) = -2/pi/tiny, (choose tiny<2**-54)
124.69 - * 3. For x>=2.
124.70 - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
124.71 - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
124.72 - * by method mentioned above.
124.73 - */
124.74 -
124.75 -#include "fdlibm.h"
124.76 -
124.77 -#ifdef __STDC__
124.78 -static double pone(double), qone(double);
124.79 -#else
124.80 -static double pone(), qone();
124.81 -#endif
124.82 -
124.83 -#ifdef __STDC__
124.84 -static const double
124.85 -#else
124.86 -static double
124.87 -#endif
124.88 -huge = 1e300,
124.89 -one = 1.0,
124.90 -invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
124.91 -tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
124.92 - /* R0/S0 on [0,2] */
124.93 -r00 = -6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */
124.94 -r01 = 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */
124.95 -r02 = -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */
124.96 -r03 = 4.96727999609584448412e-08, /* 0x3E6AAAFA, 0x46CA0BD9 */
124.97 -s01 = 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */
124.98 -s02 = 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */
124.99 -s03 = 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */
124.100 -s04 = 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */
124.101 -s05 = 1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */
124.102 -
124.103 -static double zero = 0.0;
124.104 -
124.105 -#ifdef __STDC__
124.106 - double __ieee754_j1(double x)
124.107 -#else
124.108 - double __ieee754_j1(x)
124.109 - double x;
124.110 -#endif
124.111 -{
124.112 - double z, s,c,ss,cc,r,u,v,y;
124.113 - int hx,ix;
124.114 -
124.115 - hx = __HI(x);
124.116 - ix = hx&0x7fffffff;
124.117 - if(ix>=0x7ff00000) return one/x;
124.118 - y = fabs(x);
124.119 - if(ix >= 0x40000000) { /* |x| >= 2.0 */
124.120 - s = sin(y);
124.121 - c = cos(y);
124.122 - ss = -s-c;
124.123 - cc = s-c;
124.124 - if(ix<0x7fe00000) { /* make sure y+y not overflow */
124.125 - z = cos(y+y);
124.126 - if ((s*c)>zero) cc = z/ss;
124.127 - else ss = z/cc;
124.128 - }
124.129 - /*
124.130 - * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
124.131 - * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
124.132 - */
124.133 - if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(y);
124.134 - else {
124.135 - u = pone(y); v = qone(y);
124.136 - z = invsqrtpi*(u*cc-v*ss)/sqrt(y);
124.137 - }
124.138 - if(hx<0) return -z;
124.139 - else return z;
124.140 - }
124.141 - if(ix<0x3e400000) { /* |x|<2**-27 */
124.142 - if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
124.143 - }
124.144 - z = x*x;
124.145 - r = z*(r00+z*(r01+z*(r02+z*r03)));
124.146 - s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05))));
124.147 - r *= x;
124.148 - return(x*0.5+r/s);
124.149 -}
124.150 -
124.151 -#ifdef __STDC__
124.152 -static const double U0[5] = {
124.153 -#else
124.154 -static double U0[5] = {
124.155 -#endif
124.156 - -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */
124.157 - 5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */
124.158 - -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */
124.159 - 2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */
124.160 - -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */
124.161 -};
124.162 -#ifdef __STDC__
124.163 -static const double V0[5] = {
124.164 -#else
124.165 -static double V0[5] = {
124.166 -#endif
124.167 - 1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */
124.168 - 2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */
124.169 - 1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */
124.170 - 6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */
124.171 - 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */
124.172 -};
124.173 -
124.174 -#ifdef __STDC__
124.175 - double __ieee754_y1(double x)
124.176 -#else
124.177 - double __ieee754_y1(x)
124.178 - double x;
124.179 -#endif
124.180 -{
124.181 - double z, s,c,ss,cc,u,v;
124.182 - int hx,ix,lx;
124.183 -
124.184 - hx = __HI(x);
124.185 - ix = 0x7fffffff&hx;
124.186 - lx = __LO(x);
124.187 - /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
124.188 - if(ix>=0x7ff00000) return one/(x+x*x);
124.189 - if((ix|lx)==0) return -one/zero;
124.190 - if(hx<0) return zero/zero;
124.191 - if(ix >= 0x40000000) { /* |x| >= 2.0 */
124.192 - s = sin(x);
124.193 - c = cos(x);
124.194 - ss = -s-c;
124.195 - cc = s-c;
124.196 - if(ix<0x7fe00000) { /* make sure x+x not overflow */
124.197 - z = cos(x+x);
124.198 - if ((s*c)>zero) cc = z/ss;
124.199 - else ss = z/cc;
124.200 - }
124.201 - /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
124.202 - * where x0 = x-3pi/4
124.203 - * Better formula:
124.204 - * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
124.205 - * = 1/sqrt(2) * (sin(x) - cos(x))
124.206 - * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
124.207 - * = -1/sqrt(2) * (cos(x) + sin(x))
124.208 - * To avoid cancellation, use
124.209 - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
124.210 - * to compute the worse one.
124.211 - */
124.212 - if(ix>0x48000000) z = (invsqrtpi*ss)/sqrt(x);
124.213 - else {
124.214 - u = pone(x); v = qone(x);
124.215 - z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
124.216 - }
124.217 - return z;
124.218 - }
124.219 - if(ix<=0x3c900000) { /* x < 2**-54 */
124.220 - return(-tpi/x);
124.221 - }
124.222 - z = x*x;
124.223 - u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
124.224 - v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
124.225 - return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
124.226 -}
124.227 -
124.228 -/* For x >= 8, the asymptotic expansions of pone is
124.229 - * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x.
124.230 - * We approximate pone by
124.231 - * pone(x) = 1 + (R/S)
124.232 - * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10
124.233 - * S = 1 + ps0*s^2 + ... + ps4*s^10
124.234 - * and
124.235 - * | pone(x)-1-R/S | <= 2 ** ( -60.06)
124.236 - */
124.237 -
124.238 -#ifdef __STDC__
124.239 -static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
124.240 -#else
124.241 -static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
124.242 -#endif
124.243 - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
124.244 - 1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */
124.245 - 1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */
124.246 - 4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */
124.247 - 3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */
124.248 - 7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */
124.249 -};
124.250 -#ifdef __STDC__
124.251 -static const double ps8[5] = {
124.252 -#else
124.253 -static double ps8[5] = {
124.254 -#endif
124.255 - 1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */
124.256 - 3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */
124.257 - 3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */
124.258 - 9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */
124.259 - 3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */
124.260 -};
124.261 -
124.262 -#ifdef __STDC__
124.263 -static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
124.264 -#else
124.265 -static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
124.266 -#endif
124.267 - 1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */
124.268 - 1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */
124.269 - 6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */
124.270 - 1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */
124.271 - 5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */
124.272 - 5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */
124.273 -};
124.274 -#ifdef __STDC__
124.275 -static const double ps5[5] = {
124.276 -#else
124.277 -static double ps5[5] = {
124.278 -#endif
124.279 - 5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */
124.280 - 9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */
124.281 - 5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */
124.282 - 7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */
124.283 - 1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */
124.284 -};
124.285 -
124.286 -#ifdef __STDC__
124.287 -static const double pr3[6] = {
124.288 -#else
124.289 -static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
124.290 -#endif
124.291 - 3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */
124.292 - 1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */
124.293 - 3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */
124.294 - 3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */
124.295 - 9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */
124.296 - 4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */
124.297 -};
124.298 -#ifdef __STDC__
124.299 -static const double ps3[5] = {
124.300 -#else
124.301 -static double ps3[5] = {
124.302 -#endif
124.303 - 3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */
124.304 - 3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */
124.305 - 1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */
124.306 - 8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */
124.307 - 1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */
124.308 -};
124.309 -
124.310 -#ifdef __STDC__
124.311 -static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
124.312 -#else
124.313 -static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
124.314 -#endif
124.315 - 1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */
124.316 - 1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */
124.317 - 2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */
124.318 - 1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */
124.319 - 1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */
124.320 - 5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */
124.321 -};
124.322 -#ifdef __STDC__
124.323 -static const double ps2[5] = {
124.324 -#else
124.325 -static double ps2[5] = {
124.326 -#endif
124.327 - 2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */
124.328 - 1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */
124.329 - 2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */
124.330 - 1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */
124.331 - 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */
124.332 -};
124.333 -
124.334 -#ifdef __STDC__
124.335 - static double pone(double x)
124.336 -#else
124.337 - static double pone(x)
124.338 - double x;
124.339 -#endif
124.340 -{
124.341 -#ifdef __STDC__
124.342 - const double *p=(void*)0,*q=(void*)0;
124.343 -#else
124.344 - double *p,*q;
124.345 -#endif
124.346 - double z,r,s;
124.347 - int ix;
124.348 - ix = 0x7fffffff&__HI(x);
124.349 - if(ix>=0x40200000) {p = pr8; q= ps8;}
124.350 - else if(ix>=0x40122E8B){p = pr5; q= ps5;}
124.351 - else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
124.352 - else if(ix>=0x40000000){p = pr2; q= ps2;}
124.353 - z = one/(x*x);
124.354 - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
124.355 - s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
124.356 - return one+ r/s;
124.357 -}
124.358 -
124.359 -
124.360 -/* For x >= 8, the asymptotic expansions of qone is
124.361 - * 3/8 s - 105/1024 s^3 - ..., where s = 1/x.
124.362 - * We approximate pone by
124.363 - * qone(x) = s*(0.375 + (R/S))
124.364 - * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10
124.365 - * S = 1 + qs1*s^2 + ... + qs6*s^12
124.366 - * and
124.367 - * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13)
124.368 - */
124.369 -
124.370 -#ifdef __STDC__
124.371 -static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
124.372 -#else
124.373 -static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
124.374 -#endif
124.375 - 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */
124.376 - -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */
124.377 - -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */
124.378 - -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */
124.379 - -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */
124.380 - -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */
124.381 -};
124.382 -#ifdef __STDC__
124.383 -static const double qs8[6] = {
124.384 -#else
124.385 -static double qs8[6] = {
124.386 -#endif
124.387 - 1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */
124.388 - 7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */
124.389 - 1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */
124.390 - 7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */
124.391 - 6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */
124.392 - -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */
124.393 -};
124.394 -
124.395 -#ifdef __STDC__
124.396 -static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
124.397 -#else
124.398 -static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
124.399 -#endif
124.400 - -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */
124.401 - -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */
124.402 - -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */
124.403 - -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */
124.404 - -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */
124.405 - -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */
124.406 -};
124.407 -#ifdef __STDC__
124.408 -static const double qs5[6] = {
124.409 -#else
124.410 -static double qs5[6] = {
124.411 -#endif
124.412 - 8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */
124.413 - 1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */
124.414 - 1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */
124.415 - 4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */
124.416 - 2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */
124.417 - -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */
124.418 -};
124.419 -
124.420 -#ifdef __STDC__
124.421 -static const double qr3[6] = {
124.422 -#else
124.423 -static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
124.424 -#endif
124.425 - -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */
124.426 - -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */
124.427 - -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */
124.428 - -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */
124.429 - -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */
124.430 - -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */
124.431 -};
124.432 -#ifdef __STDC__
124.433 -static const double qs3[6] = {
124.434 -#else
124.435 -static double qs3[6] = {
124.436 -#endif
124.437 - 4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */
124.438 - 6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */
124.439 - 3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */
124.440 - 5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */
124.441 - 1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */
124.442 - -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */
124.443 -};
124.444 -
124.445 -#ifdef __STDC__
124.446 -static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
124.447 -#else
124.448 -static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
124.449 -#endif
124.450 - -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */
124.451 - -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */
124.452 - -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */
124.453 - -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */
124.454 - -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */
124.455 - -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */
124.456 -};
124.457 -#ifdef __STDC__
124.458 -static const double qs2[6] = {
124.459 -#else
124.460 -static double qs2[6] = {
124.461 -#endif
124.462 - 2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */
124.463 - 2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */
124.464 - 7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */
124.465 - 7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */
124.466 - 1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */
124.467 - -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */
124.468 -};
124.469 -
124.470 -#ifdef __STDC__
124.471 - static double qone(double x)
124.472 -#else
124.473 - static double qone(x)
124.474 - double x;
124.475 -#endif
124.476 -{
124.477 -#ifdef __STDC__
124.478 - const double *p=(void*)0,*q=(void*)0;
124.479 -#else
124.480 - double *p,*q;
124.481 -#endif
124.482 - double s,r,z;
124.483 - int ix;
124.484 - ix = 0x7fffffff&__HI(x);
124.485 - if(ix>=0x40200000) {p = qr8; q= qs8;}
124.486 - else if(ix>=0x40122E8B){p = qr5; q= qs5;}
124.487 - else if(ix>=0x4006DB6D){p = qr3; q= qs3;}
124.488 - else if(ix>=0x40000000){p = qr2; q= qs2;}
124.489 - z = one/(x*x);
124.490 - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
124.491 - s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
124.492 - return (.375 + r/s)/x;
124.493 -}
125.1 --- a/src/share/native/java/lang/fdlibm/src/e_jn.c Fri Aug 05 15:35:04 2011 -0700
125.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
125.3 @@ -1,285 +0,0 @@
125.4 -
125.5 -/*
125.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
125.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
125.8 - *
125.9 - * This code is free software; you can redistribute it and/or modify it
125.10 - * under the terms of the GNU General Public License version 2 only, as
125.11 - * published by the Free Software Foundation. Oracle designates this
125.12 - * particular file as subject to the "Classpath" exception as provided
125.13 - * by Oracle in the LICENSE file that accompanied this code.
125.14 - *
125.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
125.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
125.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
125.18 - * version 2 for more details (a copy is included in the LICENSE file that
125.19 - * accompanied this code).
125.20 - *
125.21 - * You should have received a copy of the GNU General Public License version
125.22 - * 2 along with this work; if not, write to the Free Software Foundation,
125.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
125.24 - *
125.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
125.26 - * or visit www.oracle.com if you need additional information or have any
125.27 - * questions.
125.28 - */
125.29 -
125.30 -/*
125.31 - * __ieee754_jn(n, x), __ieee754_yn(n, x)
125.32 - * floating point Bessel's function of the 1st and 2nd kind
125.33 - * of order n
125.34 - *
125.35 - * Special cases:
125.36 - * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
125.37 - * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
125.38 - * Note 2. About jn(n,x), yn(n,x)
125.39 - * For n=0, j0(x) is called,
125.40 - * for n=1, j1(x) is called,
125.41 - * for n<x, forward recursion us used starting
125.42 - * from values of j0(x) and j1(x).
125.43 - * for n>x, a continued fraction approximation to
125.44 - * j(n,x)/j(n-1,x) is evaluated and then backward
125.45 - * recursion is used starting from a supposed value
125.46 - * for j(n,x). The resulting value of j(0,x) is
125.47 - * compared with the actual value to correct the
125.48 - * supposed value of j(n,x).
125.49 - *
125.50 - * yn(n,x) is similar in all respects, except
125.51 - * that forward recursion is used for all
125.52 - * values of n>1.
125.53 - *
125.54 - */
125.55 -
125.56 -#include "fdlibm.h"
125.57 -
125.58 -#ifdef __STDC__
125.59 -static const double
125.60 -#else
125.61 -static double
125.62 -#endif
125.63 -invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
125.64 -two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
125.65 -one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
125.66 -
125.67 -static double zero = 0.00000000000000000000e+00;
125.68 -
125.69 -#ifdef __STDC__
125.70 - double __ieee754_jn(int n, double x)
125.71 -#else
125.72 - double __ieee754_jn(n,x)
125.73 - int n; double x;
125.74 -#endif
125.75 -{
125.76 - int i,hx,ix,lx, sgn;
125.77 - double a, b, temp = 0, di;
125.78 - double z, w;
125.79 -
125.80 - /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
125.81 - * Thus, J(-n,x) = J(n,-x)
125.82 - */
125.83 - hx = __HI(x);
125.84 - ix = 0x7fffffff&hx;
125.85 - lx = __LO(x);
125.86 - /* if J(n,NaN) is NaN */
125.87 - if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
125.88 - if(n<0){
125.89 - n = -n;
125.90 - x = -x;
125.91 - hx ^= 0x80000000;
125.92 - }
125.93 - if(n==0) return(__ieee754_j0(x));
125.94 - if(n==1) return(__ieee754_j1(x));
125.95 - sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
125.96 - x = fabs(x);
125.97 - if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */
125.98 - b = zero;
125.99 - else if((double)n<=x) {
125.100 - /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
125.101 - if(ix>=0x52D00000) { /* x > 2**302 */
125.102 - /* (x >> n**2)
125.103 - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
125.104 - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
125.105 - * Let s=sin(x), c=cos(x),
125.106 - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
125.107 - *
125.108 - * n sin(xn)*sqt2 cos(xn)*sqt2
125.109 - * ----------------------------------
125.110 - * 0 s-c c+s
125.111 - * 1 -s-c -c+s
125.112 - * 2 -s+c -c-s
125.113 - * 3 s+c c-s
125.114 - */
125.115 - switch(n&3) {
125.116 - case 0: temp = cos(x)+sin(x); break;
125.117 - case 1: temp = -cos(x)+sin(x); break;
125.118 - case 2: temp = -cos(x)-sin(x); break;
125.119 - case 3: temp = cos(x)-sin(x); break;
125.120 - }
125.121 - b = invsqrtpi*temp/sqrt(x);
125.122 - } else {
125.123 - a = __ieee754_j0(x);
125.124 - b = __ieee754_j1(x);
125.125 - for(i=1;i<n;i++){
125.126 - temp = b;
125.127 - b = b*((double)(i+i)/x) - a; /* avoid underflow */
125.128 - a = temp;
125.129 - }
125.130 - }
125.131 - } else {
125.132 - if(ix<0x3e100000) { /* x < 2**-29 */
125.133 - /* x is tiny, return the first Taylor expansion of J(n,x)
125.134 - * J(n,x) = 1/n!*(x/2)^n - ...
125.135 - */
125.136 - if(n>33) /* underflow */
125.137 - b = zero;
125.138 - else {
125.139 - temp = x*0.5; b = temp;
125.140 - for (a=one,i=2;i<=n;i++) {
125.141 - a *= (double)i; /* a = n! */
125.142 - b *= temp; /* b = (x/2)^n */
125.143 - }
125.144 - b = b/a;
125.145 - }
125.146 - } else {
125.147 - /* use backward recurrence */
125.148 - /* x x^2 x^2
125.149 - * J(n,x)/J(n-1,x) = ---- ------ ------ .....
125.150 - * 2n - 2(n+1) - 2(n+2)
125.151 - *
125.152 - * 1 1 1
125.153 - * (for large x) = ---- ------ ------ .....
125.154 - * 2n 2(n+1) 2(n+2)
125.155 - * -- - ------ - ------ -
125.156 - * x x x
125.157 - *
125.158 - * Let w = 2n/x and h=2/x, then the above quotient
125.159 - * is equal to the continued fraction:
125.160 - * 1
125.161 - * = -----------------------
125.162 - * 1
125.163 - * w - -----------------
125.164 - * 1
125.165 - * w+h - ---------
125.166 - * w+2h - ...
125.167 - *
125.168 - * To determine how many terms needed, let
125.169 - * Q(0) = w, Q(1) = w(w+h) - 1,
125.170 - * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
125.171 - * When Q(k) > 1e4 good for single
125.172 - * When Q(k) > 1e9 good for double
125.173 - * When Q(k) > 1e17 good for quadruple
125.174 - */
125.175 - /* determine k */
125.176 - double t,v;
125.177 - double q0,q1,h,tmp; int k,m;
125.178 - w = (n+n)/(double)x; h = 2.0/(double)x;
125.179 - q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
125.180 - while(q1<1.0e9) {
125.181 - k += 1; z += h;
125.182 - tmp = z*q1 - q0;
125.183 - q0 = q1;
125.184 - q1 = tmp;
125.185 - }
125.186 - m = n+n;
125.187 - for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
125.188 - a = t;
125.189 - b = one;
125.190 - /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
125.191 - * Hence, if n*(log(2n/x)) > ...
125.192 - * single 8.8722839355e+01
125.193 - * double 7.09782712893383973096e+02
125.194 - * long double 1.1356523406294143949491931077970765006170e+04
125.195 - * then recurrent value may overflow and the result is
125.196 - * likely underflow to zero
125.197 - */
125.198 - tmp = n;
125.199 - v = two/x;
125.200 - tmp = tmp*__ieee754_log(fabs(v*tmp));
125.201 - if(tmp<7.09782712893383973096e+02) {
125.202 - for(i=n-1,di=(double)(i+i);i>0;i--){
125.203 - temp = b;
125.204 - b *= di;
125.205 - b = b/x - a;
125.206 - a = temp;
125.207 - di -= two;
125.208 - }
125.209 - } else {
125.210 - for(i=n-1,di=(double)(i+i);i>0;i--){
125.211 - temp = b;
125.212 - b *= di;
125.213 - b = b/x - a;
125.214 - a = temp;
125.215 - di -= two;
125.216 - /* scale b to avoid spurious overflow */
125.217 - if(b>1e100) {
125.218 - a /= b;
125.219 - t /= b;
125.220 - b = one;
125.221 - }
125.222 - }
125.223 - }
125.224 - b = (t*__ieee754_j0(x)/b);
125.225 - }
125.226 - }
125.227 - if(sgn==1) return -b; else return b;
125.228 -}
125.229 -
125.230 -#ifdef __STDC__
125.231 - double __ieee754_yn(int n, double x)
125.232 -#else
125.233 - double __ieee754_yn(n,x)
125.234 - int n; double x;
125.235 -#endif
125.236 -{
125.237 - int i,hx,ix,lx;
125.238 - int sign;
125.239 - double a, b, temp = 0;
125.240 -
125.241 - hx = __HI(x);
125.242 - ix = 0x7fffffff&hx;
125.243 - lx = __LO(x);
125.244 - /* if Y(n,NaN) is NaN */
125.245 - if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
125.246 - if((ix|lx)==0) return -one/zero;
125.247 - if(hx<0) return zero/zero;
125.248 - sign = 1;
125.249 - if(n<0){
125.250 - n = -n;
125.251 - sign = 1 - ((n&1)<<1);
125.252 - }
125.253 - if(n==0) return(__ieee754_y0(x));
125.254 - if(n==1) return(sign*__ieee754_y1(x));
125.255 - if(ix==0x7ff00000) return zero;
125.256 - if(ix>=0x52D00000) { /* x > 2**302 */
125.257 - /* (x >> n**2)
125.258 - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
125.259 - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
125.260 - * Let s=sin(x), c=cos(x),
125.261 - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
125.262 - *
125.263 - * n sin(xn)*sqt2 cos(xn)*sqt2
125.264 - * ----------------------------------
125.265 - * 0 s-c c+s
125.266 - * 1 -s-c -c+s
125.267 - * 2 -s+c -c-s
125.268 - * 3 s+c c-s
125.269 - */
125.270 - switch(n&3) {
125.271 - case 0: temp = sin(x)-cos(x); break;
125.272 - case 1: temp = -sin(x)-cos(x); break;
125.273 - case 2: temp = -sin(x)+cos(x); break;
125.274 - case 3: temp = sin(x)+cos(x); break;
125.275 - }
125.276 - b = invsqrtpi*temp/sqrt(x);
125.277 - } else {
125.278 - a = __ieee754_y0(x);
125.279 - b = __ieee754_y1(x);
125.280 - /* quit if b is -inf */
125.281 - for(i=1;i<n&&(__HI(b) != 0xfff00000);i++){
125.282 - temp = b;
125.283 - b = ((double)(i+i)/x)*b - a;
125.284 - a = temp;
125.285 - }
125.286 - }
125.287 - if(sign>0) return b; else return -b;
125.288 -}
126.1 --- a/src/share/native/java/lang/fdlibm/src/e_lgamma.c Fri Aug 05 15:35:04 2011 -0700
126.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
126.3 @@ -1,45 +0,0 @@
126.4 -
126.5 -/*
126.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
126.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
126.8 - *
126.9 - * This code is free software; you can redistribute it and/or modify it
126.10 - * under the terms of the GNU General Public License version 2 only, as
126.11 - * published by the Free Software Foundation. Oracle designates this
126.12 - * particular file as subject to the "Classpath" exception as provided
126.13 - * by Oracle in the LICENSE file that accompanied this code.
126.14 - *
126.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
126.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
126.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
126.18 - * version 2 for more details (a copy is included in the LICENSE file that
126.19 - * accompanied this code).
126.20 - *
126.21 - * You should have received a copy of the GNU General Public License version
126.22 - * 2 along with this work; if not, write to the Free Software Foundation,
126.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
126.24 - *
126.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
126.26 - * or visit www.oracle.com if you need additional information or have any
126.27 - * questions.
126.28 - */
126.29 -
126.30 -/* __ieee754_lgamma(x)
126.31 - * Return the logarithm of the Gamma function of x.
126.32 - *
126.33 - * Method: call __ieee754_lgamma_r
126.34 - */
126.35 -
126.36 -#include "fdlibm.h"
126.37 -
126.38 -extern int signgam;
126.39 -
126.40 -#ifdef __STDC__
126.41 - double __ieee754_lgamma(double x)
126.42 -#else
126.43 - double __ieee754_lgamma(x)
126.44 - double x;
126.45 -#endif
126.46 -{
126.47 - return __ieee754_lgamma_r(x,&signgam);
126.48 -}
127.1 --- a/src/share/native/java/lang/fdlibm/src/e_lgamma_r.c Fri Aug 05 15:35:04 2011 -0700
127.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
127.3 @@ -1,316 +0,0 @@
127.4 -
127.5 -/*
127.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
127.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
127.8 - *
127.9 - * This code is free software; you can redistribute it and/or modify it
127.10 - * under the terms of the GNU General Public License version 2 only, as
127.11 - * published by the Free Software Foundation. Oracle designates this
127.12 - * particular file as subject to the "Classpath" exception as provided
127.13 - * by Oracle in the LICENSE file that accompanied this code.
127.14 - *
127.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
127.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
127.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
127.18 - * version 2 for more details (a copy is included in the LICENSE file that
127.19 - * accompanied this code).
127.20 - *
127.21 - * You should have received a copy of the GNU General Public License version
127.22 - * 2 along with this work; if not, write to the Free Software Foundation,
127.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
127.24 - *
127.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
127.26 - * or visit www.oracle.com if you need additional information or have any
127.27 - * questions.
127.28 - */
127.29 -
127.30 -/* __ieee754_lgamma_r(x, signgamp)
127.31 - * Reentrant version of the logarithm of the Gamma function
127.32 - * with user provide pointer for the sign of Gamma(x).
127.33 - *
127.34 - * Method:
127.35 - * 1. Argument Reduction for 0 < x <= 8
127.36 - * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
127.37 - * reduce x to a number in [1.5,2.5] by
127.38 - * lgamma(1+s) = log(s) + lgamma(s)
127.39 - * for example,
127.40 - * lgamma(7.3) = log(6.3) + lgamma(6.3)
127.41 - * = log(6.3*5.3) + lgamma(5.3)
127.42 - * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)
127.43 - * 2. Polynomial approximation of lgamma around its
127.44 - * minimun ymin=1.461632144968362245 to maintain monotonicity.
127.45 - * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use
127.46 - * Let z = x-ymin;
127.47 - * lgamma(x) = -1.214862905358496078218 + z^2*poly(z)
127.48 - * where
127.49 - * poly(z) is a 14 degree polynomial.
127.50 - * 2. Rational approximation in the primary interval [2,3]
127.51 - * We use the following approximation:
127.52 - * s = x-2.0;
127.53 - * lgamma(x) = 0.5*s + s*P(s)/Q(s)
127.54 - * with accuracy
127.55 - * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71
127.56 - * Our algorithms are based on the following observation
127.57 - *
127.58 - * zeta(2)-1 2 zeta(3)-1 3
127.59 - * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ...
127.60 - * 2 3
127.61 - *
127.62 - * where Euler = 0.5771... is the Euler constant, which is very
127.63 - * close to 0.5.
127.64 - *
127.65 - * 3. For x>=8, we have
127.66 - * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+....
127.67 - * (better formula:
127.68 - * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...)
127.69 - * Let z = 1/x, then we approximation
127.70 - * f(z) = lgamma(x) - (x-0.5)(log(x)-1)
127.71 - * by
127.72 - * 3 5 11
127.73 - * w = w0 + w1*z + w2*z + w3*z + ... + w6*z
127.74 - * where
127.75 - * |w - f(z)| < 2**-58.74
127.76 - *
127.77 - * 4. For negative x, since (G is gamma function)
127.78 - * -x*G(-x)*G(x) = pi/sin(pi*x),
127.79 - * we have
127.80 - * G(x) = pi/(sin(pi*x)*(-x)*G(-x))
127.81 - * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0
127.82 - * Hence, for x<0, signgam = sign(sin(pi*x)) and
127.83 - * lgamma(x) = log(|Gamma(x)|)
127.84 - * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x);
127.85 - * Note: one should avoid compute pi*(-x) directly in the
127.86 - * computation of sin(pi*(-x)).
127.87 - *
127.88 - * 5. Special Cases
127.89 - * lgamma(2+s) ~ s*(1-Euler) for tiny s
127.90 - * lgamma(1)=lgamma(2)=0
127.91 - * lgamma(x) ~ -log(x) for tiny x
127.92 - * lgamma(0) = lgamma(inf) = inf
127.93 - * lgamma(-integer) = +-inf
127.94 - *
127.95 - */
127.96 -
127.97 -#include "fdlibm.h"
127.98 -
127.99 -#ifdef __STDC__
127.100 -static const double
127.101 -#else
127.102 -static double
127.103 -#endif
127.104 -two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
127.105 -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
127.106 -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
127.107 -pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
127.108 -a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */
127.109 -a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */
127.110 -a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */
127.111 -a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */
127.112 -a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */
127.113 -a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */
127.114 -a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */
127.115 -a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */
127.116 -a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */
127.117 -a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */
127.118 -a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */
127.119 -a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */
127.120 -tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */
127.121 -tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */
127.122 -/* tt = -(tail of tf) */
127.123 -tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */
127.124 -t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */
127.125 -t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */
127.126 -t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */
127.127 -t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */
127.128 -t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */
127.129 -t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */
127.130 -t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */
127.131 -t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */
127.132 -t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */
127.133 -t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */
127.134 -t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */
127.135 -t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */
127.136 -t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */
127.137 -t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */
127.138 -t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */
127.139 -u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */
127.140 -u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */
127.141 -u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */
127.142 -u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */
127.143 -u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */
127.144 -u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */
127.145 -v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */
127.146 -v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */
127.147 -v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */
127.148 -v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */
127.149 -v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */
127.150 -s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */
127.151 -s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */
127.152 -s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */
127.153 -s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */
127.154 -s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */
127.155 -s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */
127.156 -s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */
127.157 -r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */
127.158 -r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */
127.159 -r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */
127.160 -r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */
127.161 -r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */
127.162 -r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */
127.163 -w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */
127.164 -w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */
127.165 -w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */
127.166 -w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */
127.167 -w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */
127.168 -w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */
127.169 -w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */
127.170 -
127.171 -static double zero= 0.00000000000000000000e+00;
127.172 -
127.173 -#ifdef __STDC__
127.174 - static double sin_pi(double x)
127.175 -#else
127.176 - static double sin_pi(x)
127.177 - double x;
127.178 -#endif
127.179 -{
127.180 - double y,z;
127.181 - int n,ix;
127.182 -
127.183 - ix = 0x7fffffff&__HI(x);
127.184 -
127.185 - if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0);
127.186 - y = -x; /* x is assume negative */
127.187 -
127.188 - /*
127.189 - * argument reduction, make sure inexact flag not raised if input
127.190 - * is an integer
127.191 - */
127.192 - z = floor(y);
127.193 - if(z!=y) { /* inexact anyway */
127.194 - y *= 0.5;
127.195 - y = 2.0*(y - floor(y)); /* y = |x| mod 2.0 */
127.196 - n = (int) (y*4.0);
127.197 - } else {
127.198 - if(ix>=0x43400000) {
127.199 - y = zero; n = 0; /* y must be even */
127.200 - } else {
127.201 - if(ix<0x43300000) z = y+two52; /* exact */
127.202 - n = __LO(z)&1; /* lower word of z */
127.203 - y = n;
127.204 - n<<= 2;
127.205 - }
127.206 - }
127.207 - switch (n) {
127.208 - case 0: y = __kernel_sin(pi*y,zero,0); break;
127.209 - case 1:
127.210 - case 2: y = __kernel_cos(pi*(0.5-y),zero); break;
127.211 - case 3:
127.212 - case 4: y = __kernel_sin(pi*(one-y),zero,0); break;
127.213 - case 5:
127.214 - case 6: y = -__kernel_cos(pi*(y-1.5),zero); break;
127.215 - default: y = __kernel_sin(pi*(y-2.0),zero,0); break;
127.216 - }
127.217 - return -y;
127.218 -}
127.219 -
127.220 -
127.221 -#ifdef __STDC__
127.222 - double __ieee754_lgamma_r(double x, int *signgamp)
127.223 -#else
127.224 - double __ieee754_lgamma_r(x,signgamp)
127.225 - double x; int *signgamp;
127.226 -#endif
127.227 -{
127.228 - double t,y,z,nadj=0,p,p1,p2,p3,q,r,w;
127.229 - int i,hx,lx,ix;
127.230 -
127.231 - hx = __HI(x);
127.232 - lx = __LO(x);
127.233 -
127.234 - /* purge off +-inf, NaN, +-0, and negative arguments */
127.235 - *signgamp = 1;
127.236 - ix = hx&0x7fffffff;
127.237 - if(ix>=0x7ff00000) return x*x;
127.238 - if((ix|lx)==0) return one/zero;
127.239 - if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
127.240 - if(hx<0) {
127.241 - *signgamp = -1;
127.242 - return -__ieee754_log(-x);
127.243 - } else return -__ieee754_log(x);
127.244 - }
127.245 - if(hx<0) {
127.246 - if(ix>=0x43300000) /* |x|>=2**52, must be -integer */
127.247 - return one/zero;
127.248 - t = sin_pi(x);
127.249 - if(t==zero) return one/zero; /* -integer */
127.250 - nadj = __ieee754_log(pi/fabs(t*x));
127.251 - if(t<zero) *signgamp = -1;
127.252 - x = -x;
127.253 - }
127.254 -
127.255 - /* purge off 1 and 2 */
127.256 - if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0;
127.257 - /* for x < 2.0 */
127.258 - else if(ix<0x40000000) {
127.259 - if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */
127.260 - r = -__ieee754_log(x);
127.261 - if(ix>=0x3FE76944) {y = one-x; i= 0;}
127.262 - else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;}
127.263 - else {y = x; i=2;}
127.264 - } else {
127.265 - r = zero;
127.266 - if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */
127.267 - else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */
127.268 - else {y=x-one;i=2;}
127.269 - }
127.270 - switch(i) {
127.271 - case 0:
127.272 - z = y*y;
127.273 - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10))));
127.274 - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11)))));
127.275 - p = y*p1+p2;
127.276 - r += (p-0.5*y); break;
127.277 - case 1:
127.278 - z = y*y;
127.279 - w = z*y;
127.280 - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */
127.281 - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13)));
127.282 - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
127.283 - p = z*p1-(tt-w*(p2+y*p3));
127.284 - r += (tf + p); break;
127.285 - case 2:
127.286 - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
127.287 - p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
127.288 - r += (-0.5*y + p1/p2);
127.289 - }
127.290 - }
127.291 - else if(ix<0x40200000) { /* x < 8.0 */
127.292 - i = (int)x;
127.293 - t = zero;
127.294 - y = x-(double)i;
127.295 - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6))))));
127.296 - q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6)))));
127.297 - r = half*y+p/q;
127.298 - z = one; /* lgamma(1+s) = log(s) + lgamma(s) */
127.299 - switch(i) {
127.300 - case 7: z *= (y+6.0); /* FALLTHRU */
127.301 - case 6: z *= (y+5.0); /* FALLTHRU */
127.302 - case 5: z *= (y+4.0); /* FALLTHRU */
127.303 - case 4: z *= (y+3.0); /* FALLTHRU */
127.304 - case 3: z *= (y+2.0); /* FALLTHRU */
127.305 - r += __ieee754_log(z); break;
127.306 - }
127.307 - /* 8.0 <= x < 2**58 */
127.308 - } else if (ix < 0x43900000) {
127.309 - t = __ieee754_log(x);
127.310 - z = one/x;
127.311 - y = z*z;
127.312 - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
127.313 - r = (x-half)*(t-one)+w;
127.314 - } else
127.315 - /* 2**58 <= x <= inf */
127.316 - r = x*(__ieee754_log(x)-one);
127.317 - if(hx<0) r = nadj - r;
127.318 - return r;
127.319 -}
128.1 --- a/src/share/native/java/lang/fdlibm/src/s_asinh.c Fri Aug 05 15:35:04 2011 -0700
128.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
128.3 @@ -1,74 +0,0 @@
128.4 -
128.5 -/*
128.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
128.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
128.8 - *
128.9 - * This code is free software; you can redistribute it and/or modify it
128.10 - * under the terms of the GNU General Public License version 2 only, as
128.11 - * published by the Free Software Foundation. Oracle designates this
128.12 - * particular file as subject to the "Classpath" exception as provided
128.13 - * by Oracle in the LICENSE file that accompanied this code.
128.14 - *
128.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
128.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
128.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
128.18 - * version 2 for more details (a copy is included in the LICENSE file that
128.19 - * accompanied this code).
128.20 - *
128.21 - * You should have received a copy of the GNU General Public License version
128.22 - * 2 along with this work; if not, write to the Free Software Foundation,
128.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
128.24 - *
128.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
128.26 - * or visit www.oracle.com if you need additional information or have any
128.27 - * questions.
128.28 - */
128.29 -
128.30 -/* asinh(x)
128.31 - * Method :
128.32 - * Based on
128.33 - * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
128.34 - * we have
128.35 - * asinh(x) := x if 1+x*x=1,
128.36 - * := sign(x)*(log(x)+ln2)) for large |x|, else
128.37 - * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
128.38 - * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
128.39 - */
128.40 -
128.41 -#include "fdlibm.h"
128.42 -
128.43 -#ifdef __STDC__
128.44 -static const double
128.45 -#else
128.46 -static double
128.47 -#endif
128.48 -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
128.49 -ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
128.50 -huge= 1.00000000000000000000e+300;
128.51 -
128.52 -#ifdef __STDC__
128.53 - double asinh(double x)
128.54 -#else
128.55 - double asinh(x)
128.56 - double x;
128.57 -#endif
128.58 -{
128.59 - double t,w;
128.60 - int hx,ix;
128.61 - hx = __HI(x);
128.62 - ix = hx&0x7fffffff;
128.63 - if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
128.64 - if(ix< 0x3e300000) { /* |x|<2**-28 */
128.65 - if(huge+x>one) return x; /* return x inexact except 0 */
128.66 - }
128.67 - if(ix>0x41b00000) { /* |x| > 2**28 */
128.68 - w = __ieee754_log(fabs(x))+ln2;
128.69 - } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
128.70 - t = fabs(x);
128.71 - w = __ieee754_log(2.0*t+one/(sqrt(x*x+one)+t));
128.72 - } else { /* 2.0 > |x| > 2**-28 */
128.73 - t = x*x;
128.74 - w =log1p(fabs(x)+t/(one+sqrt(one+t)));
128.75 - }
128.76 - if(hx>0) return w; else return -w;
128.77 -}
129.1 --- a/src/share/native/java/lang/fdlibm/src/s_erf.c Fri Aug 05 15:35:04 2011 -0700
129.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
129.3 @@ -1,323 +0,0 @@
129.4 -
129.5 -/*
129.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
129.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
129.8 - *
129.9 - * This code is free software; you can redistribute it and/or modify it
129.10 - * under the terms of the GNU General Public License version 2 only, as
129.11 - * published by the Free Software Foundation. Oracle designates this
129.12 - * particular file as subject to the "Classpath" exception as provided
129.13 - * by Oracle in the LICENSE file that accompanied this code.
129.14 - *
129.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
129.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
129.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
129.18 - * version 2 for more details (a copy is included in the LICENSE file that
129.19 - * accompanied this code).
129.20 - *
129.21 - * You should have received a copy of the GNU General Public License version
129.22 - * 2 along with this work; if not, write to the Free Software Foundation,
129.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
129.24 - *
129.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
129.26 - * or visit www.oracle.com if you need additional information or have any
129.27 - * questions.
129.28 - */
129.29 -
129.30 -/* double erf(double x)
129.31 - * double erfc(double x)
129.32 - * x
129.33 - * 2 |\
129.34 - * erf(x) = --------- | exp(-t*t)dt
129.35 - * sqrt(pi) \|
129.36 - * 0
129.37 - *
129.38 - * erfc(x) = 1-erf(x)
129.39 - * Note that
129.40 - * erf(-x) = -erf(x)
129.41 - * erfc(-x) = 2 - erfc(x)
129.42 - *
129.43 - * Method:
129.44 - * 1. For |x| in [0, 0.84375]
129.45 - * erf(x) = x + x*R(x^2)
129.46 - * erfc(x) = 1 - erf(x) if x in [-.84375,0.25]
129.47 - * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375]
129.48 - * where R = P/Q where P is an odd poly of degree 8 and
129.49 - * Q is an odd poly of degree 10.
129.50 - * -57.90
129.51 - * | R - (erf(x)-x)/x | <= 2
129.52 - *
129.53 - *
129.54 - * Remark. The formula is derived by noting
129.55 - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
129.56 - * and that
129.57 - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688
129.58 - * is close to one. The interval is chosen because the fix
129.59 - * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is
129.60 - * near 0.6174), and by some experiment, 0.84375 is chosen to
129.61 - * guarantee the error is less than one ulp for erf.
129.62 - *
129.63 - * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and
129.64 - * c = 0.84506291151 rounded to single (24 bits)
129.65 - * erf(x) = sign(x) * (c + P1(s)/Q1(s))
129.66 - * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0
129.67 - * 1+(c+P1(s)/Q1(s)) if x < 0
129.68 - * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06
129.69 - * Remark: here we use the taylor series expansion at x=1.
129.70 - * erf(1+s) = erf(1) + s*Poly(s)
129.71 - * = 0.845.. + P1(s)/Q1(s)
129.72 - * That is, we use rational approximation to approximate
129.73 - * erf(1+s) - (c = (single)0.84506291151)
129.74 - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
129.75 - * where
129.76 - * P1(s) = degree 6 poly in s
129.77 - * Q1(s) = degree 6 poly in s
129.78 - *
129.79 - * 3. For x in [1.25,1/0.35(~2.857143)],
129.80 - * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1)
129.81 - * erf(x) = 1 - erfc(x)
129.82 - * where
129.83 - * R1(z) = degree 7 poly in z, (z=1/x^2)
129.84 - * S1(z) = degree 8 poly in z
129.85 - *
129.86 - * 4. For x in [1/0.35,28]
129.87 - * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0
129.88 - * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6<x<0
129.89 - * = 2.0 - tiny (if x <= -6)
129.90 - * erf(x) = sign(x)*(1.0 - erfc(x)) if x < 6, else
129.91 - * erf(x) = sign(x)*(1.0 - tiny)
129.92 - * where
129.93 - * R2(z) = degree 6 poly in z, (z=1/x^2)
129.94 - * S2(z) = degree 7 poly in z
129.95 - *
129.96 - * Note1:
129.97 - * To compute exp(-x*x-0.5625+R/S), let s be a single
129.98 - * precision number and s := x; then
129.99 - * -x*x = -s*s + (s-x)*(s+x)
129.100 - * exp(-x*x-0.5626+R/S) =
129.101 - * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
129.102 - * Note2:
129.103 - * Here 4 and 5 make use of the asymptotic series
129.104 - * exp(-x*x)
129.105 - * erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
129.106 - * x*sqrt(pi)
129.107 - * We use rational approximation to approximate
129.108 - * g(s)=f(1/x^2) = log(erfc(x)*x) - x*x + 0.5625
129.109 - * Here is the error bound for R1/S1 and R2/S2
129.110 - * |R1/S1 - f(x)| < 2**(-62.57)
129.111 - * |R2/S2 - f(x)| < 2**(-61.52)
129.112 - *
129.113 - * 5. For inf > x >= 28
129.114 - * erf(x) = sign(x) *(1 - tiny) (raise inexact)
129.115 - * erfc(x) = tiny*tiny (raise underflow) if x > 0
129.116 - * = 2 - tiny if x<0
129.117 - *
129.118 - * 7. Special case:
129.119 - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1,
129.120 - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,
129.121 - * erfc/erf(NaN) is NaN
129.122 - */
129.123 -
129.124 -
129.125 -#include "fdlibm.h"
129.126 -
129.127 -#ifdef __STDC__
129.128 -static const double
129.129 -#else
129.130 -static double
129.131 -#endif
129.132 -tiny = 1e-300,
129.133 -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
129.134 -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
129.135 -two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
129.136 - /* c = (float)0.84506291151 */
129.137 -erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */
129.138 -/*
129.139 - * Coefficients for approximation to erf on [0,0.84375]
129.140 - */
129.141 -efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */
129.142 -efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */
129.143 -pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */
129.144 -pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */
129.145 -pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */
129.146 -pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */
129.147 -pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */
129.148 -qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */
129.149 -qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */
129.150 -qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */
129.151 -qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */
129.152 -qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */
129.153 -/*
129.154 - * Coefficients for approximation to erf in [0.84375,1.25]
129.155 - */
129.156 -pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */
129.157 -pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */
129.158 -pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */
129.159 -pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */
129.160 -pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */
129.161 -pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */
129.162 -pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */
129.163 -qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */
129.164 -qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */
129.165 -qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */
129.166 -qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */
129.167 -qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */
129.168 -qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */
129.169 -/*
129.170 - * Coefficients for approximation to erfc in [1.25,1/0.35]
129.171 - */
129.172 -ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */
129.173 -ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */
129.174 -ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */
129.175 -ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */
129.176 -ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */
129.177 -ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */
129.178 -ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */
129.179 -ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */
129.180 -sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */
129.181 -sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */
129.182 -sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */
129.183 -sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */
129.184 -sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */
129.185 -sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */
129.186 -sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */
129.187 -sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */
129.188 -/*
129.189 - * Coefficients for approximation to erfc in [1/.35,28]
129.190 - */
129.191 -rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */
129.192 -rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */
129.193 -rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */
129.194 -rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */
129.195 -rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */
129.196 -rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */
129.197 -rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */
129.198 -sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */
129.199 -sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */
129.200 -sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */
129.201 -sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */
129.202 -sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */
129.203 -sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */
129.204 -sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
129.205 -
129.206 -#ifdef __STDC__
129.207 - double erf(double x)
129.208 -#else
129.209 - double erf(x)
129.210 - double x;
129.211 -#endif
129.212 -{
129.213 - int hx,ix,i;
129.214 - double R,S,P,Q,s,y,z,r;
129.215 - hx = __HI(x);
129.216 - ix = hx&0x7fffffff;
129.217 - if(ix>=0x7ff00000) { /* erf(nan)=nan */
129.218 - i = ((unsigned)hx>>31)<<1;
129.219 - return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
129.220 - }
129.221 -
129.222 - if(ix < 0x3feb0000) { /* |x|<0.84375 */
129.223 - if(ix < 0x3e300000) { /* |x|<2**-28 */
129.224 - if (ix < 0x00800000)
129.225 - return 0.125*(8.0*x+efx8*x); /*avoid underflow */
129.226 - return x + efx*x;
129.227 - }
129.228 - z = x*x;
129.229 - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
129.230 - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
129.231 - y = r/s;
129.232 - return x + x*y;
129.233 - }
129.234 - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
129.235 - s = fabs(x)-one;
129.236 - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
129.237 - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
129.238 - if(hx>=0) return erx + P/Q; else return -erx - P/Q;
129.239 - }
129.240 - if (ix >= 0x40180000) { /* inf>|x|>=6 */
129.241 - if(hx>=0) return one-tiny; else return tiny-one;
129.242 - }
129.243 - x = fabs(x);
129.244 - s = one/(x*x);
129.245 - if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */
129.246 - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
129.247 - ra5+s*(ra6+s*ra7))))));
129.248 - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
129.249 - sa5+s*(sa6+s*(sa7+s*sa8)))))));
129.250 - } else { /* |x| >= 1/0.35 */
129.251 - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
129.252 - rb5+s*rb6)))));
129.253 - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
129.254 - sb5+s*(sb6+s*sb7))))));
129.255 - }
129.256 - z = x;
129.257 - __LO(z) = 0;
129.258 - r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
129.259 - if(hx>=0) return one-r/x; else return r/x-one;
129.260 -}
129.261 -
129.262 -#ifdef __STDC__
129.263 - double erfc(double x)
129.264 -#else
129.265 - double erfc(x)
129.266 - double x;
129.267 -#endif
129.268 -{
129.269 - int hx,ix;
129.270 - double R,S,P,Q,s,y,z,r;
129.271 - hx = __HI(x);
129.272 - ix = hx&0x7fffffff;
129.273 - if(ix>=0x7ff00000) { /* erfc(nan)=nan */
129.274 - /* erfc(+-inf)=0,2 */
129.275 - return (double)(((unsigned)hx>>31)<<1)+one/x;
129.276 - }
129.277 -
129.278 - if(ix < 0x3feb0000) { /* |x|<0.84375 */
129.279 - if(ix < 0x3c700000) /* |x|<2**-56 */
129.280 - return one-x;
129.281 - z = x*x;
129.282 - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
129.283 - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
129.284 - y = r/s;
129.285 - if(hx < 0x3fd00000) { /* x<1/4 */
129.286 - return one-(x+x*y);
129.287 - } else {
129.288 - r = x*y;
129.289 - r += (x-half);
129.290 - return half - r ;
129.291 - }
129.292 - }
129.293 - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
129.294 - s = fabs(x)-one;
129.295 - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
129.296 - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
129.297 - if(hx>=0) {
129.298 - z = one-erx; return z - P/Q;
129.299 - } else {
129.300 - z = erx+P/Q; return one+z;
129.301 - }
129.302 - }
129.303 - if (ix < 0x403c0000) { /* |x|<28 */
129.304 - x = fabs(x);
129.305 - s = one/(x*x);
129.306 - if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/
129.307 - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
129.308 - ra5+s*(ra6+s*ra7))))));
129.309 - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
129.310 - sa5+s*(sa6+s*(sa7+s*sa8)))))));
129.311 - } else { /* |x| >= 1/.35 ~ 2.857143 */
129.312 - if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */
129.313 - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
129.314 - rb5+s*rb6)))));
129.315 - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
129.316 - sb5+s*(sb6+s*sb7))))));
129.317 - }
129.318 - z = x;
129.319 - __LO(z) = 0;
129.320 - r = __ieee754_exp(-z*z-0.5625)*
129.321 - __ieee754_exp((z-x)*(z+x)+R/S);
129.322 - if(hx>0) return r/x; else return two-r/x;
129.323 - } else {
129.324 - if(hx>0) return tiny*tiny; else return two-tiny;
129.325 - }
129.326 -}
130.1 --- a/src/share/native/java/lang/fdlibm/src/w_acosh.c Fri Aug 05 15:35:04 2011 -0700
130.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
130.3 @@ -1,51 +0,0 @@
130.4 -
130.5 -/*
130.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
130.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
130.8 - *
130.9 - * This code is free software; you can redistribute it and/or modify it
130.10 - * under the terms of the GNU General Public License version 2 only, as
130.11 - * published by the Free Software Foundation. Oracle designates this
130.12 - * particular file as subject to the "Classpath" exception as provided
130.13 - * by Oracle in the LICENSE file that accompanied this code.
130.14 - *
130.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
130.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
130.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
130.18 - * version 2 for more details (a copy is included in the LICENSE file that
130.19 - * accompanied this code).
130.20 - *
130.21 - * You should have received a copy of the GNU General Public License version
130.22 - * 2 along with this work; if not, write to the Free Software Foundation,
130.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
130.24 - *
130.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
130.26 - * or visit www.oracle.com if you need additional information or have any
130.27 - * questions.
130.28 - */
130.29 -
130.30 -/*
130.31 - * wrapper acosh(x)
130.32 - */
130.33 -
130.34 -#include "fdlibm.h"
130.35 -
130.36 -#ifdef __STDC__
130.37 - double acosh(double x) /* wrapper acosh */
130.38 -#else
130.39 - double acosh(x) /* wrapper acosh */
130.40 - double x;
130.41 -#endif
130.42 -{
130.43 -#ifdef _IEEE_LIBM
130.44 - return __ieee754_acosh(x);
130.45 -#else
130.46 - double z;
130.47 - z = __ieee754_acosh(x);
130.48 - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
130.49 - if(x<1.0) {
130.50 - return __kernel_standard(x,x,29); /* acosh(x<1) */
130.51 - } else
130.52 - return z;
130.53 -#endif
130.54 -}
131.1 --- a/src/share/native/java/lang/fdlibm/src/w_gamma.c Fri Aug 05 15:35:04 2011 -0700
131.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
131.3 @@ -1,58 +0,0 @@
131.4 -
131.5 -/*
131.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
131.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
131.8 - *
131.9 - * This code is free software; you can redistribute it and/or modify it
131.10 - * under the terms of the GNU General Public License version 2 only, as
131.11 - * published by the Free Software Foundation. Oracle designates this
131.12 - * particular file as subject to the "Classpath" exception as provided
131.13 - * by Oracle in the LICENSE file that accompanied this code.
131.14 - *
131.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
131.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
131.18 - * version 2 for more details (a copy is included in the LICENSE file that
131.19 - * accompanied this code).
131.20 - *
131.21 - * You should have received a copy of the GNU General Public License version
131.22 - * 2 along with this work; if not, write to the Free Software Foundation,
131.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
131.24 - *
131.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
131.26 - * or visit www.oracle.com if you need additional information or have any
131.27 - * questions.
131.28 - */
131.29 -
131.30 -/* double gamma(double x)
131.31 - * Return the logarithm of the Gamma function of x.
131.32 - *
131.33 - * Method: call gamma_r
131.34 - */
131.35 -
131.36 -#include "fdlibm.h"
131.37 -
131.38 -extern int signgam;
131.39 -
131.40 -#ifdef __STDC__
131.41 - double gamma(double x)
131.42 -#else
131.43 - double gamma(x)
131.44 - double x;
131.45 -#endif
131.46 -{
131.47 -#ifdef _IEEE_LIBM
131.48 - return __ieee754_gamma_r(x,&signgam);
131.49 -#else
131.50 - double y;
131.51 - y = __ieee754_gamma_r(x,&signgam);
131.52 - if(_LIB_VERSION == _IEEE_) return y;
131.53 - if(!finite(y)&&finite(x)) {
131.54 - if(floor(x)==x&&x<=0.0)
131.55 - return __kernel_standard(x,x,41); /* gamma pole */
131.56 - else
131.57 - return __kernel_standard(x,x,40); /* gamma overflow */
131.58 - } else
131.59 - return y;
131.60 -#endif
131.61 -}
132.1 --- a/src/share/native/java/lang/fdlibm/src/w_gamma_r.c Fri Aug 05 15:35:04 2011 -0700
132.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
132.3 @@ -1,55 +0,0 @@
132.4 -
132.5 -/*
132.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
132.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
132.8 - *
132.9 - * This code is free software; you can redistribute it and/or modify it
132.10 - * under the terms of the GNU General Public License version 2 only, as
132.11 - * published by the Free Software Foundation. Oracle designates this
132.12 - * particular file as subject to the "Classpath" exception as provided
132.13 - * by Oracle in the LICENSE file that accompanied this code.
132.14 - *
132.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
132.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
132.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
132.18 - * version 2 for more details (a copy is included in the LICENSE file that
132.19 - * accompanied this code).
132.20 - *
132.21 - * You should have received a copy of the GNU General Public License version
132.22 - * 2 along with this work; if not, write to the Free Software Foundation,
132.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
132.24 - *
132.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
132.26 - * or visit www.oracle.com if you need additional information or have any
132.27 - * questions.
132.28 - */
132.29 -
132.30 -/*
132.31 - * wrapper double gamma_r(double x, int *signgamp)
132.32 - */
132.33 -
132.34 -#include "fdlibm.h"
132.35 -
132.36 -
132.37 -#ifdef __STDC__
132.38 - double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
132.39 -#else
132.40 - double gamma_r(x,signgamp) /* wrapper lgamma_r */
132.41 - double x; int *signgamp;
132.42 -#endif
132.43 -{
132.44 -#ifdef _IEEE_LIBM
132.45 - return __ieee754_gamma_r(x,signgamp);
132.46 -#else
132.47 - double y;
132.48 - y = __ieee754_gamma_r(x,signgamp);
132.49 - if(_LIB_VERSION == _IEEE_) return y;
132.50 - if(!finite(y)&&finite(x)) {
132.51 - if(floor(x)==x&&x<=0.0)
132.52 - return __kernel_standard(x,x,41); /* gamma pole */
132.53 - else
132.54 - return __kernel_standard(x,x,40); /* gamma overflow */
132.55 - } else
132.56 - return y;
132.57 -#endif
132.58 -}
133.1 --- a/src/share/native/java/lang/fdlibm/src/w_j0.c Fri Aug 05 15:35:04 2011 -0700
133.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
133.3 @@ -1,78 +0,0 @@
133.4 -
133.5 -/*
133.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
133.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
133.8 - *
133.9 - * This code is free software; you can redistribute it and/or modify it
133.10 - * under the terms of the GNU General Public License version 2 only, as
133.11 - * published by the Free Software Foundation. Oracle designates this
133.12 - * particular file as subject to the "Classpath" exception as provided
133.13 - * by Oracle in the LICENSE file that accompanied this code.
133.14 - *
133.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
133.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
133.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
133.18 - * version 2 for more details (a copy is included in the LICENSE file that
133.19 - * accompanied this code).
133.20 - *
133.21 - * You should have received a copy of the GNU General Public License version
133.22 - * 2 along with this work; if not, write to the Free Software Foundation,
133.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
133.24 - *
133.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
133.26 - * or visit www.oracle.com if you need additional information or have any
133.27 - * questions.
133.28 - */
133.29 -
133.30 -/*
133.31 - * wrapper j0(double x), y0(double x)
133.32 - */
133.33 -
133.34 -#include "fdlibm.h"
133.35 -
133.36 -#ifdef __STDC__
133.37 - double j0(double x) /* wrapper j0 */
133.38 -#else
133.39 - double j0(x) /* wrapper j0 */
133.40 - double x;
133.41 -#endif
133.42 -{
133.43 -#ifdef _IEEE_LIBM
133.44 - return __ieee754_j0(x);
133.45 -#else
133.46 - double z = __ieee754_j0(x);
133.47 - if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
133.48 - if(fabs(x)>X_TLOSS) {
133.49 - return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
133.50 - } else
133.51 - return z;
133.52 -#endif
133.53 -}
133.54 -
133.55 -#ifdef __STDC__
133.56 - double y0(double x) /* wrapper y0 */
133.57 -#else
133.58 - double y0(x) /* wrapper y0 */
133.59 - double x;
133.60 -#endif
133.61 -{
133.62 -#ifdef _IEEE_LIBM
133.63 - return __ieee754_y0(x);
133.64 -#else
133.65 - double z;
133.66 - z = __ieee754_y0(x);
133.67 - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
133.68 - if(x <= 0.0){
133.69 - if(x==0.0)
133.70 - /* d= -one/(x-x); */
133.71 - return __kernel_standard(x,x,8);
133.72 - else
133.73 - /* d = zero/(x-x); */
133.74 - return __kernel_standard(x,x,9);
133.75 - }
133.76 - if(x>X_TLOSS) {
133.77 - return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
133.78 - } else
133.79 - return z;
133.80 -#endif
133.81 -}
134.1 --- a/src/share/native/java/lang/fdlibm/src/w_j1.c Fri Aug 05 15:35:04 2011 -0700
134.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
134.3 @@ -1,79 +0,0 @@
134.4 -
134.5 -/*
134.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
134.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
134.8 - *
134.9 - * This code is free software; you can redistribute it and/or modify it
134.10 - * under the terms of the GNU General Public License version 2 only, as
134.11 - * published by the Free Software Foundation. Oracle designates this
134.12 - * particular file as subject to the "Classpath" exception as provided
134.13 - * by Oracle in the LICENSE file that accompanied this code.
134.14 - *
134.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
134.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
134.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
134.18 - * version 2 for more details (a copy is included in the LICENSE file that
134.19 - * accompanied this code).
134.20 - *
134.21 - * You should have received a copy of the GNU General Public License version
134.22 - * 2 along with this work; if not, write to the Free Software Foundation,
134.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
134.24 - *
134.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
134.26 - * or visit www.oracle.com if you need additional information or have any
134.27 - * questions.
134.28 - */
134.29 -
134.30 -/*
134.31 - * wrapper of j1,y1
134.32 - */
134.33 -
134.34 -#include "fdlibm.h"
134.35 -
134.36 -#ifdef __STDC__
134.37 - double j1(double x) /* wrapper j1 */
134.38 -#else
134.39 - double j1(x) /* wrapper j1 */
134.40 - double x;
134.41 -#endif
134.42 -{
134.43 -#ifdef _IEEE_LIBM
134.44 - return __ieee754_j1(x);
134.45 -#else
134.46 - double z;
134.47 - z = __ieee754_j1(x);
134.48 - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
134.49 - if(fabs(x)>X_TLOSS) {
134.50 - return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
134.51 - } else
134.52 - return z;
134.53 -#endif
134.54 -}
134.55 -
134.56 -#ifdef __STDC__
134.57 - double y1(double x) /* wrapper y1 */
134.58 -#else
134.59 - double y1(x) /* wrapper y1 */
134.60 - double x;
134.61 -#endif
134.62 -{
134.63 -#ifdef _IEEE_LIBM
134.64 - return __ieee754_y1(x);
134.65 -#else
134.66 - double z;
134.67 - z = __ieee754_y1(x);
134.68 - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
134.69 - if(x <= 0.0){
134.70 - if(x==0.0)
134.71 - /* d= -one/(x-x); */
134.72 - return __kernel_standard(x,x,10);
134.73 - else
134.74 - /* d = zero/(x-x); */
134.75 - return __kernel_standard(x,x,11);
134.76 - }
134.77 - if(x>X_TLOSS) {
134.78 - return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
134.79 - } else
134.80 - return z;
134.81 -#endif
134.82 -}
135.1 --- a/src/share/native/java/lang/fdlibm/src/w_jn.c Fri Aug 05 15:35:04 2011 -0700
135.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
135.3 @@ -1,101 +0,0 @@
135.4 -
135.5 -/*
135.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
135.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
135.8 - *
135.9 - * This code is free software; you can redistribute it and/or modify it
135.10 - * under the terms of the GNU General Public License version 2 only, as
135.11 - * published by the Free Software Foundation. Oracle designates this
135.12 - * particular file as subject to the "Classpath" exception as provided
135.13 - * by Oracle in the LICENSE file that accompanied this code.
135.14 - *
135.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
135.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
135.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
135.18 - * version 2 for more details (a copy is included in the LICENSE file that
135.19 - * accompanied this code).
135.20 - *
135.21 - * You should have received a copy of the GNU General Public License version
135.22 - * 2 along with this work; if not, write to the Free Software Foundation,
135.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
135.24 - *
135.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
135.26 - * or visit www.oracle.com if you need additional information or have any
135.27 - * questions.
135.28 - */
135.29 -
135.30 -/*
135.31 - * wrapper jn(int n, double x), yn(int n, double x)
135.32 - * floating point Bessel's function of the 1st and 2nd kind
135.33 - * of order n
135.34 - *
135.35 - * Special cases:
135.36 - * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
135.37 - * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
135.38 - * Note 2. About jn(n,x), yn(n,x)
135.39 - * For n=0, j0(x) is called,
135.40 - * for n=1, j1(x) is called,
135.41 - * for n<x, forward recursion us used starting
135.42 - * from values of j0(x) and j1(x).
135.43 - * for n>x, a continued fraction approximation to
135.44 - * j(n,x)/j(n-1,x) is evaluated and then backward
135.45 - * recursion is used starting from a supposed value
135.46 - * for j(n,x). The resulting value of j(0,x) is
135.47 - * compared with the actual value to correct the
135.48 - * supposed value of j(n,x).
135.49 - *
135.50 - * yn(n,x) is similar in all respects, except
135.51 - * that forward recursion is used for all
135.52 - * values of n>1.
135.53 - *
135.54 - */
135.55 -
135.56 -#include "fdlibm.h"
135.57 -
135.58 -#ifdef __STDC__
135.59 - double jn(int n, double x) /* wrapper jn */
135.60 -#else
135.61 - double jn(n,x) /* wrapper jn */
135.62 - double x; int n;
135.63 -#endif
135.64 -{
135.65 -#ifdef _IEEE_LIBM
135.66 - return __ieee754_jn(n,x);
135.67 -#else
135.68 - double z;
135.69 - z = __ieee754_jn(n,x);
135.70 - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
135.71 - if(fabs(x)>X_TLOSS) {
135.72 - return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */
135.73 - } else
135.74 - return z;
135.75 -#endif
135.76 -}
135.77 -
135.78 -#ifdef __STDC__
135.79 - double yn(int n, double x) /* wrapper yn */
135.80 -#else
135.81 - double yn(n,x) /* wrapper yn */
135.82 - double x; int n;
135.83 -#endif
135.84 -{
135.85 -#ifdef _IEEE_LIBM
135.86 - return __ieee754_yn(n,x);
135.87 -#else
135.88 - double z;
135.89 - z = __ieee754_yn(n,x);
135.90 - if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
135.91 - if(x <= 0.0){
135.92 - if(x==0.0)
135.93 - /* d= -one/(x-x); */
135.94 - return __kernel_standard((double)n,x,12);
135.95 - else
135.96 - /* d = zero/(x-x); */
135.97 - return __kernel_standard((double)n,x,13);
135.98 - }
135.99 - if(x>X_TLOSS) {
135.100 - return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */
135.101 - } else
135.102 - return z;
135.103 -#endif
135.104 -}
136.1 --- a/src/share/native/java/lang/fdlibm/src/w_lgamma.c Fri Aug 05 15:35:04 2011 -0700
136.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
136.3 @@ -1,58 +0,0 @@
136.4 -
136.5 -/*
136.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
136.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
136.8 - *
136.9 - * This code is free software; you can redistribute it and/or modify it
136.10 - * under the terms of the GNU General Public License version 2 only, as
136.11 - * published by the Free Software Foundation. Oracle designates this
136.12 - * particular file as subject to the "Classpath" exception as provided
136.13 - * by Oracle in the LICENSE file that accompanied this code.
136.14 - *
136.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
136.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
136.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
136.18 - * version 2 for more details (a copy is included in the LICENSE file that
136.19 - * accompanied this code).
136.20 - *
136.21 - * You should have received a copy of the GNU General Public License version
136.22 - * 2 along with this work; if not, write to the Free Software Foundation,
136.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
136.24 - *
136.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
136.26 - * or visit www.oracle.com if you need additional information or have any
136.27 - * questions.
136.28 - */
136.29 -
136.30 -/* double lgamma(double x)
136.31 - * Return the logarithm of the Gamma function of x.
136.32 - *
136.33 - * Method: call __ieee754_lgamma_r
136.34 - */
136.35 -
136.36 -#include "fdlibm.h"
136.37 -
136.38 -extern int signgam;
136.39 -
136.40 -#ifdef __STDC__
136.41 - double lgamma(double x)
136.42 -#else
136.43 - double lgamma(x)
136.44 - double x;
136.45 -#endif
136.46 -{
136.47 -#ifdef _IEEE_LIBM
136.48 - return __ieee754_lgamma_r(x,&signgam);
136.49 -#else
136.50 - double y;
136.51 - y = __ieee754_lgamma_r(x,&signgam);
136.52 - if(_LIB_VERSION == _IEEE_) return y;
136.53 - if(!finite(y)&&finite(x)) {
136.54 - if(floor(x)==x&&x<=0.0)
136.55 - return __kernel_standard(x,x,15); /* lgamma pole */
136.56 - else
136.57 - return __kernel_standard(x,x,14); /* lgamma overflow */
136.58 - } else
136.59 - return y;
136.60 -#endif
136.61 -}
137.1 --- a/src/share/native/java/lang/fdlibm/src/w_lgamma_r.c Fri Aug 05 15:35:04 2011 -0700
137.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
137.3 @@ -1,55 +0,0 @@
137.4 -
137.5 -/*
137.6 - * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
137.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
137.8 - *
137.9 - * This code is free software; you can redistribute it and/or modify it
137.10 - * under the terms of the GNU General Public License version 2 only, as
137.11 - * published by the Free Software Foundation. Oracle designates this
137.12 - * particular file as subject to the "Classpath" exception as provided
137.13 - * by Oracle in the LICENSE file that accompanied this code.
137.14 - *
137.15 - * This code is distributed in the hope that it will be useful, but WITHOUT
137.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
137.17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
137.18 - * version 2 for more details (a copy is included in the LICENSE file that
137.19 - * accompanied this code).
137.20 - *
137.21 - * You should have received a copy of the GNU General Public License version
137.22 - * 2 along with this work; if not, write to the Free Software Foundation,
137.23 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
137.24 - *
137.25 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
137.26 - * or visit www.oracle.com if you need additional information or have any
137.27 - * questions.
137.28 - */
137.29 -
137.30 -/*
137.31 - * wrapper double lgamma_r(double x, int *signgamp)
137.32 - */
137.33 -
137.34 -#include "fdlibm.h"
137.35 -
137.36 -
137.37 -#ifdef __STDC__
137.38 - double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
137.39 -#else
137.40 - double lgamma_r(x,signgamp) /* wrapper lgamma_r */
137.41 - double x; int *signgamp;
137.42 -#endif
137.43 -{
137.44 -#ifdef _IEEE_LIBM
137.45 - return __ieee754_lgamma_r(x,signgamp);
137.46 -#else
137.47 - double y;
137.48 - y = __ieee754_lgamma_r(x,signgamp);
137.49 - if(_LIB_VERSION == _IEEE_) return y;
137.50 - if(!finite(y)&&finite(x)) {
137.51 - if(floor(x)==x&&x<=0.0)
137.52 - return __kernel_standard(x,x,15); /* lgamma pole */
137.53 - else
137.54 - return __kernel_standard(x,x,14); /* lgamma overflow */
137.55 - } else
137.56 - return y;
137.57 -#endif
137.58 -}
138.1 --- a/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java Fri Aug 05 15:35:04 2011 -0700
138.2 +++ b/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java Tue Aug 09 17:38:52 2011 -0700
138.3 @@ -1,5 +1,5 @@
138.4 /*
138.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
138.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
138.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
138.8 *
138.9 * This code is free software; you can redistribute it and/or modify it
138.10 @@ -53,8 +53,6 @@
138.11 import com.sun.nio.sctp.NotificationHandler;
138.12 import com.sun.nio.sctp.SctpChannel;
138.13 import com.sun.nio.sctp.SctpSocketOption;
138.14 -import sun.nio.ch.PollArrayWrapper;
138.15 -import sun.nio.ch.SelChImpl;
138.16 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
138.17 import static sun.nio.ch.SctpResultContainer.SEND_FAILED;
138.18 import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED;
138.19 @@ -118,7 +116,7 @@
138.20
138.21 private Association association;
138.22
138.23 - private Set<SocketAddress> remoteAddresses = Collections.EMPTY_SET;
138.24 + private Set<SocketAddress> remoteAddresses = Collections.emptySet();
138.25
138.26 /* -- End of fields protected by stateLock -- */
138.27
138.28 @@ -853,7 +851,7 @@
138.29 return n;
138.30 }
138.31
138.32 - private InternalNotificationHandler<?> internalNotificationHandler =
138.33 + private InternalNotificationHandler internalNotificationHandler =
138.34 new InternalNotificationHandler();
138.35
138.36 private void handleNotificationInternal(SctpResultContainer resultContainer)
138.37 @@ -862,12 +860,12 @@
138.38 internalNotificationHandler, null);
138.39 }
138.40
138.41 - private class InternalNotificationHandler<T>
138.42 - extends AbstractNotificationHandler<T>
138.43 + private class InternalNotificationHandler
138.44 + extends AbstractNotificationHandler<Object>
138.45 {
138.46 @Override
138.47 public HandlerResult handleNotification(
138.48 - AssociationChangeNotification not, T unused) {
138.49 + AssociationChangeNotification not, Object unused) {
138.50 if (not.event().equals(
138.51 AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
138.52 association == null) {
138.53 @@ -893,8 +891,8 @@
138.54 }
138.55
138.56 /* AbstractNotificationHandler */
138.57 - AbstractNotificationHandler absHandler =
138.58 - (AbstractNotificationHandler)handler;
138.59 + AbstractNotificationHandler<T> absHandler =
138.60 + (AbstractNotificationHandler<T>)handler;
138.61 switch(resultContainer.type()) {
138.62 case ASSOCIATION_CHANGED :
138.63 return absHandler.handleNotification(
138.64 @@ -1053,7 +1051,7 @@
138.65 if (!isOpen())
138.66 throw new ClosedChannelException();
138.67 if (!isBound())
138.68 - return Collections.EMPTY_SET;
138.69 + return Collections.emptySet();
138.70
138.71 return SctpNet.getLocalAddresses(fdVal);
138.72 }
138.73 @@ -1066,7 +1064,7 @@
138.74 if (!isOpen())
138.75 throw new ClosedChannelException();
138.76 if (!isConnected() || isShutdown)
138.77 - return Collections.EMPTY_SET;
138.78 + return Collections.emptySet();
138.79
138.80 try {
138.81 return SctpNet.getRemoteAddresses(fdVal, 0/*unused*/);
139.1 --- a/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java Fri Aug 05 15:35:04 2011 -0700
139.2 +++ b/src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java Tue Aug 09 17:38:52 2011 -0700
139.3 @@ -1,5 +1,5 @@
139.4 /*
139.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
139.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
139.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
139.8 *
139.9 * This code is free software; you can redistribute it and/or modify it
139.10 @@ -586,12 +586,12 @@
139.11 internalNotificationHandler, null);
139.12 }
139.13
139.14 - private class InternalNotificationHandler<T>
139.15 - extends AbstractNotificationHandler<T>
139.16 + private class InternalNotificationHandler
139.17 + extends AbstractNotificationHandler<Object>
139.18 {
139.19 @Override
139.20 public HandlerResult handleNotification(
139.21 - AssociationChangeNotification not, T unused) {
139.22 + AssociationChangeNotification not, Object unused) {
139.23 SctpAssocChange sac = (SctpAssocChange) not;
139.24
139.25 /* Update map to reflect change in association */
139.26 @@ -622,8 +622,8 @@
139.27 if (!(handler instanceof AbstractNotificationHandler)) {
139.28 result = handler.handleNotification(notification, attachment);
139.29 } else { /* AbstractNotificationHandler */
139.30 - AbstractNotificationHandler absHandler =
139.31 - (AbstractNotificationHandler)handler;
139.32 + AbstractNotificationHandler<T> absHandler =
139.33 + (AbstractNotificationHandler<T>)handler;
139.34 switch(resultContainer.type()) {
139.35 case ASSOCIATION_CHANGED :
139.36 result = absHandler.handleNotification(
139.37 @@ -912,7 +912,7 @@
139.38 if (!isOpen())
139.39 throw new ClosedChannelException();
139.40 if (!isBound())
139.41 - return Collections.EMPTY_SET;
139.42 + return Collections.emptySet();
139.43
139.44 return SctpNet.getLocalAddresses(fdVal);
139.45 }
139.46 @@ -931,7 +931,7 @@
139.47 } catch (SocketException se) {
139.48 /* a valid association should always have remote addresses */
139.49 Set<SocketAddress> addrs = associationMap.get(association);
139.50 - return addrs != null ? addrs : Collections.EMPTY_SET;
139.51 + return addrs != null ? addrs : Collections.<SocketAddress>emptySet();
139.52 }
139.53 }
139.54 }
140.1 --- a/src/solaris/classes/sun/nio/ch/SctpNet.java Fri Aug 05 15:35:04 2011 -0700
140.2 +++ b/src/solaris/classes/sun/nio/ch/SctpNet.java Tue Aug 09 17:38:52 2011 -0700
140.3 @@ -1,5 +1,5 @@
140.4 /*
140.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
140.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
140.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
140.8 *
140.9 * This code is free software; you can redistribute it and/or modify it
140.10 @@ -118,18 +118,14 @@
140.11 return set;
140.12 }
140.13
140.14 - static void setSocketOption(int fd,
140.15 - SctpSocketOption name,
140.16 - Object value,
140.17 - int assocId)
140.18 + static <T> void setSocketOption(int fd,
140.19 + SctpSocketOption<T> name,
140.20 + T value,
140.21 + int assocId)
140.22 throws IOException {
140.23 if (value == null)
140.24 throw new IllegalArgumentException("Invalid option value");
140.25
140.26 - Class<?> type = name.type();
140.27 - if (!type.isInstance(value))
140.28 - throw new IllegalArgumentException("Invalid option value");
140.29 -
140.30 if (name.equals(SCTP_INIT_MAXSTREAMS)) {
140.31 InitMaxStreams maxStreamValue = (InitMaxStreams)value;
140.32 SctpNet.setInitMsgOption0(fd,
140.33 @@ -169,7 +165,7 @@
140.34 }
140.35 }
140.36
140.37 - static Object getSocketOption(int fd, SctpSocketOption name, int assocId)
140.38 + static Object getSocketOption(int fd, SctpSocketOption<?> name, int assocId)
140.39 throws IOException {
140.40 if (name.equals(SCTP_SET_PEER_PRIMARY_ADDR)) {
140.41 throw new IllegalArgumentException(
140.42 @@ -194,7 +190,7 @@
140.43 }
140.44 }
140.45
140.46 - static void setIntOption(int fd, SctpSocketOption name, Object value)
140.47 + static void setIntOption(int fd, SctpSocketOption<?> name, Object value)
140.48 throws IOException {
140.49 if (value == null)
140.50 throw new IllegalArgumentException("Invalid option value");
140.51 @@ -234,7 +230,7 @@
140.52 setIntOption0(fd, ((SctpStdSocketOption)name).constValue(), arg);
140.53 }
140.54
140.55 - static Object getIntOption(int fd, SctpSocketOption name)
140.56 + static Object getIntOption(int fd, SctpSocketOption<?> name)
140.57 throws IOException {
140.58 Class<?> type = name.type();
140.59
141.1 --- a/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java Fri Aug 05 15:35:04 2011 -0700
141.2 +++ b/src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java Tue Aug 09 17:38:52 2011 -0700
141.3 @@ -1,5 +1,5 @@
141.4 /*
141.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
141.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
141.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
141.8 *
141.9 * This code is free software; you can redistribute it and/or modify it
141.10 @@ -367,6 +367,7 @@
141.11 }
141.12
141.13 @Override
141.14 + @SuppressWarnings("unchecked")
141.15 public <T> T getOption(SctpSocketOption<T> name) throws IOException {
141.16 if (name == null)
141.17 throw new NullPointerException();
141.18 @@ -403,7 +404,7 @@
141.19 if (!isOpen())
141.20 throw new ClosedChannelException();
141.21 if (!isBound())
141.22 - return Collections.EMPTY_SET;
141.23 + return Collections.emptySet();
141.24
141.25 return SctpNet.getLocalAddresses(fdVal);
141.26 }
142.1 --- a/src/windows/classes/sun/nio/ch/PendingIoCache.java Fri Aug 05 15:35:04 2011 -0700
142.2 +++ b/src/windows/classes/sun/nio/ch/PendingIoCache.java Tue Aug 09 17:38:52 2011 -0700
142.3 @@ -60,6 +60,7 @@
142.4 private boolean closePending;
142.5
142.6 // maps OVERLAPPED to PendingFuture
142.7 + @SuppressWarnings("rawtypes")
142.8 private final Map<Long,PendingFuture> pendingIoMap =
142.9 new HashMap<Long,PendingFuture>();
142.10
143.1 --- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java Fri Aug 05 15:35:04 2011 -0700
143.2 +++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java Tue Aug 09 17:38:52 2011 -0700
143.3 @@ -314,7 +314,7 @@
143.4 // create Future and task that will be invoked to acquire lock
143.5 PendingFuture<FileLock,A> result =
143.6 new PendingFuture<FileLock,A>(this, handler, attachment);
143.7 - LockTask lockTask = new LockTask<A>(position, fli, result);
143.8 + LockTask<A> lockTask = new LockTask<A>(position, fli, result);
143.9 result.setContext(lockTask);
143.10
143.11 // initiate I/O
143.12 @@ -552,7 +552,7 @@
143.13 // create Future and task that initiates read
143.14 PendingFuture<Integer,A> result =
143.15 new PendingFuture<Integer,A>(this, handler, attachment);
143.16 - ReadTask readTask = new ReadTask<A>(dst, pos, rem, position, result);
143.17 + ReadTask<A> readTask = new ReadTask<A>(dst, pos, rem, position, result);
143.18 result.setContext(readTask);
143.19
143.20 // initiate I/O
143.21 @@ -726,7 +726,7 @@
143.22 // create Future and task to initiate write
143.23 PendingFuture<Integer,A> result =
143.24 new PendingFuture<Integer,A>(this, handler, attachment);
143.25 - WriteTask writeTask = new WriteTask<A>(src, pos, rem, position, result);
143.26 + WriteTask<A> writeTask = new WriteTask<A>(src, pos, rem, position, result);
143.27 result.setContext(writeTask);
143.28
143.29 // initiate I/O
144.1 --- a/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java Fri Aug 05 15:35:04 2011 -0700
144.2 +++ b/src/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java Tue Aug 09 17:38:52 2011 -0700
144.3 @@ -351,7 +351,7 @@
144.4 // setup task
144.5 PendingFuture<Void,A> result =
144.6 new PendingFuture<Void,A>(this, handler, attachment);
144.7 - ConnectTask task = new ConnectTask<A>(isa, result);
144.8 + ConnectTask<A> task = new ConnectTask<A>(isa, result);
144.9 result.setContext(task);
144.10
144.11 // initiate I/O
144.12 @@ -615,7 +615,8 @@
144.13 bufs = new ByteBuffer[1];
144.14 bufs[0] = dst;
144.15 }
144.16 - final ReadTask readTask = new ReadTask<V,A>(bufs, isScatteringRead, result);
144.17 + final ReadTask<V,A> readTask =
144.18 + new ReadTask<V,A>(bufs, isScatteringRead, result);
144.19 result.setContext(readTask);
144.20
144.21 // schedule timeout
144.22 @@ -872,7 +873,8 @@
144.23 bufs = new ByteBuffer[1];
144.24 bufs[0] = src;
144.25 }
144.26 - final WriteTask writeTask = new WriteTask<V,A>(bufs, gatheringWrite, result);
144.27 + final WriteTask<V,A> writeTask =
144.28 + new WriteTask<V,A>(bufs, gatheringWrite, result);
144.29 result.setContext(writeTask);
144.30
144.31 // schedule timeout
145.1 --- a/test/ProblemList.txt Fri Aug 05 15:35:04 2011 -0700
145.2 +++ b/test/ProblemList.txt Tue Aug 09 17:38:52 2011 -0700
145.3 @@ -349,10 +349,19 @@
145.4 # Only print test left, excluding just because all print tests have been
145.5 javax/print/attribute/MediaMappingsTest.java generic-all
145.6
145.7 +# Filed 7058852
145.8 +javax/sound/sampled/FileWriter/AlawEncoderSync.java generic-all
145.9 +
145.10 ############################################################################
145.11
145.12 # jdk_net
145.13
145.14 +# Filed 7052625
145.15 +com/sun/net/httpserver/bugs/6725892/Test.java generic-all
145.16 +
145.17 +# Filed 7036666
145.18 +com/sun/net/httpserver/Test9a.java generic-all
145.19 +
145.20 ############################################################################
145.21
145.22 # jdk_io
145.23 @@ -528,9 +537,6 @@
145.24 sun/security/provider/PolicyFile/getinstance/getinstance.sh solaris-sparc
145.25 sun/security/tools/jarsigner/samename.sh solaris-sparc
145.26
145.27 -# Timed out, Solaris 10 64bit sparcv9
145.28 -com/sun/crypto/provider/Cipher/DES/PaddingTest.java generic-all
145.29 -
145.30 # Othervm, sparc, NoRouteToHostException: Cannot assign requested address
145.31 sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java generic-all
145.32
145.33 @@ -605,6 +611,18 @@
145.34 # Filed 6952105
145.35 com/sun/jdi/SuspendThreadTest.java generic-all
145.36
145.37 +# Filed 6653793
145.38 +com/sun/jdi/RedefineCrossEvent.java generic-all
145.39 +
145.40 +# Filed 6987312
145.41 +com/sun/jdi/DoubleAgentTest.java generic-all
145.42 +
145.43 +# Filed 7020857
145.44 +com/sun/jdi/FieldWatchpoints.java generic-all
145.45 +
145.46 +# Filed 6402201
145.47 +com/sun/jdi/ProcessAttachTest.sh generic-all
145.48 +
145.49 # Filed 6986875
145.50 sun/tools/jps/jps-Vvml.sh generic-all
145.51
145.52 @@ -626,18 +644,8 @@
145.53 # 11 separate stacktraces created... file reuse problem?
145.54 java/util/zip/ZipFile/ReadLongZipFileName.java generic-all
145.55
145.56 -# Assert error, failures, on Linux Fedora 9 -server
145.57 -# Windows samevm failure, assert error "Passed = 134, failed = 2"
145.58 -java/util/Arrays/ArrayObjectMethods.java generic-all
145.59 -
145.60 -# Windows 2000, -client, samevm, java.lang.Error: Completed != 2
145.61 +# Filed 6772009
145.62 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
145.63
145.64 -# Windows X64, Executor Stuck samevm mode:
145.65 -java/util/concurrent/FutureTask/BlockingTaskExecutor.java generic-all
145.66 -
145.67 -# Problems on windows, jmap.exe hangs? (these run jmap), fails on Solaris 10 x86
145.68 -java/util/concurrent/locks/Lock/TimedAcquireLeak.java generic-all
145.69 -
145.70 ############################################################################
145.71
146.1 --- a/test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java Fri Aug 05 15:35:04 2011 -0700
146.2 +++ b/test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java Tue Aug 09 17:38:52 2011 -0700
146.3 @@ -1,5 +1,5 @@
146.4 /*
146.5 - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
146.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
146.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
146.8 *
146.9 * This code is free software; you can redistribute it and/or modify it
146.10 @@ -23,16 +23,17 @@
146.11
146.12 /*
146.13 * @test
146.14 - * @bug 0000000 6296075
146.15 + * @bug 0000000 6296075 6330275
146.16 * @summary PaddingTest
146.17 * @author Jan Luehe
146.18 */
146.19 import java.io.*;
146.20 -import java.security.*;
146.21 +import java.nio.file.Files;
146.22 +import java.nio.file.Paths;
146.23 import java.security.spec.*;
146.24 import javax.crypto.*;
146.25 import javax.crypto.spec.*;
146.26 -import com.sun.crypto.provider.*;
146.27 +import java.util.Arrays;
146.28
146.29 public class PaddingTest {
146.30
146.31 @@ -80,7 +81,7 @@
146.32 public void run() throws Exception {
146.33
146.34 for (int l=0; l<numFiles; l++) {
146.35 - pinfile = new String(dataDir + "plain" + l + ".txt");
146.36 + pinfile = dataDir + "plain" + l + ".txt";
146.37 for (int i=0; i<crypts.length; i++) {
146.38 for (int j=0; j<modes.length; j++) {
146.39 for (int k=0; k<paddings.length; k++) {
146.40 @@ -89,14 +90,12 @@
146.41 System.out.println
146.42 (crypts[i]+" "+modes[j]+" " + paddings[k]+ " " +
146.43 "plain" + l + " test");
146.44 - cfile = new String
146.45 - ("c" + l + "_" +
146.46 + cfile = "c" + l + "_" +
146.47 crypts[i] + "_" +
146.48 modes[j] + "_" +
146.49 - paddings[k] + ".bin");
146.50 - poutfile = new String
146.51 - ("p" + l +
146.52 - "_" + crypts[i] + modes[j] + paddings[k] + ".txt");
146.53 + paddings[k] + ".bin";
146.54 + poutfile = "p" + l +
146.55 + "_" + crypts[i] + modes[j] + paddings[k] + ".txt";
146.56
146.57 init(crypts[i], modes[j], paddings[k]);
146.58 padding = paddings[k];
146.59 @@ -108,10 +107,7 @@
146.60 }
146.61
146.62 public void init(String crypt, String mode, String padding)
146.63 - throws Exception {
146.64 -
146.65 - SunJCE jce = new SunJCE();
146.66 - Security.addProvider(jce);
146.67 + throws Exception {
146.68
146.69 KeySpec desKeySpec = null;
146.70 SecretKeyFactory factory = null;
146.71 @@ -148,82 +144,60 @@
146.72 int len;
146.73 int totalInputLen = 0;
146.74
146.75 - BufferedInputStream pin = null;
146.76 - BufferedOutputStream cout = null;
146.77 - BufferedInputStream cin = null;
146.78 - BufferedOutputStream pout = null;
146.79 + try {
146.80 + try (FileInputStream fin = new FileInputStream(pinfile);
146.81 + BufferedInputStream pin = new BufferedInputStream(fin);
146.82 + FileOutputStream fout = new FileOutputStream(cfile);
146.83 + BufferedOutputStream cout = new BufferedOutputStream(fout)) {
146.84 + cipher.init(Cipher.ENCRYPT_MODE, cipherKey, params);
146.85
146.86 - try {
146.87 - pin = new BufferedInputStream(new FileInputStream(pinfile));
146.88 - cout = new BufferedOutputStream(new FileOutputStream(cfile));
146.89 - cipher.init(Cipher.ENCRYPT_MODE, cipherKey, params);
146.90 + while ((len = pin.read(input, 0, bufferLen)) > 0) {
146.91 + totalInputLen += len;
146.92 + byte[] output = cipher.update(input, 0, len);
146.93 + cout.write(output, 0, output.length);
146.94 + }
146.95
146.96 - while ((len = pin.read(input, 0, bufferLen)) > 0) {
146.97 - totalInputLen += len;
146.98 - byte[] output = cipher.update(input, 0, len);
146.99 - cout.write(output, 0, output.length);
146.100 - cout.flush();
146.101 + len = cipher.getOutputSize(0);
146.102 +
146.103 + byte[] out = new byte[len];
146.104 + len = cipher.doFinal(out, 0);
146.105 + cout.write(out, 0, len);
146.106 }
146.107
146.108 - len = cipher.getOutputSize(0);
146.109 + try (FileInputStream fin = new FileInputStream(cfile);
146.110 + BufferedInputStream cin = new BufferedInputStream(fin);
146.111 + FileOutputStream fout = new FileOutputStream(poutfile);
146.112 + BufferedOutputStream pout = new BufferedOutputStream(fout)) {
146.113 + cipher.init(Cipher.DECRYPT_MODE, cipherKey, params);
146.114
146.115 - byte[] out = new byte[len];
146.116 - len = cipher.doFinal(out, 0);
146.117 - cout.write(out, 0, len);
146.118 - cout.flush();
146.119 + byte[] output = null;
146.120 + while ((len = cin.read(input, 0, bufferLen)) > 0) {
146.121 + output = cipher.update(input, 0, len);
146.122 + pout.write(output, 0, output.length);
146.123 + }
146.124
146.125 - cin = new BufferedInputStream(new FileInputStream(cfile));
146.126 - pout = new BufferedOutputStream(new FileOutputStream(poutfile));
146.127 - cipher.init(Cipher.DECRYPT_MODE, cipherKey, params);
146.128 -
146.129 - byte[] output = null;
146.130 - while ((len = cin.read(input, 0, bufferLen)) > 0) {
146.131 - output = cipher.update(input, 0, len);
146.132 - pout.write(output, 0, output.length);
146.133 - pout.flush();
146.134 + len = cipher.getOutputSize(0);
146.135 + byte[] out = new byte[len];
146.136 + len = cipher.doFinal(out, 0);
146.137 + pout.write(out, 0, len);
146.138 }
146.139
146.140 - len = cipher.getOutputSize(0);
146.141 - out = new byte[len];
146.142 - len = cipher.doFinal(out, 0);
146.143 - pout.write(out, 0, len);
146.144 - pout.flush();
146.145 -
146.146 - Process child = Runtime.getRuntime().exec
146.147 - ("diff " + pinfile + " " + poutfile);
146.148 - InputStream in = child.getInputStream();
146.149 - byte[] data = new byte[64];
146.150 -
146.151 - while((len = in.read(data)) != -1)
146.152 - System.out.write(data, 0, len);
146.153 - in.close();
146.154 - child.waitFor();
146.155 - System.out.println("child exited with " + child.exitValue());
146.156 - }
146.157 - catch (IllegalBlockSizeException ex) {
146.158 - if ((totalInputLen % 8 != 0) && (padding.equals("NoPadding")))
146.159 + diff(pinfile, poutfile);
146.160 + } catch (IllegalBlockSizeException ex) {
146.161 + if ((totalInputLen % 8 != 0) && (padding.equals("NoPadding"))) {
146.162 return;
146.163 - else {
146.164 + } else {
146.165 System.out.println("Test failed!");
146.166 throw ex;
146.167 }
146.168 }
146.169 - finally {
146.170 - try {
146.171 - if (pin != null)
146.172 - pin.close();
146.173 - if (pout != null)
146.174 - pout.close();
146.175 - if (cin != null)
146.176 - cin.close();
146.177 - if (cout != null)
146.178 - cout.close();
146.179 - }
146.180 - catch (IOException e) {
146.181 - e.printStackTrace();
146.182 - return;
146.183 - }
146.184 + }
146.185 +
146.186 + private static void diff(String fname1, String fname2) throws Exception {
146.187 + if (!Arrays.equals(Files.readAllBytes(Paths.get(fname1)),
146.188 + Files.readAllBytes(Paths.get(fname1)))) {
146.189 + throw new Exception(
146.190 + "files " + fname1 + " and " + fname2 + " differ");
146.191 }
146.192 }
146.193 -
146.194 }
147.1 --- a/test/com/sun/jdi/ShellScaffold.sh Fri Aug 05 15:35:04 2011 -0700
147.2 +++ b/test/com/sun/jdi/ShellScaffold.sh Tue Aug 09 17:38:52 2011 -0700
147.3 @@ -250,6 +250,7 @@
147.4 isCygwin=
147.5 case "$osname" in
147.6 Windows* | CYGWIN*)
147.7 + devnull=NUL
147.8 if [ "$osname" = Windows_98 -o "$osname" = Windows_ME ]; then
147.9 isWin98=1
147.10 debuggeeKeyword='we_cant_kill_debuggees_on_win98'
147.11 @@ -259,6 +260,7 @@
147.12 case "$osname" in
147.13 CYGWIN*)
147.14 isCygwin=1
147.15 + devnull=/dev/null
147.16 ;;
147.17 esac
147.18
147.19 @@ -269,7 +271,6 @@
147.20 transport=dt_socket
147.21 address=
147.22 fi
147.23 - devnull=NUL
147.24 baseArgs="$baseArgs -XX:-ShowMessageBoxOnError"
147.25 # jtreg puts \\s in TESTCLASSES and some uses, eg. echo
147.26 # treat them as control chars on mks (eg \t is tab)
148.1 --- a/test/com/sun/jndi/ldap/InvalidLdapFilters.java Fri Aug 05 15:35:04 2011 -0700
148.2 +++ b/test/com/sun/jndi/ldap/InvalidLdapFilters.java Tue Aug 09 17:38:52 2011 -0700
148.3 @@ -1,5 +1,5 @@
148.4 /*
148.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
148.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
148.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
148.8 *
148.9 * This code is free software; you can redistribute it and/or modify it
148.10 @@ -23,8 +23,10 @@
148.11
148.12 /**
148.13 * @test
148.14 - * @bug 6916202
148.15 + * @bug 6916202 7041125
148.16 * @summary More cases of invalid ldap filters accepted and processed
148.17 + * LDAP API does not catch malformed filters that contain two operands
148.18 + * for the ! operator
148.19 * @run main/othervm InvalidLdapFilters valid (cn=Babs)
148.20 * @run main/othervm InvalidLdapFilters valid (&(cn=Bob))
148.21 * @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(uid=*))
148.22 @@ -34,6 +36,7 @@
148.23 * @run main/othervm InvalidLdapFilters valid (!(!(cn=Tim)))
148.24 * @run main/othervm InvalidLdapFilters valid (!(&(objectClass=*)(uid=*)))
148.25 * @run main/othervm InvalidLdapFilters valid (!(|(objectClass=*)(uid=*)))
148.26 + * @run main/othervm InvalidLdapFilters valid (&(objectClass=*)(!(uid=*)))
148.27 * @run main/othervm InvalidLdapFilters valid (o=univ*of*mich*)
148.28 * @run main/othervm InvalidLdapFilters valid (seeAlso=)
148.29 * @run main/othervm InvalidLdapFilters valid (cn:caseExactMatch:=Flintstone)
148.30 @@ -75,6 +78,8 @@
148.31 "((objectCategory=person)(cn=u)(!(cn=u2*)))"
148.32 * @run main/othervm InvalidLdapFilters invalid
148.33 "((&(objectClass=user)(cn=andy*)(cn=steve*)(cn=bob*)))"
148.34 + * @run main/othervm InvalidLdapFilters invalid
148.35 + (&(objectClass=Person)(!(sn=Jensen)(cn=Bab)))
148.36 *
148.37 * @author Xuelei Fan
148.38 */
149.1 --- a/test/com/sun/net/httpserver/Test1.java Fri Aug 05 15:35:04 2011 -0700
149.2 +++ b/test/com/sun/net/httpserver/Test1.java Tue Aug 09 17:38:52 2011 -0700
149.3 @@ -26,6 +26,7 @@
149.4 * @bug 6270015
149.5 * @run main/othervm Test1
149.6 * @run main/othervm -Dsun.net.httpserver.maxReqTime=10 Test1
149.7 + * @run main/othervm -Dsun.net.httpserver.nodelay=true Test1
149.8 * @summary Light weight HTTP server
149.9 */
149.10
149.11 @@ -42,6 +43,10 @@
149.12 * - send/receive large/small file
149.13 * - chunked encoding
149.14 * - via http and https
149.15 + *
149.16 + * The test is also run with sun.net.httpserver.nodelay simply to exercise
149.17 + * this option. There is no specific pass or failure related to running with
149.18 + * this option.
149.19 */
149.20
149.21 public class Test1 extends Test {
150.1 --- a/test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java Fri Aug 05 15:35:04 2011 -0700
150.2 +++ b/test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java Tue Aug 09 17:38:52 2011 -0700
150.3 @@ -1,5 +1,5 @@
150.4 /*
150.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
150.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
150.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
150.8 *
150.9 * This code is free software; you can redistribute it and/or modify it
150.10 @@ -36,15 +36,19 @@
150.11
150.12 public static void main(String[] args) throws Exception {
150.13
150.14 - Locale.setDefault(Locale.ITALY);
150.15 + Locale reservedLocale = Locale.getDefault();
150.16 + try {
150.17 + Locale.setDefault(Locale.ITALY);
150.18
150.19 - try {
150.20 throw new XMLSecurityException("foo");
150.21 } catch (XMLSecurityException xse) {
150.22 System.out.println("Test PASSED");
150.23 } catch (Throwable t) {
150.24 System.out.println("Test FAILED");
150.25 t.printStackTrace();
150.26 + } finally {
150.27 + // restore the reserved locale
150.28 + Locale.setDefault(reservedLocale);
150.29 }
150.30 }
150.31 }
151.1 --- a/test/demo/zipfs/basic.sh Fri Aug 05 15:35:04 2011 -0700
151.2 +++ b/test/demo/zipfs/basic.sh Tue Aug 09 17:38:52 2011 -0700
151.3 @@ -39,7 +39,7 @@
151.4
151.5 OS=`uname -s`
151.6 case "$OS" in
151.7 - Windows_* )
151.8 + Windows_* | CYGWIN* )
151.9 CLASSPATH="${TESTCLASSES};${ZIPFS}"
151.10 ;;
151.11 * )
152.1 --- a/test/java/beans/XMLDecoder/Test6341798.java Fri Aug 05 15:35:04 2011 -0700
152.2 +++ b/test/java/beans/XMLDecoder/Test6341798.java Tue Aug 09 17:38:52 2011 -0700
152.3 @@ -1,5 +1,5 @@
152.4 /*
152.5 - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
152.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
152.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
152.8 *
152.9 * This code is free software; you can redistribute it and/or modify it
152.10 @@ -47,8 +47,14 @@
152.11 + "</java> ";
152.12
152.13 public static void main(String[] args) {
152.14 - test(ENGLISH, DATA.getBytes());
152.15 - test(TURKISH, DATA.getBytes());
152.16 + Locale reservedLocale = Locale.getDefault();
152.17 + try {
152.18 + test(ENGLISH, DATA.getBytes());
152.19 + test(TURKISH, DATA.getBytes());
152.20 + } finally {
152.21 + // restore the reserved locale
152.22 + Locale.setDefault(reservedLocale);
152.23 + }
152.24 }
152.25
152.26 private static void test(Locale locale, byte[] data) {
153.1 --- a/test/java/io/pathNames/win32/bug6344646.java Fri Aug 05 15:35:04 2011 -0700
153.2 +++ b/test/java/io/pathNames/win32/bug6344646.java Tue Aug 09 17:38:52 2011 -0700
153.3 @@ -1,5 +1,5 @@
153.4 /*
153.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
153.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
153.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
153.8 *
153.9 * This code is free software; you can redistribute it and/or modify it
153.10 @@ -32,17 +32,24 @@
153.11
153.12 public class bug6344646 {
153.13 public static void main(String[] s) {
153.14 - /* This test is only valid on win32 systems */
153.15 - if (File.separatorChar != '\\') {
153.16 - return;
153.17 - }
153.18 + Locale reservedLocale = Locale.getDefault();
153.19 + try {
153.20 + /* This test is only valid on win32 systems */
153.21 + if (File.separatorChar != '\\') {
153.22 + return;
153.23 + }
153.24
153.25 - Locale.setDefault(new Locale("lt"));
153.26 - File f1 = new File("J\u0301");
153.27 - File f2 = new File("j\u0301");
153.28 + Locale.setDefault(new Locale("lt"));
153.29 + File f1 = new File("J\u0301");
153.30 + File f2 = new File("j\u0301");
153.31
153.32 - if (f1.hashCode() != f2.hashCode()) {
153.33 - throw new RuntimeException("File.hashCode() for \"J\u0301\" and \"j\u0301\" should be the same");
153.34 + if (f1.hashCode() != f2.hashCode()) {
153.35 + throw new RuntimeException("File.hashCode() for \"J\u0301\" " +
153.36 + "and \"j\u0301\" should be the same");
153.37 + }
153.38 + } finally {
153.39 + // restore the reserved locale
153.40 + Locale.setDefault(reservedLocale);
153.41 }
153.42 }
153.43 }
154.1 --- a/test/java/lang/instrument/ManifestTest.sh Fri Aug 05 15:35:04 2011 -0700
154.2 +++ b/test/java/lang/instrument/ManifestTest.sh Tue Aug 09 17:38:52 2011 -0700
154.3 @@ -26,7 +26,7 @@
154.4 # @summary JLI JAR manifest processing should ignore leading and trailing white space.
154.5 # @author Daniel D. Daugherty
154.6 #
154.7 -# @run build ManifestTestApp
154.8 +# @run build ManifestTestApp ExampleForBootClassPath
154.9 # @run shell/timeout=900 ManifestTest.sh
154.10 #
154.11
154.12 @@ -42,6 +42,9 @@
154.13 expect_retrans_line="isRetransformClassesSupported()=false"
154.14 can_set_nmp_line=""
154.15 expect_set_nmp_line="isNativeMethodPrefixSupported()=false"
154.16 + # some tests create directories with spaces in their name,
154.17 + # explicitly delete these.
154.18 + to_be_deleted=""
154.19
154.20 while [ $# != 0 ] ; do
154.21 case "$1" in
154.22 @@ -59,30 +62,33 @@
154.23 boot_cp_line2)
154.24 boot_cp_line="Boot-Class-Path: has_leading_blank"
154.25 expect_boot_cp_line="ExampleForBootClassPath was loaded."
154.26 + to_be_deleted=" has_leading_blank"
154.27 mkdir -p has_leading_blank " has_leading_blank"
154.28 # the good class is in the directory without the blank
154.29 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class \
154.30 has_leading_blank
154.31 # the bad class is in the directory with the blank
154.32 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
154.33 - " has_leading_blank"/ExampleForBootClassPath.class
154.34 + " has_leading_blank/ExampleForBootClassPath.class"
154.35 ;;
154.36
154.37 boot_cp_line3)
154.38 boot_cp_line="Boot-Class-Path: has_trailing_blank "
154.39 expect_boot_cp_line="ExampleForBootClassPath was loaded."
154.40 + to_be_deleted="has_trailing_blank "
154.41 mkdir -p has_trailing_blank "has_trailing_blank "
154.42 # the good class is in the directory without the blank
154.43 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class \
154.44 has_trailing_blank
154.45 # the bad class is in the directory with the blank
154.46 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
154.47 - "has_trailing_blank "/ExampleForBootClassPath.class
154.48 + "has_trailing_blank /ExampleForBootClassPath.class"
154.49 ;;
154.50
154.51 boot_cp_line4)
154.52 boot_cp_line="Boot-Class-Path: has_leading_and_trailing_blank "
154.53 expect_boot_cp_line="ExampleForBootClassPath was loaded."
154.54 + to_be_deleted=" has_leading_and_trailing_blank "
154.55 mkdir -p has_leading_and_trailing_blank \
154.56 " has_leading_and_trailing_blank "
154.57 # the good class is in the directory without the blanks
154.58 @@ -90,18 +96,19 @@
154.59 has_leading_and_trailing_blank
154.60 # the bad class is in the directory with the blanks
154.61 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
154.62 - " has_leading_and_trailing_blank "/ExampleForBootClassPath.class
154.63 + " has_leading_and_trailing_blank /ExampleForBootClassPath.class"
154.64 ;;
154.65
154.66 boot_cp_line5)
154.67 boot_cp_line="Boot-Class-Path: has_embedded blank"
154.68 expect_boot_cp_line="ExampleForBootClassPath was loaded."
154.69 + to_be_deleted="has_embedded blank"
154.70 mkdir -p has_embedded "has_embedded blank"
154.71 # the good class is in the first blank separated word
154.72 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class has_embedded
154.73 # the bad class is in the directory with the blank
154.74 cp -p $OUT_OF_THE_WAY/ExampleForBootClassPath.class.bad \
154.75 - "has_embedded blank"/ExampleForBootClassPath.class
154.76 + "has_embedded blank/ExampleForBootClassPath.class"
154.77 ;;
154.78
154.79 can_redef_line1)
154.80 @@ -429,6 +436,12 @@
154.81 touch $FAIL_MARKER
154.82 fi
154.83
154.84 + #clean up any problematic directories
154.85 + if [ -n "$to_be_deleted" ]; then
154.86 + echo "Test removing [$to_be_deleted]"
154.87 + rm -rf "$to_be_deleted"
154.88 + fi
154.89 +
154.90 echo "===== end test case: $token ====="
154.91 echo
154.92 done << EOF
155.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
155.2 +++ b/test/java/lang/reflect/Constructor/Equals.java Tue Aug 09 17:38:52 2011 -0700
155.3 @@ -0,0 +1,60 @@
155.4 +/*
155.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
155.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
155.7 + *
155.8 + * This code is free software; you can redistribute it and/or modify it
155.9 + * under the terms of the GNU General Public License version 2 only, as
155.10 + * published by the Free Software Foundation.
155.11 + *
155.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
155.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
155.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
155.15 + * version 2 for more details (a copy is included in the LICENSE file that
155.16 + * accompanied this code).
155.17 + *
155.18 + * You should have received a copy of the GNU General Public License version
155.19 + * 2 along with this work; if not, write to the Free Software Foundation,
155.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
155.21 + *
155.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
155.23 + * or visit www.oracle.com if you need additional information or have any
155.24 + * questions.
155.25 + */
155.26 +
155.27 +/*
155.28 + * @test
155.29 + * @bug 7073296
155.30 + * @summary Generic framework to test Constructor.equals.
155.31 + *
155.32 + * @compile Equals.java
155.33 + * @run main Equals
155.34 + */
155.35 +
155.36 +import java.lang.reflect.*;
155.37 +
155.38 +public class Equals {
155.39 + public Equals(){}
155.40 + public Equals(Object o) {/* only for testing*/}
155.41 + public Equals(int i) {/* only for testing */}
155.42 +
155.43 + public Equals m() { return this; }
155.44 +
155.45 + public static void main(String [] args) {
155.46 + Equals e = new Equals();
155.47 + e.equalConstructors();
155.48 + }
155.49 +
155.50 + public void equalConstructors() {
155.51 + Constructor<?>[] constructors = Equals.class.getDeclaredConstructors();
155.52 + for(Constructor<?> ctor1 : constructors) {
155.53 + for(Constructor<?> ctor2 : constructors) {
155.54 + boolean expected = (ctor1 == ctor2);
155.55 + if (ctor1.equals(ctor2) != expected)
155.56 + throw new RuntimeException("Constructors '" +
155.57 + ctor1 + "'("+ System.identityHashCode(ctor1) + ") " +
155.58 + (expected ? "!=" : "==") + " '" +
155.59 + ctor2 + "'("+ System.identityHashCode(ctor2) + ")");
155.60 + }
155.61 + }
155.62 + }
155.63 +}
156.1 --- a/test/java/net/CookieHandler/B6791927.java Fri Aug 05 15:35:04 2011 -0700
156.2 +++ b/test/java/net/CookieHandler/B6791927.java Tue Aug 09 17:38:52 2011 -0700
156.3 @@ -1,5 +1,5 @@
156.4 /*
156.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
156.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
156.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
156.8 *
156.9 * This code is free software; you can redistribute it and/or modify it
156.10 @@ -33,16 +33,23 @@
156.11
156.12 public class B6791927 {
156.13 public static final void main( String[] aaParamters ) throws Exception{
156.14 - // Forces a non US locale
156.15 - Locale.setDefault(Locale.FRANCE);
156.16 - List<HttpCookie> cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT");
156.17 - if (cookies == null || cookies.isEmpty()) {
156.18 - throw new RuntimeException("No cookie found");
156.19 - }
156.20 - for (HttpCookie c : cookies) {
156.21 - if (c.getMaxAge() == 0) {
156.22 - throw new RuntimeException("Expiration date shouldn't be 0");
156.23 + Locale reservedLocale = Locale.getDefault();
156.24 + try {
156.25 + // Forces a non US locale
156.26 + Locale.setDefault(Locale.FRANCE);
156.27 + List<HttpCookie> cookies = HttpCookie.parse("set-cookie: CUSTOMER=WILE_E_COYOTE; expires=Wednesday, 09-Nov-2019 23:12:40 GMT");
156.28 + if (cookies == null || cookies.isEmpty()) {
156.29 + throw new RuntimeException("No cookie found");
156.30 }
156.31 + for (HttpCookie c : cookies) {
156.32 + if (c.getMaxAge() == 0) {
156.33 + throw new RuntimeException(
156.34 + "Expiration date shouldn't be 0");
156.35 + }
156.36 + }
156.37 + } finally {
156.38 + // restore the reserved locale
156.39 + Locale.setDefault(reservedLocale);
156.40 }
156.41 }
156.42 }
157.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
157.2 +++ b/test/java/net/SocketPermission/Wildcard.java Tue Aug 09 17:38:52 2011 -0700
157.3 @@ -0,0 +1,45 @@
157.4 +/*
157.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
157.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
157.7 + *
157.8 + * This code is free software; you can redistribute it and/or modify it
157.9 + * under the terms of the GNU General Public License version 2 only, as
157.10 + * published by the Free Software Foundation.
157.11 + *
157.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
157.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
157.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
157.15 + * version 2 for more details (a copy is included in the LICENSE file that
157.16 + * accompanied this code).
157.17 + *
157.18 + * You should have received a copy of the GNU General Public License version
157.19 + * 2 along with this work; if not, write to the Free Software Foundation,
157.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
157.21 + *
157.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
157.23 + * or visit www.oracle.com if you need additional information or have any
157.24 + * questions.
157.25 + */
157.26 +
157.27 +/*
157.28 + * @test
157.29 + * @bug 7021280
157.30 + * @summary SocketPermission should accept wildcards
157.31 + */
157.32 +
157.33 +import java.net.SocketPermission;
157.34 +
157.35 +public class Wildcard
157.36 +{
157.37 + public static void main(String[] args) throws Exception {
157.38 + SocketPermission star_All =
157.39 + new SocketPermission("*.blabla.bla", "listen,accept,connect");
157.40 + SocketPermission www_All =
157.41 + new SocketPermission("bla.blabla.bla", "listen,accept,connect");
157.42 +
157.43 + if (!star_All.implies(www_All)) {
157.44 + throw new RuntimeException(
157.45 + "Failed: " + star_All + " does not imply " + www_All);
157.46 + }
157.47 + }
157.48 +}
158.1 --- a/test/java/net/URLConnection/SetIfModifiedSince.java Fri Aug 05 15:35:04 2011 -0700
158.2 +++ b/test/java/net/URLConnection/SetIfModifiedSince.java Tue Aug 09 17:38:52 2011 -0700
158.3 @@ -1,5 +1,5 @@
158.4 /*
158.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
158.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
158.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
158.8 *
158.9 * This code is free software; you can redistribute it and/or modify it
158.10 @@ -73,6 +73,7 @@
158.11 }
158.12
158.13 public static void main (String[] args) {
158.14 + Locale reservedLocale = Locale.getDefault();
158.15 try {
158.16 Locale.setDefault(Locale.JAPAN);
158.17 ServerSocket serversocket = new ServerSocket (0);
158.18 @@ -87,6 +88,10 @@
158.19 int i=0, c;
158.20 Thread.sleep (5000);
158.21 } catch (Exception e) {
158.22 + } finally {
158.23 + // restore the reserved locale
158.24 + Locale.setDefault(reservedLocale);
158.25 }
158.26 +
158.27 }
158.28 }
159.1 --- a/test/java/nio/charset/coders/CheckSJISMappingProp.sh Fri Aug 05 15:35:04 2011 -0700
159.2 +++ b/test/java/nio/charset/coders/CheckSJISMappingProp.sh Tue Aug 09 17:38:52 2011 -0700
159.3 @@ -36,7 +36,7 @@
159.4 case "$OS" in
159.5 SunOS | Linux ) ;;
159.6 # Skip locale test for Windows
159.7 - Windows* )
159.8 + Windows* | CYGWIN* )
159.9 echo "Passed"; exit 0 ;;
159.10 * ) echo "Unrecognized system!" ; exit 1 ;;
159.11 esac
160.1 --- a/test/java/nio/charset/spi/basic.sh Fri Aug 05 15:35:04 2011 -0700
160.2 +++ b/test/java/nio/charset/spi/basic.sh Tue Aug 09 17:38:52 2011 -0700
160.3 @@ -45,9 +45,19 @@
160.4 JAVA=$TESTJAVA/bin/java
160.5 JAR=$TESTJAVA/bin/jar
160.6
160.7 -JARD=`pwd`/x.jar
160.8 -EXTD=`pwd`/x.ext
160.9 -TESTD=`pwd`/x.test
160.10 +DIR=`pwd`
160.11 +case `uname` in
160.12 + SunOS | Linux ) CPS=':' ;;
160.13 + Windows* ) CPS=';' ;;
160.14 + CYGWIN* )
160.15 + DIR=`/usr/bin/cygpath -a -s -m $DIR`
160.16 + CPS=";";;
160.17 + *) echo "Unknown platform: `uname`"; exit 1 ;;
160.18 +esac
160.19 +
160.20 +JARD=$DIR/x.jar
160.21 +EXTD=$DIR/x.ext
160.22 +TESTD=$DIR/x.test
160.23
160.24 CSS='US-ASCII 8859_1 iso-ir-6 UTF-16 windows-1252 !BAR cp1252'
160.25
160.26 @@ -84,12 +94,6 @@
160.27 TMP=${TMP:-$TEMP}; TMP=${TMP:-/tmp}
160.28 cd $TMP
160.29
160.30 -case `uname` in
160.31 - SunOS | Linux ) CPS=':' ;;
160.32 - Windows* ) CPS=';' ;;
160.33 - *) echo "Unknown platform: `uname`"; exit 1 ;;
160.34 -esac
160.35 -
160.36 failures=0
160.37 for where in ext app; do
160.38 for security in none minimal-policy cp-policy; do
161.1 --- a/test/java/util/Locale/LocaleCategory.java Fri Aug 05 15:35:04 2011 -0700
161.2 +++ b/test/java/util/Locale/LocaleCategory.java Tue Aug 09 17:38:52 2011 -0700
161.3 @@ -1,5 +1,5 @@
161.4 /*
161.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
161.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
161.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
161.8 *
161.9 * This code is free software; you can redistribute it and/or modify it
161.10 @@ -29,30 +29,37 @@
161.11 private static String enc = null;
161.12
161.13 public static void main(String[] args) {
161.14 - Locale.Builder builder = new Locale.Builder();
161.15 + Locale reservedLocale = Locale.getDefault();
161.16 + try {
161.17 + Locale.Builder builder = new Locale.Builder();
161.18
161.19 - base = builder.setLanguage(System.getProperty("user.language", ""))
161.20 - .setScript(System.getProperty("user.script", ""))
161.21 - .setRegion(System.getProperty("user.country", ""))
161.22 - .setVariant(System.getProperty("user.variant", "")).build();
161.23 - disp = builder.setLanguage(System.getProperty("user.language.display",
161.24 - Locale.getDefault().getLanguage()))
161.25 - .setScript(System.getProperty("user.script.display",
161.26 - Locale.getDefault().getScript()))
161.27 - .setRegion(System.getProperty("user.country.display",
161.28 - Locale.getDefault().getCountry()))
161.29 - .setVariant(System.getProperty("user.variant.display",
161.30 - Locale.getDefault().getVariant())).build();
161.31 - fmt = builder.setLanguage(System.getProperty("user.language.format",
161.32 - Locale.getDefault().getLanguage()))
161.33 - .setScript(System.getProperty("user.script.format",
161.34 - Locale.getDefault().getScript()))
161.35 - .setRegion(System.getProperty("user.country.format",
161.36 - Locale.getDefault().getCountry()))
161.37 - .setVariant(System.getProperty("user.variant.format",
161.38 - Locale.getDefault().getVariant())).build();
161.39 - checkDefault();
161.40 - testGetSetDefault();
161.41 + base = builder.setLanguage(System.getProperty("user.language", ""))
161.42 + .setScript(System.getProperty("user.script", ""))
161.43 + .setRegion(System.getProperty("user.country", ""))
161.44 + .setVariant(System.getProperty("user.variant", "")).build();
161.45 + disp = builder.setLanguage(
161.46 + System.getProperty("user.language.display",
161.47 + Locale.getDefault().getLanguage()))
161.48 + .setScript(System.getProperty("user.script.display",
161.49 + Locale.getDefault().getScript()))
161.50 + .setRegion(System.getProperty("user.country.display",
161.51 + Locale.getDefault().getCountry()))
161.52 + .setVariant(System.getProperty("user.variant.display",
161.53 + Locale.getDefault().getVariant())).build();
161.54 + fmt = builder.setLanguage(System.getProperty("user.language.format",
161.55 + Locale.getDefault().getLanguage()))
161.56 + .setScript(System.getProperty("user.script.format",
161.57 + Locale.getDefault().getScript()))
161.58 + .setRegion(System.getProperty("user.country.format",
161.59 + Locale.getDefault().getCountry()))
161.60 + .setVariant(System.getProperty("user.variant.format",
161.61 + Locale.getDefault().getVariant())).build();
161.62 + checkDefault();
161.63 + testGetSetDefault();
161.64 + } finally {
161.65 + // restore the reserved locale
161.66 + Locale.setDefault(reservedLocale);
161.67 + }
161.68 }
161.69
161.70 static void checkDefault() {
162.1 --- a/test/java/util/Locale/LocaleCategory.sh Fri Aug 05 15:35:04 2011 -0700
162.2 +++ b/test/java/util/Locale/LocaleCategory.sh Tue Aug 09 17:38:52 2011 -0700
162.3 @@ -34,7 +34,7 @@
162.4 PS=":"
162.5 FS="/"
162.6 ;;
162.7 - Windows* )
162.8 + Windows* | CYGWIN* )
162.9 PS=";"
162.10 FS="\\"
162.11 ;;
163.1 --- a/test/java/util/PluggableLocale/CurrencyNameProviderTest.java Fri Aug 05 15:35:04 2011 -0700
163.2 +++ b/test/java/util/PluggableLocale/CurrencyNameProviderTest.java Tue Aug 09 17:38:52 2011 -0700
163.3 @@ -1,5 +1,5 @@
163.4 /*
163.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
163.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
163.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
163.8 *
163.9 * This code is free software; you can redistribute it and/or modify it
163.10 @@ -32,7 +32,13 @@
163.11 public class CurrencyNameProviderTest extends ProviderTest {
163.12
163.13 public static void main(String[] s) {
163.14 - new CurrencyNameProviderTest();
163.15 + Locale reservedLocale = Locale.getDefault();
163.16 + try {
163.17 + new CurrencyNameProviderTest();
163.18 + } finally {
163.19 + // restore the reserved locale
163.20 + Locale.setDefault(reservedLocale);
163.21 + }
163.22 }
163.23
163.24 CurrencyNameProviderTest() {
164.1 --- a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java Fri Aug 05 15:35:04 2011 -0700
164.2 +++ b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.java Tue Aug 09 17:38:52 2011 -0700
164.3 @@ -1,5 +1,5 @@
164.4 /*
164.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
164.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
164.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
164.8 *
164.9 * This code is free software; you can redistribute it and/or modify it
164.10 @@ -113,6 +113,7 @@
164.11
164.12 void test2() {
164.13 Locale defaultLocale = Locale.getDefault();
164.14 + TimeZone reservedTimeZone = TimeZone.getDefault();
164.15 Date d = new Date(2005-1900, Calendar.DECEMBER, 22);
164.16 String formatted;
164.17
164.18 @@ -139,7 +140,6 @@
164.19 df = new SimpleDateFormat(pattern, DateFormatSymbols.getInstance());
164.20 System.out.println(formatted = df.format(d));
164.21 if(!formatted.equals(DISPLAY_NAMES_KYOTO[i])) {
164.22 - Locale.setDefault(defaultLocale);
164.23 throw new RuntimeException("Timezone " + TIMEZONES[i] +
164.24 ": formatted zone names mismatch. " +
164.25 formatted + " should match with " +
164.26 @@ -148,10 +148,12 @@
164.27 df.parse(DISPLAY_NAMES_KYOTO[i]);
164.28 }
164.29 } catch (ParseException pe) {
164.30 + throw new RuntimeException("parse error occured" + pe);
164.31 + } finally {
164.32 + // restore the reserved locale and time zone
164.33 Locale.setDefault(defaultLocale);
164.34 - throw new RuntimeException("parse error occured" + pe);
164.35 + TimeZone.setDefault(reservedTimeZone);
164.36 }
164.37 - Locale.setDefault(defaultLocale);
164.38 }
164.39
164.40 final String LATIME = "America/Los_Angeles";
165.1 --- a/test/java/util/ResourceBundle/Bug6190861.java Fri Aug 05 15:35:04 2011 -0700
165.2 +++ b/test/java/util/ResourceBundle/Bug6190861.java Tue Aug 09 17:38:52 2011 -0700
165.3 @@ -1,5 +1,5 @@
165.4 /*
165.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
165.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
165.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
165.8 *
165.9 * This code is free software; you can redistribute it and/or modify it
165.10 @@ -32,27 +32,34 @@
165.11 public class Bug6190861 {
165.12
165.13 static public void main(String[] args) {
165.14 - Locale.setDefault(new Locale("en", "US"));
165.15 + Locale reservedLocale = Locale.getDefault();
165.16 + try {
165.17 + Locale.setDefault(new Locale("en", "US"));
165.18
165.19 - List localeList = new ArrayList();
165.20 - localeList.add(Locale.ENGLISH);
165.21 - localeList.add(Locale.KOREA);
165.22 - localeList.add(Locale.UK);
165.23 - localeList.add(new Locale("en", "CA"));
165.24 - localeList.add(Locale.ENGLISH);
165.25 + List localeList = new ArrayList();
165.26 + localeList.add(Locale.ENGLISH);
165.27 + localeList.add(Locale.KOREA);
165.28 + localeList.add(Locale.UK);
165.29 + localeList.add(new Locale("en", "CA"));
165.30 + localeList.add(Locale.ENGLISH);
165.31
165.32 - Iterator iter = localeList.iterator();
165.33 - while (iter.hasNext()){
165.34 - Locale currentLocale = (Locale) iter.next();
165.35 - System.out.println("\ncurrentLocale = "
165.36 + Iterator iter = localeList.iterator();
165.37 + while (iter.hasNext()){
165.38 + Locale currentLocale = (Locale) iter.next();
165.39 + System.out.println("\ncurrentLocale = "
165.40 + currentLocale.getDisplayName());
165.41
165.42 - ResourceBundle messages = ResourceBundle.getBundle("Bug6190861Data",currentLocale);
165.43 + ResourceBundle messages =
165.44 + ResourceBundle.getBundle("Bug6190861Data",currentLocale);
165.45
165.46 - Locale messagesLocale = messages.getLocale();
165.47 - System.out.println("messagesLocale = "
165.48 + Locale messagesLocale = messages.getLocale();
165.49 + System.out.println("messagesLocale = "
165.50 + messagesLocale.getDisplayName());
165.51 - checkMessages(messages);
165.52 + checkMessages(messages);
165.53 + }
165.54 + } finally {
165.55 + // restore the reserved locale
165.56 + Locale.setDefault(reservedLocale);
165.57 }
165.58 }
165.59
166.1 --- a/test/java/util/ResourceBundle/Control/Bug6530694.java Fri Aug 05 15:35:04 2011 -0700
166.2 +++ b/test/java/util/ResourceBundle/Control/Bug6530694.java Tue Aug 09 17:38:52 2011 -0700
166.3 @@ -1,5 +1,5 @@
166.4 /*
166.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
166.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
166.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
166.8 *
166.9 * This code is free software; you can redistribute it and/or modify it
166.10 @@ -43,6 +43,12 @@
166.11 }
166.12
166.13 public static void main(String[] args) {
166.14 - new Bug6530694();
166.15 + Locale reservedLocale = Locale.getDefault();
166.16 + try {
166.17 + new Bug6530694();
166.18 + } finally {
166.19 + // restore the reserved locale
166.20 + Locale.setDefault(reservedLocale);
166.21 + }
166.22 }
166.23 }
167.1 --- a/test/java/util/ResourceBundle/Control/StressTest.java Fri Aug 05 15:35:04 2011 -0700
167.2 +++ b/test/java/util/ResourceBundle/Control/StressTest.java Tue Aug 09 17:38:52 2011 -0700
167.3 @@ -69,36 +69,44 @@
167.4 if (args.length > 1) {
167.5 duration = Math.max(5, Integer.parseInt(args[1]));
167.6 }
167.7 - Locale.setDefault(Locale.US);
167.8 - Thread[] tasks = new Thread[locales.length * threadsFactor];
167.9 - counters = new AtomicIntegerArray(tasks.length);
167.10
167.11 - for (int i = 0; i < tasks.length; i++) {
167.12 - tasks[i] = new Thread(new Worker(i));
167.13 + Locale reservedLocale = Locale.getDefault();
167.14 + try {
167.15 + Locale.setDefault(Locale.US);
167.16 + Thread[] tasks = new Thread[locales.length * threadsFactor];
167.17 + counters = new AtomicIntegerArray(tasks.length);
167.18 +
167.19 + for (int i = 0; i < tasks.length; i++) {
167.20 + tasks[i] = new Thread(new Worker(i));
167.21 + }
167.22 + for (int i = 0; i < tasks.length; i++) {
167.23 + tasks[i].start();
167.24 + }
167.25 +
167.26 + int nProcessors = Runtime.getRuntime().availableProcessors();
167.27 + intervalForCounterCheck = Math.max(tasks.length / nProcessors, 1);
167.28 + System.out.printf(
167.29 + "%d processors, intervalForCounterCheck = %d [sec]%n",
167.30 + nProcessors, intervalForCounterCheck);
167.31 + try {
167.32 + for (int i = 0; runrun && i < duration; i++) {
167.33 + Thread.sleep(1000); // 1 second
167.34 + if ((i % intervalForCounterCheck) == 0) {
167.35 + checkCounters();
167.36 + }
167.37 + }
167.38 + runrun = false;
167.39 + for (int i = 0; i < tasks.length; i++) {
167.40 + tasks[i].join();
167.41 + }
167.42 + } catch (InterruptedException e) {
167.43 + }
167.44 +
167.45 + printCounters();
167.46 + } finally {
167.47 + // restore the reserved locale
167.48 + Locale.setDefault(reservedLocale);
167.49 }
167.50 - for (int i = 0; i < tasks.length; i++) {
167.51 - tasks[i].start();
167.52 - }
167.53 -
167.54 - int nProcessors = Runtime.getRuntime().availableProcessors();
167.55 - intervalForCounterCheck = Math.max(tasks.length / nProcessors, 1);
167.56 - System.out.printf("%d processors, intervalForCounterCheck = %d [sec]%n",
167.57 - nProcessors, intervalForCounterCheck);
167.58 - try {
167.59 - for (int i = 0; runrun && i < duration; i++) {
167.60 - Thread.sleep(1000); // 1 second
167.61 - if ((i % intervalForCounterCheck) == 0) {
167.62 - checkCounters();
167.63 - }
167.64 - }
167.65 - runrun = false;
167.66 - for (int i = 0; i < tasks.length; i++) {
167.67 - tasks[i].join();
167.68 - }
167.69 - } catch (InterruptedException e) {
167.70 - }
167.71 -
167.72 - printCounters();
167.73 }
167.74
167.75 static void checkCounters() {
168.1 --- a/test/java/util/ResourceBundle/Test4314141.java Fri Aug 05 15:35:04 2011 -0700
168.2 +++ b/test/java/util/ResourceBundle/Test4314141.java Tue Aug 09 17:38:52 2011 -0700
168.3 @@ -1,5 +1,5 @@
168.4 /*
168.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
168.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
168.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
168.8 *
168.9 * This code is free software; you can redistribute it and/or modify it
168.10 @@ -35,8 +35,14 @@
168.11 public class Test4314141 {
168.12
168.13 public static void main(String[] args) {
168.14 - testCandidateOmission();
168.15 - testExample();
168.16 + Locale reservedLocale = Locale.getDefault();
168.17 + try {
168.18 + testCandidateOmission();
168.19 + testExample();
168.20 + } finally {
168.21 + // restore the reserved locale
168.22 + Locale.setDefault(reservedLocale);
168.23 + }
168.24 }
168.25
168.26 /**
169.1 --- a/test/java/util/ResourceBundle/Test4318520.java Fri Aug 05 15:35:04 2011 -0700
169.2 +++ b/test/java/util/ResourceBundle/Test4318520.java Tue Aug 09 17:38:52 2011 -0700
169.3 @@ -1,5 +1,5 @@
169.4 /*
169.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
169.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
169.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
169.8 *
169.9 * This code is free software; you can redistribute it and/or modify it
169.10 @@ -36,8 +36,14 @@
169.11 public class Test4318520 {
169.12
169.13 public static void main(String[] args) {
169.14 - test(Locale.GERMAN);
169.15 - test(Locale.ENGLISH);
169.16 + Locale reservedLocale = Locale.getDefault();
169.17 + try {
169.18 + test(Locale.GERMAN);
169.19 + test(Locale.ENGLISH);
169.20 + } finally {
169.21 + // restore the reserved locale
169.22 + Locale.setDefault(reservedLocale);
169.23 + }
169.24 }
169.25
169.26 private static void test(Locale locale) {
170.1 --- a/test/java/util/concurrent/Executors/AutoShutdown.java Fri Aug 05 15:35:04 2011 -0700
170.2 +++ b/test/java/util/concurrent/Executors/AutoShutdown.java Tue Aug 09 17:38:52 2011 -0700
170.3 @@ -67,6 +67,11 @@
170.4 e1 = e2 = null;
170.5 for (int i = 0; i < 10 && Thread.activeCount() > count0; i++)
170.6 tryWaitForFinalizersToRun();
170.7 + for (int i = 0; i < 10; ++i) { // give JVM a chance to settle.
170.8 + if (Thread.activeCount() == count0)
170.9 + return;
170.10 + Thread.sleep(1000);
170.11 + }
170.12 equal(Thread.activeCount(), count0);
170.13 }
170.14
171.1 --- a/test/java/util/concurrent/Phaser/Arrive.java Fri Aug 05 15:35:04 2011 -0700
171.2 +++ b/test/java/util/concurrent/Phaser/Arrive.java Tue Aug 09 17:38:52 2011 -0700
171.3 @@ -45,9 +45,12 @@
171.4
171.5 public class Arrive {
171.6 void test(String[] args) throws Throwable {
171.7 + for (int i = 0; i < 100; ++i)
171.8 + doTest(args);
171.9 + }
171.10 + void doTest(String[] args) throws Throwable {
171.11 final int n = ThreadLocalRandom.current().nextInt(1, 10);
171.12 - final int nthreads = n*3/2;
171.13 - final Phaser startingGate = new Phaser(nthreads);
171.14 + final Phaser startingGate = new Phaser(n);
171.15 final Phaser phaser = new Phaser(n);
171.16 final List<Thread> threads = new ArrayList<Thread>();
171.17 final AtomicInteger count0 = new AtomicInteger(0);
171.18 @@ -64,14 +67,14 @@
171.19 else
171.20 fail();
171.21 }};
171.22 - for (int i = 0; i < nthreads; i++)
171.23 + for (int i = 0; i < n; i++)
171.24 threads.add(new Thread(task));
171.25 for (Thread thread : threads)
171.26 thread.start();
171.27 for (Thread thread : threads)
171.28 thread.join();
171.29 equal(count0.get(), n);
171.30 - equal(count1.get(), nthreads-n);
171.31 + equal(count1.get(), 0);
171.32 equal(phaser.getPhase(), 1);
171.33 }
171.34
172.1 --- a/test/java/util/jar/JarFile/TurkCert.java Fri Aug 05 15:35:04 2011 -0700
172.2 +++ b/test/java/util/jar/JarFile/TurkCert.java Tue Aug 09 17:38:52 2011 -0700
172.3 @@ -1,5 +1,5 @@
172.4 /*
172.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
172.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
172.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
172.8 *
172.9 * This code is free software; you can redistribute it and/or modify it
172.10 @@ -26,7 +26,6 @@
172.11 * @bug 4624534
172.12 * @summary Make sure jar certificates work for Turkish locale
172.13 * @author kladko
172.14 - * @run main/othervm TurkCert
172.15 */
172.16
172.17 import java.util.*;
172.18 @@ -36,15 +35,24 @@
172.19
172.20 public class TurkCert {
172.21 public static void main(String[] args) throws Exception{
172.22 - Locale.setDefault(new Locale("TR", "tr"));
172.23 - File f = new File(System.getProperty("test.src","."), "test.jar");
172.24 - JarFile jf = new JarFile(f, true);
172.25 - JarEntry je = (JarEntry)jf.getEntry("test.class");
172.26 - InputStream is = jf.getInputStream(je);
172.27 - byte[] b = new byte[1024];
172.28 - while (is.read(b) != -1) {
172.29 + Locale reservedLocale = Locale.getDefault();
172.30 + try {
172.31 + Locale.setDefault(new Locale("TR", "tr"));
172.32 + File f = new File(System.getProperty("test.src","."), "test.jar");
172.33 + try (JarFile jf = new JarFile(f, true)) {
172.34 + JarEntry je = (JarEntry)jf.getEntry("test.class");
172.35 + try (InputStream is = jf.getInputStream(je)) {
172.36 + byte[] b = new byte[1024];
172.37 + while (is.read(b) != -1) {
172.38 + }
172.39 + }
172.40 + if (je.getCertificates() == null) {
172.41 + throw new Exception("Null certificate for test.class.");
172.42 + }
172.43 + }
172.44 + } finally {
172.45 + // restore the default locale
172.46 + Locale.setDefault(reservedLocale);
172.47 }
172.48 - if (je.getCertificates() == null)
172.49 - throw new Exception("Null certificate for test.class.");
172.50 }
172.51 }
173.1 --- a/test/javax/crypto/Cipher/Turkish.java Fri Aug 05 15:35:04 2011 -0700
173.2 +++ b/test/javax/crypto/Cipher/Turkish.java Tue Aug 09 17:38:52 2011 -0700
173.3 @@ -1,5 +1,5 @@
173.4 /*
173.5 - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
173.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
173.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
173.8 *
173.9 * This code is free software; you can redistribute it and/or modify it
173.10 @@ -35,15 +35,21 @@
173.11 public class Turkish {
173.12
173.13 public static void main(String[] args) throws Exception {
173.14 - Locale.setDefault(new Locale("tr", "TR"));
173.15 + Locale reservedLocale = Locale.getDefault();
173.16 + try {
173.17 + Locale.setDefault(new Locale("tr", "TR"));
173.18
173.19 - System.out.println(Cipher.getInstance("RSA/ECB/PKCS1Padding"));
173.20 - System.out.println(Cipher.getInstance("RSA/ECB/PKCS1PADDING"));
173.21 - System.out.println(Cipher.getInstance("rsa/ecb/pkcs1padding"));
173.22 - System.out.println(Cipher.getInstance("Blowfish"));
173.23 - System.out.println(Cipher.getInstance("blowfish"));
173.24 - System.out.println(Cipher.getInstance("BLOWFISH"));
173.25 + System.out.println(Cipher.getInstance("RSA/ECB/PKCS1Padding"));
173.26 + System.out.println(Cipher.getInstance("RSA/ECB/PKCS1PADDING"));
173.27 + System.out.println(Cipher.getInstance("rsa/ecb/pkcs1padding"));
173.28 + System.out.println(Cipher.getInstance("Blowfish"));
173.29 + System.out.println(Cipher.getInstance("blowfish"));
173.30 + System.out.println(Cipher.getInstance("BLOWFISH"));
173.31
173.32 - System.out.println("OK");
173.33 + System.out.println("OK");
173.34 + } finally {
173.35 + // restore the default locale
173.36 + Locale.setDefault(reservedLocale);
173.37 + }
173.38 }
173.39 }
174.1 --- a/test/javax/swing/JColorChooser/Test6524757.java Fri Aug 05 15:35:04 2011 -0700
174.2 +++ b/test/javax/swing/JColorChooser/Test6524757.java Tue Aug 09 17:38:52 2011 -0700
174.3 @@ -1,5 +1,5 @@
174.4 /*
174.5 - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
174.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
174.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
174.8 *
174.9 * This code is free software; you can redistribute it and/or modify it
174.10 @@ -98,17 +98,23 @@
174.11 private static final Object[] FRENCH = convert(Locale.FRENCH, KEYS);
174.12
174.13 public static void main(String[] args) {
174.14 - // it affects Swing because it is not initialized
174.15 - Locale.setDefault(Locale.KOREAN);
174.16 - validate(KOREAN, create());
174.17 + Locale reservedLocale = Locale.getDefault();
174.18 + try {
174.19 + // it affects Swing because it is not initialized
174.20 + Locale.setDefault(Locale.KOREAN);
174.21 + validate(KOREAN, create());
174.22
174.23 - // it does not affect Swing because it is initialized
174.24 - Locale.setDefault(Locale.CANADA);
174.25 - validate(KOREAN, create());
174.26 + // it does not affect Swing because it is initialized
174.27 + Locale.setDefault(Locale.CANADA);
174.28 + validate(KOREAN, create());
174.29
174.30 - // it definitely should affect Swing
174.31 - JComponent.setDefaultLocale(Locale.FRENCH);
174.32 - validate(FRENCH, create());
174.33 + // it definitely should affect Swing
174.34 + JComponent.setDefaultLocale(Locale.FRENCH);
174.35 + validate(FRENCH, create());
174.36 + } finally {
174.37 + // restore the reserved locale
174.38 + Locale.setDefault(reservedLocale);
174.39 + }
174.40 }
174.41
174.42 private static void validate(Object[] expected, Object[] actual) {
175.1 --- a/test/sun/security/krb5/auto/KDC.java Fri Aug 05 15:35:04 2011 -0700
175.2 +++ b/test/sun/security/krb5/auto/KDC.java Tue Aug 09 17:38:52 2011 -0700
175.3 @@ -170,6 +170,10 @@
175.4 * Use only one preauth, so that some keys are not easy to generate
175.5 */
175.6 ONLY_ONE_PREAUTH,
175.7 + /**
175.8 + * Set all name-type to a value in response
175.9 + */
175.10 + RESP_NT,
175.11 };
175.12
175.13 static {
175.14 @@ -637,10 +641,16 @@
175.15 */
175.16 private byte[] processTgsReq(byte[] in) throws Exception {
175.17 TGSReq tgsReq = new TGSReq(in);
175.18 + PrincipalName service = tgsReq.reqBody.sname;
175.19 + if (options.containsKey(KDC.Option.RESP_NT)) {
175.20 + service = new PrincipalName(service.getNameStrings(),
175.21 + (int)options.get(KDC.Option.RESP_NT));
175.22 + service.setRealm(service.getRealm());
175.23 + }
175.24 try {
175.25 System.out.println(realm + "> " + tgsReq.reqBody.cname +
175.26 " sends TGS-REQ for " +
175.27 - tgsReq.reqBody.sname);
175.28 + service);
175.29 KDCReqBody body = tgsReq.reqBody;
175.30 int[] eTypes = KDCReqBodyDotEType(body);
175.31 int e2 = eTypes[0]; // etype for outgoing session key
175.32 @@ -708,7 +718,7 @@
175.33 bFlags[Krb5.TKT_OPTS_MAY_POSTDATE] = true;
175.34 }
175.35
175.36 - if (configMatch("", body.sname.getNameString(), "ok-as-delegate")) {
175.37 + if (configMatch("", service.getNameString(), "ok-as-delegate")) {
175.38 bFlags[Krb5.TKT_OPTS_DELEGATE] = true;
175.39 }
175.40 bFlags[Krb5.TKT_OPTS_INITIAL] = true;
175.41 @@ -728,13 +738,13 @@
175.42 : new HostAddresses(
175.43 new InetAddress[]{InetAddress.getLocalHost()}),
175.44 null);
175.45 - EncryptionKey skey = keyForUser(body.sname, e3, true);
175.46 + EncryptionKey skey = keyForUser(service, e3, true);
175.47 if (skey == null) {
175.48 throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO
175.49 }
175.50 Ticket t = new Ticket(
175.51 body.crealm,
175.52 - body.sname,
175.53 + service,
175.54 new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET)
175.55 );
175.56 EncTGSRepPart enc_part = new EncTGSRepPart(
175.57 @@ -750,7 +760,7 @@
175.58 body.from,
175.59 till, body.rtime,
175.60 body.crealm,
175.61 - body.sname,
175.62 + service,
175.63 body.addresses != null // always set caddr
175.64 ? body.addresses
175.65 : new HostAddresses(
175.66 @@ -781,7 +791,7 @@
175.67 0,
175.68 ke.returnCode(),
175.69 body.crealm, body.cname,
175.70 - new Realm(getRealm()), body.sname,
175.71 + new Realm(getRealm()), service,
175.72 KrbException.errorMessage(ke.returnCode()),
175.73 null);
175.74 }
175.75 @@ -800,10 +810,16 @@
175.76 int[] eTypes = null;
175.77 List<PAData> outPAs = new ArrayList<>();
175.78
175.79 + PrincipalName service = asReq.reqBody.sname;
175.80 + if (options.containsKey(KDC.Option.RESP_NT)) {
175.81 + service = new PrincipalName(service.getNameStrings(),
175.82 + (int)options.get(KDC.Option.RESP_NT));
175.83 + service.setRealm(service.getRealm());
175.84 + }
175.85 try {
175.86 System.out.println(realm + "> " + asReq.reqBody.cname +
175.87 " sends AS-REQ for " +
175.88 - asReq.reqBody.sname);
175.89 + service);
175.90
175.91 KDCReqBody body = asReq.reqBody;
175.92 body.cname.setRealm(getRealm());
175.93 @@ -812,7 +828,7 @@
175.94 int eType = eTypes[0];
175.95
175.96 EncryptionKey ckey = keyForUser(body.cname, eType, false);
175.97 - EncryptionKey skey = keyForUser(body.sname, eType, true);
175.98 + EncryptionKey skey = keyForUser(service, eType, true);
175.99
175.100 if (options.containsKey(KDC.Option.ONLY_RC4_TGT)) {
175.101 int tgtEType = EncryptedData.ETYPE_ARCFOUR_HMAC;
175.102 @@ -826,7 +842,7 @@
175.103 if (!found) {
175.104 throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
175.105 }
175.106 - skey = keyForUser(body.sname, tgtEType, true);
175.107 + skey = keyForUser(service, tgtEType, true);
175.108 }
175.109 if (ckey == null) {
175.110 throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
175.111 @@ -943,7 +959,7 @@
175.112 null);
175.113 Ticket t = new Ticket(
175.114 body.crealm,
175.115 - body.sname,
175.116 + service,
175.117 new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET)
175.118 );
175.119 EncASRepPart enc_part = new EncASRepPart(
175.120 @@ -959,7 +975,7 @@
175.121 body.from,
175.122 till, body.rtime,
175.123 body.crealm,
175.124 - body.sname,
175.125 + service,
175.126 body.addresses
175.127 );
175.128 EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_AS_REP_PART);
175.129 @@ -1023,7 +1039,7 @@
175.130 0,
175.131 ke.returnCode(),
175.132 body.crealm, body.cname,
175.133 - new Realm(getRealm()), body.sname,
175.134 + new Realm(getRealm()), service,
175.135 KrbException.errorMessage(ke.returnCode()),
175.136 eData);
175.137 }
176.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
176.2 +++ b/test/sun/security/krb5/auto/PrincipalNameEquals.java Tue Aug 09 17:38:52 2011 -0700
176.3 @@ -0,0 +1,58 @@
176.4 +/*
176.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
176.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
176.7 + *
176.8 + * This code is free software; you can redistribute it and/or modify it
176.9 + * under the terms of the GNU General Public License version 2 only, as
176.10 + * published by the Free Software Foundation.
176.11 + *
176.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
176.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
176.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
176.15 + * version 2 for more details (a copy is included in the LICENSE file that
176.16 + * accompanied this code).
176.17 + *
176.18 + * You should have received a copy of the GNU General Public License version
176.19 + * 2 along with this work; if not, write to the Free Software Foundation,
176.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
176.21 + *
176.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
176.23 + * or visit www.oracle.com if you need additional information or have any
176.24 + * questions.
176.25 + */
176.26 +
176.27 +/*
176.28 + * @test
176.29 + * @bug 7061379
176.30 + * @summary [Kerberos] Cross-realm authentication fails, due to nameType problem
176.31 + * @compile -XDignore.symbol.file PrincipalNameEquals.java
176.32 + * @run main/othervm PrincipalNameEquals
176.33 + */
176.34 +
176.35 +import sun.security.jgss.GSSUtil;
176.36 +import sun.security.krb5.PrincipalName;
176.37 +
176.38 +public class PrincipalNameEquals {
176.39 +
176.40 + public static void main(String[] args) throws Exception {
176.41 +
176.42 + OneKDC kdc = new OneKDC(null);
176.43 + kdc.writeJAASConf();
176.44 + kdc.setOption(KDC.Option.RESP_NT, PrincipalName.KRB_NT_PRINCIPAL);
176.45 +
176.46 + Context c, s;
176.47 + c = Context.fromJAAS("client");
176.48 + s = Context.fromJAAS("server");
176.49 +
176.50 + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
176.51 + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
176.52 +
176.53 + Context.handshake(c, s);
176.54 +
176.55 + Context.transmit("i say high --", c, s);
176.56 + Context.transmit(" you say low", s, c);
176.57 +
176.58 + s.dispose();
176.59 + c.dispose();
176.60 + }
176.61 +}
177.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
177.2 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/HttpsProxyStackOverflow.java Tue Aug 09 17:38:52 2011 -0700
177.3 @@ -0,0 +1,113 @@
177.4 +/*
177.5 + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
177.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
177.7 + *
177.8 + * This code is free software; you can redistribute it and/or modify it
177.9 + * under the terms of the GNU General Public License version 2 only, as
177.10 + * published by the Free Software Foundation.
177.11 + *
177.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
177.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
177.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
177.15 + * version 2 for more details (a copy is included in the LICENSE file that
177.16 + * accompanied this code).
177.17 + *
177.18 + * You should have received a copy of the GNU General Public License version
177.19 + * 2 along with this work; if not, write to the Free Software Foundation,
177.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
177.21 + *
177.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
177.23 + * or visit www.oracle.com if you need additional information or have any
177.24 + * questions.
177.25 + */
177.26 +
177.27 +/*
177.28 + * @test
177.29 + * @bug 6670868
177.30 + * @summary StackOverFlow with bad authenticated Proxy tunnels
177.31 + */
177.32 +
177.33 +import java.io.IOException;
177.34 +import java.io.InputStream;
177.35 +import java.net.Authenticator;
177.36 +import java.net.Proxy;
177.37 +import java.net.InetSocketAddress;
177.38 +import java.net.PasswordAuthentication;
177.39 +import java.net.ServerSocket;
177.40 +import java.net.Socket;
177.41 +import java.net.URL;
177.42 +import javax.net.ssl.HttpsURLConnection;
177.43 +
177.44 +public class HttpsProxyStackOverflow {
177.45 +
177.46 + public static void main(String[] args) throws IOException {
177.47 + BadAuthProxyServer server = startServer();
177.48 + doClient(server);
177.49 + }
177.50 +
177.51 + static void doClient(BadAuthProxyServer server) throws IOException {
177.52 + // url doesn't matter since we will never make the connection
177.53 + URL url = new URL("https://anythingwilldo/");
177.54 + HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(
177.55 + new Proxy(Proxy.Type.HTTP,
177.56 + new InetSocketAddress("localhost", server.getPort())));
177.57 + try (InputStream is = conn.getInputStream()) {
177.58 + } catch(IOException unused) {
177.59 + // no real server, IOException is expected.
177.60 + // failure if StackOverflowError
177.61 + } finally {
177.62 + server.done();
177.63 + }
177.64 + }
177.65 +
177.66 + static BadAuthProxyServer startServer() throws IOException {
177.67 + Authenticator.setDefault(new Authenticator() {
177.68 + @Override
177.69 + protected PasswordAuthentication getPasswordAuthentication() {
177.70 + return new PasswordAuthentication("xyz", "xyz".toCharArray());
177.71 + }
177.72 + });
177.73 +
177.74 + BadAuthProxyServer server = new BadAuthProxyServer(new ServerSocket(0));
177.75 + Thread serverThread = new Thread(server);
177.76 + serverThread.start();
177.77 + return server;
177.78 + }
177.79 +
177.80 + static class BadAuthProxyServer implements Runnable {
177.81 + private ServerSocket ss;
177.82 + private boolean done;
177.83 +
177.84 + BadAuthProxyServer(ServerSocket ss) { this.ss = ss; }
177.85 +
177.86 + public void run() {
177.87 + try {
177.88 + while (!done) {
177.89 + Socket s = ss.accept();
177.90 + s.getOutputStream().write(
177.91 + ("HTTP/1.1 407\nProxy-Authenticate:Basic " +
177.92 + "realm=\"WallyWorld\"\n\n").getBytes("US-ASCII"));
177.93 +
177.94 + s.close();
177.95 +
177.96 + s = ss.accept();
177.97 + s.close();
177.98 + }
177.99 + } catch (IOException e) {
177.100 + // Ignore IOException when the main thread calls done
177.101 + } finally {
177.102 + try { ss.close(); } catch (IOException e) {}
177.103 + }
177.104 + }
177.105 +
177.106 + int getPort() {
177.107 + return ss.getLocalPort();
177.108 + }
177.109 +
177.110 + void done() {
177.111 + try { ss.close(); } catch (IOException e) {}
177.112 + done = true;
177.113 + }
177.114 + }
177.115 +}
177.116 +
178.1 --- a/test/sun/security/tools/keytool/KeyToolTest.java Fri Aug 05 15:35:04 2011 -0700
178.2 +++ b/test/sun/security/tools/keytool/KeyToolTest.java Tue Aug 09 17:38:52 2011 -0700
178.3 @@ -1,5 +1,5 @@
178.4 /*
178.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
178.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
178.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
178.8 *
178.9 * This code is free software; you can redistribute it and/or modify it
178.10 @@ -1278,52 +1278,58 @@
178.11 }
178.12
178.13 public static void main(String[] args) throws Exception {
178.14 - // first test if HumanInputStream really acts like a human being
178.15 - HumanInputStream.test();
178.16 - KeyToolTest t = new KeyToolTest();
178.17 + Locale reservedLocale = Locale.getDefault();
178.18 + try {
178.19 + // first test if HumanInputStream really acts like a human being
178.20 + HumanInputStream.test();
178.21 + KeyToolTest t = new KeyToolTest();
178.22
178.23 - if (System.getProperty("file") != null) {
178.24 - t.sqeTest();
178.25 - t.testAll();
178.26 - t.i18nTest();
178.27 - t.v3extTest("RSA");
178.28 - t.v3extTest("DSA");
178.29 - boolean testEC = true;
178.30 - try {
178.31 - KeyPairGenerator.getInstance("EC");
178.32 - } catch (NoSuchAlgorithmException nae) {
178.33 - testEC = false;
178.34 + if (System.getProperty("file") != null) {
178.35 + t.sqeTest();
178.36 + t.testAll();
178.37 + t.i18nTest();
178.38 + t.v3extTest("RSA");
178.39 + t.v3extTest("DSA");
178.40 + boolean testEC = true;
178.41 + try {
178.42 + KeyPairGenerator.getInstance("EC");
178.43 + } catch (NoSuchAlgorithmException nae) {
178.44 + testEC = false;
178.45 + }
178.46 + if (testEC) t.v3extTest("EC");
178.47 }
178.48 - if (testEC) t.v3extTest("EC");
178.49 +
178.50 + if (System.getProperty("nss") != null) {
178.51 + t.srcP11Arg = NSS_SRC_P11_ARG;
178.52 + t.p11Arg = NSS_P11_ARG;
178.53 +
178.54 + t.testPKCS11();
178.55 +
178.56 + // FAIL:
178.57 + // 1. we still don't have srcprovidername yet
178.58 + // 2. cannot store privatekey into NSS keystore
178.59 + // java.security.KeyStoreException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE.
178.60 + //t.testPKCS11ImportKeyStore();
178.61 +
178.62 + t.i18nPKCS11Test();
178.63 + //FAIL: currently PKCS11-NSS does not support 2 NSS KeyStores to be loaded at the same time
178.64 + //t.sszzTest();
178.65 + }
178.66 +
178.67 + if (System.getProperty("solaris") != null) {
178.68 + // For Solaris Cryptography Framework
178.69 + t.srcP11Arg = SUN_SRC_P11_ARG;
178.70 + t.p11Arg = SUN_P11_ARG;
178.71 + t.testPKCS11();
178.72 + t.testPKCS11ImportKeyStore();
178.73 + t.i18nPKCS11Test();
178.74 + }
178.75 +
178.76 + System.out.println("Test pass!!!");
178.77 + } finally {
178.78 + // restore the reserved locale
178.79 + Locale.setDefault(reservedLocale);
178.80 }
178.81 -
178.82 - if (System.getProperty("nss") != null) {
178.83 - t.srcP11Arg = NSS_SRC_P11_ARG;
178.84 - t.p11Arg = NSS_P11_ARG;
178.85 -
178.86 - t.testPKCS11();
178.87 -
178.88 - // FAIL:
178.89 - // 1. we still don't have srcprovidername yet
178.90 - // 2. cannot store privatekey into NSS keystore
178.91 - // java.security.KeyStoreException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_TEMPLATE_INCOMPLETE.
178.92 - //t.testPKCS11ImportKeyStore();
178.93 -
178.94 - t.i18nPKCS11Test();
178.95 - //FAIL: currently PKCS11-NSS does not support 2 NSS KeyStores to be loaded at the same time
178.96 - //t.sszzTest();
178.97 - }
178.98 -
178.99 - if (System.getProperty("solaris") != null) {
178.100 - // For Solaris Cryptography Framework
178.101 - t.srcP11Arg = SUN_SRC_P11_ARG;
178.102 - t.p11Arg = SUN_P11_ARG;
178.103 - t.testPKCS11();
178.104 - t.testPKCS11ImportKeyStore();
178.105 - t.i18nPKCS11Test();
178.106 - }
178.107 -
178.108 - System.out.println("Test pass!!!");
178.109 }
178.110 }
178.111
179.1 --- a/test/sun/text/resources/Collator/Bug4248694.java Fri Aug 05 15:35:04 2011 -0700
179.2 +++ b/test/sun/text/resources/Collator/Bug4248694.java Tue Aug 09 17:38:52 2011 -0700
179.3 @@ -1,5 +1,5 @@
179.4 /*
179.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
179.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
179.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
179.8 *
179.9 * This code is free software; you can redistribute it and/or modify it
179.10 @@ -35,43 +35,49 @@
179.11 /********************************************************
179.12 *********************************************************/
179.13 public static void main (String[] args) {
179.14 - int errors=0;
179.15 + Locale reservedLocale = Locale.getDefault();
179.16 + try {
179.17 + int errors=0;
179.18
179.19 - Locale loc = new Locale ("is", "is"); // Icelandic
179.20 + Locale loc = new Locale ("is", "is"); // Icelandic
179.21
179.22 - Locale.setDefault (loc);
179.23 - Collator col = Collator.getInstance ();
179.24 + Locale.setDefault (loc);
179.25 + Collator col = Collator.getInstance ();
179.26
179.27 - String[] data = {"\u00e6ard",
179.28 - "Zard",
179.29 - "aard",
179.30 - "\u00feard",
179.31 - "vird",
179.32 - "\u00c6ard",
179.33 - "Zerd",
179.34 - "\u00deard"};
179.35 + String[] data = {"\u00e6ard",
179.36 + "Zard",
179.37 + "aard",
179.38 + "\u00feard",
179.39 + "vird",
179.40 + "\u00c6ard",
179.41 + "Zerd",
179.42 + "\u00deard"};
179.43
179.44 - String[] sortedData = {"aard",
179.45 - "vird",
179.46 - "Zard",
179.47 - "Zerd",
179.48 - "\u00feard",
179.49 - "\u00deard",
179.50 - "\u00e6ard",
179.51 - "\u00c6ard"};
179.52 + String[] sortedData = {"aard",
179.53 + "vird",
179.54 + "Zard",
179.55 + "Zerd",
179.56 + "\u00feard",
179.57 + "\u00deard",
179.58 + "\u00e6ard",
179.59 + "\u00c6ard"};
179.60
179.61 - Arrays.sort (data, col);
179.62 + Arrays.sort (data, col);
179.63
179.64 - System.out.println ("Using " + loc.getDisplayName());
179.65 - for (int i = 0; i < data.length; i++) {
179.66 - System.out.println(data[i] + " : " + sortedData[i]);
179.67 - if (sortedData[i].compareTo(data[i]) != 0) {
179.68 - errors++;
179.69 - }
179.70 - }//end for
179.71 + System.out.println ("Using " + loc.getDisplayName());
179.72 + for (int i = 0; i < data.length; i++) {
179.73 + System.out.println(data[i] + " : " + sortedData[i]);
179.74 + if (sortedData[i].compareTo(data[i]) != 0) {
179.75 + errors++;
179.76 + }
179.77 + }//end for
179.78
179.79 - if (errors > 0)
179.80 - throw new RuntimeException();
179.81 + if (errors > 0)
179.82 + throw new RuntimeException();
179.83 + } finally {
179.84 + // restore the reserved locale
179.85 + Locale.setDefault(reservedLocale);
179.86 + }
179.87 }//end main
179.88
179.89 }//end class CollatorTest
180.1 --- a/test/sun/text/resources/Collator/Bug4804273.java Fri Aug 05 15:35:04 2011 -0700
180.2 +++ b/test/sun/text/resources/Collator/Bug4804273.java Tue Aug 09 17:38:52 2011 -0700
180.3 @@ -1,5 +1,5 @@
180.4 /*
180.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
180.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
180.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
180.8 *
180.9 * This code is free software; you can redistribute it and/or modify it
180.10 @@ -35,82 +35,89 @@
180.11 /********************************************************
180.12 *********************************************************/
180.13 public static void main (String[] args) {
180.14 - int errors=0;
180.15 + Locale reservedLocale = Locale.getDefault();
180.16 + try {
180.17 + int errors=0;
180.18
180.19 - Locale loc = new Locale ("sv", "se"); // Swedish
180.20 + Locale loc = new Locale ("sv", "se"); // Swedish
180.21
180.22 - Locale.setDefault (loc);
180.23 - Collator col = Collator.getInstance ();
180.24 + Locale.setDefault (loc);
180.25 + Collator col = Collator.getInstance ();
180.26
180.27 - String[] data = {"A",
180.28 - "Aa",
180.29 - "Ae",
180.30 - "B",
180.31 - "Y",
180.32 - "U\u0308", // U-umlaut
180.33 - "Z",
180.34 - "A\u030a", // A-ring
180.35 - "A\u0308", // A-umlaut
180.36 - "\u00c6", // AE ligature
180.37 - "O\u0308", // O-umlaut
180.38 - "a\u030b", // a-double-acute
180.39 - "\u00d8", // O-stroke
180.40 - "a",
180.41 - "aa",
180.42 - "ae",
180.43 - "b",
180.44 - "y",
180.45 - "u\u0308", // u-umlaut
180.46 - "z",
180.47 - "A\u030b", // A-double-acute
180.48 - "a\u030a", // a-ring
180.49 - "a\u0308", // a-umlaut
180.50 - "\u00e6", // ae ligature
180.51 - "o\u0308", // o-umlaut
180.52 - "\u00f8", // o-stroke
180.53 - };
180.54 + String[] data = {"A",
180.55 + "Aa",
180.56 + "Ae",
180.57 + "B",
180.58 + "Y",
180.59 + "U\u0308", // U-umlaut
180.60 + "Z",
180.61 + "A\u030a", // A-ring
180.62 + "A\u0308", // A-umlaut
180.63 + "\u00c6", // AE ligature
180.64 + "O\u0308", // O-umlaut
180.65 + "a\u030b", // a-double-acute
180.66 + "\u00d8", // O-stroke
180.67 + "a",
180.68 + "aa",
180.69 + "ae",
180.70 + "b",
180.71 + "y",
180.72 + "u\u0308", // u-umlaut
180.73 + "z",
180.74 + "A\u030b", // A-double-acute
180.75 + "a\u030a", // a-ring
180.76 + "a\u0308", // a-umlaut
180.77 + "\u00e6", // ae ligature
180.78 + "o\u0308", // o-umlaut
180.79 + "\u00f8", // o-stroke
180.80 + };
180.81
180.82
180.83 - String[] sortedData = {"a",
180.84 - "A",
180.85 - "aa",
180.86 - "Aa",
180.87 - "ae",
180.88 - "Ae",
180.89 - "b",
180.90 - "B",
180.91 - "y",
180.92 - "Y",
180.93 - "u\u0308", // o-umlaut
180.94 - "U\u0308", // o-umlaut
180.95 - "z",
180.96 - "Z",
180.97 - "a\u030a", // a-ring
180.98 - "A\u030a", // A-ring
180.99 - "a\u0308", // a-umlaut
180.100 - "A\u0308", // A-umlaut
180.101 - "a\u030b", // a-double-acute
180.102 - "A\u030b", // A-double-acute
180.103 - "\u00e6", // ae ligature
180.104 - "\u00c6", // AE ligature
180.105 - "o\u0308", // o-umlaut
180.106 - "O\u0308", // O-umlaut
180.107 - "\u00f8", // o-stroke
180.108 - "\u00d8", // O-stroke
180.109 - };
180.110 + String[] sortedData = {"a",
180.111 + "A",
180.112 + "aa",
180.113 + "Aa",
180.114 + "ae",
180.115 + "Ae",
180.116 + "b",
180.117 + "B",
180.118 + "y",
180.119 + "Y",
180.120 + "u\u0308", // o-umlaut
180.121 + "U\u0308", // o-umlaut
180.122 + "z",
180.123 + "Z",
180.124 + "a\u030a", // a-ring
180.125 + "A\u030a", // A-ring
180.126 + "a\u0308", // a-umlaut
180.127 + "A\u0308", // A-umlaut
180.128 + "a\u030b", // a-double-acute
180.129 + "A\u030b", // A-double-acute
180.130 + "\u00e6", // ae ligature
180.131 + "\u00c6", // AE ligature
180.132 + "o\u0308", // o-umlaut
180.133 + "O\u0308", // O-umlaut
180.134 + "\u00f8", // o-stroke
180.135 + "\u00d8", // O-stroke
180.136 + };
180.137
180.138 - Arrays.sort (data, col);
180.139 + Arrays.sort (data, col);
180.140
180.141 - System.out.println ("Using " + loc.getDisplayName());
180.142 - for (int i = 0; i < data.length; i++) {
180.143 - System.out.println(data[i] + " : " + sortedData[i]);
180.144 - if (sortedData[i].compareTo(data[i]) != 0) {
180.145 - errors++;
180.146 - }
180.147 - }//end for
180.148 + System.out.println ("Using " + loc.getDisplayName());
180.149 + for (int i = 0; i < data.length; i++) {
180.150 + System.out.println(data[i] + " : " + sortedData[i]);
180.151 + if (sortedData[i].compareTo(data[i]) != 0) {
180.152 + errors++;
180.153 + }
180.154 + }//end for
180.155
180.156 - if (errors > 0)
180.157 - throw new RuntimeException("There are " + errors + " words sorted incorrectly!");
180.158 + if (errors > 0)
180.159 + throw new RuntimeException("There are " + errors +
180.160 + " words sorted incorrectly!");
180.161 + } finally {
180.162 + // restore the reserved locale
180.163 + Locale.setDefault(reservedLocale);
180.164 + }
180.165 }//end main
180.166
180.167 }//end class CollatorTest
181.1 --- a/test/sun/text/resources/Collator/Bug4848897.java Fri Aug 05 15:35:04 2011 -0700
181.2 +++ b/test/sun/text/resources/Collator/Bug4848897.java Tue Aug 09 17:38:52 2011 -0700
181.3 @@ -1,5 +1,5 @@
181.4 /*
181.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
181.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
181.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
181.8 *
181.9 * This code is free software; you can redistribute it and/or modify it
181.10 @@ -35,39 +35,44 @@
181.11 /********************************************************
181.12 *********************************************************/
181.13 public static void main (String[] args) {
181.14 + Locale reservedLocale = Locale.getDefault();
181.15 + try {
181.16 + int errors=0;
181.17 + Locale loc = new Locale ("no", "NO"); // Norwegian
181.18
181.19 - int errors=0;
181.20 - Locale loc = new Locale ("no", "NO"); // Norwegian
181.21 + Locale.setDefault (loc);
181.22 + Collator col = Collator.getInstance ();
181.23
181.24 - Locale.setDefault (loc);
181.25 - Collator col = Collator.getInstance ();
181.26 + String[] data = {"wird",
181.27 + "vird",
181.28 + "verd",
181.29 + "werd",
181.30 + "vard",
181.31 + "ward"};
181.32
181.33 - String[] data = {"wird",
181.34 - "vird",
181.35 - "verd",
181.36 - "werd",
181.37 - "vard",
181.38 - "ward"};
181.39 + String[] sortedData = {"vard",
181.40 + "verd",
181.41 + "vird",
181.42 + "ward",
181.43 + "werd",
181.44 + "wird"};
181.45
181.46 - String[] sortedData = {"vard",
181.47 - "verd",
181.48 - "vird",
181.49 - "ward",
181.50 - "werd",
181.51 - "wird"};
181.52 + Arrays.sort (data, col);
181.53
181.54 - Arrays.sort (data, col);
181.55 + System.out.println ("Using " + loc.getDisplayName());
181.56 + for (int i = 0; i < data.length; i++) {
181.57 + System.out.println(data[i] + " : " + sortedData[i]);
181.58 + if (sortedData[i].compareTo(data[i]) != 0) {
181.59 + errors++;
181.60 + }
181.61 + }//end for
181.62
181.63 - System.out.println ("Using " + loc.getDisplayName());
181.64 - for (int i = 0; i < data.length; i++) {
181.65 - System.out.println(data[i] + " : " + sortedData[i]);
181.66 - if (sortedData[i].compareTo(data[i]) != 0) {
181.67 - errors++;
181.68 - }
181.69 - }//end for
181.70 -
181.71 - if (errors > 0)
181.72 - throw new RuntimeException();
181.73 - }//end main
181.74 + if (errors > 0)
181.75 + throw new RuntimeException();
181.76 + } finally {
181.77 + // restore the reserved locale
181.78 + Locale.setDefault(reservedLocale);
181.79 + }
181.80 + } // end main
181.81
181.82 }//end class CollatorTest
182.1 --- a/test/sun/text/resources/Format/Bug4651568.java Fri Aug 05 15:35:04 2011 -0700
182.2 +++ b/test/sun/text/resources/Format/Bug4651568.java Tue Aug 09 17:38:52 2011 -0700
182.3 @@ -1,5 +1,5 @@
182.4 /*
182.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
182.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
182.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
182.8 *
182.9 * This code is free software; you can redistribute it and/or modify it
182.10 @@ -34,23 +34,29 @@
182.11 public class Bug4651568 {
182.12
182.13 public static void main (String argv[] ) {
182.14 - String expectedCurrencyPattern = "\u00A4 #.##0,00";
182.15 + Locale reservedLocale = Locale.getDefault();
182.16 + try {
182.17 + String expectedCurrencyPattern = "\u00A4 #.##0,00";
182.18
182.19 - Locale locale = new Locale ("pt", "BR");
182.20 - Locale.setDefault(locale);
182.21 + Locale locale = new Locale ("pt", "BR");
182.22 + Locale.setDefault(locale);
182.23
182.24 - DecimalFormat formatter =
182.25 - (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
182.26 + DecimalFormat formatter =
182.27 + (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
182.28
182.29 - if (formatter.toLocalizedPattern().equals(expectedCurrencyPattern))
182.30 -{
182.31 - System.out.println ("Passed.");
182.32 - } else {
182.33 - System.out.println ("Failed Currency pattern." +
182.34 - " Expected: " + expectedCurrencyPattern +
182.35 - " Received: " + formatter.toLocalizedPattern() );
182.36 - throw new RuntimeException();
182.37 + if (formatter.toLocalizedPattern().equals(
182.38 + expectedCurrencyPattern)) {
182.39 + System.out.println ("Passed.");
182.40 + } else {
182.41 + System.out.println ("Failed Currency pattern." +
182.42 + " Expected: " + expectedCurrencyPattern +
182.43 + " Received: " + formatter.toLocalizedPattern() );
182.44 + throw new RuntimeException();
182.45
182.46 - }
182.47 + }
182.48 + } finally {
182.49 + // restore the reserved locale
182.50 + Locale.setDefault(reservedLocale);
182.51 + }
182.52 }
182.53 }
183.1 --- a/test/sun/util/resources/Locale/Bug4965260.java Fri Aug 05 15:35:04 2011 -0700
183.2 +++ b/test/sun/util/resources/Locale/Bug4965260.java Tue Aug 09 17:38:52 2011 -0700
183.3 @@ -1,5 +1,5 @@
183.4 /*
183.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
183.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
183.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
183.8 *
183.9 * This code is free software; you can redistribute it and/or modify it
183.10 @@ -30,49 +30,55 @@
183.11
183.12 public class Bug4965260 {
183.13
183.14 - // Define supported locales
183.15 - static Locale[] locales2Test = new Locale[] {
183.16 - new Locale("de"),
183.17 - new Locale("es"),
183.18 - new Locale("fr"),
183.19 - new Locale("it"),
183.20 - new Locale("sv")
183.21 - };
183.22 + // Define supported locales
183.23 + static Locale[] locales2Test = new Locale[] {
183.24 + new Locale("de"),
183.25 + new Locale("es"),
183.26 + new Locale("fr"),
183.27 + new Locale("it"),
183.28 + new Locale("sv")
183.29 + };
183.30
183.31 - static String[] expectedNames = new String[] {
183.32 - "Niederl\u00e4ndisch",
183.33 - "neerland\u00e9s",
183.34 - "n\u00e9erlandais",
183.35 - "neerlandese",
183.36 - "nederl\u00e4ndska"
183.37 - };
183.38 + static String[] expectedNames = new String[] {
183.39 + "Niederl\u00e4ndisch",
183.40 + "neerland\u00e9s",
183.41 + "n\u00e9erlandais",
183.42 + "neerlandese",
183.43 + "nederl\u00e4ndska"
183.44 + };
183.45
183.46 - public static void main(String[] args) throws Exception {
183.47 - Locale.setDefault(Locale.ENGLISH);
183.48 - if (locales2Test.length != expectedNames.length) {
183.49 - throw new Exception("\nData sizes does not match!\n");
183.50 + public static void main(String[] args) throws Exception {
183.51 + Locale reservedLocale = Locale.getDefault();
183.52 + try {
183.53 + Locale.setDefault(Locale.ENGLISH);
183.54 + if (locales2Test.length != expectedNames.length) {
183.55 + throw new Exception("\nData sizes does not match!\n");
183.56 + }
183.57 +
183.58 + StringBuffer message = new StringBuffer("");
183.59 + Locale dutch = new Locale("nl", "BE");
183.60 + String current;
183.61 + for (int i = 0; i < locales2Test.length; i++) {
183.62 + Locale locale = locales2Test[i];
183.63 + current = dutch.getDisplayLanguage(locale);
183.64 + if (!current.equals(expectedNames[i])) {
183.65 + message.append("[");
183.66 + message.append(locale.getDisplayLanguage());
183.67 + message.append("] ");
183.68 + message.append("Language name is ");
183.69 + message.append(current);
183.70 + message.append(" should be ");
183.71 + message.append(expectedNames[i]);
183.72 + message.append("\n");
183.73 + }
183.74 + }
183.75 +
183.76 + if (message.length() >0) {
183.77 + throw new Exception("\n" + message.toString());
183.78 + }
183.79 + } finally {
183.80 + // restore the reserved locale
183.81 + Locale.setDefault(reservedLocale);
183.82 + }
183.83 }
183.84 -
183.85 - StringBuffer message = new StringBuffer("");
183.86 - Locale dutch = new Locale("nl", "BE");
183.87 - String current;
183.88 - for (int i = 0; i < locales2Test.length; i++) {
183.89 - Locale locale = locales2Test[i];
183.90 - current = dutch.getDisplayLanguage(locale);
183.91 - if (!current.equals(expectedNames[i])) {
183.92 - message.append("[");
183.93 - message.append(locale.getDisplayLanguage());
183.94 - message.append("] ");
183.95 - message.append("Language name is ");
183.96 - message.append(current);
183.97 - message.append(" should be ");
183.98 - message.append(expectedNames[i]);
183.99 - message.append("\n");
183.100 - }
183.101 - }
183.102 -
183.103 - if (message.length() >0) {
183.104 - throw new Exception("\n" + message.toString());
183.105 - }
183.106 - }
183.107 }
184.1 --- a/test/sun/util/resources/TimeZone/Bug4640234.java Fri Aug 05 15:35:04 2011 -0700
184.2 +++ b/test/sun/util/resources/TimeZone/Bug4640234.java Tue Aug 09 17:38:52 2011 -0700
184.3 @@ -1,5 +1,5 @@
184.4 /*
184.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
184.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
184.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
184.8 *
184.9 * This code is free software; you can redistribute it and/or modify it
184.10 @@ -24,11 +24,11 @@
184.11 /**
184.12 * @test
184.13 * @bug 4640234 4946057 4938151 4873691 5023181
184.14 - * @summary Verifies the translation of time zone names, this test will catch presence
184.15 - * of country name for english and selected locales for all ISO country
184.16 - * codes.
184.17 - * The test program also displays which timezone, country and language names
184.18 - * are not translated
184.19 + * @summary Verifies the translation of time zone names, this test will catch
184.20 + * presence of country name for english and selected locales for all
184.21 + * ISO country codes.
184.22 + * The test program also displays which timezone, country and
184.23 + * language names are not translated
184.24 */
184.25
184.26
184.27 @@ -51,230 +51,242 @@
184.28
184.29
184.30 public class Bug4640234 {
184.31 - static SimpleDateFormat sdfEn = new SimpleDateFormat("zzzz", Locale.US);
184.32 - static SimpleDateFormat sdfEnShort = new SimpleDateFormat("z", Locale.US);
184.33 - static Locale locEn = Locale.ENGLISH;
184.34 + static SimpleDateFormat sdfEn = new SimpleDateFormat("zzzz", Locale.US);
184.35 + static SimpleDateFormat sdfEnShort = new SimpleDateFormat("z", Locale.US);
184.36 + static Locale locEn = Locale.ENGLISH;
184.37
184.38 - static SimpleDateFormat sdfLoc;
184.39 - static SimpleDateFormat sdfLocShort;
184.40 - static Date date = new Date();
184.41 + static SimpleDateFormat sdfLoc;
184.42 + static SimpleDateFormat sdfLocShort;
184.43 + static Date date = new Date();
184.44
184.45 - // Define supported locales
184.46 - static Locale[] locales2Test = new Locale[] {
184.47 - new Locale("de"),
184.48 - new Locale("es"),
184.49 - new Locale("fr"),
184.50 - new Locale("it"),
184.51 - new Locale("ja"),
184.52 - new Locale("ko"),
184.53 - new Locale("sv"),
184.54 - new Locale("zh", "CN"),
184.55 - new Locale("zh", "TW")
184.56 - };
184.57 + // Define supported locales
184.58 + static Locale[] locales2Test = new Locale[] {
184.59 + new Locale("de"),
184.60 + new Locale("es"),
184.61 + new Locale("fr"),
184.62 + new Locale("it"),
184.63 + new Locale("ja"),
184.64 + new Locale("ko"),
184.65 + new Locale("sv"),
184.66 + new Locale("zh", "CN"),
184.67 + new Locale("zh", "TW")
184.68 + };
184.69
184.70 - public static void main(String[] args) throws Exception {
184.71 - Locale.setDefault(Locale.ENGLISH);
184.72 + public static void main(String[] args) throws Exception {
184.73 + Locale reservedLocale = Locale.getDefault();
184.74 + try {
184.75 + Locale.setDefault(Locale.ENGLISH);
184.76
184.77 - StringBuffer errors = new StringBuffer("");
184.78 - StringBuffer warnings = new StringBuffer("");
184.79 + StringBuffer errors = new StringBuffer("");
184.80 + StringBuffer warnings = new StringBuffer("");
184.81
184.82 - String[] timezones = TimeZone.getAvailableIDs();
184.83 - String[] countries = locEn.getISOCountries();
184.84 - String[] languages = locEn.getISOLanguages();
184.85 + String[] timezones = TimeZone.getAvailableIDs();
184.86 + String[] countries = locEn.getISOCountries();
184.87 + String[] languages = locEn.getISOLanguages();
184.88
184.89 - ResourceBundle resEn = ResourceBundle.getBundle("sun.util.resources.LocaleNames", locEn);
184.90 - Map<String, String> countryMapEn = getList(resEn, true);
184.91 - Map<String, String> languageMapEn = getList(resEn, false);
184.92 + ResourceBundle resEn = ResourceBundle.getBundle(
184.93 + "sun.util.resources.LocaleNames", locEn);
184.94 + Map<String, String> countryMapEn = getList(resEn, true);
184.95 + Map<String, String> languageMapEn = getList(resEn, false);
184.96
184.97 - ResourceBundle resLoc;
184.98 - Map<String, String> countryMap;
184.99 - Map<String, String> languageMap;
184.100 + ResourceBundle resLoc;
184.101 + Map<String, String> countryMap;
184.102 + Map<String, String> languageMap;
184.103
184.104 - for (Locale locale : locales2Test) {
184.105 - resLoc = ResourceBundle.getBundle("sun.util.resources.LocaleNames", locale);
184.106 + for (Locale locale : locales2Test) {
184.107 + resLoc = ResourceBundle.getBundle(
184.108 + "sun.util.resources.LocaleNames", locale);
184.109
184.110 - sdfLoc = new SimpleDateFormat("zzzz", locale);
184.111 - sdfLocShort = new SimpleDateFormat("z", locale);
184.112 + sdfLoc = new SimpleDateFormat("zzzz", locale);
184.113 + sdfLocShort = new SimpleDateFormat("z", locale);
184.114
184.115 - for (String timezone : timezones) {
184.116 - if (isTZIgnored(timezone)) {
184.117 - continue;
184.118 + for (String timezone : timezones) {
184.119 + if (isTZIgnored(timezone)) {
184.120 + continue;
184.121 + }
184.122 + warnings.append(testTZ(timezone, locale));
184.123 + }
184.124 +
184.125 + countryMap = getList(resLoc, true);
184.126 +
184.127 + for (String country : countries) {
184.128 + String[] result = testEntry(country,
184.129 + countryMapEn,
184.130 + countryMap,
184.131 + locale,
184.132 + "ERROR: {0} country name for country code: {1} not found!\n",
184.133 + "WARNING: {0} country name for country code: {1} not localized!\n"
184.134 + );
184.135 + if (warnings.indexOf(result[0]) == -1) {
184.136 + warnings.append(result[0]);
184.137 + }
184.138 + if (errors.indexOf(result[1]) == -1) {
184.139 + errors.append(result[1]);
184.140 + }
184.141 + }
184.142 +
184.143 + languageMap = getList(resLoc, false);
184.144 + for (String language : languages) {
184.145 + String[] result = testEntry(language,
184.146 + languageMapEn,
184.147 + languageMap,
184.148 + locale,
184.149 + "ERROR: {0} language name for language code: {1} not found!\n",
184.150 + "WARNING: {0} language name for language code: {1} not localized!\n");
184.151 + if (warnings.indexOf(result[0]) == -1) {
184.152 + warnings.append(result[0]);
184.153 + }
184.154 + if (errors.indexOf(result[1]) == -1) {
184.155 + errors.append(result[1]);
184.156 + }
184.157 + }
184.158 + }
184.159 +
184.160 + StringBuffer message = new StringBuffer("");
184.161 + if (!"".equals(errors.toString())) {
184.162 + message.append("Test failed! ");
184.163 + message.append("ERROR: some keys are missing! ");
184.164 + }
184.165 +
184.166 + if ("".equals(message.toString())) {
184.167 + System.out.println("\nTest passed");
184.168 + System.out.println(warnings.toString());
184.169 + } else {
184.170 + System.out.println("\nTest failed!");
184.171 + System.out.println(errors.toString());
184.172 + System.out.println(warnings.toString());
184.173 + throw new Exception("\n" + message);
184.174 + }
184.175 + } finally {
184.176 + // restore the reserved locale
184.177 + Locale.setDefault(reservedLocale);
184.178 }
184.179 - warnings.append(testTZ(timezone, locale));
184.180 - }
184.181 -
184.182 - countryMap = getList(resLoc, true);
184.183 -
184.184 - for (String country : countries) {
184.185 - String[] result = testEntry(country,
184.186 - countryMapEn,
184.187 - countryMap,
184.188 - locale,
184.189 - "ERROR: {0} country name for country code: {1} not found!\n",
184.190 - "WARNING: {0} country name for country code: {1} not localized!\n"
184.191 - );
184.192 - if (warnings.indexOf(result[0]) == -1) {
184.193 - warnings.append(result[0]);
184.194 - }
184.195 - if (errors.indexOf(result[1]) == -1) {
184.196 - errors.append(result[1]);
184.197 - }
184.198 - }
184.199 -
184.200 - languageMap = getList(resLoc, false);
184.201 - for (String language : languages) {
184.202 - String[] result = testEntry(language,
184.203 - languageMapEn,
184.204 - languageMap,
184.205 - locale,
184.206 - "ERROR: {0} language name for language code: {1} not found!\n",
184.207 - "WARNING: {0} language name for language code: {1} not localized!\n");
184.208 - if (warnings.indexOf(result[0]) == -1) {
184.209 - warnings.append(result[0]);
184.210 - }
184.211 - if (errors.indexOf(result[1]) == -1) {
184.212 - errors.append(result[1]);
184.213 - }
184.214 - }
184.215 }
184.216
184.217 - StringBuffer message = new StringBuffer("");
184.218 - if (!"".equals(errors.toString())) {
184.219 - message.append("Test failed! ");
184.220 - message.append("ERROR: some keys are missing! ");
184.221 + /**
184.222 + * Compares the english timezone name and timezone name in specified locale
184.223 + * @param timeZoneName - name of the timezone to compare
184.224 + * @param locale - locale to test against english
184.225 + * @return empty string when passed, descriptive error message in other cases
184.226 + */
184.227 + private static String testTZ(String timeZoneName, Locale locale) {
184.228 + StringBuffer timeZoneResult = new StringBuffer("");
184.229 + TimeZone tz = TimeZone.getTimeZone(timeZoneName);
184.230 + sdfEn.setTimeZone(tz);
184.231 + sdfEnShort.setTimeZone(tz);
184.232 + sdfLoc.setTimeZone(tz);
184.233 + sdfLocShort.setTimeZone(tz);
184.234 +
184.235 + String en, enShort, loc, locShort;
184.236 + en = sdfEn.format(date);
184.237 + enShort = sdfEnShort.format(date);
184.238 + loc = sdfLoc.format(date);
184.239 + locShort = sdfLocShort.format(date);
184.240 +
184.241 + String displayLanguage = locale.getDisplayLanguage();
184.242 + String displayCountry = locale.getDisplayCountry();
184.243 +
184.244 + if (loc.equals(en)) {
184.245 + timeZoneResult.append("[");
184.246 + timeZoneResult.append(displayLanguage);
184.247 + if (!"".equals(displayCountry)) {
184.248 + timeZoneResult.append(" ");
184.249 + timeZoneResult.append(displayCountry);
184.250 + }
184.251 + timeZoneResult.append("] timezone \"");
184.252 + timeZoneResult.append(timeZoneName);
184.253 + timeZoneResult.append("\" long name \"" + en);
184.254 + timeZoneResult.append("\" not localized!\n");
184.255 + }
184.256 +
184.257 + if (!locShort.equals(enShort)) {
184.258 + timeZoneResult.append("[");
184.259 + timeZoneResult.append(displayLanguage);
184.260 + if (!"".equals(displayCountry)) {
184.261 + timeZoneResult.append(" ");
184.262 + timeZoneResult.append(displayCountry);
184.263 + }
184.264 + timeZoneResult.append("] timezone \"");
184.265 + timeZoneResult.append(timeZoneName);
184.266 + timeZoneResult.append("\" short name \"" + enShort);
184.267 + timeZoneResult.append("\" is localized \"");
184.268 + timeZoneResult.append(locShort);
184.269 + timeZoneResult.append("\"!\n");
184.270 + }
184.271 + return timeZoneResult.toString();
184.272 }
184.273
184.274 - if ("".equals(message.toString())) {
184.275 - System.out.println("\nTest passed");
184.276 - System.out.println(warnings.toString());
184.277 - } else {
184.278 - System.out.println("\nTest failed!");
184.279 - System.out.println(errors.toString());
184.280 - System.out.println(warnings.toString());
184.281 - throw new Exception("\n" + message);
184.282 - }
184.283 - }
184.284 + /**
184.285 + * Verifies whether the name for ISOCode is localized.
184.286 + * @param ISOCode - ISO country/language code for country/language name
184.287 + * to test
184.288 + * @param entriesEn - array of english country/language names
184.289 + * @param entriesLoc - array of localized country/language names for
184.290 + * specified locale
184.291 + * @param locale - locale to test against english
184.292 + * @param notFoundMessage - message in form ready for MessageFormat,
184.293 + * {0} will be human readable language name, {1} will be ISOCode.
184.294 + * @param notLocalizedMessage - message in for ready for MessageFormat,
184.295 + * same formatting like for notFountMessage
184.296 + * @return array of two empty strings when passed, descriptive error message
184.297 + * in other cases, [0] - warnings for not localized, [1] - errors for
184.298 + * missing keys.
184.299 + */
184.300 + private static String[] testEntry(String ISOCode,
184.301 + Map<String, String> entriesEn,
184.302 + Map<String, String> entriesLoc,
184.303 + Locale locale,
184.304 + String notFoundMessage,
184.305 + String notLocalizedMessage) {
184.306 + String nameEn = null;
184.307 + String nameLoc = null;
184.308
184.309 - /**
184.310 - * Compares the english timezone name and timezone name in specified locale
184.311 - * @param timeZoneName - name of the timezone to compare
184.312 - * @param locale - locale to test against english
184.313 - * @return empty string when passed, descriptive error message in other cases
184.314 - */
184.315 - private static String testTZ(String timeZoneName, Locale locale) {
184.316 - StringBuffer timeZoneResult = new StringBuffer("");
184.317 - TimeZone tz = TimeZone.getTimeZone(timeZoneName);
184.318 - sdfEn.setTimeZone(tz);
184.319 - sdfEnShort.setTimeZone(tz);
184.320 - sdfLoc.setTimeZone(tz);
184.321 - sdfLocShort.setTimeZone(tz);
184.322 + for (String key: entriesEn.keySet()) {
184.323 + if (ISOCode.equalsIgnoreCase(key)) {
184.324 + nameEn = entriesEn.get(key);
184.325 + break;
184.326 + }
184.327 + }
184.328
184.329 - String en, enShort, loc, locShort;
184.330 - en = sdfEn.format(date);
184.331 - enShort = sdfEnShort.format(date);
184.332 - loc = sdfLoc.format(date);
184.333 - locShort = sdfLocShort.format(date);
184.334 + for (String key: entriesLoc.keySet()) {
184.335 + if (ISOCode.equalsIgnoreCase(key)) {
184.336 + nameLoc = entriesLoc.get(key);
184.337 + break;
184.338 + }
184.339 + }
184.340
184.341 - String displayLanguage = locale.getDisplayLanguage();
184.342 - String displayCountry = locale.getDisplayCountry();
184.343 + if (nameEn == null) {
184.344 + // We should not get here but test is a MUST have
184.345 + return new String[] {"", MessageFormat.format(notFoundMessage,
184.346 + new String[] {"English", ISOCode})};
184.347 + }
184.348
184.349 - if (loc.equals(en)) {
184.350 - timeZoneResult.append("[");
184.351 - timeZoneResult.append(displayLanguage);
184.352 - if (!"".equals(displayCountry)) {
184.353 - timeZoneResult.append(" ");
184.354 - timeZoneResult.append(displayCountry);
184.355 - }
184.356 - timeZoneResult.append("] timezone \"");
184.357 - timeZoneResult.append(timeZoneName);
184.358 - timeZoneResult.append("\" long name \"" + en);
184.359 - timeZoneResult.append("\" not localized!\n");
184.360 + if (nameLoc == null) {
184.361 + return new String[] {"", MessageFormat.format(notFoundMessage,
184.362 + new String[] {locale.getDisplayName(), ISOCode})};
184.363 + }
184.364 +
184.365 + if (nameEn.equals(nameLoc)) {
184.366 + return new String[] {MessageFormat.format(notLocalizedMessage,
184.367 + new String[] {locale.getDisplayName(), ISOCode}), ""};
184.368 + }
184.369 +
184.370 + return new String[] {"", ""};
184.371 }
184.372
184.373 - if (!locShort.equals(enShort)) {
184.374 - timeZoneResult.append("[");
184.375 - timeZoneResult.append(displayLanguage);
184.376 - if (!"".equals(displayCountry)) {
184.377 - timeZoneResult.append(" ");
184.378 - timeZoneResult.append(displayCountry);
184.379 - }
184.380 - timeZoneResult.append("] timezone \"");
184.381 - timeZoneResult.append(timeZoneName);
184.382 - timeZoneResult.append("\" short name \"" + enShort);
184.383 - timeZoneResult.append("\" is localized \"");
184.384 - timeZoneResult.append(locShort);
184.385 - timeZoneResult.append("\"!\n");
184.386 - }
184.387 - return timeZoneResult.toString();
184.388 - }
184.389 -
184.390 - /**
184.391 - * Verifies whether the name for ISOCode is localized.
184.392 - * @param ISOCode - ISO country/language code for country/language name to test
184.393 - * @param entriesEn - array of english country/language names
184.394 - * @param entriesLoc - array of localized country/language names for specified locale
184.395 - * @param locale - locale to test against english
184.396 - * @param notFoundMessage - message in form ready for MessageFormat, {0} will be human readable
184.397 - * language name, {1} will be ISOCode.
184.398 - * @param notLocalizedMessage - message in for ready for MessageFormat, same formatting like
184.399 - * for notFountMessage
184.400 - * @return array of two empty strings when passed, descriptive error message in
184.401 - * other cases, [0] - warnings for not localized, [1] - errors for missing keys.
184.402 - */
184.403 - private static String[] testEntry(String ISOCode,
184.404 - Map<String, String> entriesEn,
184.405 - Map<String, String> entriesLoc,
184.406 - Locale locale,
184.407 - String notFoundMessage,
184.408 - String notLocalizedMessage) {
184.409 - String nameEn = null;
184.410 - String nameLoc = null;
184.411 -
184.412 - for (String key: entriesEn.keySet()) {
184.413 - if (ISOCode.equalsIgnoreCase(key)) {
184.414 - nameEn = entriesEn.get(key);
184.415 - break;
184.416 - }
184.417 + private static boolean isTZIgnored(String TZName) {
184.418 + if (TZName.startsWith("Etc/GMT") ||
184.419 + TZName.indexOf("Riyadh8") != -1 ||
184.420 + TZName.equals("GMT0") ||
184.421 + TZName.equals("MET")
184.422 + ) {
184.423 + return true;
184.424 + }
184.425 + return false;
184.426 }
184.427
184.428 - for (String key: entriesLoc.keySet()) {
184.429 - if (ISOCode.equalsIgnoreCase(key)) {
184.430 - nameLoc = entriesLoc.get(key);
184.431 - break;
184.432 - }
184.433 - }
184.434 -
184.435 - if (nameEn == null) {
184.436 - // We should not get here but test is a MUST have
184.437 - return new String[] {"", MessageFormat.format(notFoundMessage,
184.438 - new String[] {"English", ISOCode})};
184.439 - }
184.440 -
184.441 - if (nameLoc == null) {
184.442 - return new String[] {"", MessageFormat.format(notFoundMessage,
184.443 - new String[] {locale.getDisplayName(), ISOCode})};
184.444 - }
184.445 -
184.446 - if (nameEn.equals(nameLoc)) {
184.447 - return new String[] {MessageFormat.format(notLocalizedMessage,
184.448 - new String[] {locale.getDisplayName(), ISOCode}), ""};
184.449 - }
184.450 -
184.451 - return new String[] {"", ""};
184.452 - }
184.453 -
184.454 - private static boolean isTZIgnored(String TZName) {
184.455 - if (TZName.startsWith("Etc/GMT") ||
184.456 - TZName.indexOf("Riyadh8") != -1 ||
184.457 - TZName.equals("GMT0") ||
184.458 - TZName.equals("MET")
184.459 - ) {
184.460 - return true;
184.461 - }
184.462 - return false;
184.463 - }
184.464 -
184.465 - private static Map<String, String> getList(ResourceBundle rs, Boolean getCountryList) {
184.466 + private static Map<String, String> getList(
184.467 + ResourceBundle rs, Boolean getCountryList) {
184.468 char beginChar = 'a';
184.469 char endChar = 'z';
184.470 if (getCountryList) {
185.1 --- a/test/tools/launcher/Arrrghs.java Fri Aug 05 15:35:04 2011 -0700
185.2 +++ b/test/tools/launcher/Arrrghs.java Tue Aug 09 17:38:52 2011 -0700
185.3 @@ -24,7 +24,7 @@
185.4 /**
185.5 * @test
185.6 * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938
185.7 - * 6894719 6968053
185.8 + * 6894719 6968053 7067922
185.9 * @summary Argument parsing validation.
185.10 * @compile -XDignore.symbol.file Arrrghs.java TestHelper.java
185.11 * @run main Arrrghs
185.12 @@ -362,6 +362,16 @@
185.13 tr.checkPositive();
185.14 System.out.println(tr);
185.15 }
185.16 +
185.17 + static void test7067922() {
185.18 + // a missing manifest entry 7067922
185.19 + TestHelper.TestResult tr = null;
185.20 + TestHelper.createJar("cvf", "missingmainentry.jar", ".");
185.21 + tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "missingmainentry.jar");
185.22 + tr.contains("no main manifest attribute");
185.23 + System.out.println(tr);
185.24 + }
185.25 +
185.26 /**
185.27 * @param args the command line arguments
185.28 * @throws java.io.FileNotFoundException
185.29 @@ -374,6 +384,7 @@
185.30 runBasicErrorMessageTests();
185.31 runMainMethodTests();
185.32 test6894719();
185.33 + test7067922();
185.34 runDiagOptionTests();
185.35 if (TestHelper.testExitValue > 0) {
185.36 System.out.println("Total of " + TestHelper.testExitValue + " failed");
186.1 --- a/test/tools/launcher/TestHelper.java Fri Aug 05 15:35:04 2011 -0700
186.2 +++ b/test/tools/launcher/TestHelper.java Tue Aug 09 17:38:52 2011 -0700
186.3 @@ -171,15 +171,15 @@
186.4 if (jarName.exists()) {
186.5 jarName.delete();
186.6 }
186.7 - PrintStream ps = new PrintStream(new FileOutputStream(mainClass + ".java"));
186.8 - ps.println("public class Foo {");
186.9 - if (mainDefs != null) {
186.10 - for (String x : mainDefs) {
186.11 - ps.println(x);
186.12 + try (PrintStream ps = new PrintStream(new FileOutputStream(mainClass + ".java"))) {
186.13 + ps.println("public class Foo {");
186.14 + if (mainDefs != null) {
186.15 + for (String x : mainDefs) {
186.16 + ps.println(x);
186.17 + }
186.18 }
186.19 + ps.println("}");
186.20 }
186.21 - ps.println("}");
186.22 - ps.close();
186.23
186.24 String compileArgs[] = {
186.25 mainClass + ".java"
186.26 @@ -196,12 +196,20 @@
186.27 mEntry,
186.28 mainClass.getName() + ".class"
186.29 };
186.30 + createJar(jarArgs);
186.31 + }
186.32 +
186.33 + static void createJar(String... args) {
186.34 sun.tools.jar.Main jarTool =
186.35 new sun.tools.jar.Main(System.out, System.err, "JarCreator");
186.36 - if (!jarTool.run(jarArgs)) {
186.37 - throw new RuntimeException("jar creation failed " + jarName);
186.38 + if (!jarTool.run(args)) {
186.39 + String message = "jar creation failed with command:";
186.40 + for (String x : args) {
186.41 + message = message.concat(" " + x);
186.42 + }
186.43 + throw new RuntimeException(message);
186.44 }
186.45 - }
186.46 + }
186.47
186.48 static void copyFile(File src, File dst) throws IOException {
186.49 Path parent = dst.toPath().getParent();