diff --git a/jdk/make/common/Defs-embedded.gmk b/jdk/make/common/Defs-embedded.gmk
new file mode 100644
index 00000000000..f196e2f4fed
--- /dev/null
+++ b/jdk/make/common/Defs-embedded.gmk
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Variable definitions for SE Embedded builds. This file should
+# not contain rules.
+#
+ifdef JAVASE_EMBEDDED
+
+# Compress jar files
+COMPRESS_JARS = true
+
+# Don't mmap zip files
+LIBZIP_CAN_USE_MMAP = false
+
+# Disable ALSA version check
+REQUIRED_ALSA_VERSION =
+
+# Compilation settings
+OTHER_CPPFLAGS += -DJAVASE_EMBEDDED
+
+# Product naming
+PRODUCT_SUFFIX = SE Runtime Environment for Embedded
+RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
+
+# Reduced JRE locations
+JRE_REDUCED_HEADLESS_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-headless-image
+JRE_REDUCED_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-image
+
+endif # JAVASE_EMBEDDED
+
diff --git a/jdk/make/common/Defs.gmk b/jdk/make/common/Defs.gmk
index a290efa652c..1e12d411942 100644
--- a/jdk/make/common/Defs.gmk
+++ b/jdk/make/common/Defs.gmk
@@ -115,6 +115,12 @@ endif
include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
+#
+# SE-Embedded support, if enabled
+#
+
+include $(JDK_TOPDIR)/make/common/Defs-embedded.gmk
+
#
# Cross-compilation Settings
#
@@ -144,7 +150,6 @@ ifdef BUILD_CLIENT_ONLY
VM_NAME = client
endif
-
#
# Freetype logic is applicable to OpenJDK only
#
diff --git a/jdk/make/common/Library.gmk b/jdk/make/common/Library.gmk
index e7a24d477ff..9999406b718 100644
--- a/jdk/make/common/Library.gmk
+++ b/jdk/make/common/Library.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@ LINKER=$(LINK.c)
endif
$(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders
-
+ @$(ECHO) Building lib:$(ACTUAL_LIBRARY)
#
# COMPILE_APPROACH: Different approaches to compile up the native object
# files as quickly as possible.
diff --git a/jdk/make/common/Release-embedded.gmk b/jdk/make/common/Release-embedded.gmk
new file mode 100644
index 00000000000..f7a87f28421
--- /dev/null
+++ b/jdk/make/common/Release-embedded.gmk
@@ -0,0 +1,232 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# SE-Embedded Reduced JRE targets
+#
+ifdef JAVASE_EMBEDDED
+
+reduced-image-jre reduced-headless-image-jre ::
+ @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
+
+# Add the reduced-jre images as pre-reqs. These will be processed last
+images:: reduced-image-jre reduced-headless-image-jre
+
+
+######################################################
+# Create the headless rt.jar
+######################################################
+
+NOT_HEADLESS_RT_JAR_LIST = $(ABS_TEMPDIR)/not_hl_rt_jar.list
+HEADLESS_RT_JAR_FILELIST=$(JARFILELISTS_TEMPDIR)/hl_rt_jar_list
+TOTAL_HEADLESS_JAR_FILELIST=$(REORDER_TEMPDIR)/hl_file_list
+HEADLESS_CLASSLIST=$(ABS_TEMPDIR)/headless_classlist
+
+# Add the jar file directories that we don't want in the
+# headless JRE. If you want to remove most classes in a
+# directory, put the directory in the NOT_HEADLESS_RT_JAR_LIST
+# and put the individual classes you want to keep in the
+# HEADLESS_CLASSLIST file.
+$(NOT_HEADLESS_RT_JAR_LIST): $(NOT_RT_JAR_LIST)
+ $(RM) $(HEADLESS_CLASSLIST)
+ $(RM) $(NOT_HEADLESS_RT_JAR_LIST)
+ $(CP) $(NOT_RT_JAR_LIST) $(NOT_HEADLESS_RT_JAR_LIST)
+ $(ECHO) "sun/awt/motif/" >> $@
+ $(ECHO) "sun/awt/X11/" >> $@
+ $(ECHO) "sun/applet/" >> $@
+ $(ECHO) "sun/java2d/opengl/" >> $@
+ $(ECHO) "com/sun/java/swing/plaf/" >> $@
+ $(ECHO) "sun/awt/motif/MFontConfiguration" >$(HEADLESS_CLASSLIST)
+ $(ECHO) "sun/applet/AppContextCreator" >>$(HEADLESS_CLASSLIST)
+ $(ECHO) "sun/applet/AppletAudioClip" >>$(HEADLESS_CLASSLIST)
+ $(ECHO) "sun/java2d/opengl/GLXSurfaceData" >>$(HEADLESS_CLASSLIST)
+ $(ECHO) "sun/java2d/opengl/GLXSurfaceData"\$$"GLXOffScreenSurfaceData" >>$(HEADLESS_CLASSLIST)
+ $(ECHO) "sun/java2d/opengl/GLXVolatileSurfaceManager" >>$(HEADLESS_CLASSLIST)
+ $(ECHO) "sun/java2d/opengl/OGLSurfaceData" >>$(HEADLESS_CLASSLIST)
+
+$(TOTAL_HEADLESS_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_HEADLESS_RT_JAR_LIST)
+ $(prep-target)
+ $(RM) $@.temp
+ $(CD) $(CLASSBINDIR) ; \
+ $(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \
+ -o $@.temp $(HEADLESS_CLASSLIST) $(NOT_HEADLESS_RT_JAR_LIST) .
+ $(MV) $@.temp $@
+ @$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
+
+# Create the headless rt.jar file list & non-class files list
+MakeHeadlessJarFileList: $(TOTAL_HEADLESS_JAR_FILELIST) $(JARSPLIT_JARFILE)
+ @$(RM) $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
+ $(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) $(TOTAL_HEADLESS_JAR_FILELIST) \
+ -o $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
+ @$(java-vm-cleanup)
+
+# Create headless rt.jar
+HL_RT_JAR=$(ABS_TEMPDIR)/rt-hl-orig.jar
+$(HL_RT_JAR): MakeHeadlessJarFileList $(JAR_MANIFEST_FILE)
+ $(prep-target)
+ $(CD) $(CLASSBINDIR) ; \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ @$(HEADLESS_RT_JAR_FILELIST) \
+ $(JAR_JFLAGS)
+ @$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
+
+
+#
+# Produce a reduced Headful JRE for Embedded Devices
+#
+# The deployment binaries are added during the deployment build process
+#
+
+# Binaries that don't get included in reduced jre image bin directory
+NOT_REDUCEDJRE_BIN = \
+ java_vm \
+ kinit \
+ klist \
+ ktab \
+ orbd \
+ policytool \
+ rmid \
+ rmiregistry \
+ servertool \
+ tnameserv \
+ pack200 \
+ unpack200
+
+# jars/resources/libs that don't get included in reduced jre image lib directory
+NOT_REDUCEDJRE_LIB = \
+ charsets.jar \
+ ext/dnsns.jar \
+ ext/localedata.jar \
+ $(LIBARCH)/client/classes.jsa \
+ $(LIBARCH)/libjavaplugin_jni.so \
+ $(LIBARCH)/libjavaplugin_nscp_gcc29.so \
+ $(LIBARCH)/libjavaplugin_nscp.so \
+ $(LIBARCH)/libjavaplugin_oji.so
+
+
+ifeq ($(PLATFORM), linux)
+ STRIP_OPTS = --strip-unneeded
+else
+ STRIP_OPTS = -x
+endif
+
+
+reduced-image-jre::
+ @$(ECHO) Starting to Produce Reduced JRE
+ @#
+ @# First make a copy of the full JRE
+ @#
+ $(RM) -r $(JRE_REDUCED_IMAGE_DIR)
+ $(MKDIR) -p $(JRE_REDUCED_IMAGE_DIR)
+ $(CD) $(JRE_IMAGE_DIR); \
+ $(TAR) cf - . | ($(CD) $(JRE_REDUCED_IMAGE_DIR); $(TAR) xf - );
+
+ @# strip the main .so files
+ $(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/client/libjvm.so
+ifndef BUILD_CLIENT_ONLY
+ $(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/server/libjvm.so
+endif
+
+ @#
+ @# Remove all of the files that are not needed for the
+ @# reduced JRE
+ @#
+ for l in $(NOT_REDUCEDJRE_BIN) ; do \
+ $(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \
+ done
+ for l in $(NOT_REDUCEDJRE_LIB) ; do \
+ $(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \
+ done
+
+ @# Remove misc. other files
+ $(RM) -r $(JRE_REDUCED_IMAGE_DIR)/man
+ $(RM) -f $(JRE_REDUCED_IMAGE_DIR)/CHANGES
+
+ @$(ECHO) Done Creating Reduced JRE
+
+#
+# Produce a reduced Headless JRE
+#
+reduced-headless-image-jre:: $(RT_JAR) $(RESOURCES_JAR) $(BUILD_META_INDEX) $(HL_RT_JAR)
+ @$(ECHO) Starting to Produce Reduced Headless JRE
+ @#
+ @# First make a copy of the reduced JRE we just built
+ @#
+ $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
+ $(MKDIR) -p $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
+ $(CD) $(JRE_REDUCED_IMAGE_DIR); \
+ $(TAR) cf - . | ($(CD) $(JRE_REDUCED_HEADLESS_IMAGE_DIR); $(TAR) xf - );
+
+ @# Replace the full rt.jar with the headless rt.jar
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
+ $(CP) $(HL_RT_JAR) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
+
+ @#
+ @# Remove all of the files that are not needed for the
+ @# reduced Headless JRE
+ @#
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/gtkhelper
+ $(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libjsoundalsa.so
+ $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio
+ $(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet
+ $(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot
+ $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/xawt
+ $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so
+ @# Remove oblique fonts and reduce font support to LucidaSansRegular only
+ $(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiBold.ttf
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiItalic.ttf
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightItalic.ttf
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightRegular.ttf
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaSansDemiBold.ttf
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterBold.ttf
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterRegular.ttf
+
+ifeq ($(PLATFORM), linux)
+# put out minimal fonts.dir file for the remaining font
+ $(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) 6>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+ $(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+
+endif # Linux
+
+ @#
+ @# all done with JRE reduced headless image
+ @#
+
+ @$(ECHO) Done Creating Reduced Headless JRE
+
+images-clobber::
+ $(RM) -r $(JRE_REDUCED_IMAGE_DIR)
+ $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
+
+.PHONY: reduced-image-jre reduced-headless-image-jre
+
+endif # JAVASE_EMBEDDED
+
diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk
index 63e03c44edc..17297d573b0 100644
--- a/jdk/make/common/Release.gmk
+++ b/jdk/make/common/Release.gmk
@@ -38,7 +38,7 @@ THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSIO
IMAGE_BINDIR = bin
-# The compiler should not issue a "Sun Propietary" warning when compiling
+# The compiler should not issue a "Proprietary" warning when compiling
# classes in the com.sun.java.swing.plaf packages, since we've always
# allowed, and even advocated, extending them (see bug 6476749).
#
@@ -195,6 +195,16 @@ if [ "$(JA_DIRNAME)" != "" ] ; then \
fi
endef
+
+# no compression unless requested
+ifndef COMPRESS_JARS
+ CREATE_JAR_OPTS = c0mf
+ CREATE_JAR_OPTS_NOMANIFEST = c0f
+else
+ CREATE_JAR_OPTS = cmf
+ CREATE_JAR_OPTS_NOMANIFEST = cf
+endif
+
#
# Targets.
#
@@ -222,7 +232,7 @@ images:: sanity-images post-sanity-images \
$(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
trim-image-jre trim-image-jdk \
identify-image-jre identify-image-jdk \
- process-image-jre process-image-jdk sec-files sec-files-win jgss-files
+ process-image-jre process-image-jdk sec-files sec-files-win jgss-files
# Don't use these
image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre
@@ -613,7 +623,7 @@ RESOURCES_JAR=$(ABS_TEMPDIR)/resources-orig.jar
$(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(prep-target)
$(CD) $(CLASSBINDIR) && \
- $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
@$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
@@ -622,7 +632,7 @@ JSSE_JAR=$(ABS_TEMPDIR)/jsse-orig.jar
$(JSSE_JAR): $(JAR_MANIFEST_FILE)
$(prep-target)
$(CD) $(CLASSBINDIR) && \
- $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
$(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
@@ -669,7 +679,7 @@ RT_JAR=$(ABS_TEMPDIR)/rt-orig.jar
$(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
$(prep-target)
$(CD) $(CLASSBINDIR) && \
- $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
@$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
@@ -677,6 +687,10 @@ $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar
+# SE-Embedded targets if enabled
+include $(JDK_TOPDIR)/make/common/Release-embedded.gmk
+
+
######################################################
# JRE Image
######################################################
@@ -924,7 +938,7 @@ initial-image-jdk:: initial-image-jdk-setup \
@# lib/tools.jar
@#
$(CD) $(CLASSBINDIR) && \
- $(BOOT_JAR_CMD) c0f $(ABS_LIBDIR)/tools.jar \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(ABS_LIBDIR)/tools.jar \
$(TOOLS) $(BOOT_JAR_JFLAGS)
@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
$(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar
@@ -937,7 +951,7 @@ initial-image-jdk:: initial-image-jdk-setup \
-Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
-Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
$(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
- $(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(LIBDIR)/ct.sym \
-C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
$(CP) $(LIBDIR)/ct.sym $(JDK_IMAGE_DIR)/lib/ct.sym
diff --git a/jdk/make/common/shared/Sanity-Settings.gmk b/jdk/make/common/shared/Sanity-Settings.gmk
index 0184a74792d..36179fed5fd 100644
--- a/jdk/make/common/shared/Sanity-Settings.gmk
+++ b/jdk/make/common/shared/Sanity-Settings.gmk
@@ -185,7 +185,9 @@ ifeq ($(PLATFORM),windows)
endif
endif
ifeq ($(PLATFORM),linux)
- ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION)
+ ifdef REQUIRED_ALSA_VERSION
+ ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION)
+ endif
endif
ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION)
ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME)
diff --git a/jdk/make/java/java/Makefile b/jdk/make/java/java/Makefile
index 9a2627096f0..bc81588407d 100644
--- a/jdk/make/java/java/Makefile
+++ b/jdk/make/java/java/Makefile
@@ -198,10 +198,12 @@ INSTALL_DOT_LIB = true
#
# What to link?
+# On Windows, shell32 is not normally required and so it is delay loaded.
#
ifeq ($(PLATFORM),windows)
OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
- -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib
+ -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib \
+ shell32.lib delayimp.lib /DELAYLOAD:shell32.dll
else
OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \
-L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
diff --git a/jdk/make/java/management/Makefile b/jdk/make/java/management/Makefile
index ebf3640b812..45c06da9cc9 100644
--- a/jdk/make/java/management/Makefile
+++ b/jdk/make/java/management/Makefile
@@ -86,7 +86,8 @@ OTHER_INCLUDES += \
-I$(SHARE_SRC)/native/sun/management
ifeq ($(PLATFORM),windows)
- OTHER_LDLIBS += $(JVMLIB)
+ # Need process status helper API (psapi) on Windows
+ OTHER_LDLIBS += $(JVMLIB) psapi.lib
endif
#
diff --git a/jdk/make/java/net/Makefile b/jdk/make/java/net/Makefile
index 6e865fa24ec..a23697ffb8f 100644
--- a/jdk/make/java/net/Makefile
+++ b/jdk/make/java/net/Makefile
@@ -37,10 +37,6 @@ include FILES_c.gmk
AUTO_FILES_JAVA_DIRS = java/net
ifeq ($(PLATFORM), windows)
- # Windows 9x module only needed on 32-bit build
- ifeq ($(ARCH_DATA_MODEL), 32)
- FILES_c += NetworkInterface_win9x.c
- endif
FILES_c += NTLMAuthSequence.c
FILES_c += NetworkInterface_winXP.c
else
@@ -96,7 +92,9 @@ include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk
ifeq ($(PLATFORM), windows)
- OTHER_LDLIBS = ws2_32.lib $(JVMLIB)
+ OTHER_LDLIBS = ws2_32.lib $(JVMLIB) \
+ secur32.lib iphlpapi.lib delayimp.lib \
+ /DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll
else
OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB)
endif
diff --git a/jdk/make/java/zip/Makefile b/jdk/make/java/zip/Makefile
index fd83ea3f282..906e7e85096 100644
--- a/jdk/make/java/zip/Makefile
+++ b/jdk/make/java/zip/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,10 @@ FILES_export = \
java/util/jar/JarFile.java
ifneq ($(PLATFORM), windows)
-OTHER_CFLAGS += -DUSE_MMAP
+ # Use mmap unless explicitly disallowed
+ ifneq ($(LIBZIP_CAN_USE_MMAP),false)
+ OTHER_CFLAGS += -DUSE_MMAP
+ endif
endif
#
diff --git a/jdk/make/jprt.properties b/jdk/make/jprt.properties
index 7cb87c1e3a3..b479e22f06a 100644
--- a/jdk/make/jprt.properties
+++ b/jdk/make/jprt.properties
@@ -52,8 +52,11 @@ jprt.build.targets= \
${jprt.my.windows.i586}-{product|fastdebug}, \
windows_x64_5.2-{product|fastdebug}
+# User can select the test set with jprt submit "-testset name" option
+jprt.my.test.set=${jprt.test.set}
+
# Standard vm test target
-jprt.test.targets= \
+jprt.vm.default.test.targets= \
solaris_sparc_5.10-product-c1-jvm98, \
solaris_sparcv9_5.10-product-c2-jvm98, \
solaris_i586_5.10-product-c1-jvm98, \
@@ -63,8 +66,10 @@ jprt.test.targets= \
${jprt.my.windows.i586}-product-c1-jvm98, \
windows_x64_5.2-product-c2-jvm98
-# User can select the test set with jprt submit "-testset name" option
-jprt.my.test.set=${jprt.test.set}
+# Select vm testlist to use (allow for testset to be empty too)
+jprt.vm.all.test.targets=${jprt.vm.default.test.targets}
+jprt.vm..test.targets=${jprt.vm.default.test.targets}
+jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Default jdk test targets in test/Makefile (no fastdebug & limited c2)
jprt.make.rule.default.test.targets= \
@@ -281,6 +286,21 @@ jprt.make.rule.all.test.targets= \
${jprt.my.windows.i586}-product-c1-jdk_tools2, \
windows_x64_5.2-product-c2-jdk_tools2
+# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
+jprt.my.jck.test.target.set= \
+ solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
+ solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
+ solaris_i586_5.10-product-c1-JCK7TESTRULE, \
+ solaris_x64_5.10-product-c2-JCK7TESTRULE, \
+ linux_i586_2.6-product-c1-JCK7TESTRULE, \
+ linux_x64_2.6-product-c2-JCK7TESTRULE
+
+# JCK testset targets (e.g. jprt submit -testset jck ... )
+jprt.make.rule.jck.test.targets= \
+ ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7devtools}, \
+ ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7runtime}, \
+ ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
+
# Select list to use (allow for testset to be empty too)
jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets}
jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets}
diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile
index 8d7036be179..cc07bbe9cb0 100644
--- a/jdk/make/launchers/Makefile
+++ b/jdk/make/launchers/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -44,8 +44,17 @@ $(MAKE) -f Makefile.launcher \
endef
# Run MAKE $@ for all generic launchers
-define make-all-launchers
+ifndef BUILD_HEADLESS_ONLY
+define make-appletviewer
$(call make-launcher, appletviewer, sun.applet.Main, , )
+endef
+else
+define make-appletviewer
+endef
+endif
+
+define make-all-launchers
+$(make-appletviewer)
$(call make-launcher, apt, com.sun.tools.apt.Main, , )
$(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , )
$(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , )
diff --git a/jdk/make/mkdemo/jfc/Makefile b/jdk/make/mkdemo/jfc/Makefile
index 768e5b8f4a8..8eecf285978 100644
--- a/jdk/make/mkdemo/jfc/Makefile
+++ b/jdk/make/mkdemo/jfc/Makefile
@@ -39,7 +39,8 @@ SUBDIRS = \
Notepad \
SampleTree \
SwingApplet \
- TableExample
+ TableExample \
+ TransparentRuler
# Some demos aren't currently included in OpenJDK
ifndef OPENJDK
diff --git a/jdk/make/mkdemo/jfc/TransparentRuler/Makefile b/jdk/make/mkdemo/jfc/TransparentRuler/Makefile
new file mode 100644
index 00000000000..7092b875048
--- /dev/null
+++ b/jdk/make/mkdemo/jfc/TransparentRuler/Makefile
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Makefile to build the TransparentRuler demo.
+#
+
+BUILDDIR = ../../..
+PRODUCT = demo/jfc
+DEMONAME = TransparentRuler
+include $(BUILDDIR)/common/Defs.gmk
+
+DEMO_ROOT = $(SHARE_SRC)/demo/jfc/$(DEMONAME)
+DEMO_TOPFILES = ./README.txt
+DEMO_MAINCLASS = transparentruler.Ruler
+DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME)
+
+
+#
+# Demo jar building rules.
+#
+include $(BUILDDIR)/common/Demo.gmk
diff --git a/jdk/make/sun/Makefile b/jdk/make/sun/Makefile
index cac9b8781d6..6e0830cd117 100644
--- a/jdk/make/sun/Makefile
+++ b/jdk/make/sun/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -69,10 +69,17 @@ endif
# nio need to be compiled before awt to have all charsets ready
SUBDIRS = jar security javazic misc net nio text launcher
+
+ifdef BUILD_HEADLESS_ONLY
+ DISPLAY_LIBS = awt $(HEADLESS_SUBDIR)
+ DISPLAY_TOOLS =
+else
+ DISPLAY_LIBS = awt splashscreen $(XAWT_SUBDIR) $(HEADLESS_SUBDIR)
+ DISPLAY_TOOLS = applet
+endif
SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \
- awt splashscreen $(XAWT_SUBDIR) \
- $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
- jawt font jpeg cmm applet beans
+ $(DISPLAY_LIBS) $(DGA_SUBDIR) \
+ jawt font jpeg cmm $(DISPLAY_TOOLS) beans
SUBDIRS_management = management
SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
SUBDIRS_tools = native2ascii serialver tools jconsole
diff --git a/jdk/make/sun/awt/mawt.gmk b/jdk/make/sun/awt/mawt.gmk
index 44de692602b..f8160ee7d7d 100644
--- a/jdk/make/sun/awt/mawt.gmk
+++ b/jdk/make/sun/awt/mawt.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -149,13 +149,13 @@ ifeq ($(PLATFORM), linux)
LIBXT = -lXt
else
# Allows for builds on Debian GNU Linux, X11 is in a different place
- LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \
+ LIBXT = $(firstword $(wildcard $(OPENWIN_LIB)/libXt.a) \
$(wildcard /usr/lib/libXt.a))
- LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \
+ LIBSM = $(firstword $(wildcard $(OPENWIN_LIB)/libSM.a) \
$(wildcard /usr/lib/libSM.a))
- LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \
+ LIBICE = $(firstword $(wildcard $(OPENWIN_LIB)/libICE.a) \
$(wildcard /usr/lib/libICE.a))
- LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \
+ LIBXTST = $(firstword $(wildcard $(OPENWIN_LIB)/libXtst.a) \
$(wildcard /usr/lib/libXtst.a))
endif
endif
@@ -224,9 +224,9 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \
$(EVENT_MODEL)
ifeq ($(PLATFORM), linux)
-# Checking for the X11/extensions headers at the additional location
- CPPFLAGS += -I/X11R6/include/X11/extensions \
- -I/usr/include/X11/extensions
+ # Checking for the X11/extensions headers at the additional location
+ CPPFLAGS += -I$(firstword $(wildcard $(OPENWIN_HOME)/include/X11/extensions) \
+ $(wildcard /usr/include/X11/extensions))
endif
ifeq ($(PLATFORM), solaris)
diff --git a/jdk/make/sun/javazic/tzdata/VERSION b/jdk/make/sun/javazic/tzdata/VERSION
index 0b57ca90d10..c19847f5a11 100644
--- a/jdk/make/sun/javazic/tzdata/VERSION
+++ b/jdk/make/sun/javazic/tzdata/VERSION
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2011d
+tzdata2011e
diff --git a/jdk/make/sun/javazic/tzdata/africa b/jdk/make/sun/javazic/tzdata/africa
index ce560077e00..bea5f8157bb 100644
--- a/jdk/make/sun/javazic/tzdata/africa
+++ b/jdk/make/sun/javazic/tzdata/africa
@@ -734,6 +734,48 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
#
+# From Dan Abitol (2011-03-30):
+# ...Rules for Africa/Casablanca are the following (24h format)
+# The 3rd april 2011 at 00:00:00, [it] will be 3rd april 1:00:00
+# The 31th july 2011 at 00:59:59, [it] will be 31th July 00:00:00
+# ...Official links of change in morocco
+# The change was broadcast on the FM Radio
+# I ve called ANRT (telecom regulations in Morocco) at
+# +212.537.71.84.00
+#
+# http://www.anrt.net.ma/fr/
+#
+# They said that
+#
+# http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view
+#
+# is the official publication to look at.
+# They said that the decision was already taken.
+#
+# More articles in the press
+#
+# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-lev
+#
+# e.html
+#
+# http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
+#
+#
+# http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
+# anche-prochain-5538.html
+#
+
+# From Petr Machata (2011-03-30):
+# They have it written in English here:
+#
+# http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view
+#
+#
+# It says there that "Morocco will resume its standard time on July 31,
+# 2011 at midnight." Now they don't say whether they mean midnight of
+# wall clock time (i.e. 11pm UTC), but that's what I would assume. It has
+# also been like that in the past.
+
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
@@ -757,6 +799,8 @@ Rule Morocco 2009 only - Jun 1 0:00 1:00 S
Rule Morocco 2009 only - Aug 21 0:00 0 -
Rule Morocco 2010 only - May 2 0:00 1:00 S
Rule Morocco 2010 only - Aug 8 0:00 0 -
+Rule Morocco 2011 only - Apr 3 0:00 1:00 S
+Rule Morocco 2011 only - Jul 31 0 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
diff --git a/jdk/make/sun/javazic/tzdata/southamerica b/jdk/make/sun/javazic/tzdata/southamerica
index a11df76f6e9..7afec35d696 100644
--- a/jdk/make/sun/javazic/tzdata/southamerica
+++ b/jdk/make/sun/javazic/tzdata/southamerica
@@ -1193,6 +1193,19 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# From Arthur David Olson (2011-03-02):
# The emol.com article mentions a water shortage as the cause of the
# postponement, which may mean that it's not a permanent change.
+
+# From Glenn Eychaner (2011-03-28):
+# The article:
+#
+# http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E}
+#
+#
+# In English:
+# Chile's clocks will go back an hour this year on the 7th of May instead
+# of this Saturday. They will go forward again the 3rd Saturday in
+# August, not in October as they have since 1968. This is a pilot plan
+# which will be reevaluated in 2012.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 -
@@ -1222,13 +1235,16 @@ Rule Chile 1997 only - Mar 30 3:00u 0 -
Rule Chile 1998 only - Mar Sun>=9 3:00u 0 -
Rule Chile 1998 only - Sep 27 4:00u 1:00 S
Rule Chile 1999 only - Apr 4 3:00u 0 -
-Rule Chile 1999 max - Oct Sun>=9 4:00u 1:00 S
+Rule Chile 1999 2010 - Oct Sun>=9 4:00u 1:00 S
+Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
+Rule Chile 2012 max - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# N.B.: the end of March 29 in Chile is March 30 in Universal time,
# which is used below in specifying the transition.
Rule Chile 2008 only - Mar 30 3:00u 0 -
Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
-Rule Chile 2010 2011 - Apr Sun>=1 3:00u 0 -
+Rule Chile 2010 only - Apr Sun>=1 3:00u 0 -
+Rule Chile 2011 only - May Sun>=2 3:00u 0 -
Rule Chile 2012 max - Mar Sun>=9 3:00u 0 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
diff --git a/jdk/make/sun/jawt/Makefile b/jdk/make/sun/jawt/Makefile
index 7741e1b5a83..afbce78e638 100644
--- a/jdk/make/sun/jawt/Makefile
+++ b/jdk/make/sun/jawt/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -112,11 +112,20 @@ CPPFLAGS += -I$(OPENWIN_HOME)/include \
# Libraries to link in.
#
ifeq ($(PLATFORM), solaris)
-OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+ ifndef BUILD_HEADLESS_ONLY
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+ else
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/headless -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+ endif
endif # PLATFORM
ifeq ($(PLATFORM), linux)
-OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
+ ifndef BUILD_HEADLESS_ONLY
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
+ else
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/headless -lmawt
+ CFLAGS += -DHEADLESS
+ endif
endif # PLATFORM
endif # PLATFORM
diff --git a/jdk/make/sun/jpeg/Makefile b/jdk/make/sun/jpeg/Makefile
index 78c53c461a1..880fc7c5e78 100644
--- a/jdk/make/sun/jpeg/Makefile
+++ b/jdk/make/sun/jpeg/Makefile
@@ -73,9 +73,10 @@ ifeq ($(PLATFORM), linux)
# Recommended way to avoid such warning is to declare the variable as
# volatile to prevent the optimization. However, this approach does not
# work because we have to declare all variables as volatile in result.
-
+ifndef CROSS_COMPILE_ARCH
OTHER_CFLAGS += -Wno-clobbered
endif
+endif
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk
diff --git a/jdk/make/sun/nio/cs/Makefile b/jdk/make/sun/nio/cs/Makefile
index eeddbb03120..d60d8a528d5 100644
--- a/jdk/make/sun/nio/cs/Makefile
+++ b/jdk/make/sun/nio/cs/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -120,8 +120,15 @@ $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
$(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH)
$(install-file)
+# no compression unless requested
+ifndef COMPRESS_JARS
+ CREATE_JAR_OPTS_NOMANIFEST = cf0
+else
+ CREATE_JAR_OPTS_NOMANIFEST = cf
+endif
+
$(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
- $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \
+ $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(CHARSETS_JAR) \
-C $(CLASSDESTDIR) sun \
-C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH) \
$(BOOT_JAR_JFLAGS)
diff --git a/jdk/make/sun/security/tools/Makefile b/jdk/make/sun/security/tools/Makefile
index bfdb261f6ba..f46070d07ca 100644
--- a/jdk/make/sun/security/tools/Makefile
+++ b/jdk/make/sun/security/tools/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -46,5 +46,7 @@ include $(BUILDDIR)/common/Classes.gmk
build:
$(call make-launcher, keytool, sun.security.tools.KeyTool, , )
+ifndef BUILD_HEADLESS_ONLY
$(call make-launcher, policytool, sun.security.tools.policytool.PolicyTool, , )
+endif
diff --git a/jdk/make/sun/xawt/Makefile b/jdk/make/sun/xawt/Makefile
index afe16f5737d..cf322d9023c 100644
--- a/jdk/make/sun/xawt/Makefile
+++ b/jdk/make/sun/xawt/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -129,10 +129,17 @@ CPPFLAGS += -DXAWT -DXAWT_HACK \
-I$(PLATFORM_SRC)/native/sun/awt
ifeq ($(PLATFORM), linux)
-# Allows for builds on Debian GNU Linux, X11 is in a different place
- CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
- -I/usr/include/X11/extensions \
- -I$(OPENWIN_HOME)/include
+ ifndef CROSS_COMPILE_ARCH
+ # Allows for builds on Debian GNU Linux, X11 is in a different place
+ # This should really be handled at a higher-level so we don't have to
+ # work-around this when cross-compiling
+ CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
+ -I/usr/include/X11/extensions \
+ -I$(OPENWIN_HOME)/include
+ else
+ CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \
+ -I$(OPENWIN_HOME)/include
+ endif
endif
# We have some odd logic here because some Solaris 10 updates
@@ -245,7 +252,11 @@ XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt
$(SIZERS): $(SIZERS_C)
$(prep-target)
+ifndef CROSS_COMPILE_ARCH
$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
+else
+ $(HOST_CC) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
+endif
$(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
$(prep-target)
diff --git a/jdk/make/sun/xawt/mapfile-vers b/jdk/make/sun/xawt/mapfile-vers
index 3aa1ca49fc6..096bfe55326 100644
--- a/jdk/make/sun/xawt/mapfile-vers
+++ b/jdk/make/sun/xawt/mapfile-vers
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -158,6 +158,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
Java_sun_awt_X11_XRobotPeer_setup;
+ Java_sun_awt_X11_XRobotPeer__1dispose;
Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
Java_java_awt_Component_initIDs;
Java_java_awt_Container_initIDs;
@@ -225,6 +226,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
Java_sun_awt_X11GraphicsConfig_swapBuffers;
Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
+ Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout;
Java_java_awt_Insets_initIDs;
Java_java_awt_KeyboardFocusManager_initIDs;
Java_java_awt_Font_initIDs;
diff --git a/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java
index e4168e4072c..aaf061b514f 100644
--- a/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,13 +30,14 @@ import java.lang.RuntimePermission;
import java.net.MalformedURLException;
import java.net.SocketPermission;
import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.text.MessageFormat;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Vector;
import java.util.StringTokenizer;
-import java.security.GeneralSecurityException;
import sun.security.util.PropertyExpander;
/**
@@ -368,8 +369,8 @@ class PolicyParser {
"WILDCARD class but no WILDCARD name");
throw new ParsingException
(st.lineno(),
- rb.getString("can.not.specify.Principal.with.a.") +
- rb.getString("wildcard.class.without.a.wildcard.name"));
+ rb.getString("can.not.specify.Principal.with.a." +
+ "wildcard.class.without.a.wildcard.name"));
}
try {
@@ -525,9 +526,10 @@ class PolicyParser {
rb.getString("number.") +
String.valueOf(st.nval));
case StreamTokenizer.TT_EOF:
- throw new ParsingException
- (rb.getString("expected.") + expect +
- rb.getString(".read.end.of.file"));
+ MessageFormat form = new MessageFormat(
+ rb.getString("expected.expect.read.end.of.file."));
+ Object[] source = {expect};
+ throw new ParsingException(form.format(source));
case StreamTokenizer.TT_WORD:
if (expect.equalsIgnoreCase(st.sval)) {
lookahead = st.nextToken();
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index c6ab0494574..09df2e00ba1 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -5821,7 +5821,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* InputMethodRequests instance.
* If listener l is null,
* no exception is thrown and no action is performed.
- *
Refer to Refer to AWT Threading Issues for details on AWT's threading model.
*
* @param l the input method listener
diff --git a/jdk/src/share/classes/java/awt/Shape.java b/jdk/src/share/classes/java/awt/Shape.java
index e037d0aa271..e478ea7f3d8 100644
--- a/jdk/src/share/classes/java/awt/Shape.java
+++ b/jdk/src/share/classes/java/awt/Shape.java
@@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D;
* object that describes the trajectory path of the Shape
* outline.
*
- * Definition of insideness:
+ * Definition of insideness:
* A point is considered to lie inside a
* Shape if and only if:
*
getBounds2D method generally returns a
* tighter bounding box due to its greater flexibility in
* representation.
+ *
+ * + * Note that the + * definition of insideness can lead to situations where points + * on the defining outline of the {@code shape} may not be considered + * contained in the returned {@code bounds} object, but only in cases + * where those points are also not considered contained in the original + * {@code shape}. + *
+ *+ * If a {@code point} is inside the {@code shape} according to the + * {@link #contains(double x, double y) contains(point)} method, then + * it must be inside the returned {@code Rectangle} bounds object + * according to the {@link #contains(double x, double y) contains(point)} + * method of the {@code bounds}. Specifically: + *
+ *+ * {@code shape.contains(x,y)} requires {@code bounds.contains(x,y)} + *
+ *+ * If a {@code point} is not inside the {@code shape}, then it might + * still be contained in the {@code bounds} object: + *
+ *+ * {@code bounds.contains(x,y)} does not imply {@code shape.contains(x,y)} + *
* @return an integerRectangle that completely encloses
* the Shape.
* @see #getBounds2D
@@ -107,6 +133,32 @@ public interface Shape {
* to overflow problems since the return value can be an instance of
* the Rectangle2D that uses double precision values to
* store the dimensions.
+ *
+ * + * Note that the + * definition of insideness can lead to situations where points + * on the defining outline of the {@code shape} may not be considered + * contained in the returned {@code bounds} object, but only in cases + * where those points are also not considered contained in the original + * {@code shape}. + *
+ *+ * If a {@code point} is inside the {@code shape} according to the + * {@link #contains(Point2D p) contains(point)} method, then it must + * be inside the returned {@code Rectangle2D} bounds object according + * to the {@link #contains(Point2D p) contains(point)} method of the + * {@code bounds}. Specifically: + *
+ *+ * {@code shape.contains(p)} requires {@code bounds.contains(p)} + *
+ *+ * If a {@code point} is not inside the {@code shape}, then it might + * still be contained in the {@code bounds} object: + *
+ *+ * {@code bounds.contains(p)} does not imply {@code shape.contains(p)} + *
* @return an instance ofRectangle2D that is a
* high-precision bounding box of the Shape.
* @see #getBounds
@@ -116,7 +168,9 @@ public interface Shape {
/**
* Tests if the specified coordinates are inside the boundary of the
- * Shape.
+ * Shape, as described by the
+ *
+ * definition of insideness.
* @param x the specified X coordinate to be tested
* @param y the specified Y coordinate to be tested
* @return true if the specified coordinates are inside
@@ -128,7 +182,9 @@ public interface Shape {
/**
* Tests if a specified {@link Point2D} is inside the boundary
- * of the Shape.
+ * of the Shape, as described by the
+ *
+ * definition of insideness.
* @param p the specified Point2D to be tested
* @return true if the specified Point2D is
* inside the boundary of the Shape;
diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java
index 85ee6db4a43..cc0b658e7b2 100644
--- a/jdk/src/share/classes/java/awt/Toolkit.java
+++ b/jdk/src/share/classes/java/awt/Toolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -858,7 +858,7 @@ public abstract class Toolkit {
String nm = null;
Class cls = null;
try {
- nm = System.getProperty("awt.toolkit", "sun.awt.X11.XToolkit");
+ nm = System.getProperty("awt.toolkit");
try {
cls = Class.forName(nm);
} catch (ClassNotFoundException e) {
@@ -1157,12 +1157,9 @@ public abstract class Toolkit {
* takes JobAttributes and PageAttributes objects. This object
* may be updated to reflect the user's job choices on exit. May
* be null.
- *
* @return a PrintJob object, or null if the
* user cancelled the print job.
- * @throws NullPointerException if frame is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns
- * true.
+ * @throws NullPointerException if frame is null
* @throws SecurityException if this thread is not allowed to initiate a
* print job request
* @see java.awt.GraphicsEnvironment#isHeadless
@@ -1201,12 +1198,9 @@ public abstract class Toolkit {
* job. The attributes will be updated to reflect the user's
* choices as outlined in the PageAttributes documentation. May be
* null.
- *
* @return a PrintJob object, or null if the
* user cancelled the print job.
- * @throws NullPointerException if frame is null and either jobAttributes
- * is null or jobAttributes.getDialog() returns
- * JobAttributes.DialogType.NATIVE.
+ * @throws NullPointerException if frame is null
* @throws IllegalArgumentException if pageAttributes specifies differing
* cross feed and feed resolutions. Also if this thread has
* access to the file system and jobAttributes specifies
@@ -1218,9 +1212,6 @@ public abstract class Toolkit {
* opportunity to select a file and proceed with printing.
* The dialog will ensure that the selected output file
* is valid before returning from this method.
- *
- * This exception is always thrown when GraphicsEnvironment.isHeadless()
- * returns true.
* @throws SecurityException if this thread is not allowed to initiate a
* print job request, or if jobAttributes specifies print to file,
* and this thread is not allowed to access the file system
@@ -1236,10 +1227,6 @@ public abstract class Toolkit {
PageAttributes pageAttributes) {
// Override to add printing support with new job/page control classes
- if (GraphicsEnvironment.isHeadless()) {
- throw new IllegalArgumentException();
- }
-
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getPrintJob(frame, jobtitle,
jobAttributes,
diff --git a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java
index 5a9acc50ae5..c1a620c7d8f 100644
--- a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java
+++ b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java
@@ -408,7 +408,12 @@ public final class BandedSampleModel extends ComponentSampleModel
*/
public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
@@ -690,7 +695,12 @@ public final class BandedSampleModel extends ComponentSampleModel
*/
public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
diff --git a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java
index 12ce6189ad4..627c9291074 100644
--- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java
+++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java
@@ -739,7 +739,12 @@ public class ComponentSampleModel extends SampleModel
*/
public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || y > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
@@ -1025,7 +1030,12 @@ public class ComponentSampleModel extends SampleModel
*/
public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
diff --git a/jdk/src/share/classes/java/awt/image/SampleModel.java b/jdk/src/share/classes/java/awt/image/SampleModel.java
index 2412da2db94..ab81b78d984 100644
--- a/jdk/src/share/classes/java/awt/image/SampleModel.java
+++ b/jdk/src/share/classes/java/awt/image/SampleModel.java
@@ -361,8 +361,8 @@ public abstract class SampleModel
int x1 = x + w;
int y1 = y + h;
- if (x < 0 || x1 < x || x1 > width ||
- y < 0 || y1 < y || y1 > height)
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
@@ -588,6 +588,15 @@ public abstract class SampleModel
int type = getTransferType();
int numDataElems = getNumDataElements();
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
switch(type) {
case DataBuffer.TYPE_BYTE:
@@ -595,8 +604,8 @@ public abstract class SampleModel
byte[] barray = (byte[])obj;
byte[] btemp = new byte[numDataElems];
- for (int i=y; iArithmeticException with no detail
+ * Constructs an {@code ArithmeticException} with no detail
* message.
*/
public ArithmeticException() {
@@ -46,7 +49,7 @@ class ArithmeticException extends RuntimeException {
}
/**
- * Constructs an ArithmeticException with the specified
+ * Constructs an {@code ArithmeticException} with the specified
* detail message.
*
* @param s the detail message.
diff --git a/jdk/src/share/classes/java/lang/CharSequence.java b/jdk/src/share/classes/java/lang/CharSequence.java
index 6d19f5a1830..d9e65a005a1 100644
--- a/jdk/src/share/classes/java/lang/CharSequence.java
+++ b/jdk/src/share/classes/java/lang/CharSequence.java
@@ -66,7 +66,7 @@ public interface CharSequence {
* indexing.
If the char value specified by the index is a
- * surrogate, the surrogate
+ * surrogate, the surrogate
* value is returned.
*
* @param index the index of the char value to be returned
diff --git a/jdk/src/share/classes/java/lang/Character.java b/jdk/src/share/classes/java/lang/Character.java
index 0289d54cdf7..cc1dae863df 100644
--- a/jdk/src/share/classes/java/lang/Character.java
+++ b/jdk/src/share/classes/java/lang/Character.java
@@ -31,10 +31,10 @@ import java.util.HashMap;
import java.util.Locale;
/**
- * The Character class wraps a value of the primitive
- * type char in an object. An object of type
- * Character contains a single field whose type is
- * char.
+ * The {@code Character} class wraps a value of the primitive
+ * type {@code char} in an object. An object of type
+ * {@code Character} contains a single field whose type is
+ * {@code char}.
*
* In addition, this class provides several methods for determining * a character's category (lowercase letter, digit, etc.) and for converting @@ -42,7 +42,7 @@ import java.util.Locale; *
* Character information is based on the Unicode Standard, version 6.0.0. *
- * The methods and data of class Character are defined by
+ * The methods and data of class {@code Character} are defined by
* the information in the UnicodeData file that is part of the
* Unicode Character Database maintained by the Unicode
* Consortium. This file specifies various properties including name
@@ -56,8 +56,8 @@ import java.util.Locale;
*
*
The char data type (and therefore the value that a
- * Character object encapsulates) are based on the
+ *
The {@code char} data type (and therefore the value that a
+ * {@code Character} object encapsulates) are based on the
* original Unicode specification, which defined characters as
* fixed-width 16-bit entities. The Unicode standard has since been
* changed to allow for characters whose representation requires more
@@ -72,43 +72,43 @@ import java.util.Locale;
* sometimes referred to as the Basic Multilingual Plane (BMP).
* Characters whose code points are greater
* than U+FFFF are called supplementary characters. The Java
- * platform uses the UTF-16 representation in char arrays and
- * in the String and StringBuffer classes. In
+ * platform uses the UTF-16 representation in {@code char} arrays and
+ * in the {@code String} and {@code StringBuffer} classes. In
* this representation, supplementary characters are represented as a pair
- * of char values, the first from the high-surrogates
+ * of {@code char} values, the first from the high-surrogates
* range, (\uD800-\uDBFF), the second from the
* low-surrogates range (\uDC00-\uDFFF).
*
- *
A char value, therefore, represents Basic
+ *
A {@code char} value, therefore, represents Basic
* Multilingual Plane (BMP) code points, including the surrogate
* code points, or code units of the UTF-16 encoding. An
- * int value represents all Unicode code points,
+ * {@code int} value represents all Unicode code points,
* including supplementary code points. The lower (least significant)
- * 21 bits of int are used to represent Unicode code
+ * 21 bits of {@code int} are used to represent Unicode code
* points and the upper (most significant) 11 bits must be zero.
* Unless otherwise specified, the behavior with respect to
- * supplementary characters and surrogate char values is
+ * supplementary characters and surrogate {@code char} values is
* as follows:
*
*
char value cannot support
- * supplementary characters. They treat char values from the
+ * Character.isLetter('\uD840') returns false, even though
+ * {@code Character.isLetter('\u005CuD840')} returns {@code false}, even though
* this specific value if followed by any low-surrogate value in a string
* would represent a letter.
*
- * int value support all
+ * Character.isLetter(0x2F81A) returns
- * true because the code point value represents a letter
+ * example, {@code Character.isLetter(0x2F81A)} returns
+ * {@code true} because the code point value represents a letter
* (a CJK ideograph).
* In the Java SE API documentation, Unicode code point is
* used for character values in the range between U+0000 and U+10FFFF,
* and Unicode code unit is used for 16-bit
- * Note: This method cannot handle
@@ -2969,9 +2967,9 @@ class Character implements java.io.Serializable, Comparable
*
- * @param scriptName A
* A character is lowercase if its general category type, provided
- * by
* The following are examples of lowercase characters:
*
* A character is lowercase if its general category type, provided
* by {@link Character#getType getType(codePoint)}, is
- *
* The following are examples of lowercase characters:
* Many other Unicode characters are lowercase too.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return
* A character is uppercase if its general category type, provided by
- *
* The following are examples of uppercase characters:
*
* A character is uppercase if its general category type, provided by
- * {@link Character#getType(int) getType(codePoint)}, is
* The following are examples of uppercase characters:
* Many other Unicode characters are uppercase too.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return
* A character is a titlecase character if its general
- * category type, provided by
* Some characters look like pairs of Latin letters. For example, there
* is an uppercase letter that looks like "LJ" and has a corresponding
@@ -5336,12 +5334,12 @@ class Character implements java.io.Serializable, Comparable
* These are some of the Unicode characters for which this method returns
- * Many other Unicode characters are titlecase too.
*
@@ -5351,8 +5349,8 @@ class Character implements java.io.Serializable, Comparable
* A character is a titlecase character if its general
* category type, provided by {@link Character#getType(int) getType(codePoint)},
- * is
* Some characters look like pairs of Latin letters. For example, there
* is an uppercase letter that looks like "LJ" and has a corresponding
@@ -5377,18 +5375,18 @@ class Character implements java.io.Serializable, Comparable
* These are some of the Unicode characters for which this method returns
- * Many other Unicode characters are titlecase too.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return
* A character is a digit if its general category type, provided
- * by
* Some Unicode character ranges that contain digits:
*
* A character is a digit if its general category type, provided
* by {@link Character#getType(int) getType(codePoint)}, is
- *
* Some Unicode character ranges that contain digits:
* char values that are code units of the UTF-16
+ * {@code char} values that are code units of the UTF-16
* encoding. For more information on Unicode terminology, refer to the
* Unicode Glossary.
*
@@ -125,9 +125,8 @@ class Character implements java.io.Serializable, Comparabledigit method, the forDigit
- * method, and the toString method of class
- * Integer.
+ * {@code digit} method, the {@code forDigit} method, and the
+ * {@code toString} method of class {@code Integer}.
*
* @see Character#digit(char, int)
* @see Character#forDigit(int, int)
@@ -140,9 +139,8 @@ class Character implements java.io.Serializable, Comparabledigit method, the forDigit
- * method, and the toString method of class
- * Integer.
+ * {@code digit} method, the {@code forDigit} method, and the
+ * {@code toString} method of class {@code Integer}.
*
* @see Character#digit(char, int)
* @see Character#forDigit(int, int)
@@ -153,7 +151,7 @@ class Character implements java.io.Serializable, Comparablechar, '\u0000'.
+ * {@code char}, {@code '\u005Cu0000'}.
*
* @since 1.0.2
*/
@@ -161,15 +159,15 @@ class Character implements java.io.Serializable, Comparablechar, '\uFFFF'.
+ * {@code char}, {@code '\u005CuFFFF'}.
*
* @since 1.0.2
*/
public static final char MAX_VALUE = '\uFFFF';
/**
- * The Class instance representing the primitive type
- * char.
+ * The {@code Class} instance representing the primitive type
+ * {@code char}.
*
* @since 1.1
*/
@@ -371,7 +369,7 @@ class Character implements java.io.Serializable, Comparablechar
+ * Undefined bidirectional character type. Undefined {@code char}
* values have undefined directionality in the Unicode specification.
* @since 1.4
*/
@@ -495,7 +493,7 @@ class Character implements java.io.Serializable, Comparable'\uD800'.
+ * in the UTF-16 encoding, constant {@code '\u005CuD800'}.
* A high-surrogate is also known as a leading-surrogate.
*
* @since 1.5
@@ -506,7 +504,7 @@ class Character implements java.io.Serializable, Comparable'\uDBFF'.
+ * in the UTF-16 encoding, constant {@code '\u005CuDBFF'}.
* A high-surrogate is also known as a leading-surrogate.
*
* @since 1.5
@@ -517,7 +515,7 @@ class Character implements java.io.Serializable, Comparable'\uDC00'.
+ * in the UTF-16 encoding, constant {@code '\u005CuDC00'}.
* A low-surrogate is also known as a trailing-surrogate.
*
* @since 1.5
@@ -528,7 +526,7 @@ class Character implements java.io.Serializable, Comparable'\uDFFF'.
+ * in the UTF-16 encoding, constant {@code '\u005CuDFFF'}.
* A low-surrogate is also known as a trailing-surrogate.
*
* @since 1.5
@@ -537,7 +535,7 @@ class Character implements java.io.Serializable, Comparable'\uD800'.
+ * UTF-16 encoding, constant {@code '\u005CuD800'}.
*
* @since 1.5
*/
@@ -545,7 +543,7 @@ class Character implements java.io.Serializable, Comparable'\uDFFF'.
+ * UTF-16 encoding, constant {@code '\u005CuDFFF'}.
*
* @since 1.5
*/
@@ -582,7 +580,7 @@ class Character implements java.io.Serializable, ComparableCharacter class is {@link Character.UnicodeBlock}.
+ * {@code Character} class is {@link Character.UnicodeBlock}.
* Other portions of the Java API may define other subsets for their
* own purposes.
*
@@ -593,10 +591,10 @@ class Character implements java.io.Serializable, ComparableSubset instance.
+ * Constructs a new {@code Subset} instance.
*
* @param name The name of this subset
- * @exception NullPointerException if name is null
+ * @exception NullPointerException if name is {@code null}
*/
protected Subset(String name) {
if (name == null) {
@@ -606,10 +604,10 @@ class Character implements java.io.Serializable, ComparableSubset objects for equality.
- * This method returns true if and only if
- * this and the argument refer to the same
- * object; since this method is final, this
+ * Compares two {@code Subset} objects for equality.
+ * This method returns {@code true} if and only if
+ * {@code this} and the argument refer to the same
+ * object; since this method is {@code final}, this
* guarantee holds for all subclasses.
*/
public final boolean equals(Object obj) {
@@ -618,9 +616,9 @@ class Character implements java.io.Serializable, Comparable{@link Object#hashCode} method. This method
- * is final in order to ensure that the
- * equals and hashCode methods will
+ * {@link Object#hashCode} method. This method
+ * is {@code final} in order to ensure that the
+ * {@code equals} and {@code hashCode} methods will
* be consistent in all subclasses.
*/
public final int hashCode() {
@@ -2960,7 +2958,7 @@ class Character implements java.io.Serializable, Comparablenull if the character is not a
+ * given character, or {@code null} if the character is not a
* member of a defined block.
*
* UnicodeBlock instance representing the
+ * @return The {@code UnicodeBlock} instance representing the
* Unicode block of which this character is a member, or
- * null if the character is not a member of any
+ * {@code null} if the character is not a member of any
* Unicode block
*/
public static UnicodeBlock of(char c) {
@@ -2981,16 +2979,16 @@ class Character implements java.io.Serializable, Comparablenull if the character is not a member of a
+ * {@code null} if the character is not a member of a
* defined block.
*
* @param codePoint the character (Unicode code point) in question.
- * @return The UnicodeBlock instance representing the
+ * @return The {@code UnicodeBlock} instance representing the
* Unicode block of which this character is a member, or
- * null if the character is not a member of any
+ * {@code null} if the character is not a member of any
* Unicode block
* @exception IllegalArgumentException if the specified
- * codePoint is an invalid Unicode code point.
+ * {@code codePoint} is an invalid Unicode code point.
* @see Character#isValidCodePoint(int)
* @since 1.5
*/
@@ -3044,12 +3042,12 @@ class Character implements java.io.Serializable, ComparableUnicodeBlock name.
- * @return The UnicodeBlock instance identified
- * by blockName
- * @throws IllegalArgumentException if blockName is an
+ * @param blockName A {@code UnicodeBlock} name.
+ * @return The {@code UnicodeBlock} instance identified
+ * by {@code blockName}
+ * @throws IllegalArgumentException if {@code blockName} is an
* invalid name
- * @throws NullPointerException if blockName is null
+ * @throws NullPointerException if {@code blockName} is null
* @since 1.5
*/
public static final UnicodeBlock forName(String blockName) {
@@ -4280,11 +4278,11 @@ class Character implements java.io.Serializable, ComparableUnicodeScript constant representing the
+ * @return The {@code UnicodeScript} constant representing the
* Unicode script of which this character is assigned to.
*
* @exception IllegalArgumentException if the specified
- * codePoint is an invalid Unicode code point.
+ * {@code codePoint} is an invalid Unicode code point.
* @see Character#isValidCodePoint(int)
*
*/
@@ -4315,12 +4313,12 @@ class Character implements java.io.Serializable, ComparableUnicodeScript name.
- * @return The UnicodeScript constant identified
- * by scriptName
- * @throws IllegalArgumentException if scriptName is an
+ * @param scriptName A {@code UnicodeScript} name.
+ * @return The {@code UnicodeScript} constant identified
+ * by {@code scriptName}
+ * @throws IllegalArgumentException if {@code scriptName} is an
* invalid name
- * @throws NullPointerException if scriptName is null
+ * @throws NullPointerException if {@code scriptName} is null
*/
public static final UnicodeScript forName(String scriptName) {
scriptName = scriptName.toUpperCase(Locale.ENGLISH);
@@ -4333,7 +4331,7 @@ class Character implements java.io.Serializable, ComparableCharacter.
+ * The value of the {@code Character}.
*
* @serial
*/
@@ -4343,11 +4341,11 @@ class Character implements java.io.Serializable, ComparableCharacter object that
- * represents the specified char value.
+ * Constructs a newly allocated {@code Character} object that
+ * represents the specified {@code char} value.
*
* @param value the value to be represented by the
- * Character object.
+ * {@code Character} object.
*/
public Character(char value) {
this.value = value;
@@ -4374,7 +4372,7 @@ class Character implements java.io.Serializable, ComparableCharacter object.
- * @return the primitive char value represented by
+ * Returns the value of this {@code Character} object.
+ * @return the primitive {@code char} value represented by
* this object.
*/
public char charValue() {
@@ -4409,13 +4407,13 @@ class Character implements java.io.Serializable, Comparabletrue if and only if the argument is not
- * null and is a Character object that
- * represents the same char value as this object.
+ * The result is {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Character} object that
+ * represents the same {@code char} value as this object.
*
* @param obj the object to compare with.
- * @return true if the objects are the same;
- * false otherwise.
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (obj instanceof Character) {
@@ -4425,11 +4423,11 @@ class Character implements java.io.Serializable, ComparableString object representing this
- * Character's value. The result is a string of
+ * Returns a {@code String} object representing this
+ * {@code Character}'s value. The result is a string of
* length 1 whose sole component is the primitive
- * char value represented by this
- * Character object.
+ * {@code char} value represented by this
+ * {@code Character} object.
*
* @return a string representation of this object.
*/
@@ -4439,12 +4437,12 @@ class Character implements java.io.Serializable, ComparableString object representing the
- * specified char. The result is a string of length
- * 1 consisting solely of the specified char.
+ * Returns a {@code String} object representing the
+ * specified {@code char}. The result is a string of length
+ * 1 consisting solely of the specified {@code char}.
*
- * @param c the char to be converted
- * @return the string representation of the specified char
+ * @param c the {@code char} to be converted
+ * @return the string representation of the specified {@code char}
* @since 1.4
*/
public static String toString(char c) {
@@ -4578,7 +4576,7 @@ class Character implements java.io.Serializable, Comparablechar
+ * Determines whether the specified pair of {@code char}
* values is a valid
*
* Unicode surrogate pair.
@@ -4590,9 +4588,9 @@ class Character implements java.io.Serializable, Comparabletrue if the specified high and
+ * @return {@code true} if the specified high and
* low-surrogate code values represent a valid surrogate pair;
- * false otherwise.
+ * {@code false} otherwise.
* @since 1.5
*/
public static boolean isSurrogatePair(char high, char low) {
@@ -4600,7 +4598,7 @@ class Character implements java.io.Serializable, Comparablechar values needed to
+ * Determines the number of {@code char} values needed to
* represent the specified character (Unicode code point). If the
* specified character is equal to or greater than 0x10000, then
* the method returns 2. Otherwise, the method returns 1.
@@ -4643,23 +4641,23 @@ class Character implements java.io.Serializable, ComparableCharSequence. If the char value at
- * the given index in the CharSequence is in the
+ * {@code CharSequence}. If the {@code char} value at
+ * the given index in the {@code CharSequence} is in the
* high-surrogate range, the following index is less than the
- * length of the CharSequence, and the
- * char value at the following index is in the
+ * length of the {@code CharSequence}, and the
+ * {@code char} value at the following index is in the
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char value at the given index is returned.
+ * the {@code char} value at the given index is returned.
*
- * @param seq a sequence of char values (Unicode code
+ * @param seq a sequence of {@code char} values (Unicode code
* units)
- * @param index the index to the char values (Unicode
- * code units) in seq to be converted
+ * @param index the index to the {@code char} values (Unicode
+ * code units) in {@code seq} to be converted
* @return the Unicode code point at the given index
- * @exception NullPointerException if seq is null.
+ * @exception NullPointerException if {@code seq} is null.
* @exception IndexOutOfBoundsException if the value
- * index is negative or not less than
+ * {@code index} is negative or not less than
* {@link CharSequence#length() seq.length()}.
* @since 1.5
*/
@@ -4678,23 +4676,23 @@ class Character implements java.io.Serializable, Comparablechar array. If the char value at
- * the given index in the char array is in the
+ * {@code char} array. If the {@code char} value at
+ * the given index in the {@code char} array is in the
* high-surrogate range, the following index is less than the
- * length of the char array, and the
- * char value at the following index is in the
+ * length of the {@code char} array, and the
+ * {@code char} value at the following index is in the
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char value at the given index is returned.
+ * the {@code char} value at the given index is returned.
*
- * @param a the char array
- * @param index the index to the char values (Unicode
- * code units) in the char array to be converted
+ * @param a the {@code char} array
+ * @param index the index to the {@code char} values (Unicode
+ * code units) in the {@code char} array to be converted
* @return the Unicode code point at the given index
- * @exception NullPointerException if a is null.
+ * @exception NullPointerException if {@code a} is null.
* @exception IndexOutOfBoundsException if the value
- * index is negative or not less than
- * the length of the char array.
+ * {@code index} is negative or not less than
+ * the length of the {@code char} array.
* @since 1.5
*/
public static int codePointAt(char[] a, int index) {
@@ -4703,27 +4701,27 @@ class Character implements java.io.Serializable, Comparablechar array, where only array elements with
- * index less than limit can be used. If
- * the char value at the given index in the
- * char array is in the high-surrogate range, the
- * following index is less than the limit, and the
- * char value at the following index is in the
+ * {@code char} array, where only array elements with
+ * {@code index} less than {@code limit} can be used. If
+ * the {@code char} value at the given index in the
+ * {@code char} array is in the high-surrogate range, the
+ * following index is less than the {@code limit}, and the
+ * {@code char} value at the following index is in the
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char value at the given index is returned.
+ * the {@code char} value at the given index is returned.
*
- * @param a the char array
- * @param index the index to the char values (Unicode
- * code units) in the char array to be converted
- * @param limit the index after the last array element that can be used in the
- * char array
+ * @param a the {@code char} array
+ * @param index the index to the {@code char} values (Unicode
+ * code units) in the {@code char} array to be converted
+ * @param limit the index after the last array element that
+ * can be used in the {@code char} array
* @return the Unicode code point at the given index
- * @exception NullPointerException if a is null.
- * @exception IndexOutOfBoundsException if the index
- * argument is negative or not less than the limit
- * argument, or if the limit argument is negative or
- * greater than the length of the char array.
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
+ * argument is negative or not less than the {@code limit}
+ * argument, or if the {@code limit} argument is negative or
+ * greater than the length of the {@code char} array.
* @since 1.5
*/
public static int codePointAt(char[] a, int index, int limit) {
@@ -4749,21 +4747,21 @@ class Character implements java.io.Serializable, ComparableCharSequence. If the char value at
- * (index - 1) in the CharSequence is in
- * the low-surrogate range, (index - 2) is not
- * negative, and the char value at (index -
- * 2) in the CharSequence is in the
+ * {@code CharSequence}. If the {@code char} value at
+ * {@code (index - 1)} in the {@code CharSequence} is in
+ * the low-surrogate range, {@code (index - 2)} is not
+ * negative, and the {@code char} value at {@code (index - 2)}
+ * in the {@code CharSequence} is in the
* high-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char value at (index - 1) is
+ * the {@code char} value at {@code (index - 1)} is
* returned.
*
- * @param seq the CharSequence instance
+ * @param seq the {@code CharSequence} instance
* @param index the index following the code point that should be returned
* @return the Unicode code point value before the given index.
- * @exception NullPointerException if seq is null.
- * @exception IndexOutOfBoundsException if the index
+ * @exception NullPointerException if {@code seq} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is less than 1 or greater than {@link
* CharSequence#length() seq.length()}.
* @since 1.5
@@ -4783,23 +4781,23 @@ class Character implements java.io.Serializable, Comparablechar array. If the char value at
- * (index - 1) in the char array is in
- * the low-surrogate range, (index - 2) is not
- * negative, and the char value at (index -
- * 2) in the char array is in the
+ * {@code char} array. If the {@code char} value at
+ * {@code (index - 1)} in the {@code char} array is in
+ * the low-surrogate range, {@code (index - 2)} is not
+ * negative, and the {@code char} value at {@code (index - 2)}
+ * in the {@code char} array is in the
* high-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char value at (index - 1) is
+ * the {@code char} value at {@code (index - 1)} is
* returned.
*
- * @param a the char array
+ * @param a the {@code char} array
* @param index the index following the code point that should be returned
* @return the Unicode code point value before the given index.
- * @exception NullPointerException if a is null.
- * @exception IndexOutOfBoundsException if the index
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
* argument is less than 1 or greater than the length of the
- * char array
+ * {@code char} array
* @since 1.5
*/
public static int codePointBefore(char[] a, int index) {
@@ -4808,29 +4806,29 @@ class Character implements java.io.Serializable, Comparablechar array, where only array elements with
- * index greater than or equal to start
- * can be used. If the char value at (index -
- * 1) in the char array is in the
- * low-surrogate range, (index - 2) is not less than
- * start, and the char value at
- * (index - 2) in the char array is in
+ * {@code char} array, where only array elements with
+ * {@code index} greater than or equal to {@code start}
+ * can be used. If the {@code char} value at {@code (index - 1)}
+ * in the {@code char} array is in the
+ * low-surrogate range, {@code (index - 2)} is not less than
+ * {@code start}, and the {@code char} value at
+ * {@code (index - 2)} in the {@code char} array is in
* the high-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
- * the char value at (index - 1) is
+ * the {@code char} value at {@code (index - 1)} is
* returned.
*
- * @param a the char array
+ * @param a the {@code char} array
* @param index the index following the code point that should be returned
* @param start the index of the first array element in the
- * char array
+ * {@code char} array
* @return the Unicode code point value before the given index.
- * @exception NullPointerException if a is null.
- * @exception IndexOutOfBoundsException if the index
- * argument is not greater than the start argument or
- * is greater than the length of the char array, or
- * if the start argument is negative or not less than
- * the length of the char array.
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
+ * argument is not greater than the {@code start} argument or
+ * is greater than the length of the {@code char} array, or
+ * if the {@code start} argument is negative or not less than
+ * the length of the {@code char} array.
* @since 1.5
*/
public static int codePointBefore(char[] a, int index, int start) {
@@ -4915,31 +4913,31 @@ class Character implements java.io.Serializable, Comparabledst[dstIndex], and 1 is returned. If the
+ * stored in {@code dst[dstIndex]}, and 1 is returned. If the
* specified code point is a supplementary character, its
- * surrogate values are stored in dst[dstIndex]
- * (high-surrogate) and dst[dstIndex+1]
+ * surrogate values are stored in {@code dst[dstIndex]}
+ * (high-surrogate) and {@code dst[dstIndex+1]}
* (low-surrogate), and 2 is returned.
*
* @param codePoint the character (Unicode code point) to be converted.
- * @param dst an array of char in which the
- * codePoint's UTF-16 value is stored.
- * @param dstIndex the start index into the dst
+ * @param dst an array of {@code char} in which the
+ * {@code codePoint}'s UTF-16 value is stored.
+ * @param dstIndex the start index into the {@code dst}
* array where the converted value is stored.
* @return 1 if the code point is a BMP code point, 2 if the
* code point is a supplementary code point.
* @exception IllegalArgumentException if the specified
- * codePoint is not a valid Unicode code point.
- * @exception NullPointerException if the specified dst is null.
- * @exception IndexOutOfBoundsException if dstIndex
- * is negative or not less than dst.length, or if
- * dst at dstIndex doesn't have enough
- * array element(s) to store the resulting char
- * value(s). (If dstIndex is equal to
- * dst.length-1 and the specified
- * codePoint is a supplementary character, the
+ * {@code codePoint} is not a valid Unicode code point.
+ * @exception NullPointerException if the specified {@code dst} is null.
+ * @exception IndexOutOfBoundsException if {@code dstIndex}
+ * is negative or not less than {@code dst.length}, or if
+ * {@code dst} at {@code dstIndex} doesn't have enough
+ * array element(s) to store the resulting {@code char}
+ * value(s). (If {@code dstIndex} is equal to
+ * {@code dst.length-1} and the specified
+ * {@code codePoint} is a supplementary character, the
* high-surrogate value is not stored in
- * dst[dstIndex].)
+ * {@code dst[dstIndex]}.)
* @since 1.5
*/
public static int toChars(int codePoint, char[] dst, int dstIndex) {
@@ -4956,18 +4954,18 @@ class Character implements java.io.Serializable, Comparablechar array. If
+ * UTF-16 representation stored in a {@code char} array. If
* the specified code point is a BMP (Basic Multilingual Plane or
- * Plane 0) value, the resulting char array has
- * the same value as codePoint. If the specified code
+ * Plane 0) value, the resulting {@code char} array has
+ * the same value as {@code codePoint}. If the specified code
* point is a supplementary code point, the resulting
- * char array has the corresponding surrogate pair.
+ * {@code char} array has the corresponding surrogate pair.
*
* @param codePoint a Unicode code point
- * @return a char array having
- * codePoint's UTF-16 representation.
+ * @return a {@code char} array having
+ * {@code codePoint}'s UTF-16 representation.
* @exception IllegalArgumentException if the specified
- * codePoint is not a valid Unicode code point.
+ * {@code codePoint} is not a valid Unicode code point.
* @since 1.5
*/
public static char[] toChars(int codePoint) {
@@ -4991,24 +4989,24 @@ class Character implements java.io.Serializable, ComparablebeginIndex and extends to the
- * char at index endIndex - 1. Thus the
- * length (in chars) of the text range is
- * endIndex-beginIndex. Unpaired surrogates within
+ * specified {@code beginIndex} and extends to the
+ * {@code char} at index {@code endIndex - 1}. Thus the
+ * length (in {@code char}s) of the text range is
+ * {@code endIndex-beginIndex}. Unpaired surrogates within
* the text range count as one code point each.
*
* @param seq the char sequence
- * @param beginIndex the index to the first char of
+ * @param beginIndex the index to the first {@code char} of
* the text range.
- * @param endIndex the index after the last char of
+ * @param endIndex the index after the last {@code char} of
* the text range.
* @return the number of Unicode code points in the specified text
* range
- * @exception NullPointerException if seq is null.
+ * @exception NullPointerException if {@code seq} is null.
* @exception IndexOutOfBoundsException if the
- * beginIndex is negative, or endIndex
+ * {@code beginIndex} is negative, or {@code endIndex}
* is larger than the length of the given sequence, or
- * beginIndex is larger than endIndex.
+ * {@code beginIndex} is larger than {@code endIndex}.
* @since 1.5
*/
public static int codePointCount(CharSequence seq, int beginIndex, int endIndex) {
@@ -5029,21 +5027,21 @@ class Character implements java.io.Serializable, Comparablechar array argument. The offset
- * argument is the index of the first char of the
- * subarray and the count argument specifies the
- * length of the subarray in chars. Unpaired
+ * {@code char} array argument. The {@code offset}
+ * argument is the index of the first {@code char} of the
+ * subarray and the {@code count} argument specifies the
+ * length of the subarray in {@code char}s. Unpaired
* surrogates within the subarray count as one code point each.
*
- * @param a the char array
- * @param offset the index of the first char in the
- * given char array
- * @param count the length of the subarray in chars
+ * @param a the {@code char} array
+ * @param offset the index of the first {@code char} in the
+ * given {@code char} array
+ * @param count the length of the subarray in {@code char}s
* @return the number of Unicode code points in the specified subarray
- * @exception NullPointerException if a is null.
- * @exception IndexOutOfBoundsException if offset or
- * count is negative, or if offset +
- * count is larger than the length of the given array.
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if {@code offset} or
+ * {@code count} is negative, or if {@code offset +
+ * count} is larger than the length of the given array.
* @since 1.5
*/
public static int codePointCount(char[] a, int offset, int count) {
@@ -5068,24 +5066,24 @@ class Character implements java.io.Serializable, Comparableindex by codePointOffset
+ * from the given {@code index} by {@code codePointOffset}
* code points. Unpaired surrogates within the text range given by
- * index and codePointOffset count as
+ * {@code index} and {@code codePointOffset} count as
* one code point each.
*
* @param seq the char sequence
* @param index the index to be offset
* @param codePointOffset the offset in code points
* @return the index within the char sequence
- * @exception NullPointerException if seq is null.
- * @exception IndexOutOfBoundsException if index
+ * @exception NullPointerException if {@code seq} is null.
+ * @exception IndexOutOfBoundsException if {@code index}
* is negative or larger then the length of the char sequence,
- * or if codePointOffset is positive and the
- * subsequence starting with index has fewer than
- * codePointOffset code points, or if
- * codePointOffset is negative and the subsequence
- * before index has fewer than the absolute value
- * of codePointOffset code points.
+ * or if {@code codePointOffset} is positive and the
+ * subsequence starting with {@code index} has fewer than
+ * {@code codePointOffset} code points, or if
+ * {@code codePointOffset} is negative and the subsequence
+ * before {@code index} has fewer than the absolute value
+ * of {@code codePointOffset} code points.
* @since 1.5
*/
public static int offsetByCodePoints(CharSequence seq, int index,
@@ -5123,36 +5121,36 @@ class Character implements java.io.Serializable, Comparablechar subarray
- * that is offset from the given index by
- * codePointOffset code points. The
- * start and count arguments specify a
- * subarray of the char array. Unpaired surrogates
- * within the text range given by index and
- * codePointOffset count as one code point each.
+ * Returns the index within the given {@code char} subarray
+ * that is offset from the given {@code index} by
+ * {@code codePointOffset} code points. The
+ * {@code start} and {@code count} arguments specify a
+ * subarray of the {@code char} array. Unpaired surrogates
+ * within the text range given by {@code index} and
+ * {@code codePointOffset} count as one code point each.
*
- * @param a the char array
- * @param start the index of the first char of the
+ * @param a the {@code char} array
+ * @param start the index of the first {@code char} of the
* subarray
- * @param count the length of the subarray in chars
+ * @param count the length of the subarray in {@code char}s
* @param index the index to be offset
* @param codePointOffset the offset in code points
* @return the index within the subarray
- * @exception NullPointerException if a is null.
+ * @exception NullPointerException if {@code a} is null.
* @exception IndexOutOfBoundsException
- * if start or count is negative,
- * or if start + count is larger than the length of
+ * if {@code start} or {@code count} is negative,
+ * or if {@code start + count} is larger than the length of
* the given array,
- * or if index is less than start or
- * larger then start + count,
- * or if codePointOffset is positive and the text range
- * starting with index and ending with start
- * + count - 1 has fewer than codePointOffset code
+ * or if {@code index} is less than {@code start} or
+ * larger then {@code start + count},
+ * or if {@code codePointOffset} is positive and the text range
+ * starting with {@code index} and ending with {@code start + count - 1}
+ * has fewer than {@code codePointOffset} code
* points,
- * or if codePointOffset is negative and the text range
- * starting with start and ending with index
- * - 1 has fewer than the absolute value of
- * codePointOffset code points.
+ * or if {@code codePointOffset} is negative and the text range
+ * starting with {@code start} and ending with {@code index - 1}
+ * has fewer than the absolute value of
+ * {@code codePointOffset} code points.
* @since 1.5
*/
public static int offsetByCodePoints(char[] a, int start, int count,
@@ -5198,8 +5196,8 @@ class Character implements java.io.Serializable, ComparableCharacter.getType(ch), is
- * LOWERCASE_LETTER.
+ * by {@code Character.getType(ch)}, is
+ * {@code LOWERCASE_LETTER}.
*
@@ -5217,8 +5215,8 @@ class Character implements java.io.Serializable, Comparable
true if the character is lowercase;
- * false otherwise.
+ * @return {@code true} if the character is lowercase;
+ * {@code false} otherwise.
* @see Character#isLowerCase(char)
* @see Character#isTitleCase(char)
* @see Character#toLowerCase(char)
@@ -5234,7 +5232,7 @@ class Character implements java.io.Serializable, ComparableLOWERCASE_LETTER.
+ * {@code LOWERCASE_LETTER}.
*
@@ -5247,8 +5245,8 @@ class Character implements java.io.Serializable, Comparable
true if the character is lowercase;
- * false otherwise.
+ * @return {@code true} if the character is lowercase;
+ * {@code false} otherwise.
* @see Character#isLowerCase(int)
* @see Character#isTitleCase(int)
* @see Character#toLowerCase(int)
@@ -5263,7 +5261,7 @@ class Character implements java.io.Serializable, ComparableCharacter.getType(ch), is UPPERCASE_LETTER.
+ * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
*
@@ -5281,8 +5279,8 @@ class Character implements java.io.Serializable, Comparable
true if the character is uppercase;
- * false otherwise.
+ * @return {@code true} if the character is uppercase;
+ * {@code false} otherwise.
* @see Character#isLowerCase(char)
* @see Character#isTitleCase(char)
* @see Character#toUpperCase(char)
@@ -5297,7 +5295,7 @@ class Character implements java.io.Serializable, ComparableUPPERCASE_LETTER.
+ * {@link Character#getType(int) getType(codePoint)}, is {@code UPPERCASE_LETTER}.
*
@@ -5310,8 +5308,8 @@ class Character implements java.io.Serializable, Comparable
true if the character is uppercase;
- * false otherwise.
+ * @return {@code true} if the character is uppercase;
+ * {@code false} otherwise.
* @see Character#isLowerCase(int)
* @see Character#isTitleCase(int)
* @see Character#toUpperCase(int)
@@ -5326,8 +5324,8 @@ class Character implements java.io.Serializable, ComparableCharacter.getType(ch),
- * is TITLECASE_LETTER.
+ * category type, provided by {@code Character.getType(ch)},
+ * is {@code TITLECASE_LETTER}.
* true:
+ * {@code true}:
*
- *
* LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
- * LATIN CAPITAL LETTER L WITH SMALL LETTER J
- * LATIN CAPITAL LETTER N WITH SMALL LETTER J
- * LATIN CAPITAL LETTER D WITH SMALL LETTER Z
+ * true if the character is titlecase;
- * false otherwise.
+ * @return {@code true} if the character is titlecase;
+ * {@code false} otherwise.
* @see Character#isLowerCase(char)
* @see Character#isUpperCase(char)
* @see Character#toTitleCase(char)
@@ -5368,7 +5366,7 @@ class Character implements java.io.Serializable, ComparableTITLECASE_LETTER.
+ * is {@code TITLECASE_LETTER}.
* true:
+ * {@code true}:
*
- *
* LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
- * LATIN CAPITAL LETTER L WITH SMALL LETTER J
- * LATIN CAPITAL LETTER N WITH SMALL LETTER J
- * LATIN CAPITAL LETTER D WITH SMALL LETTER Z
+ * true if the character is titlecase;
- * false otherwise.
+ * @return {@code true} if the character is titlecase;
+ * {@code false} otherwise.
* @see Character#isLowerCase(int)
* @see Character#isUpperCase(int)
* @see Character#toTitleCase(int)
@@ -5403,20 +5401,20 @@ class Character implements java.io.Serializable, ComparableCharacter.getType(ch), is
- * DECIMAL_DIGIT_NUMBER.
+ * by {@code Character.getType(ch)}, is
+ * {@code DECIMAL_DIGIT_NUMBER}.
*
- *
*
@@ -5428,8 +5426,8 @@ class Character implements java.io.Serializable, Comparable'\u0030' through '\u0039',
- * ISO-LATIN-1 digits ('0' through '9')
- * '\u0660' through '\u0669',
+ * '\u06F0' through '\u06F9',
+ * '\u0966' through '\u096F',
+ * '\uFF10' through '\uFF19',
+ * true if the character is a digit;
- * false otherwise.
+ * @return {@code true} if the character is a digit;
+ * {@code false} otherwise.
* @see Character#digit(char, int)
* @see Character#forDigit(int, int)
* @see Character#getType(char)
@@ -5443,27 +5441,27 @@ class Character implements java.io.Serializable, ComparableDECIMAL_DIGIT_NUMBER.
+ * {@code DECIMAL_DIGIT_NUMBER}.
*
- *
*
* Many other character ranges contain digits as well.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return '\u0030' through '\u0039',
- * ISO-LATIN-1 digits ('0' through '9')
- * '\u0660' through '\u0669',
+ * '\u06F0' through '\u06F9',
+ * '\u0966' through '\u096F',
+ * '\uFF10' through '\uFF19',
+ * true if the character is a digit;
- * false otherwise.
+ * @return {@code true} if the character is a digit;
+ * {@code false} otherwise.
* @see Character#forDigit(int, int)
* @see Character#getType(int)
* @since 1.5
@@ -5487,8 +5485,8 @@ class Character implements java.io.Serializable, Comparabletrue if the character has a defined meaning
- * in Unicode; false otherwise.
+ * @return {@code true} if the character has a defined meaning
+ * in Unicode; {@code false} otherwise.
* @see Character#isDigit(char)
* @see Character#isLetter(char)
* @see Character#isLetterOrDigit(char)
@@ -5511,8 +5509,8 @@ class Character implements java.io.Serializable, Comparable
true if the character has a defined meaning
- * in Unicode; false otherwise.
+ * @return {@code true} if the character has a defined meaning
+ * in Unicode; {@code false} otherwise.
* @see Character#isDigit(int)
* @see Character#isLetter(int)
* @see Character#isLetterOrDigit(int)
@@ -5529,14 +5527,14 @@ class Character implements java.io.Serializable, Comparable
* A character is considered to be a letter if its general
- * category type, provided by Character.getType(ch),
+ * category type, provided by {@code Character.getType(ch)},
* is any of the following:
*
UPPERCASE_LETTER
- * LOWERCASE_LETTER
- * TITLECASE_LETTER
- * MODIFIER_LETTER
- * OTHER_LETTER
+ * true if the character is a letter;
- * false otherwise.
+ * @return {@code true} if the character is a letter;
+ * {@code false} otherwise.
* @see Character#isDigit(char)
* @see Character#isJavaIdentifierStart(char)
* @see Character#isJavaLetter(char)
@@ -5571,19 +5569,19 @@ class Character implements java.io.Serializable, ComparableUPPERCASE_LETTER
- * LOWERCASE_LETTER
- * TITLECASE_LETTER
- * MODIFIER_LETTER
- * OTHER_LETTER
+ * true if the character is a letter;
- * false otherwise.
+ * @return {@code true} if the character is a letter;
+ * {@code false} otherwise.
* @see Character#isDigit(int)
* @see Character#isJavaIdentifierStart(int)
* @see Character#isLetterOrDigit(int)
@@ -5606,9 +5604,9 @@ class Character implements java.io.Serializable, Comparable
* A character is considered to be a letter or digit if either
- * Character.isLetter(char ch) or
- * Character.isDigit(char ch) returns
- * true for the character.
+ * {@code Character.isLetter(char ch)} or
+ * {@code Character.isDigit(char ch)} returns
+ * {@code true} for the character.
*
*
Note: This method cannot handle supplementary characters. To support
@@ -5616,8 +5614,8 @@ class Character implements java.io.Serializable, Comparable Note: This method cannot handle {
* the {@link #isJavaIdentifierStart(int)} method.
*
* @param ch the character to be tested.
- * @return Note: This method cannot handle {
* the {@link #isJavaIdentifierPart(int)} method.
*
* @param ch the character to be tested.
- * @return Note: This method cannot handle {
* the {@link #isUnicodeIdentifierStart(int)} method.
*
* @param ch the character to be tested.
- * @return Note: This method cannot handle {
* the {@link #isUnicodeIdentifierPart(int)} method.
*
* @param ch the character to be tested.
- * @return
* Note that
- * In general, {@link String#toLowerCase()} should be used to map
- * characters to lowercase. Note: This method cannot handle supplementary characters. To support
@@ -6072,16 +6070,16 @@ class Character implements java.io.Serializable, Comparable Note that
- * In general, {@link String#toLowerCase()} should be used to map
- * characters to lowercase.
* Note that
- * In general, {@link String#toUpperCase()} should be used to map
- * characters to uppercase. Note: This method cannot handle supplementary characters. To support
@@ -6132,16 +6130,16 @@ class Character implements java.io.Serializable, Comparable Note that
- * In general, {@link String#toUpperCase()} should be used to map
- * characters to uppercase.
* Note that
- * Note: This method cannot handle {
* returned.
*
* Note that
- *
- * If the radix is not in the range If the radix is not in the range If the radix is not in the range {@code MIN_RADIX} ≤
+ * {@code radix} ≤ {@code MAX_RADIX} or if the
* character is not a valid digit in the specified
- * radix,
- * The letters A-Z in their uppercase (
* If the character does not have a numeric value, then -1 is returned.
@@ -6321,7 +6345,7 @@ class Character implements java.io.Serializable, Comparable
- * The letters A-Z in their uppercase (
* If the character does not have a numeric value, then -1 is returned.
@@ -6354,7 +6378,7 @@ class Character implements java.io.Serializable, Comparable Note: This method cannot handle {
* the {@link #isSpaceChar(int)} method.
*
* @param ch the character to be tested.
- * @return Note: This method cannot handle {
* the {@link #isWhitespace(int)} method.
*
* @param ch the character to be tested.
- * @return
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return Note: This method cannot handle supplementary characters. To support
@@ -6533,8 +6557,8 @@ class Character implements java.io.Serializable, Comparable
- * The
* If the digit is less than 10, then
- * Note: This method cannot handle supplementary characters. To support
* all Unicode characters, including supplementary characters, use
* the {@link #getDirectionality(int)} method.
*
- * @param ch
* Note: if the specified character is not assigned a name by
@@ -6916,14 +6940,12 @@ class Character implements java.io.Serializable, Comparable
* Applications should throw instances of this class to indicate
- * other illegal uses of the A throwable contains a snapshot of the execution stack of its thread at
- * the time it was created. It can also contain a message string that gives
- * more information about the error. Finally, it can contain a cause:
- * another throwable that caused this throwable to get thrown. The cause
- * facility is new in release 1.4. It is also known as the chained
- * exception facility, as the cause can, itself, have a cause, and so on,
- * leading to a "chain" of exceptions, each caused by another.
+ * A throwable contains a snapshot of the execution stack of its
+ * thread at the time it was created. It can also contain a message
+ * string that gives more information about the error. Over time, a
+ * throwable can {@linkplain Throwable#addSuppressed suppress} other
+ * throwables from being propagated. Finally, the throwable can also
+ * contain a cause: another throwable that caused this
+ * throwable to be constructed. The recording of this causal information
+ * is referred to as the chained exception facility, as the
+ * cause can, itself, have a cause, and so on, leading to a "chain" of
+ * exceptions, each caused by another.
*
* One reason that a throwable may have a cause is that the class that
* throws it is built atop a lower layered abstraction, and an operation on
@@ -86,47 +89,12 @@ import java.util.*;
* {@link #initCause(Throwable)} method. New throwable classes that
* wish to allow causes to be associated with them should provide constructors
* that take a cause and delegate (perhaps indirectly) to one of the
- * {@code Throwable} constructors that takes a cause. For example:
- * Prior to release 1.4, there were many throwables that had their own
- * non-standard exception chaining mechanisms (
- * {@link ExceptionInInitializerError}, {@link ClassNotFoundException},
- * {@link java.lang.reflect.UndeclaredThrowableException},
- * {@link java.lang.reflect.InvocationTargetException},
- * {@link java.io.WriteAbortedException},
- * {@link java.security.PrivilegedActionException},
- * {@link java.awt.print.PrinterIOException},
- * {@link java.rmi.RemoteException} and
- * {@link javax.naming.NamingException}).
- * All of these throwables have been retrofitted to
- * use the standard exception chaining mechanism, while continuing to
- * implement their "legacy" chaining mechanisms for compatibility.
- *
- * Further, as of release 1.4, many general purpose {@code Throwable}
- * classes (for example {@link Exception}, {@link RuntimeException},
- * {@link Error}) have been retrofitted with constructors that take
- * a cause. This was not strictly necessary, due to the existence of the
- * {@code initCause} method, but it is more convenient and expressive to
- * delegate to a constructor that takes a cause.
+ * {@code Throwable}.
*
* By convention, class {@code Throwable} and its subclasses have two
* constructors, one that takes no arguments and one that takes a
@@ -137,14 +105,6 @@ import java.util.*;
* {@code String} (the detail message) and a {@code Throwable} (the
* cause).
*
- * Also introduced in release 1.4 is the {@link #getStackTrace()} method,
- * which allows programmatic access to the stack trace information that was
- * previously available only in text form, via the various forms of the
- * {@link #printStackTrace()} method. This information has been added to the
- * serialized representation of this class so {@code getStackTrace}
- * and {@code printStackTrace} will operate properly on a throwable that
- * was obtained by deserialization.
- *
* @author unascribed
* @author Josh Bloch (Added exception chaining and programmatic access to
* stack trace in 1.4.)
@@ -322,6 +282,41 @@ public class Throwable implements Serializable {
this.cause = cause;
}
+ /**
+ * Constructs a new throwable with the specified detail message,
+ * cause, and {@linkplain #addSuppressed suppression} enabled or
+ * disabled. If suppression is disabled, {@link #getSuppressed}
+ * for this object will return a zero-length array and calls to
+ * {@link #addSuppressed} that would otherwise append an exception
+ * to the suppressed list will have no effect.
+ *
+ * Note that the other constructors of {@code Throwable} treat
+ * suppression as being enabled. Subclasses of {@code Throwable}
+ * should document any conditions under which suppression is
+ * disabled. Disabling of suppression should only occur in
+ * exceptional circumstances where special requirements exist,
+ * such as a virtual machine reusing exception objects under
+ * low-memory situations.
+ *
+ * @param message the detail message.
+ * @param cause the cause. (A {@code null} value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @param enableSuppression whether or not suppression is enabled or disabled
+ *
+ * @see OutOfMemoryError
+ * @see NullPointerException
+ * @see ArithmeticException
+ * @since 1.7
+ */
+ protected Throwable(String message, Throwable cause,
+ boolean enableSuppression) {
+ fillInStackTrace();
+ detailMessage = message;
+ this.cause = cause;
+ if (!enableSuppression)
+ suppressedExceptions = null;
+ }
+
/**
* Returns the detail message string of this throwable.
*
@@ -870,54 +865,64 @@ public class Throwable implements Serializable {
* typically called (automatically and implicitly) by the {@code
* try}-with-resources statement.
*
- * If the first exception to be suppressed is {@code null}, that
- * indicates suppressed exception information will not be
- * recorded for this exception. Subsequent calls to this method
- * will not record any suppressed exceptions. Otherwise,
- * attempting to suppress {@code null} after an exception has
- * already been successfully suppressed results in a {@code
- * NullPointerException}.
+ * The suppression behavior is enabled unless disabled
+ * {@linkplain #Throwable(String, Throwable, boolean) via a
+ * constructor}. When suppression is disabled, this method does
+ * nothing other than to validate its argument.
*
* Note that when one exception {@linkplain
* #initCause(Throwable) causes} another exception, the first
* exception is usually caught and then the second exception is
- * thrown in response. In contrast, when one exception suppresses
- * another, two exceptions are thrown in sibling code blocks, such
- * as in a {@code try} block and in its {@code finally} block, and
- * control flow can only continue with one exception so the second
- * is recorded as a suppressed exception of the first.
+ * thrown in response. In other words, there is a causal
+ * connection between the two exceptions.
+ *
+ * In contrast, there are situations where two independent
+ * exceptions can be thrown in sibling code blocks, in particular
+ * in the {@code try} block of a {@code try}-with-resources
+ * statement and the compiler-generated {@code finally} block
+ * which closes the resource.
+ *
+ * In these situations, only one of the thrown exceptions can be
+ * propagated. In the {@code try}-with-resources statement, when
+ * there are two such exceptions, the exception originating from
+ * the {@code try} block is propagated and the exception from the
+ * {@code finally} block is added to the list of exceptions
+ * suppressed by the exception from the {@code try} block. As an
+ * exception unwinds the stack, it can accumulate multiple
+ * suppressed exceptions.
+ *
+ * An exception may have suppressed exceptions while also being
+ * caused by another exception. Whether or not an exception has a
+ * cause is semantically known at the time of its creation, unlike
+ * whether or not an exception will suppress other exceptions
+ * which is typically only determined after an exception is
+ * thrown.
+ *
+ * Note that programmer written code is also able to take
+ * advantage of calling this method in situations where there are
+ * multiple sibling exceptions and only one can be propagated.
*
* @param exception the exception to be added to the list of
* suppressed exceptions
* @throws IllegalArgumentException if {@code exception} is this
* throwable; a throwable cannot suppress itself.
- * @throws NullPointerException if {@code exception} is null and
- * an exception has already been suppressed by this exception
+ * @throws NullPointerException if {@code exception} is {@code null}
* @since 1.7
*/
public final synchronized void addSuppressed(Throwable exception) {
if (exception == this)
throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
- if (exception == null) {
- if (suppressedExceptions == SUPPRESSED_SENTINEL) {
- suppressedExceptions = null; // No suppression information recorded
- return;
- } else
- throw new NullPointerException(NULL_CAUSE_MESSAGE);
- } else {
- assert exception != null && exception != this;
+ if (exception == null)
+ throw new NullPointerException(NULL_CAUSE_MESSAGE);
- if (suppressedExceptions == null) // Suppressed exceptions not recorded
- return;
+ if (suppressedExceptions == null) // Suppressed exceptions not recorded
+ return;
- if (suppressedExceptions == SUPPRESSED_SENTINEL)
- suppressedExceptions = new ArrayList<>(1);
+ if (suppressedExceptions == SUPPRESSED_SENTINEL)
+ suppressedExceptions = new ArrayList<>(1);
- assert suppressedExceptions != SUPPRESSED_SENTINEL;
-
- suppressedExceptions.add(exception);
- }
+ suppressedExceptions.add(exception);
}
private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];
@@ -927,7 +932,9 @@ public class Throwable implements Serializable {
* suppressed, typically by the {@code try}-with-resources
* statement, in order to deliver this exception.
*
- * If no exceptions were suppressed, an empty array is returned.
+ * If no exceptions were suppressed or {@linkplain
+ * Throwable(String, Throwable, boolean) suppression is disabled},
+ * an empty array is returned.
*
* @return an array containing all of the exceptions that were
* suppressed to deliver this exception.
diff --git a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java b/jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java
similarity index 90%
rename from jdk/src/share/classes/java/nio/BufferPoolMXBean.java
rename to jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java
index d2f2586fbe1..f8fb4bd42f3 100644
--- a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java
+++ b/jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java
@@ -23,15 +23,15 @@
* questions.
*/
-package java.nio;
-
-import java.lang.management.PlatformManagedObject;
+package java.lang.management;
/**
- * The management interface for a buffer pool.
+ * The management interface for a buffer pool, for example a pool of
+ * {@link java.nio.ByteBuffer#allocateDirect direct} or {@link
+ * java.nio.MappedByteBuffer mapped} buffers.
*
- * A class implementing this interface is an MXBean. A Java
+ * A class implementing this interface is an
+ * {@link javax.management.MXBean}. A Java
* virtual machine has one or more implementations of this interface. The {@link
* java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
* method can be used to obtain the list of {@code BufferPoolMXBean} objects
@@ -44,14 +44,13 @@ import java.lang.management.PlatformManagedObject;
* javax.management.MBeanServer MBeanServer}. The {@link
* javax.management.ObjectName ObjectName} that uniquely identifies the
* management interface within the {@code MBeanServer} takes the form:
- *
+ *
+ * A platform MXBean is a managed bean that
+ * conforms to the JMX
+ * Instrumentation Specification and only uses a set of basic data types.
+ * A JMX management application and the {@linkplain
+ * #getPlatformMBeanServer platform MBeanServer}
+ * can interoperate without requiring classes for MXBean specific
+ * data types.
+ * The data types being transmitted between the JMX connector
+ * server and the connector client are
+ * {@linkplain javax.management.openmbean.OpenType open types}
+ * and this allows interoperation across versions.
+ * See
+ * the specification of MXBeans for details.
+ *
+ *
+ * Each platform MXBean is a {@link PlatformManagedObject}
+ * and it has a unique
+ * {@link javax.management.ObjectName ObjectName} for
+ * registration in the platform {@code MBeanServer} as returned by
+ * by the {@link PlatformManagedObject#getObjectName getObjectName}
+ * method.
*
*
* An application can access a platform MXBean in the following ways:
+ *
- * A JMX management application and the platform MBeanServer
- * can interoperate without requiring classes for MXBean specific
- * data types.
- * The data types being transmitted between the JMX connector
- * server and the connector client are
- * {@linkplain javax.management.openmbean.OpenType open types}
- * and this allows interoperation across versions.
- *
- * The platform MXBean interfaces use only the following data types:
- *
- * When an attribute or operation of a platform MXBean
- * is accessed via an MBeanServer, the data types are mapped
- * as follows:
- *
- * For example, the {@link MemoryMXBean}
- * interface has the following getter and setter methods:
- *
- *
+ * The {@link #getPlatformManagementInterfaces getPlatformManagementInterfaces}
+ * method returns all management interfaces supported in the Java virtual machine
+ * including the standard management interfaces listed in the tables
+ * below as well as the management interfaces extended by the JDK implementation.
+ *
* A Java virtual machine has a single instance of the following management
* interfaces:
*
@@ -228,27 +141,32 @@ import sun.management.ManagementFactoryHelper;
*
* MXBeans that get created and destroyed dynamically, for example,
* memory {@link MemoryPoolMXBean pools} and
* {@link MemoryManagerMXBean managers},
* will automatically be registered and deregistered into the platform
- * MBeanServer.
+ * {@code MBeanServer}.
*
- * If the system property javax.management.builder.initial
- * is set, the platform MBeanServer creation will be done
+ * If the system property {@code javax.management.builder.initial}
+ * is set, the platform {@code MBeanServer} creation will be done
* by the specified {@link javax.management.MBeanServerBuilder}.
*
* It is recommended that this platform MBeanServer also be used
* to register other application managed beans
* besides the platform MXBeans.
* This will allow all MBeans to be published through the same
- * MBeanServer and hence allow for easier network publishing
+ * {@code MBeanServer} and hence allow for easier network publishing
* and discovery.
* Name conflicts with the platform MXBeans should be avoided.
*
- * @return the platform MBeanServer; the platform
- * MXBeans are registered into the platform MBeanServer
+ * @return the platform {@code MBeanServer}; the platform
+ * MXBeans are registered into the platform {@code MBeanServer}
* at the first time this method is called.
*
* @exception SecurityException if there is a security manager
@@ -671,7 +592,9 @@ public class ManagementFactory {
try {
final ObjectName objName = new ObjectName(mxbeanName);
- if (!connection.isInstanceOf(objName, interfaceClass.getName())) {
+ // skip the isInstanceOf check for LoggingMXBean
+ String intfName = interfaceClass.getName();
+ if (!connection.isInstanceOf(objName, intfName)) {
throw new IllegalArgumentException(mxbeanName +
" is not an instance of " + interfaceClass);
}
@@ -683,55 +606,128 @@ public class ManagementFactory {
// create an MXBean proxy
return JMX.newMXBeanProxy(connection, objName, mxbeanInterface,
emitter);
- } catch (InstanceNotFoundException e) {
- final IllegalArgumentException iae =
- new IllegalArgumentException(mxbeanName +
- " not found in the connection.");
- iae.initCause(e);
- throw iae;
- } catch (MalformedObjectNameException e) {
- final IllegalArgumentException iae =
- new IllegalArgumentException(mxbeanName +
- " is not a valid ObjectName format.");
- iae.initCause(e);
- throw iae;
+ } catch (InstanceNotFoundException|MalformedObjectNameException e) {
+ throw new IllegalArgumentException(e);
}
}
/**
- * Returns the list of platform MXBeans that implement
- * the given {@code mxbeanInterface} in the running Java
+ * Returns the platform MXBean implementing
+ * the given {@code mxbeanInterface} which is specified
+ * to have one single instance in the Java virtual machine.
+ * This method may return {@code null} if the management interface
+ * is not implemented in the Java virtual machine (for example,
+ * a Java virtual machine with no compilation system does not
+ * implement {@link CompilationMXBean});
+ * otherwise, this method is equivalent to calling:
+ * There is a single global instance of the PlatformLoggingMXBean.
+ * The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean} method can be used to obtain
+ * the {@code PlatformLoggingMXBean} object as follows:
+ * The instance registered in the platform MBeanServer with
+ * this {@code ObjectName} implements all attributes defined by
+ * {@link java.util.logging.LoggingMXBean}.
+ *
+ * @since 1.7
+ */
+public interface PlatformLoggingMXBean extends PlatformManagedObject {
+
+ /**
+ * Returns the list of the currently registered
+ * {@linkplain java.util.logging.Logger logger} names. This method
+ * calls {@link java.util.logging.LogManager#getLoggerNames} and
+ * returns a list of the logger names.
+ *
+ * @return A list of {@code String} each of which is a
+ * currently registered {@code Logger} name.
+ */
+ java.util.List
+ * If the {@code Level} of the specified logger is {@code null},
+ * which means that this logger's effective level is inherited
+ * from its parent, an empty string will be returned.
+ *
+ * @param loggerName The name of the {@code Logger} to be retrieved.
+ *
+ * @return The name of the log level of the specified logger; or
+ * an empty string if the log level of the specified logger
+ * is {@code null}. If the specified logger does not
+ * exist, {@code null} is returned.
+ *
+ * @see java.util.logging.Logger#getLevel
+ */
+ String getLoggerLevel(String loggerName);
+
+ /**
+ * Sets the specified logger to the specified new
+ * {@linkplain java.util.logging.Logger#setLevel level}.
+ * If the {@code levelName} is not {@code null}, the level
+ * of the specified logger is set to the parsed
+ * {@link java.util.logging.Level Level}
+ * matching the {@code levelName}.
+ * If the {@code levelName} is {@code null}, the level
+ * of the specified logger is set to {@code null} and
+ * the effective level of the logger is inherited from
+ * its nearest ancestor with a specific (non-null) level value.
+ *
+ * @param loggerName The name of the {@code Logger} to be set.
+ * Must be non-null.
+ * @param levelName The name of the level to set on the specified logger,
+ * or {@code null} if setting the level to inherit
+ * from its nearest ancestor.
+ *
+ * @throws IllegalArgumentException if the specified logger
+ * does not exist, or {@code levelName} is not a valid level name.
+ *
+ * @throws SecurityException if a security manager exists and if
+ * the caller does not have LoggingPermission("control").
+ *
+ * @see java.util.logging.Logger#setLevel
+ */
+ void setLoggerLevel(String loggerName, String levelName);
+
+ /**
+ * Returns the name of the
+ * {@linkplain java.util.logging.Logger#getParent parent}
+ * for the specified logger.
+ * If the specified logger does not exist, {@code null} is returned.
+ * If the specified logger is the root {@code Logger} in the namespace,
+ * the result will be an empty string.
+ *
+ * @param loggerName The name of a {@code Logger}.
+ *
+ * @return the name of the nearest existing parent logger;
+ * an empty string if the specified logger is the root logger.
+ * If the specified logger does not exist, {@code null}
+ * is returned.
+ */
+ String getParentLoggerName(String loggerName);
+}
diff --git a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
index b12dc268347..b8782573263 100644
--- a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
+++ b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
@@ -46,7 +46,7 @@ import javax.management.ObjectName;
* intended for the management interfaces for the platform to extend but
* not for applications.
*
- * @see Platform MXBeans
+ * @see ManagementFactory
* @since 1.7
*/
public interface PlatformManagedObject {
diff --git a/jdk/src/share/classes/java/lang/management/package.html b/jdk/src/share/classes/java/lang/management/package.html
index 7ae6fbefc1e..eb01e37a2d8 100644
--- a/jdk/src/share/classes/java/lang/management/package.html
+++ b/jdk/src/share/classes/java/lang/management/package.html
@@ -27,160 +27,124 @@
Management Interface Description
-A platform MXBean is a managed bean that defines the management
-interface for one component for the platform and is specified in the
-
-ManagementFactory class.
-
- An application can monitor the instrumentation of the
-Java virtual machine and manage certain characteristics in
-the following ways:
-
+A platform MXBean is a managed bean that
+conforms to the JMX
+Instrumentation Specification and only uses a set of basic data types.
+Each platform MXBean is a {@link java.lang.management.PlatformManagedObject}
+with a unique
+{@linkplain java.lang.management.PlatformManagedObject#getObjectName name}.
+
The {@link java.lang.management.ManagementFactory} class is the management
+factory class for the Java platform. This class provides a set of
static factory methods to obtain the MXBeans for the Java platform
to allow an application to access the MXBeans directly.
A platform MBeanServer can be accessed with the
{@link java.lang.management.ManagementFactory#getPlatformMBeanServer
getPlatformMBeanServer} method. On the first call to this method,
-it creates the platform MBeanServer and registers all platform MXBeans
-including platform MXBeans defined in other packages such as
-{@link java.util.logging.LoggingMXBean}.
-Each platform MXBean is registered with a unique name defined in the
-{@link java.lang.management.ManagementFactory ManagementFactory} class
-for constructing {@link javax.management.ObjectName ObjectName}.
-This is a single MBeanServer that can be shared by different managed
+it creates the platform MBeanServer and registers all platform MXBeans
+including {@linkplain java.lang.management.PlatformManagedObject
+platform MXBeans}.
+Each platform MXBean is registered with a unique name defined in
+the specification of the management interface.
+This is a single MBeanServer that can be shared by different managed
components running within the same Java virtual machine.
-
+
A management application and a platform MBeanServer of a running
+virtual machine can interoperate
without requiring classes used by the platform MXBean interfaces.
The data types being transmitted between the JMX connector
server and the connector client are JMX
-{@link javax.management.openmbean.OpenType open types} and
+{@linkplain javax.management.openmbean.OpenType open types} and
this allows interoperation across versions.
-
- A data type used by the MXBean interfaces are mapped to
-an open type when being accessed via MBeanServer interface.
-The data type mapping is specified in the
-{@link java.lang.management.ManagementFactory ManagementFactory} class.
+A data type used by the MXBean interfaces are mapped to an
+open type when being accessed via MBeanServer interface.
+See the
+MXBean specification for details.
An application can monitor the instrumentation of the
+Java virtual machine and the runtime in the following ways:
-
+
+ Or by calling the
+ {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ getPlatformMXBean} or
+ {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
+ getPlatformMXBeans} method:
+
+
+
+ A proxy is typically used to access an MXBean
+ in a remote Java virtual machine.
+ An alternative way to create an MXBean proxy is:
+
+2. Indirect access to an MXBean interface via MBeanServer
+
+ A Java virtual machine implementation may add its platform extension to
the management interface by defining platform-dependent
interfaces that extend the standard management interfaces to include
-platform-specific metrics and management operations.
+platform-specific metrics and management operations.
The static factory methods in the ManagementFactory class will
-return the MBeans with the platform extension.
+return the MXBeans with the platform extension.
It is recommended to name the platform-specific attributes with
@@ -240,26 +187,30 @@ is happened to be same as some vendor-specific attribute's name,
the applications accessing that vendor-specific attribute would have
to be modified to cope with versioning and compatibility issues.
- Below is an example showing how to access a platform-specific
-attribute from Sun's implementation of the RuntimeMXBean.
+ Below is an example showing how to access an attribute
+from the platform extension:
-1) Direct access to the Sun-specific MXBean interface
-
-2) Access the Sun-specific MXBean interface via MBeanServer
+2) Access the Oracle-specific MXBean interface via MBeanServer
+ through proxy
Unless otherwise noted, passing a null argument to a constructor
diff --git a/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java
index c324add6957..69b08ebe720 100644
--- a/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java
+++ b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java
@@ -26,6 +26,7 @@
package java.lang.reflect;
import java.security.AccessController;
+import sun.reflect.Reflection;
import sun.reflect.ReflectionFactory;
import java.lang.annotation.Annotation;
@@ -201,4 +202,73 @@ public class AccessibleObject implements AnnotatedElement {
public Annotation[] getDeclaredAnnotations() {
throw new AssertionError("All subclasses should override this method");
}
+
+
+ // Shared access checking logic.
+
+ // For non-public members or members in package-private classes,
+ // it is necessary to perform somewhat expensive security checks.
+ // If the security check succeeds for a given class, it will
+ // always succeed (it is not affected by the granting or revoking
+ // of permissions); we speed up the check in the common case by
+ // remembering the last Class for which the check succeeded.
+ //
+ // The simple security check for Constructor is to see if
+ // the caller has already been seen, verified, and cached.
+ // (See also Class.newInstance(), which uses a similar method.)
+ //
+ // A more complicated security check cache is needed for Method and Field
+ // The cache can be either null (empty cache), a 2-array of {caller,target},
+ // or a caller (with target implicitly equal to this.clazz).
+ // In the 2-array case, the target is always different from the clazz.
+ volatile Object securityCheckCache;
+
+ void checkAccess(Class> caller, Class> clazz, Object obj, int modifiers)
+ throws IllegalAccessException
+ {
+ if (caller == clazz) { // quick check
+ return; // ACCESS IS OK
+ }
+ Object cache = securityCheckCache; // read volatile
+ Class> targetClass = clazz;
+ if (obj != null
+ && Modifier.isProtected(modifiers)
+ && ((targetClass = obj.getClass()) != clazz)) {
+ // Must match a 2-list of { caller, targetClass }.
+ if (cache instanceof Class[]) {
+ Class>[] cache2 = (Class>[]) cache;
+ if (cache2[1] == targetClass &&
+ cache2[0] == caller) {
+ return; // ACCESS IS OK
+ }
+ // (Test cache[1] first since range check for [1]
+ // subsumes range check for [0].)
+ }
+ } else if (cache == caller) {
+ // Non-protected case (or obj.class == this.clazz).
+ return; // ACCESS IS OK
+ }
+
+ // If no return, fall through to the slow path.
+ slowCheckMemberAccess(caller, clazz, obj, modifiers, targetClass);
+ }
+
+ // Keep all this slow stuff out of line:
+ void slowCheckMemberAccess(Class> caller, Class> clazz, Object obj, int modifiers,
+ Class> targetClass)
+ throws IllegalAccessException
+ {
+ Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
+
+ // Success: Update the cache.
+ Object cache = ((targetClass == clazz)
+ ? caller
+ : new Class>[] { caller, targetClass });
+
+ // Note: The two cache elements are not volatile,
+ // but they are effectively final. The Java memory model
+ // guarantees that the initializing stores for the cache
+ // elements will occur before the volatile write.
+ securityCheckCache = cache; // write volatile
+ }
}
diff --git a/jdk/src/share/classes/java/lang/reflect/Constructor.java b/jdk/src/share/classes/java/lang/reflect/Constructor.java
index 601eafe066d..2451c54e82d 100644
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java
@@ -74,14 +74,6 @@ public final
private byte[] annotations;
private byte[] parameterAnnotations;
- // For non-public members or members in package-private classes,
- // it is necessary to perform somewhat expensive security checks.
- // If the security check succeeds for a given class, it will
- // always succeed (it is not affected by the granting or revoking
- // of permissions); we speed up the check in the common case by
- // remembering the last Class for which the check succeeded.
- private volatile Class> securityCheckCache;
-
// Generics infrastructure
// Accessor for factory
private GenericsFactory getFactory() {
@@ -495,7 +487,7 @@ public final
* this object represents
*
* @exception IllegalAccessException if this {@code Constructor} object
- * enforces Java language access control and the underlying
+ * is enforcing Java language access control and the underlying
* constructor is inaccessible.
* @exception IllegalArgumentException if the number of actual
* and formal parameters differ; if an unwrapping
@@ -518,16 +510,17 @@ public final
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
Class> caller = Reflection.getCallerClass(2);
- if (securityCheckCache != caller) {
- Reflection.ensureMemberAccess(caller, clazz, null, modifiers);
- securityCheckCache = caller;
- }
+
+ checkAccess(caller, clazz, null, modifiers);
}
}
if ((clazz.getModifiers() & Modifier.ENUM) != 0)
throw new IllegalArgumentException("Cannot reflectively create enum objects");
- if (constructorAccessor == null) acquireConstructorAccessor();
- return (T) constructorAccessor.newInstance(initargs);
+ ConstructorAccessor ca = constructorAccessor; // read volatile
+ if (ca == null) {
+ ca = acquireConstructorAccessor();
+ }
+ return (T) ca.newInstance(initargs);
}
/**
@@ -560,18 +553,20 @@ public final
// ConstructorAccessor for a given Constructor. However, avoiding
// synchronization will probably make the implementation more
// scalable.
- private void acquireConstructorAccessor() {
+ private ConstructorAccessor acquireConstructorAccessor() {
// First check to see if one has been created yet, and take it
// if so.
ConstructorAccessor tmp = null;
if (root != null) tmp = root.getConstructorAccessor();
if (tmp != null) {
constructorAccessor = tmp;
- return;
+ } else {
+ // Otherwise fabricate one and propagate it up to the root
+ tmp = reflectionFactory.newConstructorAccessor(this);
+ setConstructorAccessor(tmp);
}
- // Otherwise fabricate one and propagate it up to the root
- tmp = reflectionFactory.newConstructorAccessor(this);
- setConstructorAccessor(tmp);
+
+ return tmp;
}
// Returns ConstructorAccessor for this Constructor object, not
diff --git a/jdk/src/share/classes/java/lang/reflect/Field.java b/jdk/src/share/classes/java/lang/reflect/Field.java
index 77884d46bbe..f7647d6dc8f 100644
--- a/jdk/src/share/classes/java/lang/reflect/Field.java
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java
@@ -79,11 +79,6 @@ class Field extends AccessibleObject implements Member {
// potentially many Field objects pointing to it.)
private Field root;
- // More complicated security check cache needed here than for
- // Class.newInstance() and Constructor.newInstance()
- private Class> securityCheckCache;
- private Class> securityCheckTargetClassCache;
-
// Generics infrastructure
private String getGenericSignature() {return signature;}
@@ -340,7 +335,7 @@ class Field extends AccessibleObject implements Member {
* instance of the class or interface declaring the underlying
* field, the method throws an {@code IllegalArgumentException}.
*
- * If this {@code Field} object enforces Java language access control, and
+ * If this {@code Field} object is enforcing Java language access control, and
* the underlying field is inaccessible, the method throws an
* {@code IllegalAccessException}.
* If the underlying field is static, the class that declared the
@@ -360,8 +355,9 @@ class Field extends AccessibleObject implements Member {
* {@code obj}; primitive values are wrapped in an appropriate
* object before being returned
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof).
@@ -383,8 +379,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the {@code boolean} field
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -410,8 +407,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the {@code byte} field
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -439,8 +437,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the field converted to type {@code char}
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -468,8 +467,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the field converted to type {@code short}
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -497,8 +497,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the field converted to type {@code int}
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -526,8 +527,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the field converted to type {@code long}
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -555,8 +557,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the field converted to type {@code float}
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -584,8 +587,9 @@ class Field extends AccessibleObject implements Member {
* from
* @return the value of the field converted to type {@code double}
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is inaccessible.
* @exception IllegalArgumentException if the specified object is not
* an instance of the class or interface declaring the
* underlying field (or a subclass or implementor
@@ -621,14 +625,14 @@ class Field extends AccessibleObject implements Member {
* an instance of the class or interface declaring the underlying
* field, the method throws an {@code IllegalArgumentException}.
*
- * If this {@code Field} object enforces Java language access control, and
+ * If this {@code Field} object is enforcing Java language access control, and
* the underlying field is inaccessible, the method throws an
* {@code IllegalAccessException}.
*
* If the underlying field is final, the method throws an
- * {@code IllegalAccessException} unless
- * {@code setAccessible(true)} has succeeded for this field
- * and this field is non-static. Setting a final field in this way
+ * {@code IllegalAccessException} unless {@code setAccessible(true)}
+ * has succeeded for this {@code Field} object
+ * and the field is non-static. Setting a final field in this way
* is meaningful only during deserialization or reconstruction of
* instances of classes with blank final fields, before they are
* made available for access by other parts of a program. Use in
@@ -658,8 +662,9 @@ class Field extends AccessibleObject implements Member {
* @param value the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -686,8 +691,9 @@ class Field extends AccessibleObject implements Member {
* @param z the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -715,8 +721,9 @@ class Field extends AccessibleObject implements Member {
* @param b the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -744,8 +751,9 @@ class Field extends AccessibleObject implements Member {
* @param c the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -773,8 +781,9 @@ class Field extends AccessibleObject implements Member {
* @param s the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -802,8 +811,9 @@ class Field extends AccessibleObject implements Member {
* @param i the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -831,8 +841,9 @@ class Field extends AccessibleObject implements Member {
* @param l the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -860,8 +871,9 @@ class Field extends AccessibleObject implements Member {
* @param f the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -889,8 +901,9 @@ class Field extends AccessibleObject implements Member {
* @param d the new value for the field of {@code obj}
* being modified
*
- * @exception IllegalAccessException if the underlying field
- * is inaccessible.
+ * @exception IllegalAccessException if this {@code Field} object
+ * is enforcing Java language access control and the underlying
+ * field is either inaccessible or final.
* @exception IllegalArgumentException if the specified object is not an
* instance of the class or interface declaring the underlying
* field (or a subclass or implementor thereof),
@@ -936,6 +949,7 @@ class Field extends AccessibleObject implements Member {
tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
setFieldAccessor(tmp, overrideFinalCheck);
}
+
return tmp;
}
@@ -965,21 +979,8 @@ class Field extends AccessibleObject implements Member {
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
Class> caller = Reflection.getCallerClass(4);
- Class> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
- ? clazz
- : obj.getClass());
- synchronized (this) {
- if ((securityCheckCache == caller)
- && (securityCheckTargetClassCache == targetClass)) {
- return;
- }
- }
- Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
- synchronized (this) {
- securityCheckCache = caller;
- securityCheckTargetClassCache = targetClass;
- }
+ checkAccess(caller, clazz, obj, modifiers);
}
}
}
diff --git a/jdk/src/share/classes/java/lang/reflect/Method.java b/jdk/src/share/classes/java/lang/reflect/Method.java
index 51eaf2dff50..1de15570511 100644
--- a/jdk/src/share/classes/java/lang/reflect/Method.java
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java
@@ -83,11 +83,6 @@ public final
// potentially many Method objects pointing to it.)
private Method root;
- // More complicated security check cache needed here than for
- // Class.newInstance() and Constructor.newInstance()
- private Class> securityCheckCache;
- private Class> securityCheckTargetClassCache;
-
// Generics infrastructure
private String getGenericSignature() {return signature;}
@@ -402,28 +397,28 @@ public final
*/
public String toString() {
try {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int mod = getModifiers() & Modifier.methodModifiers();
if (mod != 0) {
- sb.append(Modifier.toString(mod) + " ");
+ sb.append(Modifier.toString(mod)).append(' ');
}
- sb.append(Field.getTypeName(getReturnType()) + " ");
- sb.append(Field.getTypeName(getDeclaringClass()) + ".");
- sb.append(getName() + "(");
+ sb.append(Field.getTypeName(getReturnType())).append(' ');
+ sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+ sb.append(getName()).append('(');
Class>[] params = parameterTypes; // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(Field.getTypeName(params[j]));
if (j < (params.length - 1))
- sb.append(",");
+ sb.append(',');
}
- sb.append(")");
+ sb.append(')');
Class>[] exceptions = exceptionTypes; // avoid clone
if (exceptions.length > 0) {
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
sb.append(exceptions[k].getName());
if (k < (exceptions.length - 1))
- sb.append(",");
+ sb.append(',');
}
}
return sb.toString();
@@ -475,15 +470,15 @@ public final
StringBuilder sb = new StringBuilder();
int mod = getModifiers() & Modifier.methodModifiers();
if (mod != 0) {
- sb.append(Modifier.toString(mod) + " ");
+ sb.append(Modifier.toString(mod)).append(' ');
}
TypeVariable>[] typeparms = getTypeParameters();
if (typeparms.length > 0) {
boolean first = true;
- sb.append("<");
+ sb.append('<');
for(TypeVariable> typeparm: typeparms) {
if (!first)
- sb.append(",");
+ sb.append(',');
// Class objects can't occur here; no need to test
// and call Class.getName().
sb.append(typeparm.toString());
@@ -494,10 +489,11 @@ public final
Type genRetType = getGenericReturnType();
sb.append( ((genRetType instanceof Class>)?
- Field.getTypeName((Class>)genRetType):genRetType.toString()) + " ");
+ Field.getTypeName((Class>)genRetType):genRetType.toString()))
+ .append(' ');
- sb.append(Field.getTypeName(getDeclaringClass()) + ".");
- sb.append(getName() + "(");
+ sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+ sb.append(getName()).append('(');
Type[] params = getGenericParameterTypes();
for (int j = 0; j < params.length; j++) {
String param = (params[j] instanceof Class)?
@@ -507,9 +503,9 @@ public final
param = param.replaceFirst("\\[\\]$", "...");
sb.append(param);
if (j < (params.length - 1))
- sb.append(",");
+ sb.append(',');
}
- sb.append(")");
+ sb.append(')');
Type[] exceptions = getGenericExceptionTypes();
if (exceptions.length > 0) {
sb.append(" throws ");
@@ -518,7 +514,7 @@ public final
((Class)exceptions[k]).getName():
exceptions[k].toString());
if (k < (exceptions.length - 1))
- sb.append(",");
+ sb.append(',');
}
}
return sb.toString();
@@ -565,7 +561,7 @@ public final
* {@code args}
*
* @exception IllegalAccessException if this {@code Method} object
- * enforces Java language access control and the underlying
+ * is enforcing Java language access control and the underlying
* method is inaccessible.
* @exception IllegalArgumentException if the method is an
* instance method and the specified object argument
@@ -591,26 +587,15 @@ public final
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
Class> caller = Reflection.getCallerClass(1);
- Class> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
- ? clazz
- : obj.getClass());
- boolean cached;
- synchronized (this) {
- cached = (securityCheckCache == caller)
- && (securityCheckTargetClassCache == targetClass);
- }
- if (!cached) {
- Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
- synchronized (this) {
- securityCheckCache = caller;
- securityCheckTargetClassCache = targetClass;
- }
- }
+ checkAccess(caller, clazz, obj, modifiers);
}
}
- if (methodAccessor == null) acquireMethodAccessor();
- return methodAccessor.invoke(obj, args);
+ MethodAccessor ma = methodAccessor; // read volatile
+ if (ma == null) {
+ ma = acquireMethodAccessor();
+ }
+ return ma.invoke(obj, args);
}
/**
@@ -654,18 +639,20 @@ public final
// (though not efficient) to generate more than one MethodAccessor
// for a given Method. However, avoiding synchronization will
// probably make the implementation more scalable.
- private void acquireMethodAccessor() {
+ private MethodAccessor acquireMethodAccessor() {
// First check to see if one has been created yet, and take it
// if so
MethodAccessor tmp = null;
if (root != null) tmp = root.getMethodAccessor();
if (tmp != null) {
methodAccessor = tmp;
- return;
+ } else {
+ // Otherwise fabricate one and propagate it up to the root
+ tmp = reflectionFactory.newMethodAccessor(this);
+ setMethodAccessor(tmp);
}
- // Otherwise fabricate one and propagate it up to the root
- tmp = reflectionFactory.newMethodAccessor(this);
- setMethodAccessor(tmp);
+
+ return tmp;
}
// Returns MethodAccessor for this Method object, not looking up
diff --git a/jdk/src/share/classes/java/nio/file/Files.java b/jdk/src/share/classes/java/nio/file/Files.java
index 8b7af13544c..77847e7fcc1 100644
--- a/jdk/src/share/classes/java/nio/file/Files.java
+++ b/jdk/src/share/classes/java/nio/file/Files.java
@@ -2067,7 +2067,7 @@ public final class Files {
*
* @return {@code true} if the file is a symbolic link; {@code false} if
* the file does not exist, is not a symbolic link, or it cannot
- * be determined if the file is symbolic link or not.
+ * be determined if the file is a symbolic link or not.
*
* @throws SecurityException
* In the case of the default provider, and a security manager is
@@ -2106,7 +2106,7 @@ public final class Files {
*
* @return {@code true} if the file is a directory; {@code false} if
* the file does not exist, is not a directory, or it cannot
- * be determined if the file is directory or not.
+ * be determined if the file is a directory or not.
*
* @throws SecurityException
* In the case of the default provider, and a security manager is
@@ -2142,8 +2142,8 @@ public final class Files {
* options indicating how symbolic links are handled
*
* @return {@code true} if the file is a regular file; {@code false} if
- * the file does not exist, is not a direcregular filetory, or it
- * cannot be determined if the file is regular file or not.
+ * the file does not exist, is not a regular file, or it
+ * cannot be determined if the file is a regular file or not.
*
* @throws SecurityException
* In the case of the default provider, and a security manager is
diff --git a/jdk/src/share/classes/java/nio/file/Path.java b/jdk/src/share/classes/java/nio/file/Path.java
index 618f0226363..cefd2d2fd04 100644
--- a/jdk/src/share/classes/java/nio/file/Path.java
+++ b/jdk/src/share/classes/java/nio/file/Path.java
@@ -550,18 +550,21 @@ public interface Path
* If this path is relative then its absolute path is first obtained,
* as if by invoking the {@link #toAbsolutePath toAbsolutePath} method.
*
- * The {@code resolveLinks} parameter specifies if symbolic links
- * should be resolved. This parameter is ignored when symbolic links are
- * not supported. Where supported, and the parameter has the value {@code
- * true} then symbolic links are resolved to their final target. Where the
- * parameter has the value {@code false} then this method does not resolve
- * symbolic links. Some implementations allow special names such as
- * "{@code ..}" to refer to the parent directory. When deriving the real
- * path, and a "{@code ..}" (or equivalent) is preceded by a
- * non-"{@code ..}" name then an implementation will typically causes both
- * names to be removed. When not resolving symbolic links and the preceding
- * name is a symbolic link then the names are only removed if it guaranteed
- * that the resulting path will locate the same file as this path.
+ * The {@code options} array may be used to indicate how symbolic links
+ * are handled. By default, symbolic links are resolved to their final
+ * target. If the option {@link LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} is
+ * present then this method does not resolve symbolic links.
+ *
+ * Some implementations allow special names such as "{@code ..}" to refer to
+ * the parent directory. When deriving the real path, and a
+ * "{@code ..}" (or equivalent) is preceded by a non-"{@code ..}" name then
+ * an implementation will typically cause both names to be removed. When
+ * not resolving symbolic links and the preceding name is a symbolic link
+ * then the names are only removed if it guaranteed that the resulting path
+ * will locate the same file as this path.
+ *
+ * @param options
+ * options indicating how symbolic links are handled
*
* @return an absolute path represent the real path of the file
* located by this object
@@ -576,7 +579,7 @@ public interface Path
* checkPropertyAccess} method is invoked to check access to the
* system property {@code user.dir}
*/
- Path toRealPath(boolean resolveLinks) throws IOException;
+ Path toRealPath(LinkOption... options) throws IOException;
/**
* Returns a {@link File} object representing this path. Where this {@code
diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java
index 1ea0ecb04c0..826cbe759c9 100644
--- a/jdk/src/share/classes/java/util/Collections.java
+++ b/jdk/src/share/classes/java/util/Collections.java
@@ -3533,20 +3533,20 @@ public class Collections {
}
/**
- * Returns a comparator that imposes the reverse of the natural
- * ordering on a collection of objects that implement the
- * Comparable interface. (The natural ordering is the ordering
- * imposed by the objects' own compareTo method.) This enables a
+ * Returns a comparator that imposes the reverse of the natural
+ * ordering on a collection of objects that implement the
+ * {@code Comparable} interface. (The natural ordering is the ordering
+ * imposed by the objects' own {@code compareTo} method.) This enables a
* simple idiom for sorting (or maintaining) collections (or arrays) of
- * objects that implement the Comparable interface in
- * reverse-natural-order. For example, suppose a is an array of
+ * objects that implement the {@code Comparable} interface in
+ * reverse-natural-order. For example, suppose {@code a} is an array of
* strings. Then:
*
* The returned comparator is serializable.
*
- * @return a comparator that imposes the reverse of the natural
+ * @return A comparator that imposes the reverse of the natural
* ordering on a collection of objects that implement
* the Comparable interface.
* @see Comparable
@@ -3575,16 +3575,18 @@ public class Collections {
/**
* Returns a comparator that imposes the reverse ordering of the specified
- * comparator. If the specified comparator is null, this method is
+ * comparator. If the specified comparator is {@code null}, this method is
* equivalent to {@link #reverseOrder()} (in other words, it returns a
- * comparator that imposes the reverse of the natural ordering on a
- * collection of objects that implement the Comparable interface).
+ * comparator that imposes the reverse of the natural ordering on
+ * a collection of objects that implement the Comparable interface).
*
* The returned comparator is serializable (assuming the specified
- * comparator is also serializable or null).
+ * comparator is also serializable or {@code null}).
*
- * @return a comparator that imposes the reverse ordering of the
- * specified comparator
+ * @param cmp a comparator who's ordering is to be reversed by the returned
+ * comparator or {@code null}
+ * @return A comparator that imposes the reverse ordering of the
+ * specified comparator.
* @since 1.5
*/
public static All keys inserted into a sorted map must implement the Comparable
+ * All keys inserted into a sorted map must implement the {@code Comparable}
* interface (or be accepted by the specified comparator). Furthermore, all
- * such keys must be mutually comparable: k1.compareTo(k2) (or
- * comparator.compare(k1, k2)) must not throw a
- * ClassCastException for any keys k1 and k2 in
+ * such keys must be mutually comparable: {@code k1.compareTo(k2)} (or
+ * {@code comparator.compare(k1, k2)}) must not throw a
+ * {@code ClassCastException} for any keys {@code k1} and {@code k2} in
* the sorted map. Attempts to violate this restriction will cause the
* offending method or constructor invocation to throw a
- * ClassCastException.
+ * {@code ClassCastException}.
*
* Note that the ordering maintained by a sorted map (whether or not an
- * explicit comparator is provided) must be consistent with equals if
- * the sorted map is to correctly implement the Map interface. (See
- * the Comparable interface or Comparator interface for a
- * precise definition of consistent with equals.) This is so because
- * the Map interface is defined in terms of the equals
+ * explicit comparator is provided) must be consistent with equals if
+ * the sorted map is to correctly implement the {@code Map} interface. (See
+ * the {@code Comparable} interface or {@code Comparator} interface for a
+ * precise definition of consistent with equals.) This is so because
+ * the {@code Map} interface is defined in terms of the {@code equals}
* operation, but a sorted map performs all key comparisons using its
- * compareTo (or compare) method, so two keys that are
+ * {@code compareTo} (or {@code compare}) method, so two keys that are
* deemed equal by this method are, from the standpoint of the sorted map,
- * equal. The behavior of a tree map is well-defined even if its
+ * equal. The behavior of a tree map is well-defined even if its
* ordering is inconsistent with equals; it just fails to obey the general
- * contract of the Map interface.
+ * contract of the {@code Map} interface.
*
- * All general-purpose sorted map implementation classes should
- * provide four "standard" constructors: 1) A void (no arguments)
- * constructor, which creates an empty sorted map sorted according to
- * the natural ordering of its keys. 2) A constructor with a
- * single argument of type Comparator, which creates an empty
- * sorted map sorted according to the specified comparator. 3) A
- * constructor with a single argument of type Map, which
- * creates a new map with the same key-value mappings as its argument,
- * sorted according to the keys' natural ordering. 4) A constructor
- * with a single argument of type SortedMap,
- * which creates a new sorted map with the same key-value mappings and
- * the same ordering as the input sorted map. There is no way to
- * enforce this recommendation, as interfaces cannot contain
- * constructors.
+ * All general-purpose sorted map implementation classes should provide four
+ * "standard" constructors. It is not possible to enforce this recommendation
+ * though as required constructors cannot be specified by interfaces. The
+ * expected "standard" constructors for all sorted map implementations are:
+ * Note: several methods return submaps with restricted key ranges.
- * Such ranges are half-open, that is, they include their low
+ * Note: several methods return submaps with restricted key
+ * ranges. Such ranges are half-open, that is, they include their low
* endpoint but not their high endpoint (where applicable). If you need a
- * closed range (which includes both endpoints), and the key type
+ * closed range (which includes both endpoints), and the key type
* allows for calculation of the successor of a given key, merely request
- * the subrange from lowEndpoint to
- * successor(highEndpoint). For example, suppose that m
+ * the subrange from {@code lowEndpoint} to
+ * {@code successor(highEndpoint)}. For example, suppose that {@code m}
* is a map whose keys are strings. The following idiom obtains a view
- * containing all of the key-value mappings in m whose keys are
- * between low and high, inclusive: This interface is a member of the
@@ -112,96 +113,96 @@ package java.util;
public interface SortedMap The returned map will throw an IllegalArgumentException
+ * The returned map will throw an {@code IllegalArgumentException}
* on an attempt to insert a key outside its range.
*
* @param fromKey low endpoint (inclusive) of the keys in the returned map
* @param toKey high endpoint (exclusive) of the keys in the returned map
* @return a view of the portion of this map whose keys range from
- * fromKey, inclusive, to toKey, exclusive
- * @throws ClassCastException if fromKey and toKey
+ * {@code fromKey}, inclusive, to {@code toKey}, exclusive
+ * @throws ClassCastException if {@code fromKey} and {@code toKey}
* cannot be compared to one another using this map's comparator
* (or, if the map has no comparator, using natural ordering).
* Implementations may, but are not required to, throw this
- * exception if fromKey or toKey
+ * exception if {@code fromKey} or {@code toKey}
* cannot be compared to keys currently in the map.
- * @throws NullPointerException if fromKey or toKey
+ * @throws NullPointerException if {@code fromKey} or {@code toKey}
* is null and this map does not permit null keys
- * @throws IllegalArgumentException if fromKey is greater than
- * toKey; or if this map itself has a restricted
- * range, and fromKey or toKey lies
+ * @throws IllegalArgumentException if {@code fromKey} is greater than
+ * {@code toKey}; or if this map itself has a restricted
+ * range, and {@code fromKey} or {@code toKey} lies
* outside the bounds of the range
*/
SortedMap The returned map will throw an IllegalArgumentException
+ * The returned map will throw an {@code IllegalArgumentException}
* on an attempt to insert a key outside its range.
*
* @param toKey high endpoint (exclusive) of the keys in the returned map
* @return a view of the portion of this map whose keys are strictly
- * less than toKey
- * @throws ClassCastException if toKey is not compatible
+ * less than {@code toKey}
+ * @throws ClassCastException if {@code toKey} is not compatible
* with this map's comparator (or, if the map has no comparator,
- * if toKey does not implement {@link Comparable}).
+ * if {@code toKey} does not implement {@link Comparable}).
* Implementations may, but are not required to, throw this
- * exception if toKey cannot be compared to keys
+ * exception if {@code toKey} cannot be compared to keys
* currently in the map.
- * @throws NullPointerException if toKey is null and
+ * @throws NullPointerException if {@code toKey} is null and
* this map does not permit null keys
* @throws IllegalArgumentException if this map itself has a
- * restricted range, and toKey lies outside the
+ * restricted range, and {@code toKey} lies outside the
* bounds of the range
*/
SortedMap The returned map will throw an IllegalArgumentException
+ * The returned map will throw an {@code IllegalArgumentException}
* on an attempt to insert a key outside its range.
*
* @param fromKey low endpoint (inclusive) of the keys in the returned map
* @return a view of the portion of this map whose keys are greater
- * than or equal to fromKey
- * @throws ClassCastException if fromKey is not compatible
+ * than or equal to {@code fromKey}
+ * @throws ClassCastException if {@code fromKey} is not compatible
* with this map's comparator (or, if the map has no comparator,
- * if fromKey does not implement {@link Comparable}).
+ * if {@code fromKey} does not implement {@link Comparable}).
* Implementations may, but are not required to, throw this
- * exception if fromKey cannot be compared to keys
+ * exception if {@code fromKey} cannot be compared to keys
* currently in the map.
- * @throws NullPointerException if fromKey is null and
+ * @throws NullPointerException if {@code fromKey} is null and
* this map does not permit null keys
* @throws IllegalArgumentException if this map itself has a
- * restricted range, and fromKey lies outside the
+ * restricted range, and {@code fromKey} lies outside the
* bounds of the range
*/
SortedMap There is a single global instance of the LoggingMXBean.
- * This instance is an
- * MXBean
- * can be obtained by calling
- * the {@link LogManager#getLoggingMXBean} method or from the
+ * This instance is an {@link javax.management.MXBean MXBean} that
+ * can be obtained by calling the {@link LogManager#getLoggingMXBean}
+ * method or from the
* {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
* platform MBeanServer}.
- *
- * The {@link javax.management.ObjectName ObjectName} for uniquely
- * identifying the LoggingMXBean within an MBeanServer is:
- *
+ * The {@link javax.management.ObjectName ObjectName} that uniquely identifies
+ * the management interface for logging within the {@code MBeanServer} is:
+ *
+ * The instance registered in the platform {@code MBeanServer}
+ * is also a {@link java.lang.management.PlatformLoggingMXBean}.
*
* @author Ron Mann
* @author Mandy Chung
* @since 1.5
*
- * @see PlatformLoggingMXBean
+ * @see java.lang.management.PlatformLoggingMXBean
*/
public interface LoggingMXBean {
/**
- * Returns the list of currently registered loggers. This method
+ * Returns the list of currently registered logger names. This method
* calls {@link LogManager#getLoggerNames} and returns a list
* of the logger names.
*
@@ -89,7 +94,7 @@ public interface LoggingMXBean {
*
* @see Logger#getLevel
*/
- public String getLoggerLevel( String loggerName );
+ public String getLoggerLevel(String loggerName);
/**
* Sets the specified logger to the specified new level.
@@ -115,7 +120,7 @@ public interface LoggingMXBean {
*
* @see Logger#setLevel
*/
- public void setLoggerLevel( String loggerName, String levelName );
+ public void setLoggerLevel(String loggerName, String levelName);
/**
* Returns the name of the parent for the specified logger.
diff --git a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
index 61e56db406b..8e027d66a47 100644
--- a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
+++ b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
@@ -99,4 +99,9 @@ class LoggingProxyImpl implements LoggingProxy {
public String getLevelName(Object level) {
return ((Level) level).getName();
}
+
+ @Override
+ public String getProperty(String key) {
+ return LogManager.getLogManager().getProperty(key);
+ }
}
diff --git a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java b/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
deleted file mode 100644
index 72297490ee4..00000000000
--- a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.util.logging;
-
-import java.lang.management.PlatformManagedObject;
-
-/**
- * The {@linkplain PlatformManagedObject platform managed object} for the
- * logging facility. This interface simply unifies {@link LoggingMXBean}
- * {@link PlatformManagedObject};
- * and it does not specify any new operations.
- *
- * The {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
- * ManagementFactory.getPlatformMXBeans} method can be used to obtain
- * the {@code PlatformLoggingMXBean} object as follows:
- *
+ *
+ * Configuration:
+ * The {@code SimpleFormatter} is initialized with the
+ * format string
+ * specified in the {@code java.util.logging.SimpleFormatter.format}
+ * property to {@linkplain #format format} the log messages.
+ * This property can be defined
+ * in the {@linkplain LogManager#getProperty logging properties}
+ * configuration file
+ * or as a system property. If this property is set in both
+ * the logging properties and system properties,
+ * the format string specified in the system property will be used.
+ * If this property is not defined or the given format string
+ * is {@linkplain java.util.IllegalFormatException illegal},
+ * the default format is implementation-specific.
+ *
* @since 1.4
+ * @see java.util.Formatter
*/
public class SimpleFormatter extends Formatter {
- Date dat = new Date();
- private final static String format = "{0,date} {0,time}";
- private MessageFormat formatter;
-
- private Object args[] = new Object[1];
-
- // Line separator string. This is the value of the line.separator
- // property at the moment that the SimpleFormatter was created.
- private String lineSeparator = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
+ // format string for printing the log record
+ private static final String format = LoggingSupport.getSimpleFormat();
+ private final Date dat = new Date();
/**
* Format the given LogRecord.
*
- * This method can be overridden in a subclass.
+ * The formatting can be customized by specifying the
+ * format string
+ * in the
+ * {@code java.util.logging.SimpleFormatter.format} property.
+ * The given {@code LogRecord} will be formatted as if by calling:
+ * Some example formats: This prints 1 line with the log level ({@code 4$}),
+ * the log message ({@code 5$}) and the timestamp ({@code 1$}) in
+ * a square bracket.
+ * This prints 2 lines where the first line includes
+ * the timestamp ({@code 1$}) and the source ({@code 2$});
+ * the second line includes the log level ({@code 4$}) and
+ * the log message ({@code 5$}) followed with the throwable
+ * and its backtrace ({@code 6$}), if any:
+ * This prints 2 lines similar to the example above
+ * with a different date/time formatting and does not print
+ * the throwable and its backtrace:
+ * This method can also be overridden in a subclass.
* It is recommended to use the {@link Formatter#formatMessage}
* convenience method to localize and format the message field.
*
@@ -61,42 +138,32 @@ public class SimpleFormatter extends Formatter {
* @return a formatted log record
*/
public synchronized String format(LogRecord record) {
- StringBuffer sb = new StringBuffer();
- // Minimize memory allocations here.
dat.setTime(record.getMillis());
- args[0] = dat;
- StringBuffer text = new StringBuffer();
- if (formatter == null) {
- formatter = new MessageFormat(format);
- }
- formatter.format(args, text, null);
- sb.append(text);
- sb.append(" ");
+ String source;
if (record.getSourceClassName() != null) {
- sb.append(record.getSourceClassName());
- } else {
- sb.append(record.getLoggerName());
- }
- if (record.getSourceMethodName() != null) {
- sb.append(" ");
- sb.append(record.getSourceMethodName());
- }
- sb.append(lineSeparator);
- String message = formatMessage(record);
- sb.append(record.getLevel().getLocalizedName());
- sb.append(": ");
- sb.append(message);
- sb.append(lineSeparator);
- if (record.getThrown() != null) {
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- record.getThrown().printStackTrace(pw);
- pw.close();
- sb.append(sw.toString());
- } catch (Exception ex) {
+ source = record.getSourceClassName();
+ if (record.getSourceMethodName() != null) {
+ source += " " + record.getSourceMethodName();
}
+ } else {
+ source = record.getLoggerName();
}
- return sb.toString();
+ String message = formatMessage(record);
+ String throwable = "";
+ if (record.getThrown() != null) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ pw.println();
+ record.getThrown().printStackTrace(pw);
+ pw.close();
+ throwable = sw.toString();
+ }
+ return String.format(format,
+ dat,
+ source,
+ record.getLoggerName(),
+ record.getLevel().getLocalizedName(),
+ message,
+ throwable);
}
}
diff --git a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
index e7a78cb5ce1..96ade216719 100644
--- a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
+++ b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java
@@ -206,14 +206,9 @@ class DeflaterOutputStream extends FilterOutputStream {
return;
}
if (!def.finished()) {
- // Deflate no more than stride bytes at a time. This avoids
- // excess copying in deflateBytes (see Deflater.c)
- int stride = buf.length;
- for (int i = 0; i < len; i+= stride) {
- def.setInput(b, off + i, Math.min(stride, len - i));
- while (!def.needsInput()) {
- deflate();
- }
+ def.setInput(b, off, len);
+ while (!def.needsInput()) {
+ deflate();
}
}
}
diff --git a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
index 4e3c016874c..9d4145c80da 100644
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
@@ -724,7 +724,7 @@ public class IIOMetadataNode implements Element, NodeList {
/**
* Equivalent to true if the character is a letter or digit;
- * false otherwise.
+ * @return {@code true} if the character is a letter or digit;
+ * {@code false} otherwise.
* @see Character#isDigit(char)
* @see Character#isJavaIdentifierPart(char)
* @see Character#isJavaLetter(char)
@@ -5636,11 +5634,11 @@ class Character implements java.io.Serializable, Comparabletrue for the character.
+ * {@code true} for the character.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return true if the character is a letter or digit;
- * false otherwise.
+ * @return {@code true} if the character is a letter or digit;
+ * {@code false} otherwise.
* @see Character#isDigit(int)
* @see Character#isJavaIdentifierPart(int)
* @see Character#isLetter(int)
@@ -5664,15 +5662,15 @@ class Character implements java.io.Serializable, Comparable
- *
*
* @param ch the character to be tested.
- * @return true
- * LETTER_NUMBER
- * true if the character may start a Java
- * identifier; false otherwise.
+ * @return {@code true} if the character may start a Java
+ * identifier; {@code false} otherwise.
* @see Character#isJavaLetterOrDigit(char)
* @see Character#isJavaIdentifierStart(char)
* @see Character#isJavaIdentifierPart(char)
@@ -5695,19 +5693,19 @@ class Character implements java.io.Serializable, Comparable
*
*
* @param ch the character to be tested.
- * @return '$')
- * '_')
+ * isIdentifierIgnorable returns
- * true for the character.
+ * true if the character may be part of a
- * Java identifier; false otherwise.
+ * @return {@code true} if the character may be part of a
+ * Java identifier; {@code false} otherwise.
* @see Character#isJavaLetter(char)
* @see Character#isJavaIdentifierStart(char)
* @see Character#isJavaIdentifierPart(char)
@@ -5730,10 +5728,10 @@ class Character implements java.io.Serializable, Comparable
- *
*
* true
- * LETTER_NUMBER
- * true if the character may start a Java identifier;
- * false otherwise.
+ * @return {@code true} if the character may start a Java identifier;
+ * {@code false} otherwise.
* @see Character#isJavaIdentifierPart(char)
* @see Character#isLetter(char)
* @see Character#isUnicodeIdentifierStart(char)
@@ -5762,17 +5760,17 @@ class Character implements java.io.Serializable, Comparable
*
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return true
+ * returns {@code true}
* LETTER_NUMBER
- * true if the character may start a Java identifier;
- * false otherwise.
+ * @return {@code true} if the character may start a Java identifier;
+ * {@code false} otherwise.
* @see Character#isJavaIdentifierPart(int)
* @see Character#isLetter(int)
* @see Character#isUnicodeIdentifierStart(int)
@@ -5791,14 +5789,14 @@ class Character implements java.io.Serializable, Comparable
*
*
* '$')
- * '_')
+ * isIdentifierIgnorable returns
- * true for the character
+ * true if the character may be part of a
- * Java identifier; false otherwise.
+ * @return {@code true} if the character may be part of a
+ * Java identifier; {@code false} otherwise.
* @see Character#isIdentifierIgnorable(char)
* @see Character#isJavaIdentifierStart(char)
* @see Character#isLetterOrDigit(char)
@@ -5828,20 +5826,20 @@ class Character implements java.io.Serializable, Comparable
*
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return '$')
- * '_')
+ * true for
+ * isIdentifierIgnorable(codePoint)} returns {@code true} for
* the character
* true if the character may be part of a
- * Java identifier; false otherwise.
+ * @return {@code true} if the character may be part of a
+ * Java identifier; {@code false} otherwise.
* @see Character#isIdentifierIgnorable(int)
* @see Character#isJavaIdentifierStart(int)
* @see Character#isLetterOrDigit(int)
@@ -5860,9 +5858,9 @@ class Character implements java.io.Serializable, Comparable
- *
*
* true
+ * LETTER_NUMBER.
+ * {@code LETTER_NUMBER}.
* true if the character may start a Unicode
- * identifier; false otherwise.
+ * @return {@code true} if the character may start a Unicode
+ * identifier; {@code false} otherwise.
* @see Character#isJavaIdentifierStart(char)
* @see Character#isLetter(char)
* @see Character#isUnicodeIdentifierPart(char)
@@ -5890,13 +5888,13 @@ class Character implements java.io.Serializable, Comparable
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return true
+ * returns {@code true}
* LETTER_NUMBER.
+ * returns {@code LETTER_NUMBER}.
* true if the character may start a Unicode
- * identifier; false otherwise.
+ * @return {@code true} if the character may start a Unicode
+ * identifier; {@code false} otherwise.
* @see Character#isJavaIdentifierStart(int)
* @see Character#isLetter(int)
* @see Character#isUnicodeIdentifierPart(int)
@@ -5914,13 +5912,13 @@ class Character implements java.io.Serializable, Comparable
*
*
* '_')
+ * isIdentifierIgnorable returns
- * true for this character.
+ * true if the character may be part of a
- * Unicode identifier; false otherwise.
+ * @return {@code true} if the character may be part of a
+ * Unicode identifier; {@code false} otherwise.
* @see Character#isIdentifierIgnorable(char)
* @see Character#isJavaIdentifierPart(char)
* @see Character#isLetterOrDigit(char)
@@ -5949,17 +5947,17 @@ class Character implements java.io.Serializable, Comparable
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return '_')
+ * isIdentifierIgnorable returns
- * true for this character.
+ * true if the character may be part of a
- * Unicode identifier; false otherwise.
+ * @return {@code true} if the character may be part of a
+ * Unicode identifier; {@code false} otherwise.
* @see Character#isIdentifierIgnorable(int)
* @see Character#isJavaIdentifierPart(int)
* @see Character#isLetterOrDigit(int)
@@ -5979,12 +5977,12 @@ class Character implements java.io.Serializable, Comparable
*
*
@@ -5994,9 +5992,9 @@ class Character implements java.io.Serializable, Comparable
- *
*
- * '\u0000' through '\u0008'
- * '\u000E' through '\u001B'
- * '\u007F' through '\u009F'
+ * FORMAT general
+ * true if the character is an ignorable control
+ * @return {@code true} if the character is an ignorable control
* character that may be part of a Java or Unicode identifier;
- * false otherwise.
+ * {@code false} otherwise.
* @see Character#isJavaIdentifierPart(char)
* @see Character#isUnicodeIdentifierPart(char)
* @since 1.1
@@ -6014,19 +6012,19 @@ class Character implements java.io.Serializable, Comparable
*
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return
- *
*
- * '\u0000' through '\u0008'
- * '\u000E' through '\u001B'
- * '\u007F' through '\u009F'
+ * FORMAT general
+ * true if the character is an ignorable control
+ * @return {@code true} if the character is an ignorable control
* character that may be part of a Java or Unicode identifier;
- * false otherwise.
+ * {@code false} otherwise.
* @see Character#isJavaIdentifierPart(int)
* @see Character#isUnicodeIdentifierPart(int)
* @since 1.5
@@ -6040,16 +6038,16 @@ class Character implements java.io.Serializable, ComparableCharacter.isLowerCase(Character.toLowerCase(ch))
- * does not always return true for some ranges of
+ * {@code Character.isLowerCase(Character.toLowerCase(ch))}
+ * does not always return {@code true} for some ranges of
* characters, particularly those that are symbols or ideographs.
*
* String case mapping methods
- * have several benefits over Character case mapping methods.
- * String case mapping methods can perform locale-sensitive
+ * characters to lowercase. {@code String} case mapping methods
+ * have several benefits over {@code Character} case mapping methods.
+ * {@code String} case mapping methods can perform locale-sensitive
* mappings, context-sensitive mappings, and 1:M character mappings, whereas
- * the Character case mapping methods cannot.
+ * the {@code Character} case mapping methods cannot.
*
* Character.isLowerCase(Character.toLowerCase(codePoint))
- * does not always return true for some ranges of
+ * {@code Character.isLowerCase(Character.toLowerCase(codePoint))}
+ * does not always return {@code true} for some ranges of
* characters, particularly those that are symbols or ideographs.
*
* String case mapping methods
- * have several benefits over Character case mapping methods.
- * String case mapping methods can perform locale-sensitive
+ * characters to lowercase. {@code String} case mapping methods
+ * have several benefits over {@code Character} case mapping methods.
+ * {@code String} case mapping methods can perform locale-sensitive
* mappings, context-sensitive mappings, and 1:M character mappings, whereas
- * the Character case mapping methods cannot.
+ * the {@code Character} case mapping methods cannot.
*
* @param codePoint the character (Unicode code point) to be converted.
* @return the lowercase equivalent of the character (Unicode code
@@ -6100,16 +6098,16 @@ class Character implements java.io.Serializable, ComparableCharacter.isUpperCase(Character.toUpperCase(ch))
- * does not always return true for some ranges of
+ * {@code Character.isUpperCase(Character.toUpperCase(ch))}
+ * does not always return {@code true} for some ranges of
* characters, particularly those that are symbols or ideographs.
*
* String case mapping methods
- * have several benefits over Character case mapping methods.
- * String case mapping methods can perform locale-sensitive
+ * characters to uppercase. {@code String} case mapping methods
+ * have several benefits over {@code Character} case mapping methods.
+ * {@code String} case mapping methods can perform locale-sensitive
* mappings, context-sensitive mappings, and 1:M character mappings, whereas
- * the Character case mapping methods cannot.
+ * the {@code Character} case mapping methods cannot.
*
* Character.isUpperCase(Character.toUpperCase(codePoint))
- * does not always return true for some ranges of
+ * {@code Character.isUpperCase(Character.toUpperCase(codePoint))}
+ * does not always return {@code true} for some ranges of
* characters, particularly those that are symbols or ideographs.
*
* String case mapping methods
- * have several benefits over Character case mapping methods.
- * String case mapping methods can perform locale-sensitive
+ * characters to uppercase. {@code String} case mapping methods
+ * have several benefits over {@code Character} case mapping methods.
+ * {@code String} case mapping methods can perform locale-sensitive
* mappings, context-sensitive mappings, and 1:M character mappings, whereas
- * the Character case mapping methods cannot.
+ * the {@code Character} case mapping methods cannot.
*
* @param codePoint the character (Unicode code point) to be converted.
* @return the uppercase equivalent of the character, if any;
@@ -6161,13 +6159,13 @@ class Character implements java.io.Serializable, Comparablechar argument is already a titlecase
- * char, the same char value will be
+ * {@code char} argument is already a titlecase
+ * {@code char}, the same {@code char} value will be
* returned.
* Character.isTitleCase(Character.toTitleCase(ch))
- * does not always return true for some ranges of
+ * {@code Character.isTitleCase(Character.toTitleCase(ch))}
+ * does not always return {@code true} for some ranges of
* characters.
*
* Character.isTitleCase(Character.toTitleCase(codePoint))
- * does not always return true for some ranges of
+ * {@code Character.isTitleCase(Character.toTitleCase(codePoint))}
+ * does not always return {@code true} for some ranges of
* characters.
*
* @param codePoint the character (Unicode code point) to be converted.
@@ -6215,28 +6213,40 @@ class Character implements java.io.Serializable, Comparablech in the
+ * Returns the numeric value of the character {@code ch} in the
* specified radix.
* MIN_RADIX <=
- * radix <= MAX_RADIX or if the
- * value of ch is not a valid digit in the specified
- * radix, -1 is returned. A character is a valid digit
+ * If the radix is not in the range {@code MIN_RADIX} ≤
+ * {@code radix} ≤ {@code MAX_RADIX} or if the
+ * value of {@code ch} is not a valid digit in the specified
+ * radix, {@code -1} is returned. A character is a valid digit
* if at least one of the following is true:
*
- *
*
@@ -6260,25 +6270,39 @@ class Character implements java.io.Serializable, ComparableisDigit is true of the character
+ * 'A' through 'Z' and its code is less than
- * radix + 'A' - 10.
- * In this case, ch - 'A' + 10
+ * {@code 'A'} through {@code 'Z'} and its code is less than
+ * {@code radix + 'A' - 10}.
+ * In this case, {@code ch - 'A' + 10}
* is returned.
* 'a' through 'z' and its code is less than
- * radix + 'a' - 10.
- * In this case, ch - 'a' + 10
+ * {@code 'a'} through {@code 'z'} and its code is less than
+ * {@code radix + 'a' - 10}.
+ * In this case, {@code ch - 'a' + 10}
+ * is returned.
+ * MIN_RADIX <=
- * radix <= MAX_RADIX or if the
+ * -1 is returned. A character is a valid digit
+ * radix, {@code -1} is returned. A character is a valid digit
* if at least one of the following is true:
*
- *
*
@@ -6295,19 +6319,19 @@ class Character implements java.io.Serializable, Comparabletrue of the character
+ * 'A' through 'Z' and its code is less than
- * radix + 'A' - 10.
- * In this case, ch - 'A' + 10
+ * {@code 'A'} through {@code 'Z'} and its code is less than
+ * {@code radix + 'A' - 10}.
+ * In this case, {@code codePoint - 'A' + 10}
* is returned.
* 'a' through 'z' and its code is less than
- * radix + 'a' - 10.
- * In this case, ch - 'a' + 10
+ * {@code 'a'} through {@code 'z'} and its code is less than
+ * {@code radix + 'a' - 10}.
+ * In this case, {@code codePoint - 'a' + 10}
+ * is returned.
+ * int value that the specified Unicode
+ * Returns the {@code int} value that the specified Unicode
* character represents. For example, the character
- * '\u216C' (the roman numeral fifty) will return
+ * {@code '\u005Cu216C'} (the roman numeral fifty) will return
* an int with a value of 50.
* '\u0041' through
- * '\u005A'), lowercase
- * ('\u0061' through '\u007A'), and
- * full width variant ('\uFF21' through
- * '\uFF3A' and '\uFF41' through
- * '\uFF5A') forms have numeric values from 10
+ * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through
+ * {@code '\u005Cu005A'}), lowercase
+ * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and
+ * full width variant ({@code '\u005CuFF21'} through
+ * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through
+ * {@code '\u005CuFF5A'}) forms have numeric values from 10
* through 35. This is independent of the Unicode specification,
- * which does not assign numeric values to these char
+ * which does not assign numeric values to these {@code char}
* values.
* int
+ * @return the numeric value of the character, as a nonnegative {@code int}
* value; -2 if the character has a numeric value that is not a
* nonnegative integer; -1 if the character has no numeric value.
* @see Character#forDigit(int, int)
@@ -6333,19 +6357,19 @@ class Character implements java.io.Serializable, Comparableint value that the specified
+ * Returns the {@code int} value that the specified
* character (Unicode code point) represents. For example, the character
- * '\u216C' (the Roman numeral fifty) will return
- * an int with a value of 50.
+ * {@code '\u005Cu216C'} (the Roman numeral fifty) will return
+ * an {@code int} with a value of 50.
* '\u0041' through
- * '\u005A'), lowercase
- * ('\u0061' through '\u007A'), and
- * full width variant ('\uFF21' through
- * '\uFF3A' and '\uFF41' through
- * '\uFF5A') forms have numeric values from 10
+ * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through
+ * {@code '\u005Cu005A'}), lowercase
+ * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and
+ * full width variant ({@code '\u005CuFF21'} through
+ * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through
+ * {@code '\u005CuFF5A'}) forms have numeric values from 10
* through 35. This is independent of the Unicode specification,
- * which does not assign numeric values to these char
+ * which does not assign numeric values to these {@code char}
* values.
* int
+ * @return the numeric value of the character, as a nonnegative {@code int}
* value; -2 if the character has a numeric value that is not a
* nonnegative integer; -1 if the character has no numeric value.
* @see Character#forDigit(int, int)
@@ -6367,24 +6391,24 @@ class Character implements java.io.Serializable, Comparabletrue for the following five
+ * This method returns {@code true} for the following five
* characters only:
*
- *
*
* @param ch the character to be tested.
- * @return
- * '\t'
- * U+0009HORIZONTAL TABULATION
- * '\n'
- * U+000ANEW LINE
- * '\f'
- * U+000CFORM FEED
- * '\r'
- * U+000DCARRIAGE RETURN
+ * ' '
- * U+0020SPACE
+ * {@code '\t'} {@code U+0009}
+ * {@code HORIZONTAL TABULATION}
+ * {@code '\n'} {@code U+000A}
+ * {@code NEW LINE}
+ * {@code '\f'} {@code U+000C}
+ * {@code FORM FEED}
+ * {@code '\r'} {@code U+000D}
+ * {@code CARRIAGE RETURN}
* {@code ' '} {@code U+0020}
+ * {@code SPACE} true if the character is ISO-LATIN-1 white
- * space; false otherwise.
+ * @return {@code true} if the character is ISO-LATIN-1 white
+ * space; {@code false} otherwise.
* @see Character#isSpaceChar(char)
* @see Character#isWhitespace(char)
* @deprecated Replaced by isWhitespace(char).
@@ -6407,9 +6431,9 @@ class Character implements java.io.Serializable, Comparable
- *
*
* SPACE_SEPARATOR
- * LINE_SEPARATOR
- * PARAGRAPH_SEPARATOR
+ * true if the character is a space character;
- * false otherwise.
+ * @return {@code true} if the character is a space character;
+ * {@code false} otherwise.
* @see Character#isWhitespace(char)
* @since 1.1
*/
@@ -6441,8 +6465,8 @@ class Character implements java.io.Serializable, Comparabletrue if the character is a space character;
- * false otherwise.
+ * @return {@code true} if the character is a space character;
+ * {@code false} otherwise.
* @see Character#isWhitespace(int)
* @since 1.5
*/
@@ -6458,19 +6482,19 @@ class Character implements java.io.Serializable, Comparable
- *
*
* SPACE_SEPARATOR,
- * LINE_SEPARATOR, or PARAGRAPH_SEPARATOR)
- * but is not also a non-breaking space ('\u00A0',
- * '\u2007', '\u202F').
- * '\t', U+0009 HORIZONTAL TABULATION.
- * '\n', U+000A LINE FEED.
- * '\u000B', U+000B VERTICAL TABULATION.
- * '\f', U+000C FORM FEED.
- * '\r', U+000D CARRIAGE RETURN.
- * '\u001C', U+001C FILE SEPARATOR.
- * '\u001D', U+001D GROUP SEPARATOR.
- * '\u001E', U+001E RECORD SEPARATOR.
- * '\u001F', U+001F UNIT SEPARATOR.
+ * true if the character is a Java whitespace
- * character; false otherwise.
+ * @return {@code true} if the character is a Java whitespace
+ * character; {@code false} otherwise.
* @see Character#isSpaceChar(char)
* @since 1.1
*/
@@ -6496,23 +6520,23 @@ class Character implements java.io.Serializable, Comparable
*
* '\u00A0',
- * '\u2007', '\u202F').
- * '\t', U+0009 HORIZONTAL TABULATION.
- * '\n', U+000A LINE FEED.
- * '\u000B', U+000B VERTICAL TABULATION.
- * '\f', U+000C FORM FEED.
- * '\r', U+000D CARRIAGE RETURN.
- * '\u001C', U+001C FILE SEPARATOR.
- * '\u001D', U+001D GROUP SEPARATOR.
- * '\u001E', U+001E RECORD SEPARATOR.
- * '\u001F', U+001F UNIT SEPARATOR.
+ * but is not also a non-breaking space ({@code '\u005Cu00A0'},
+ * {@code '\u005Cu2007'}, {@code '\u005Cu202F'}).
+ * true if the character is a Java whitespace
- * character; false otherwise.
+ * @return {@code true} if the character is a Java whitespace
+ * character; {@code false} otherwise.
* @see Character#isSpaceChar(int)
* @since 1.5
*/
@@ -6523,9 +6547,9 @@ class Character implements java.io.Serializable, Comparable'\u0000'
- * through '\u001F' or in the range
- * '\u007F' through '\u009F'.
+ * character if its code is in the range {@code '\u005Cu0000'}
+ * through {@code '\u005Cu001F'} or in the range
+ * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}.
*
* true if the character is an ISO control character;
- * false otherwise.
+ * @return {@code true} if the character is an ISO control character;
+ * {@code false} otherwise.
*
* @see Character#isSpaceChar(char)
* @see Character#isWhitespace(char)
@@ -6547,13 +6571,13 @@ class Character implements java.io.Serializable, Comparable'\u0000'
- * through '\u001F' or in the range
- * '\u007F' through '\u009F'.
+ * character if its code is in the range {@code '\u005Cu0000'}
+ * through {@code '\u005Cu001F'} or in the range
+ * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return true if the character is an ISO control character;
- * false otherwise.
+ * @return {@code true} if the character is an ISO control character;
+ * {@code false} otherwise.
* @see Character#isSpaceChar(int)
* @see Character#isWhitespace(int)
* @since 1.5
@@ -6575,7 +6599,7 @@ class Character implements java.io.Serializable, Comparableint representing the
+ * @return a value of type {@code int} representing the
* character's general category.
* @see Character#COMBINING_SPACING_MARK
* @see Character#CONNECTOR_PUNCTUATION
@@ -6617,7 +6641,7 @@ class Character implements java.io.Serializable, Comparableint representing the
+ * @return a value of type {@code int} representing the
* character's general category.
* @see Character#COMBINING_SPACING_MARK COMBINING_SPACING_MARK
* @see Character#CONNECTOR_PUNCTUATION CONNECTOR_PUNCTUATION
@@ -6657,23 +6681,23 @@ class Character implements java.io.Serializable, Comparableradix is not a
- * valid radix, or the value of digit is not a valid
+ * the specified radix. If the value of {@code radix} is not a
+ * valid radix, or the value of {@code digit} is not a valid
* digit in the specified radix, the null character
- * ('\u0000') is returned.
+ * ({@code '\u005Cu0000'}) is returned.
* radix argument is valid if it is greater than or
- * equal to MIN_RADIX and less than or equal to
- * MAX_RADIX. The digit argument is valid if
- * 0 <=digit < radix.
+ * The {@code radix} argument is valid if it is greater than or
+ * equal to {@code MIN_RADIX} and less than or equal to
+ * {@code MAX_RADIX}. The {@code digit} argument is valid if
+ * {@code 0 <= digit < radix}.
* '0' + digit is returned. Otherwise, the value
- * 'a' + digit - 10 is returned.
+ * {@code '0' + digit} is returned. Otherwise, the value
+ * {@code 'a' + digit - 10} is returned.
*
* @param digit the number to convert to a character.
* @param radix the radix.
- * @return the char representation of the specified digit
+ * @return the {@code char} representation of the specified digit
* in the specified radix.
* @see Character#MIN_RADIX
* @see Character#MAX_RADIX
@@ -6696,16 +6720,16 @@ class Character implements java.io.Serializable, Comparablechar values is DIRECTIONALITY_UNDEFINED.
+ * {@code char} values is {@code DIRECTIONALITY_UNDEFINED}.
*
* char for which the directionality property
+ * @param ch {@code char} for which the directionality property
* is requested.
- * @return the directionality property of the char value.
+ * @return the directionality property of the {@code char} value.
*
* @see Character#DIRECTIONALITY_UNDEFINED
* @see Character#DIRECTIONALITY_LEFT_TO_RIGHT
@@ -6774,7 +6798,7 @@ class Character implements java.io.Serializable, Comparable'\u0028' LEFT
+ * right-to-left. For example, {@code '\u005Cu0028'} LEFT
* PARENTHESIS is semantically defined to be an opening
* parenthesis. This will appear as a "(" in text that is
* left-to-right but as a ")" in text that is right-to-left.
@@ -6784,9 +6808,9 @@ class Character implements java.io.Serializable, Comparablechar for which the mirrored property is requested
- * @return true if the char is mirrored, false
- * if the char is not mirrored or is not defined.
+ * @param ch {@code char} for which the mirrored property is requested
+ * @return {@code true} if the char is mirrored, {@code false}
+ * if the {@code char} is not mirrored or is not defined.
* @since 1.4
*/
public static boolean isMirrored(char ch) {
@@ -6798,13 +6822,13 @@ class Character implements java.io.Serializable, Comparable'\u0028' LEFT PARENTHESIS is semantically
+ * {@code '\u005Cu0028'} LEFT PARENTHESIS is semantically
* defined to be an opening parenthesis. This will appear
* as a "(" in text that is left-to-right but as a ")" in text
* that is right-to-left.
*
* @param codePoint the character (Unicode code point) to be tested.
- * @return true if the character is mirrored, false
+ * @return {@code true} if the character is mirrored, {@code false}
* if the character is not mirrored or is not defined.
* @since 1.5
*/
@@ -6813,16 +6837,16 @@ class Character implements java.io.Serializable, ComparableCharacter objects numerically.
+ * Compares two {@code Character} objects numerically.
*
- * @param anotherCharacter the Character to be compared.
+ * @param anotherCharacter the {@code Character} to be compared.
- * @return the value 0 if the argument Character
- * is equal to this Character; a value less than
- * 0 if this Character is numerically less
- * than the Character argument; and a value greater than
- * 0 if this Character is numerically greater
- * than the Character argument (unsigned comparison).
+ * @return the value {@code 0} if the argument {@code Character}
+ * is equal to this {@code Character}; a value less than
+ * {@code 0} if this {@code Character} is numerically less
+ * than the {@code Character} argument; and a value greater than
+ * {@code 0} if this {@code Character} is numerically greater
+ * than the {@code Character} argument (unsigned comparison).
* Note that this is strictly a numerical comparison; it is not
* locale-dependent.
* @since 1.2
@@ -6856,8 +6880,8 @@ class Character implements java.io.Serializable, ComparableCharacter.ERROR)
- * that indicates that a 1:M char mapping exists.
+ * any, or an error flag ({@code Character.ERROR})
+ * that indicates that a 1:M {@code char} mapping exists.
* @see Character#isLowerCase(char)
* @see Character#isUpperCase(char)
* @see Character#toLowerCase(char)
@@ -6873,11 +6897,11 @@ class Character implements java.io.Serializable, Comparablechar itself is returned in the
- * char[].
+ * mapping, then the {@code char} itself is returned in the
+ * {@code char[]}.
*
* @param codePoint the character (Unicode code point) to be converted.
- * @return a char[] with the uppercased character.
+ * @return a {@code char[]} with the uppercased character.
* @since 1.4
*/
static char[] toUpperCaseCharArray(int codePoint) {
@@ -6908,7 +6932,7 @@ class Character implements java.io.Serializable, ComparablecodePoint, or null if the code point is
+ * {@code codePoint}, or null if the code point is
* {@link #UNASSIGNED unassigned}.
*
+ * }
*
* @param codePoint the character (Unicode code point)
*
@@ -6931,7 +6953,7 @@ class Character implements java.io.Serializable, Comparable
- * Character.UnicodeBlock.of(codePoint)
- * .toString()
- * .replace('_', ' ')
+ * {@code
+ * Character.UnicodeBlock.of(codePoint).toString().replace('_', ' ')
* + " "
* + Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH);
*
- *
codePoint is not a valid Unicode
+ * {@code codePoint} is not a valid Unicode
* code point.
*
* @since 1.7
diff --git a/jdk/src/share/classes/java/lang/NullPointerException.java b/jdk/src/share/classes/java/lang/NullPointerException.java
index 24105eab27e..0472710f23f 100644
--- a/jdk/src/share/classes/java/lang/NullPointerException.java
+++ b/jdk/src/share/classes/java/lang/NullPointerException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,20 +26,24 @@
package java.lang;
/**
- * Thrown when an application attempts to use null in a
+ * Thrown when an application attempts to use {@code null} in a
* case where an object is required. These include:
*
- *
* null object.
- * null object.
- * null as if it were an array.
- * null as if it
+ * null as if it were a Throwable
+ * null object.
+ * other illegal uses of the {@code null} object.
+ *
+ * {@code NullPointerException} objects may be constructed by the
+ * virtual machine as if {@linkplain Throwable#Throwable(String,
+ * Throwable, boolean) suppression were disabled}.
*
* @author unascribed
* @since JDK1.0
@@ -49,14 +53,14 @@ class NullPointerException extends RuntimeException {
private static final long serialVersionUID = 5162710183389028792L;
/**
- * Constructs a NullPointerException with no detail message.
+ * Constructs a {@code NullPointerException} with no detail message.
*/
public NullPointerException() {
super();
}
/**
- * Constructs a NullPointerException with the specified
+ * Constructs a {@code NullPointerException} with the specified
* detail message.
*
* @param s the detail message.
diff --git a/jdk/src/share/classes/java/lang/OutOfMemoryError.java b/jdk/src/share/classes/java/lang/OutOfMemoryError.java
index 8cec23f762a..37b0ae6f476 100644
--- a/jdk/src/share/classes/java/lang/OutOfMemoryError.java
+++ b/jdk/src/share/classes/java/lang/OutOfMemoryError.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,22 +30,25 @@ package java.lang;
* because it is out of memory, and no more memory could be made
* available by the garbage collector.
*
+ * {@code OutOfMemoryError} objects may be constructed by the virtual
+ * machine as if {@linkplain Throwable#Throwable(String, Throwable,
+ * boolean) suppression were disabled}.
+ *
* @author unascribed
* @since JDK1.0
*/
-public
-class OutOfMemoryError extends VirtualMachineError {
+public class OutOfMemoryError extends VirtualMachineError {
private static final long serialVersionUID = 8228564086184010517L;
/**
- * Constructs an OutOfMemoryError with no detail message.
+ * Constructs an {@code OutOfMemoryError} with no detail message.
*/
public OutOfMemoryError() {
super();
}
/**
- * Constructs an OutOfMemoryError with the specified
+ * Constructs an {@code OutOfMemoryError} with the specified
* detail message.
*
* @param s the detail message.
diff --git a/jdk/src/share/classes/java/lang/Throwable.java b/jdk/src/share/classes/java/lang/Throwable.java
index c77868e366e..2784238efa4 100644
--- a/jdk/src/share/classes/java/lang/Throwable.java
+++ b/jdk/src/share/classes/java/lang/Throwable.java
@@ -46,13 +46,16 @@ import java.util.*;
* are freshly created in the context of the exceptional situation so
* as to include relevant information (such as stack trace data).
*
- *
- * try {
- * lowLevelOp();
- * } catch (LowLevelException le) {
- * throw new HighLevelException(le); // Chaining-aware constructor
- * }
- *
+ * {@code Throwable} constructors that takes a cause.
+ *
* Because the {@code initCause} method is public, it allows a cause to be
* associated with any throwable, even a "legacy throwable" whose
* implementation predates the addition of the exception chaining mechanism to
- * {@code Throwable}. For example:
- *
- * try {
- * lowLevelOp();
- * } catch (LowLevelException le) {
- * throw (HighLevelException)
- * new HighLevelException().initCause(le); // Legacy constructor
- * }
- *
- *
- *
- * java.nio:type=BufferPool,name=pool name
- *
+ *
+ * java.nio:type=BufferPool,name=pool name
+ *
* where pool name is the {@link #getName name} of the buffer pool.
*
* @since 1.7
*/
-
public interface BufferPoolMXBean extends PlatformManagedObject {
/**
diff --git a/jdk/src/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/share/classes/java/lang/management/ManagementFactory.java
index bfe9d23f959..2dd64d19a84 100644
--- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java
+++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java
@@ -40,8 +40,9 @@ import javax.management.NotCompliantMBeanException;
import javax.management.StandardEmitterMBean;
import javax.management.StandardMBean;
import java.util.Collections;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
@@ -51,37 +52,63 @@ import javax.management.JMX;
import sun.management.ManagementFactoryHelper;
/**
- * The ManagementFactory class is a factory class for getting
+ * The {@code ManagementFactory} class is a factory class for getting
* managed beans for the Java platform.
* This class consists of static methods each of which returns
- * one or more platform MXBean(s) representing
+ * one or more platform MXBeans representing
* the management interface of a component of the Java virtual
* machine.
+ * Platform MXBeans
+ * 1. Direct access to an MXBean interface
+ *
*
@@ -266,7 +184,7 @@ import sun.management.ManagementFactoryHelper;
*
- *
+ *
- *
- *
2. Indirect access to an MXBean interface via MBeanServer
+ *
+ *
- *
- * Platform MXBeans
- * A platform MXBean is a managed bean that conforms to
- * the JMX Instrumentation Specification and only uses
- * a set of basic data types described below.
- * See
- * the specification of MXBeans for details.
- * All platform MXBean interfaces extend {@link PlatformManagedObject}s
- * and new methods may be added in these interfaces
- * in future Java SE releases.
- *
- *
- *
- *
- *
- *
- * The {@link javax.management.MBeanInfo MBeanInfo}
- * for a platform MXBean
- * describes the data types of the attributes and operations
- * as primitive or open types mapped as specified above.
- *
- *
- *
- * These attributes in the MBeanInfo
- * of the MemoryMXBean have the following names and types:
- *
- *
- * public MemoryUsage getHeapMemoryUsage();
- * public boolean isVerbose();
- * public void setVerbose(boolean value);
- *
- *
*
- *
- *
*
- *
- * Attribute Name
- * Type
- *
- *
- * HeapMemoryUsage
- * {@link MemoryUsage#from
- * CompositeData representing MemoryUsage}
- *
- *
- * Verbose
- * boolean
- * MXBean Names
- * Each platform MXBean for a Java virtual machine has a unique
- * {@link javax.management.ObjectName ObjectName} for
- * registration in the platform MBeanServer that can
- * be obtained by calling the {@link PlatformManagedObject#getObjectName}
- * method.
- *
+ *
*
* {@link ClassLoadingMXBean}
* {@link #CLASS_LOADING_MXBEAN_NAME
- * java.lang:type=ClassLoading}
+ * java.lang:type=ClassLoading}
*
*
* {@link MemoryMXBean}
* {@link #MEMORY_MXBEAN_NAME
- * java.lang:type=Memory}
+ * java.lang:type=Memory}
*
*
* {@link ThreadMXBean}
* {@link #THREAD_MXBEAN_NAME
- * java.lang:type=Threading}
+ * java.lang:type=Threading}
*
*
* {@link RuntimeMXBean}
* {@link #RUNTIME_MXBEAN_NAME
- * java.lang:type=Runtime}
+ * java.lang:type=Runtime}
*
*
+ * {@link OperatingSystemMXBean}
* {@link #OPERATING_SYSTEM_MXBEAN_NAME
- * java.lang:type=OperatingSystem}
+ * java.lang:type=OperatingSystem}
+ *
+ *
*
* {@link PlatformLoggingMXBean}
+ * {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME
+ * java.util.logging:type=Logging}
*
*
*
*
@@ -283,17 +201,21 @@ import sun.management.ManagementFactoryHelper;
* {@link CompilationMXBean}
* {@link #COMPILATION_MXBEAN_NAME
- * java.lang:type=Compilation}
+ * java.lang:type=Compilation}
*
*
* {@link GarbageCollectorMXBean}
* {@link #GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
- * java.lang:type=GarbageCollector},name=collector's name
+ * java.lang:type=GarbageCollector},name=collector's name
*
*
* {@link MemoryManagerMXBean}
* {@link #MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
- * java.lang:type=MemoryManager},name=manager's name
+ * java.lang:type=MemoryManager},name=manager's name
*
*
+ * {@link MemoryPoolMXBean}
* {@link #MEMORY_POOL_MXBEAN_DOMAIN_TYPE
- * java.lang:type=MemoryPool},name=pool's name
+ * java.lang:type=MemoryPool},name=pool's name
+ *
+ *
*
*
@@ -302,7 +224,6 @@ import sun.management.ManagementFactoryHelper;
* JMX Specification {@link BufferPoolMXBean}
+ * {@code java.nio:type=BufferPool,name=}pool name
*
+ * {@link #getPlatformMXBeans(Class)
+ * getPlatformMXBeans(mxbeanInterface)}.get(0);
+ *
+ *
+ * @param mxbeanInterface a management interface for a platform
+ * MXBean with one single instance in the Java virtual machine
+ * if implemented.
+ *
+ * @return the platform MXBean that implements
+ * {@code mxbeanInterface}, or {@code null} if not exist.
+ *
+ * @throws IllegalArgumentException if {@code mxbeanInterface}
+ * is not a platform management interface or
+ * not a singleton platform MXBean.
+ *
+ * @since 1.7
+ */
+ public static
+ * {@link #getPlatformMXBeans(MBeanServerConnection, Class)
+ * getPlatformMXBeans(connection, mxbeanInterface)}.get(0);
+ *
+ *
+ * @param connection the {@code MBeanServerConnection} to forward to.
+ * @param mxbeanInterface a management interface for a platform
+ * MXBean with one single instance in the Java virtual machine
+ * being monitored, if implemented.
+ *
+ * @return the platform MXBean proxy for
+ * forwarding the method calls of the {@code mxbeanInterface}
+ * through the given {@code MBeanServerConnection},
+ * or {@code null} if not exist.
+ *
+ * @throws IllegalArgumentException if {@code mxbeanInterface}
+ * is not a platform management interface or
+ * not a singleton platform MXBean.
+ * @throws java.io.IOException if a communication problem
+ * occurred when accessing the {@code MBeanServerConnection}.
+ *
+ * @see #newPlatformMXBeanProxy
+ * @since 1.7
+ */
+ public static
+ * PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
+ *
+ * The {@code PlatformLoggingMXBean} object is also registered with the
+ * platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
+ * MBeanServer}.
+ * The {@link javax.management.ObjectName ObjectName} for uniquely
+ * identifying the {@code PlatformLoggingMXBean} within an MBeanServer is:
+ *
+ * {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
+ *
+ *
+ *
+ * {@link java.util.logging.Logger#getLevel
+ * Logger.getLevel()}.{@link java.util.logging.Level#getName getName()};
+ *
+ *
+ * Platform MXBeans
-
-This package defines the management interface of the following
-components:
-
-
-
-
+Provides the management interfaces for monitoring and management of the
+Java virtual machine and other components in the Java runtime.
+It allows both local and remote
+monitoring and management of the running Java virtual machine.
-
-
-
-
-
-
-
- {@link java.lang.management.ClassLoadingMXBean}
- Class loading system of the Java virtual machine.
-
-
- {@link java.lang.management.CompilationMXBean}
- Compilation system of the Java virtual machine.
-
-
- {@link java.lang.management.MemoryMXBean}
- Memory system of the Java virtual machine.
-
-
- {@link java.lang.management.ThreadMXBean}
- Threads system of the Java virtual machine.
-
-
- {@link java.lang.management.RuntimeMXBean}
- Runtime system of the Java virtual machine.
-
-
- {@link java.lang.management.OperatingSystemMXBean}
- Operating system on which the Java virtual machine is running.
-
-
- {@link java.lang.management.GarbageCollectorMXBean}
- Garbage collector in the Java virtual machine.
-
-
- {@link java.lang.management.MemoryManagerMXBean}
- Memory manager in the Java virtual machine.
-
-
- {@link java.lang.management.MemoryPoolMXBean}
- Memory pool in the Java virtual machine.
-
-
-
-Below shows a few examples of different
-ways to access MXBeans.
+
-
-
Platform MXBean
+ManagementFactory
-The {@link java.lang.management.ManagementFactory} class is the management
-factory class for the Java platform. This class provides a set of
+Interoperability
-A management application and a platform MBeanServer of a running
-virtual machine can interoperate
+Ways to Access MXBeans
-There are three different ways to access the management interfaces.
-
+
-
+
+
+
-
+1. Direct access to an MXBean interface
+
+
RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
// Get the standard attribute "VmVendor"
String vendor = mxbean.getVmVendor();
-
-
+ RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
-
-
-
+ // Get the standard attribute "VmVendor"
+ String vendor = mxbean.getVmVendor();
+
+
+ MBeanServerConnection mbs;
+
+ // Connect to a running JVM (or itself) and get MBeanServerConnection
+ // that has the JVM MBeans registered in it
+ ...
+
+ // Get a MBean proxy for RuntimeMXBean interface
+ RuntimeMXBean proxy =
+ {@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
+ ManagementFactory.getPlatformMXBean}(mbs,
+ RuntimeMXBean.class);
+ // Get standard attribute "VmVendor"
+ String vendor = proxy.getVmVendor();
+
+
+ RuntimeMXBean proxy =
+ {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
+ ManagementFactory.newPlatformMXBeanProxy}(mbs,
+ ManagementFactory.RUNTIME_MXBEAN_NAME,
+ RuntimeMXBean.class);
+
+
+
MBeanServerConnection mbs;
// Connect to a running JVM (or itself) and get MBeanServerConnection
@@ -190,7 +154,7 @@ There are three different ways to access the management interfaces.
try {
// Assuming the RuntimeMXBean has been registered in mbs
ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-
+
// Get standard attribute "VmVendor"
String vendor = (String) mbs.getAttribute(oname, "VmVendor");
} catch (....) {
@@ -198,36 +162,19 @@ There are three different ways to access the management interfaces.
// and MBeanServer.getAttribute method
...
}
-
-
-
- MBeanServerConnection mbs;
-
- // Connect to a running JVM (or itself) and get MBeanServerConnection
- // that has the JVM MBeans registered in it
- ...
-
- // Get a MBean proxy for RuntimeMXBean interface
- RuntimeMXBean proxy =
- ManagementFactory.newPlatformMXBeanProxy(mbs,
- ManagementFactory.RUNTIME_MXBEAN_NAME,
- RuntimeMXBean.class);
- // Get standard attribute "VmVendor"
- String vendor = proxy.getVmVendor();
-
Platform Extension
-A Java virtual machine implementation may add its platform extension to
+
- com.sun.management.RuntimeMXBean mxbean =
- (com.sun.management.RuntimeMXBean) ManagementFactory.getRuntimeMXBean();
+1) Direct access to the Oracle-specific MXBean interface
+
+
+ List<com.sun.management.GarbageCollectorMXBean> mxbeans =
+ ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
- // Get the standard attribute "VmVendor"
- String vendor = mxbean.getVmVendor();
-
- // Get the platform-specific attribute "Bar"
- BarType bar = mxbean.getBar();
+ for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+ // Get the standard attribute "CollectionCount"
+ String count = mxbean.getCollectionCount();
+ // Get the platform-specific attribute "LastGcInfo"
+ GcInfo gcinfo = gc.getLastGcInfo();
+ ...
+ }
MBeanServerConnection mbs;
@@ -268,24 +219,17 @@ attribute from Sun's implementation of the RuntimeMXBean.
// that has the JVM MXBeans registered in it
...
- try {
- // Assuming the RuntimeMXBean has been registered in mbs
- ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-
- // Get standard attribute "VmVendor"
- String vendor = (String) mbs.getAttribute(oname, "VmVendor");
+ List<com.sun.management.GarbageCollectorMXBean> mxbeans =
+ ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
- // Check if this MXBean contains Sun's extension
- if (mbs.isInstanceOf(oname, "com.sun.management.RuntimeMXBean")) {
- // Get platform-specific attribute "Bar"
- BarType bar = (String) mbs.getAttribute(oname, "Bar");
- }
- } catch (....) {
- // Catch the exceptions thrown by ObjectName constructor
- // and MBeanServer methods
+ for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+ // Get the standard attribute "CollectionCount"
+ String count = mxbean.getCollectionCount();
+
+ // Get the platform-specific attribute "LastGcInfo"
+ GcInfo gcinfo = gc.getLastGcInfo();
...
}
-
* Arrays.sort(a, Collections.reverseOrder());
* sorts the array in reverse-lexicographic (alphabetical) order.
+ *
*
- *
+ * containing all of the key-value mappings in {@code m} whose keys are
+ * between {@code low} and {@code high}, inclusive:
* SortedMap<String, V> sub = m.subMap(low, high+"\0");
*
- * A similar technique can be used to generate an open range
+ * A similar technique can be used to generate an open range
* (which contains neither endpoint). The following idiom obtains a
- * view containing all of the key-value mappings in m whose keys
- * are between low and high, exclusive:
+ * view containing all of the key-value mappings in {@code m} whose keys
+ * are between {@code low} and {@code high}, exclusive:
* SortedMap<String, V> sub = m.subMap(low+"\0", high);
*
*
- * List<{@link PlatformLoggingMXBean}> result = ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
+ * PlatformLoggingMXBean logging = {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean}(PlatformLoggingMXBean.class);
*
*
* @return a {@link LoggingMXBean} object.
*
- * @see PlatformLoggingMXBean
- * @see java.lang.management.ManagementFactory
+ * @see java.lang.management.PlatformLoggingMXBean
* @since 1.5
*/
- public static synchronized LoggingMXBean getLoggingMXBean() {
+ public static synchronized LoggingMXBean getLoggingMXBean() {
if (loggingMXBean == null) {
loggingMXBean = new Logging();
}
diff --git a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java
index d6700e098bc..2c9bad2feb8 100644
--- a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java
+++ b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java
@@ -27,36 +27,41 @@ package java.util.logging;
/**
- * The management interface for the logging facility.
+ * The management interface for the logging facility. It is recommended
+ * to use the {@link java.lang.management.PlatformLoggingMXBean} management
+ * interface that implements all attributes defined in this
+ * {@code LoggingMXBean}. The
+ * {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean} method can be used to obtain
+ * the {@code PlatformLoggingMXBean} object representing the management
+ * interface for logging.
*
*
- * {@link LogManager#LOGGING_MXBEAN_NAME
- * java.util.logging:type=Logging}
- *
- *
- * The instance registered in the platform MBeanServer with
- * this {@code ObjectName} is also a {@link PlatformLoggingMXBean}.
+ *
+ * {@link LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
+ *
+ *
- * ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
- *
- * or from the {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
- * platform MBeanServer}.
- *
- * The {@link javax.management.ObjectName ObjectName} for uniquely
- * identifying the LoggingMXBean within an MBeanServer is:
- *
- * java.util.logging:type=Logging
- *
- *
- * The {@link PlatformManagedObject#getObjectName} method
- * can be used to obtain its {@code ObjectName}.
- *
- * @see java.lang.management.PlatformManagedObject
- *
- * @author Mandy Chung
- * @since 1.7
- */
-public interface PlatformLoggingMXBean extends LoggingMXBean, PlatformManagedObject {
-}
diff --git a/jdk/src/share/classes/java/util/logging/SimpleFormatter.java b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java
index e318a047f2b..87f2c7eeba6 100644
--- a/jdk/src/share/classes/java/util/logging/SimpleFormatter.java
+++ b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java
@@ -29,31 +29,108 @@ package java.util.logging;
import java.io.*;
import java.text.*;
import java.util.Date;
+import sun.util.logging.LoggingSupport;
/**
- * Print a brief summary of the LogRecord in a human readable
+ * Print a brief summary of the {@code LogRecord} in a human readable
* format. The summary will typically be 1 or 2 lines.
*
+ *
+ * {@link String#format String.format}(format, date, source, logger, level, message, thrown);
+ *
+ * where the arguments are:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * WARNING: warning message [Tue Mar 22 13:11:31 PDT 2011]
+ *
+ * Tue Mar 22 13:11:31 PDT 2011 MyClass fatal
+ * SEVERE: several message with an exception
+ * java.lang.IllegalArgumentException: invalid argument
+ * at MyClass.mash(MyClass.java:9)
+ * at MyClass.crunch(MyClass.java:6)
+ * at MyClass.main(MyClass.java:3)
+ *
+ * Mar 22, 2011 1:11:31 PM MyClass fatal
+ * SEVERE: several message with an exception
+ *
getNodeName.
*
- * @return the node name, as a StringString
*/
public String getTagName() {
return nodeName;
diff --git a/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java b/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java
index 87b582fed30..678b0a2ff6d 100644
--- a/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java
+++ b/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
* @exception NullPointerException if builder is null
*/
public KeyStoreBuilderParameters(Builder builder) {
- parameters = Collections.singletonList(builder);
+ parameters = Collections.singletonList(Objects.requireNonNull(builder));
}
/**
@@ -64,11 +64,12 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
* @exception IllegalArgumentException if parameters is an empty list
*/
public KeyStoreBuilderParameters(List
* public void installUI(JComponent c) {
@@ -834,7 +834,7 @@ public final class JLayerString value passed as the edge,
* no action is taken. For a null edge, a
* NullPointerException is thrown.
+ *
+ * Note: This method can affect {@code x} and {@code y} values
+ * previously set for this {@code Constraints}.
*
* @param edgeName the edge to be set
* @param s the spring controlling the specified edge
diff --git a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java
index e118467aa99..c7ff14eeb4b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java
@@ -25,9 +25,7 @@
package javax.swing.plaf;
-import javax.accessibility.Accessible;
import javax.swing.*;
-import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
@@ -38,7 +36,7 @@ import java.io.Serializable;
/**
* The base class for all {@link javax.swing.JLayer}'s UI delegates.
*
- * {@link #paint(java.awt.Graphics, javax.swing.JComponent)} method performes the
+ * {@link #paint(java.awt.Graphics, javax.swing.JComponent)} method performs the
* painting of the {@code JLayer}
* and {@link #eventDispatched(AWTEvent, JLayer)} method is notified
* about any {@code AWTEvent}s which have been generated by a {@code JLayer}
@@ -165,7 +163,7 @@ public class LayerUIFractals 1.1
-