This commit is contained in:
Lana Steuck 2011-04-25 15:44:20 -07:00
commit b550ca992e
390 changed files with 18428 additions and 4223 deletions

View File

@ -56,10 +56,6 @@ build: unpacker
vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)
ifeq ($(STANDALONE),true)
ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME)
@ -131,8 +127,9 @@ prop:
pack200-tool:
$(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack)
# ignore mapfile for non-product binary
unpacker:
$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG=
$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_DBG=
ifeq ($(PLATFORM), windows)
IMVERSIONVALUE=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
@ -147,8 +144,14 @@ winres::
$(ECHO) "Resource files not required for Unix"
endif
# Mapfile-vers.gmk, does not copy over the mapfile-vers-unpack200, when
# the make utiliy is re-invoked, as in this case. In order to workaround
# this special case, the mapfile required for the unpack200 command, is
# explicitly copied over to the expected location.
$(UNPACK_EXE): $(UNPACK_EXE_FILES_o) updatefiles winres
$(prep-target)
$(RM) $(TEMPDIR)/mapfile-vers
$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
$(LINKER) $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
ifdef MT
$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1

View File

@ -0,0 +1,31 @@
#
# 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.
#
# Define library interface.
SUNWprivate_1.1 {
local:
*;
};

View File

@ -52,8 +52,8 @@ ifeq ($(VARIANT), OPT)
endif
# If we are re-ordering functions in this solaris library, we need to make
# sure that -xF is added to the compile lines. This option is critical and
# enables the functions to be reordered.
# sure that -xF is added to the compile lines. This option is critical and
# enables the functions to be reordered.
ifdef FILES_reorder
CFLAGS_OPT += -xF
CXXFLAGS_OPT += -xF
@ -76,7 +76,6 @@ endif
endif # PLATFORM
ifeq ($(PLATFORM), linux)
ifeq ($(VARIANT), OPT)

View File

@ -55,6 +55,11 @@ program_default_rule: all
program: $(ACTUAL_PROGRAM)
# reuse the mapfiles in the launcher's directory, the same should
# be applicable to the tool launchers as well.
FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH)
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(JDK_TOPDIR)/make/common/Rules.gmk
ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE

View File

@ -885,12 +885,18 @@ else
ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
# Java DB image. Move the Java DB demo directory into the JDK's demo
# dir and in the process, rename it to db. Also remove index.html,
# since it presumes docs are co-located. Also remove register.html (no
# longer relevant).
initial-image-jdk-db: $(DB_ZIP_LIST)
$(MKDIR) -p $(JDK_IMAGE_DIR)/db
for d in $(DB_ZIP_LIST); do \
($(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
done
$(RM) -rf $(DEMODIR)/db
$(MV) $(JDK_IMAGE_DIR)/db/demo $(DEMODIR)/db
$(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/register.html
endif
# Standard jdk image

View File

@ -53,7 +53,7 @@ DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
# Url to Java Language Spec
JLS3_URL = http://java.sun.com/docs/books/jls/
#JLS3_URL = http://java.sun.com/docs/books/jls/
# Common Java trademark line
JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
@ -293,8 +293,8 @@ COREAPI_HEADER = \
<strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
# Java language specification cite
TAG_JLS3 = jls3:a:See <cite><a href="$(JLS3_URL)"> \
The Java Language Specification, Third Edition</a></cite>:
TAG_JLS = jls:a:See <cite> \
The Java&trade; Language Specification</cite>:
# Overview file for core apis
COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html
@ -329,7 +329,7 @@ $(COREAPI_OPTIONS_FILE): $(COREAPI_OVERVIEW)
$(call OptionPair,-tag,specdefault:X) ; \
$(call OptionPair,-tag,Note:X) ; \
$(call OptionPair,-tag,ToDo:X) ; \
$(call OptionPair,-tag,$(TAG_JLS3)) ; \
$(call OptionPair,-tag,$(TAG_JLS)) ; \
$(call OptionOnly,-splitIndex) ; \
$(call OptionPair,-overview,$(COREAPI_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(COREAPI_DOCTITLE)) ; \
@ -1081,6 +1081,7 @@ $(TREEAPI_OPTIONS_FILE):
$(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-tag,$(TAG_JLS)) ; \
$(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
$(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \

View File

@ -189,7 +189,6 @@ JAVA_JAVA_java = \
java/util/ListResourceBundle.java \
sun/util/EmptyListResourceBundle.java \
java/util/Locale.java \
sun/util/locale/AsciiUtil.java \
sun/util/locale/BaseLocale.java \
sun/util/locale/Extension.java \
sun/util/locale/InternalLocaleBuilder.java \
@ -197,6 +196,7 @@ JAVA_JAVA_java = \
sun/util/locale/LocaleExtensions.java \
sun/util/locale/LocaleObjectCache.java \
sun/util/locale/LocaleSyntaxException.java \
sun/util/locale/LocaleUtils.java \
sun/util/locale/ParseStatus.java \
sun/util/locale/StringTokenIterator.java \
sun/util/locale/UnicodeLocaleExtension.java \

View File

@ -61,5 +61,4 @@ OTHER_CPPFLAGS += -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"'
ifeq ($(PLATFORM), solaris)
LDFLAGS += -R$(OPENWIN_LIB)
LDFLAGS += -M mapfile-$(ARCH)
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
# interested in declaring a version, simply scoping the file is sufficient.
#
{
SUNWprivate_1.1 {
global:
main; # Provides basic adb symbol offsets
environ; # Public symbols and required by Java run time

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
# interested in declaring a version, simply scoping the file is sufficient.
#
{
SUNWprivate_1.1 {
global:
main; # Provides basic adb symbol offsets
environ; # Public symbols and required by Java run time

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
# interested in declaring a version, simply scoping the file is sufficient.
#
{
SUNWprivate_1.1 {
global:
main; # Provides basic adb symbol offsets
environ; # Public symbols and required by Java run time

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@
# interested in declaring a version, simply scoping the file is sufficient.
#
{
SUNWprivate_1.1 {
global:
main; # Provides basic adb symbol offsets
environ; # Public symbols and required by Java run time

View File

@ -58,7 +58,7 @@ endef
SIGNING_KEY_DIR = /security/ws/JCE-signing/src
SIGNING_KEYSTORE = $(SIGNING_KEY_DIR)/KeyStore.jks
SIGNING_PASSPHRASE = $(SIGNING_KEY_DIR)/passphrase.txt
SIGNING_ALIAS = jce_rsa
SIGNING_ALIAS = oracle_jce_rsa
#
# Defines for signing the various jar files.

View File

@ -519,9 +519,8 @@ JDWP "Java(tm) Debug Wire Protocol"
"Both the JNI signature and the generic signature are "
"returned for each class. "
"Generic signatures are described in the signature attribute "
"section in the "
"<a href=\"http://java.sun.com/docs/books/vmspec\">
"Java Virtual Machine Specification, 3rd Edition.</a> "
"section in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"Since JDWP version 1.5."
(Out
)
@ -623,8 +622,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(referenceType refType "The reference type ID.")
)
(Reply
(int modBits "Modifier bits as defined in the "
"<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>")
(int modBits "Modifier bits as defined in Chapter 4 of "
"<cite>The Java&trade; Virtual Machine Specification</cite>")
)
(ErrorSet
(Error INVALID_CLASS "refType is not the ID of a reference "
@ -651,8 +650,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(int modBits "The modifier bit flags (also known as access flags) "
"which provide additional information on the "
"field declaration. Individual flag values are "
"defined in the "
"<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
"defined in Chapter 4 of "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"In addition, The <code>0xf0000000</code> bit identifies "
"the field as synthetic, if the synthetic attribute "
"<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@ -686,8 +685,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(int modBits "The modifier bit flags (also known as access flags) "
"which provide additional information on the "
"method declaration. Individual flag values are "
"defined in the "
"<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
"defined in Chapter 4 of "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"In addition, The <code>0xf0000000</code> bit identifies "
"the method as synthetic, if the synthetic attribute "
"<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@ -773,8 +772,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(Command Status=9
"Returns the current status of the reference type. The status "
"indicates the extent to which the reference type has been "
"initialized, as described in the "
"<a href=\"http://java.sun.com/docs/books/vmspec/html/Concepts.doc.html#16491\">VM specification</a>. "
"initialized, as described in section 2.1.6 of "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"If the class is linked the PREPARED and VERIFIED bits in the returned status bits "
"will be set. If the class is initialized the INITIALIZED bit in the returned "
"status bits will be set. If an error occured during initialization then the "
@ -852,9 +851,8 @@ JDWP "Java(tm) Debug Wire Protocol"
"Returns the JNI signature of a reference type along with the "
"generic signature if there is one. "
"Generic signatures are described in the signature attribute "
"section in the "
"<a href=\"http://java.sun.com/docs/books/vmspec\">
"Java Virtual Machine Specification, 3rd Edition.</a> "
"section in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"Since JDWP version 1.5."
"<p>
(Out
@ -882,9 +880,8 @@ JDWP "Java(tm) Debug Wire Protocol"
"by the compiler. "
"Fields are returned in the order they occur in the class file. "
"Generic signatures are described in the signature attribute "
"section in the "
"<a href=\"http://java.sun.com/docs/books/vmspec\">
"Java Virtual Machine Specification, 3rd Edition.</a> "
"section in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"Since JDWP version 1.5."
(Out
(referenceType refType "The reference type ID.")
@ -900,8 +897,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(int modBits "The modifier bit flags (also known as access flags) "
"which provide additional information on the "
"field declaration. Individual flag values are "
"defined in the "
"<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
"defined in Chapter 4 of "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"In addition, The <code>0xf0000000</code> bit identifies "
"the field as synthetic, if the synthetic attribute "
"<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@ -925,9 +922,8 @@ JDWP "Java(tm) Debug Wire Protocol"
"if present, and any synthetic methods created by the compiler. "
"Methods are returned in the order they occur in the class file. "
"Generic signatures are described in the signature attribute "
"section in the "
"<a href=\"http://java.sun.com/docs/books/vmspec\">
"Java Virtual Machine Specification, 3rd Edition.</a> "
"section in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"Since JDWP version 1.5."
(Out
(referenceType refType "The reference type ID.")
@ -943,8 +939,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(int modBits "The modifier bit flags (also known as access flags) "
"which provide additional information on the "
"method declaration. Individual flag values are "
"defined in the "
"<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
"defined in Chapter 4 of "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"In addition, The <code>0xf0000000</code> bit identifies "
"the method as synthetic, if the synthetic attribute "
"<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@ -1006,8 +1002,8 @@ JDWP "Java(tm) Debug Wire Protocol"
)
(Command ConstantPool=18
"Return the raw bytes of the constant pool in the format of the "
"constant_pool item of the Class File Format in the "
"Java Virtual Machine Specification. "
"constant_pool item of the Class File Format in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"<p>Since JDWP version 1.6. Requires canGetConstantPool capability - see "
"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>.""
(Out
@ -1016,7 +1012,8 @@ JDWP "Java(tm) Debug Wire Protocol"
(Reply
(int count "Total number of constant pool entries plus one. This "
"corresponds to the constant_pool_count item of the "
"Class File Format in the Java Virtual Machine Specification. ")
"Class File Format in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. ")
(Repeat bytes
(byte cpbytes "Raw bytes of constant pool")
)
@ -1324,7 +1321,8 @@ JDWP "Java(tm) Debug Wire Protocol"
)
)
(Command Bytecodes=3
"Retrieve the method's bytecodes as defined in the JVM Specification."
"Retrieve the method's bytecodes as defined in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"Requires canGetBytecodes capability - see "
"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>."
(Out
@ -1379,9 +1377,8 @@ JDWP "Java(tm) Debug Wire Protocol"
"instance methods, the \"this\" reference is included in the "
"table. Also, synthetic variables may be present. "
"Generic signatures are described in the signature attribute "
"section in the "
"<a href=\"http://java.sun.com/docs/books/vmspec\">
"Java Virtual Machine Specification, 3rd Edition.</a> "
"section in "
"<cite>The Java&trade; Virtual Machine Specification</cite>. "
"Since JDWP version 1.5."
(Out
(referenceType refType "The class.")
@ -1970,8 +1967,9 @@ JDWP "Java(tm) Debug Wire Protocol"
"<p>"
"The method which will return early is referred to as the "
"called method. The called method is the current method (as "
"defined by the Frames section in the Java Virtual Machine "
"Specification) for the specified thread at the time this command "
"defined by the Frames section in "
"<cite>The Java&trade; Virtual Machine Specification</cite>) "
"for the specified thread at the time this command "
"is received. "
"<p>"
"The specified thread must be suspended. "

View File

@ -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
@ -38,7 +38,7 @@ else
endif
SUBDIRS =
SUBDIRS_misc = nio scripting nbproject
SUBDIRS_misc = nio scripting nbproject forkjoin
SUBDIRS_enterprise = $(WEBSERVICES_SUBDIR)
SUBDIRS_management = jmx

View File

@ -0,0 +1,41 @@
#
# 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 for building all the samples under the forkjoin subdirectory.
#
BUILDDIR = ../..
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = mergesort
include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::
$(SUBDIRS-loop)
clobber clean ::
$(RM) -r $(SAMPLEDIR)/forkjoin

View File

@ -0,0 +1,51 @@
#
# 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 for the forkjoin/mergesort sample code
#
BUILDDIR = ../../..
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/forkjoin/mergesort
SAMPLE_DST_DIR = $(SAMPLEDIR)/forkjoin/mergesort
SAMPLE_FILES = \
$(SAMPLE_DST_DIR)/MergeDemo.java \
$(SAMPLE_DST_DIR)/MergeSort.java
all build: $(SAMPLE_FILES)
$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
$(install-file)
clean clobber:
$(RM) -r $(SAMPLE_DST_DIR)
.PHONY: all build clean clobber

View File

@ -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
@ -31,7 +31,7 @@ BUILDDIR = ../..
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = file multicast server
SUBDIRS = chatserver file multicast server
include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::

View File

@ -0,0 +1,56 @@
#
# 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 for the nio/chatserver sample code
#
BUILDDIR = ../../..
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/nio/chatserver
SAMPLE_DST_DIR = $(SAMPLEDIR)/nio/chatserver
SAMPLE_FILES = \
$(SAMPLE_DST_DIR)/ChatServer.java \
$(SAMPLE_DST_DIR)/Client.java \
$(SAMPLE_DST_DIR)/ClientReader.java \
$(SAMPLE_DST_DIR)/DataReader.java \
$(SAMPLE_DST_DIR)/MessageReader.java \
$(SAMPLE_DST_DIR)/NameReader.java \
$(SAMPLE_DST_DIR)/README.txt
all build: $(SAMPLE_FILES)
$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
$(install-file)
clean clobber:
$(RM) -r $(SAMPLE_DST_DIR)
.PHONY: all build clean clobber

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,6 @@ char *JLI_StringDup(const char *s1);
void JLI_MemFree(void *ptr);
int JLI_StrCCmp(const char *s1, const char* s2);
#define JLI_StrLen(p1) strlen((p1))
#define JLI_StrChr(p1, p2) strchr((p1), (p2))
#define JLI_StrRChr(p1, p2) strrchr((p1), (p2))
@ -48,6 +47,7 @@ int JLI_StrCCmp(const char *s1, const char* s2);
#define JLI_StrSpn(p1, p2) strspn((p1), (p2))
#define JLI_StrCSpn(p1, p2) strcspn((p1), (p2))
#define JLI_StrPBrk(p1, p2) strpbrk((p1), (p2))
#define JLI_StrTok(p1, p2) strtok((p1), (p2))
/* On Windows lseek() is in io.h rather than the location dictated by POSIX. */
#ifdef _WIN32

View File

@ -175,8 +175,8 @@ public final class TypeResolver {
/**
* Converts the given {@code type} to the corresponding class.
* This method implements the concept of type erasure,
* that is described in <a href="http://jscstage.sfbay.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.6">section 4.6</a>
* of Java Language Specification.
* that is described in section 4.6 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param type the array of types to convert
* @return a corresponding class

View File

@ -88,8 +88,8 @@ Jar File Specification :<a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html</a></li>
<li>
Java Virtual Machine Specification : <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html">
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html</a></li>
Class File Specification: Chapter 4 of
<em>The Java&trade; Virtual Machine Specification</em>
<li>
Hypertext Transfer Protocol -- HTTP/1.1 : <a href="http://www.ietf.org/rfc/rfc2616.txt">

View File

@ -42,12 +42,9 @@ public interface Accessible {
* Returns the Java<sup><font size=-2>TM</font></sup>
* programming language modifiers, encoded in an integer.
* <p>
* The modifier encodings are defined in the
* <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
* Specification</a>, in the <code>access_flag</code> tables for
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">classes</a>,
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">fields</a>, and
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">methods</a>.
* The modifier encodings are defined in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* in the <code>access_flag</code> tables for classes(section 4.1), fields(section 4.5), and methods(section 4.6).
*/
public int modifiers();

View File

@ -77,11 +77,9 @@ public interface ArrayType extends ReferenceType {
* as specified in the array declaration.
* <P>
* Note: The component type of a array will always be
* created or loaded before the array - see the
* <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
* Machine Specification</a>, section
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79473">5.3.3
* Creating Array Classes</a>.
* created or loaded before the array - see
* <cite>The Java&trade; Virtual Machine Specification</cite>,
* section 5.3.3 - Creating Array Classes.
* However, although the component type will be loaded it may
* not yet be prepared, in which case the type will be returned
* but attempts to perform some operations on the returned type

View File

@ -71,11 +71,9 @@ public interface ClassLoaderReference extends ObjectReference {
* <p>
* No ordering of the returned list is guaranteed.
* <p>
* See the revised
* <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a> section
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#72007">5.3
* Creation and Loading</a>
* See
* <cite>The Java&trade; Virtual Machine Specification</cite>,
* section 5.3 - Creation and Loading
* for more information on the initiating classloader.
* <p>
* Note that unlike {@link #definedClasses()}

View File

@ -60,9 +60,9 @@ package com.sun.jdi;
* is visible to the class loader of enclosing class. (That is, the
* class loader of the enclosing class must be an <i>initiating</i> class
* loader for the class in question.)
* See the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a> for
* more details.
* See
* <cite>The Java&trade; Virtual Machine Specification</cite>
* for more details.
*
* @author Gordon Hirsch
* @since 1.3

View File

@ -164,10 +164,8 @@ public interface ClassType extends ReferenceType {
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See the <a href="http://java.sun.com/docs/books/jls/">
* Java Language Specification</a>.
* section
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
* See Section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, all threads in the target VM are resumed while
@ -280,10 +278,8 @@ public interface ClassType extends ReferenceType {
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See the <a href="http://java.sun.com/docs/books/jls/">
* Java Language Specification</a>.
* section
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
* See section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, all threads in the target VM are resumed while

View File

@ -102,9 +102,7 @@ public interface LocalVariable extends Mirror, Comparable<LocalVariable> {
/**
* Gets the generic signature for this variable if there is one.
* Generic signatures are described in the
* <a href="http://java.sun.com/docs/books/vmspec">
* "Java<sup><font size=-2>TM</font></sup>
* Virtual Machine Specification, 3rd Edition.</a>
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @return a string containing the generic signature, or <code>null</code>
* if there is no generic signature.

View File

@ -164,10 +164,8 @@ public interface Method extends TypeComponent, Locatable, Comparable<Method> {
/**
* Determine if this method is a bridge method. Bridge
* methods are defined in the
* <a href="http://java.sun.com/docs/books/jls">
* "Java<sup><font size=-2>TM</font></sup>
* Language Specification, 3rd Edition.</a>
* methods are defined in
* <cite>The Java&trade; Language Specification</cite>.
*
* @return <code>true</code> if the method is a bridge method,
* false otherwise.

View File

@ -118,10 +118,8 @@ public interface ObjectReference extends Value
* enclosing class's class loader). Primitive values must be
* either assignment compatible with the field type or must be
* convertible to the field type without loss of information.
* See the <a href="http://java.sun.com/docs/books/jls/">
* Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
* section
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
* See section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment
* compatibility.
*
@ -182,18 +180,13 @@ public interface ObjectReference extends Value
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See the <a href="http://java.sun.com/docs/books/jls/">
* Java Language Specification</a>.
* section
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
* See section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, the method is invoked using dynamic lookup as
* documented in the
* <a href="http://java.sun.com/docs/books/jls/">
* Java Language Specification</a>
* second edition, section
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#45606">15.12.4.4</a>;
* documented in section 15.12.4.4 of
* <cite>The Java&trade; Language Specification</cite>
* in particular, overriding based on the runtime type of the object
* mirrored by this {@link ObjectReference} will occur. This
* behavior can be changed by specifying the

View File

@ -30,9 +30,8 @@ import java.util.Map;
/**
* The type of an object in a target VM. ReferenceType encompasses
* classes, interfaces, and array types as defined in the
* <a href="http://java.sun.com/docs/books/jls/">
* Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
* classes, interfaces, and array types as defined in
* <cite>The Java&trade; Language Specification</cite>.
* All ReferenceType objects belong to one of the following
* subinterfaces:
* {@link ClassType} for classes,
@ -98,9 +97,7 @@ public interface ReferenceType
/**
* Gets the generic signature for this type if there is one.
* Generic signatures are described in the
* <a href="http://java.sun.com/docs/books/vmspec">
* "Java<sup><font size=-2>TM</font></sup>
* Virtual Machine Specification, 3rd Edition.</a>
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @return a string containing the generic signature, or <code>null</code>
* if there is no generic signature.

View File

@ -74,9 +74,7 @@ public interface TypeComponent extends Mirror, Accessible {
/**
* Gets the generic signature for this TypeComponent if there is one.
* Generic signatures are described in the
* <a href="http://java.sun.com/docs/books/vmspec">
* "Java<sup><font size=-2>TM</font></sup>
* Virtual Machine Specification, 3rd Edition.</a>
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @return a string containing the generic signature, or <code>null</code>
* if there is no generic signature.

View File

@ -25,6 +25,7 @@
package com.sun.media.sound;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -439,10 +440,10 @@ public class DLSInstrument extends ModelInstrument {
}
public byte[] getGuid() {
return guid;
return guid == null ? null : Arrays.copyOf(guid, guid.length);
}
public void setGuid(byte[] guid) {
this.guid = guid;
this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length);
}
}

View File

@ -25,6 +25,7 @@
package com.sun.media.sound;
import java.io.InputStream;
import java.util.Arrays;
import javax.sound.midi.Soundbank;
import javax.sound.midi.SoundbankResource;
import javax.sound.sampled.AudioFormat;
@ -113,10 +114,10 @@ public class DLSSample extends SoundbankResource {
}
public byte[] getGuid() {
return guid;
return guid == null ? null : Arrays.copyOf(guid, guid.length);
}
public void setGuid(byte[] guid) {
this.guid = guid;
this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length);
}
}

View File

@ -24,6 +24,8 @@
*/
package com.sun.media.sound;
import java.util.Arrays;
/**
* Connection blocks are used to connect source variable
* to a destination variable.
@ -117,19 +119,17 @@ public class ModelConnectionBlock {
}
public ModelSource[] getSources() {
return sources;
return Arrays.copyOf(sources, sources.length);
}
public void setSources(ModelSource[] source) {
this.sources = source;
this.sources = source == null ? no_sources : Arrays.copyOf(source, source.length);
}
public void addSource(ModelSource source) {
ModelSource[] oldsources = sources;
sources = new ModelSource[oldsources.length + 1];
for (int i = 0; i < oldsources.length; i++) {
sources[i] = oldsources[i];
}
System.arraycopy(oldsources, 0, sources, 0, oldsources.length);
sources[sources.length - 1] = source;
}
}

View File

@ -503,7 +503,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
firstVoice = true;
voiceNo = 0;
int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0));
play_noteNumber = noteNumber;
play_velocity = velocity;
play_delay = delay;
@ -607,7 +607,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
firstVoice = true;
voiceNo = 0;
int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0));
play_noteNumber = noteNumber;
play_velocity = lastVelocity[noteNumber];
play_releasetriggered = true;
@ -632,7 +632,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer {
int delay = play_delay;
boolean releasetriggered = play_releasetriggered;
SoftPerformer p = current_instrument.getPerformers()[performerIndex];
SoftPerformer p = current_instrument.getPerformer(performerIndex);
if (firstVoice) {
firstVoice = false;

View File

@ -76,7 +76,12 @@ public class SoftInstrument extends Instrument {
return data;
}
/* am: currently getPerformers() is not used (replaced with getPerformer(int))
public SoftPerformer[] getPerformers() {
return performers;
}
*/
public SoftPerformer getPerformer(int index) {
return performers[index];
}
}

View File

@ -505,7 +505,7 @@ public abstract class SoftMixingDataLine implements DataLine {
}
public Control[] getControls() {
return controls;
return Arrays.copyOf(controls, controls.length);
}
public boolean isControlSupported(Type control) {

View File

@ -24,6 +24,7 @@
*/
package com.sun.media.sound;
import java.util.Arrays;
import javax.sound.midi.MidiDevice;
import javax.sound.midi.MidiDevice.Info;
import javax.sound.midi.spi.MidiDeviceProvider;
@ -39,7 +40,7 @@ public class SoftProvider extends MidiDeviceProvider {
private static Info[] softinfos = {softinfo};
public MidiDevice.Info[] getDeviceInfo() {
return softinfos;
return Arrays.copyOf(softinfos, softinfos.length);
}
public MidiDevice getDevice(MidiDevice.Info info) {

View File

@ -25,6 +25,7 @@
package com.sun.media.sound;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import javax.sound.midi.Patch;
@ -234,8 +235,10 @@ public class SoftTuning {
}
}
// am: getTuning(int) is more effective.
// currently getTuning() is used only by tests
public double[] getTuning() {
return tuning;
return Arrays.copyOf(tuning, tuning.length);
}
public double getTuning(int noteNumber) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -111,13 +111,13 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
private String tableName;
/**
* A <code>Vector</code> object containing the <code>Row</code>
* objects that comprise this <code>CachedRowSetImpl</code> object.
* @serial
*/
private Vector rvh;
private Vector<Object> rvh;
/**
* The current postion of the cursor in this <code>CachedRowSetImpl</code>
* object.
@ -293,12 +293,12 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
/**
* The Vector holding the Match Columns
*/
private Vector iMatchColumns;
private Vector<Integer> iMatchColumns;
/**
* The Vector that will hold the Match Column names.
*/
private Vector strMatchColumns;
private Vector<String> strMatchColumns;
/**
* Trigger that indicates whether the active SyncProvider is exposes the
@ -484,7 +484,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
private void initContainer() {
rvh = new Vector(100);
rvh = new Vector<Object>(100);
cursorPos = 0;
absolutePos = 0;
numRows = 0;
@ -523,12 +523,12 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
//Instantiating the vector for MatchColumns
iMatchColumns = new Vector(10);
iMatchColumns = new Vector<Integer>(10);
for(int i = 0; i < 10 ; i++) {
iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
strMatchColumns = new Vector<String>(10);
for(int j = 0; j < 10; j++) {
strMatchColumns.add(j,null);
}
@ -622,7 +622,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
Row currentRow;
int numCols;
int i;
Map map = getTypeMap();
Map<String, Class<?>> map = getTypeMap();
Object obj;
int mRows;
@ -939,14 +939,9 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
public void acceptChanges(Connection con) throws SyncProviderException{
try{
setConnection(con);
acceptChanges();
} catch (SyncProviderException spe) {
throw spe;
} catch(SQLException sqle){
throw new SyncProviderException(sqle.getMessage());
}
setConnection(con);
acceptChanges();
}
/**
@ -1289,14 +1284,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
public Collection<?> toCollection() throws SQLException {
TreeMap tMap;
int count = 0;
Row origRow;
Vector newRow;
int colCount = ((RowSetMetaDataImpl)this.getMetaData()).getColumnCount();
tMap = new TreeMap();
TreeMap<Integer, Object> tMap = new TreeMap<>();
for (int i = 0; i<numRows; i++) {
tMap.put(Integer.valueOf(i), rvh.get(i));
@ -1325,10 +1313,8 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
public Collection<?> toCollection(int column) throws SQLException {
Vector vec;
Row origRow;
int nRows = numRows;
vec = new Vector(nRows);
Vector<Object> vec = new Vector<>(nRows);
// create a copy
CachedRowSetImpl crsTemp;
@ -2953,7 +2939,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
public Object getObject(int columnIndex) throws SQLException {
Object value;
java.util.Map map;
Map<String, Class<?>> map;
// sanity check.
checkIndex(columnIndex);
@ -7257,7 +7243,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
Row currentRow;
int numCols;
int i;
Map map = getTypeMap();
Map<String, Class<?>> map = getTypeMap();
Object obj;
int mRows;
@ -7304,11 +7290,11 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
resultSet.absolute(start -1);
}
if( pageSize == 0) {
rvh = new Vector(getMaxRows());
rvh = new Vector<Object>(getMaxRows());
}
else{
rvh = new Vector(getPageSize());
rvh = new Vector<Object>(getPageSize());
}
if (data == null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,12 +93,12 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
/**
* The Vector holding the Match Columns
*/
private Vector iMatchColumns;
private Vector<Integer> iMatchColumns;
/**
* The Vector that will hold the Match Column names.
*/
private Vector strMatchColumns;
private Vector<String> strMatchColumns;
protected transient JdbcRowSetResourceBundle resBundle;
@ -213,12 +213,12 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
//Instantiating the vector for MatchColumns
iMatchColumns = new Vector(10);
iMatchColumns = new Vector<Integer>(10);
for(int i = 0; i < 10 ; i++) {
iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
strMatchColumns = new Vector<String>(10);
for(int j = 0; j < 10; j++) {
strMatchColumns.add(j,null);
}
@ -286,12 +286,12 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
//Instantiating the vector for MatchColumns
iMatchColumns = new Vector(10);
iMatchColumns = new Vector<Integer>(10);
for(int i = 0; i < 10 ; i++) {
iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
strMatchColumns = new Vector<String>(10);
for(int j = 0; j < 10; j++) {
strMatchColumns.add(j,null);
}
@ -373,12 +373,12 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
//Instantiating the vector for MatchColumns
iMatchColumns = new Vector(10);
iMatchColumns = new Vector<Integer>(10);
for(int i = 0; i < 10 ; i++) {
iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
strMatchColumns = new Vector<String>(10);
for(int j = 0; j < 10; j++) {
strMatchColumns.add(j,null);
}
@ -463,12 +463,12 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
//Instantiating the vector for MatchColumns
iMatchColumns = new Vector(10);
iMatchColumns = new Vector<Integer>(10);
for(int i = 0; i < 10 ; i++) {
iMatchColumns.add(i,Integer.valueOf(-1));
}
strMatchColumns = new Vector(10);
strMatchColumns = new Vector<String>(10);
for(int j = 0; j < 10; j++) {
strMatchColumns.add(j,null);
}
@ -675,7 +675,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
try {
Map aMap = getTypeMap();
Map<String, Class<?>> aMap = getTypeMap();
if( aMap != null) {
conn.setTypeMap(aMap);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,8 +59,8 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
/**
* A <code>Vector</code> object that contains the <code>RowSet</code> objects
* that have been added to this <code>JoinRowSet</code> object.
*/
private Vector vecRowSetsInJOIN;
*/
private Vector<CachedRowSetImpl> vecRowSetsInJOIN;
/**
* The <code>CachedRowSet</code> object that encapsulates this
@ -78,13 +78,13 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
* for this <code>JoinRowSet</code> object.
* The last join type set forms the basis of succeeding joins.
*/
private Vector vecJoinType;
private Vector<Integer> vecJoinType;
/**
* A <code>Vector</code> object containing the names of all the tables entering
* the join.
*/
private Vector vecTableNames;
private Vector<String> vecTableNames;
/**
* An <code>int</code> that indicates the column index of the match column.
@ -121,10 +121,10 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
*/
public JoinRowSetImpl() throws SQLException {
vecRowSetsInJOIN = new Vector();
vecRowSetsInJOIN = new Vector<CachedRowSetImpl>();
crsInternal = new CachedRowSetImpl();
vecJoinType = new Vector();
vecTableNames = new Vector();
vecJoinType = new Vector<Integer>();
vecTableNames = new Vector<String>();
iMatchKey = -1;
strMatchKey = null;
supportedJOINs =
@ -222,7 +222,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
// either of the setter methods have been set.
if(boolColId){
//
ArrayList indices = new ArrayList();
ArrayList<Integer> indices = new ArrayList<>();
for(int i=0;i<cRowset.getMatchColumnNames().length;i++) {
if( (strMatchKey = (cRowset.getMatchColumnNames())[i]) != null) {
iMatchKey = cRowset.findColumn(strMatchKey);

View File

@ -903,7 +903,7 @@ public class Dialog extends Window {
if (peer == null) {
addNotify();
}
validate();
validateUnconditionally();
if (visible) {
toFront();
retval = false;

View File

@ -243,8 +243,10 @@ public abstract class GraphicsDevice {
* a non-client of the input method framework.
* </ul>
* <p>
* Simulated full-screen mode resizes
* the window to the size of the screen and positions it at (0,0).
* The simulated full-screen mode places and resizes the window to the maximum
* possible visible area of the screen. However, the native windowing system
* may modify the requested geometry-related data, so that the {@code Window} object
* is placed and sized in a way that corresponds closely to the desktop settings.
* <p>
* When entering full-screen mode, if the window to be used as a
* full-screen window is not visible, this method will make it visible.

View File

@ -466,6 +466,10 @@ public abstract class Toolkit {
*/
protected void loadSystemColors(int[] systemColors)
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
}
/**
@ -500,6 +504,10 @@ public abstract class Toolkit {
*/
public void setDynamicLayout(boolean dynamic)
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
}
/**
@ -523,6 +531,9 @@ public abstract class Toolkit {
*/
protected boolean isDynamicLayoutSet()
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
} else {
@ -558,6 +569,9 @@ public abstract class Toolkit {
*/
public boolean isDynamicLayoutActive()
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
} else {
@ -601,6 +615,9 @@ public abstract class Toolkit {
*/
public Insets getScreenInsets(GraphicsConfiguration gc)
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getScreenInsets(gc);
} else {
@ -1342,6 +1359,9 @@ public abstract class Toolkit {
* @since 1.4
*/
public Clipboard getSystemSelection() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getSystemSelection();
} else {
@ -1371,6 +1391,10 @@ public abstract class Toolkit {
* @since JDK1.1
*/
public int getMenuShortcutKeyMask() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
return Event.CTRL_MASK;
}
@ -1499,6 +1523,9 @@ public abstract class Toolkit {
*/
public Dimension getBestCursorSize(int preferredWidth,
int preferredHeight) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
// Override to implement custom cursor support.
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().
@ -1526,6 +1553,9 @@ public abstract class Toolkit {
* @since 1.2
*/
public int getMaximumCursorColors() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
// Override to implement custom cursor support.
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getMaximumCursorColors();
@ -2561,8 +2591,6 @@ public abstract class Toolkit {
* initialized with {@code true}.
* Changing this value after the {@code Toolkit} class initialization will have no effect.
* <p>
* The current value could be queried by using the
* {@code System.getProperty("sun.awt.enableExtraMouseButtons")} method.
* @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
* @return {@code true} if events from extra mouse buttons are allowed to be processed and posted;
* {@code false} otherwise
@ -2572,6 +2600,9 @@ public abstract class Toolkit {
* @since 1.7
*/
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
}
}

View File

@ -870,6 +870,11 @@ public class Window extends Container implements Accessible {
* are automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getSize
* @see #setBounds
@ -887,6 +892,11 @@ public class Window extends Container implements Accessible {
* are automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getSize
* @see #setBounds
@ -897,6 +907,32 @@ public class Window extends Container implements Accessible {
super.setSize(width, height);
}
/**
* {@inheritDoc}
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*/
@Override
public void setLocation(int x, int y) {
super.setLocation(x, y);
}
/**
* {@inheritDoc}
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*/
@Override
public void setLocation(Point p) {
super.setLocation(p);
}
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>setBounds(int, int, int, int)</code>.
@ -3147,6 +3183,11 @@ public class Window extends Container implements Accessible {
* placed at the left side of the screen. The similar placement
* will occur if both top and bottom edges are out of the screen.
* In that case, the window is placed at the top side of the screen.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @param c the component in relation to which the window's location
* is determined
@ -3395,6 +3436,11 @@ public class Window extends Container implements Accessible {
* are automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getBounds
* @see #setLocation(int, int)
@ -3424,6 +3470,11 @@ public class Window extends Container implements Accessible {
* will be automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getBounds
* @see #setLocation(int, int)

View File

@ -40,10 +40,9 @@ newly added listener is only notified on subsequent key events.
<a name="Autoshutdown"></a>
<h2>Auto-shutdown</h2>
According to <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The
Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification,
Second edition</i></a> (see <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19152">§2.17.9</a>
and <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33308">§2.19</a>),
According to
<cite>The Java&trade; Virtual Machine Specification</cite>,
sections 2.17.9 and 2.19,
the Java virtual machine (JVM) initially starts up with a single non-daemon
thread, which typically calls the <code>main</code> method of some class.
The virtual machine terminates all its activity and exits when
@ -183,7 +182,8 @@ non-daemon thread that blocks forever.
<...>
</pre>
The Java Virtual Machine Specification guarantees
<cite>The Java&trade; Virtual Machine Specification</cite>
guarantees
that the JVM doesn't exit until this thread terminates.
</body>
</html>

View File

@ -148,8 +148,8 @@ public final class Console implements Flushable
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -187,8 +187,8 @@ public final class Console implements Flushable
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -220,8 +220,7 @@ public final class Console implements Flushable
* string. If there are more arguments than format specifiers, the
* extra arguments are ignored. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>.
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format
@ -285,8 +284,7 @@ public final class Console implements Flushable
* string. If there are more arguments than format specifiers, the
* extra arguments are ignored. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>.
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format

View File

@ -846,8 +846,8 @@ public class PrintStream extends FilterOutputStream
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -896,8 +896,8 @@ public class PrintStream extends FilterOutputStream
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -939,8 +939,8 @@ public class PrintStream extends FilterOutputStream
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -996,8 +996,8 @@ public class PrintStream extends FilterOutputStream
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*

View File

@ -779,8 +779,8 @@ public class PrintWriter extends Writer {
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -830,8 +830,8 @@ public class PrintWriter extends Writer {
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -874,8 +874,8 @@ public class PrintWriter extends Writer {
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -934,8 +934,8 @@ public class PrintWriter extends Writer {
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*

View File

@ -34,11 +34,9 @@ package java.lang;
* new AssertionError(<i>expression</i>)
* </pre>
* has as its detail message the <i>string conversion</i> of
* <i>expression</i> (as defined in <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html">
* <i>The Java Language Specification, Second Edition</i></a>,
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#40220">
* Section 15.18.1.1</a>), regardless of the type of <i>expression</i>.
* <i>expression</i> (as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>),
* regardless of the type of <i>expression</i>.
*
* @since 1.4
*/
@ -63,8 +61,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified object, which is converted to a string as
* defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1.
* defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*<p>
* If the specified object is an instance of {@code Throwable}, it
* becomes the <i>cause</i> of the newly constructed assertion error.
@ -81,8 +79,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified <code>boolean</code>, which is converted to
* a string as defined in <i>The Java Language Specification,
* Second Edition</i>, Section 15.18.1.1.
* a string as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param detailMessage value to be used in constructing detail message
*/
@ -93,8 +91,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified <code>char</code>, which is converted to a
* string as defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1.
* string as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param detailMessage value to be used in constructing detail message
*/
@ -105,8 +103,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified <code>int</code>, which is converted to a
* string as defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1.
* string as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param detailMessage value to be used in constructing detail message
*/
@ -117,8 +115,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified <code>long</code>, which is converted to a
* string as defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1.
* string as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param detailMessage value to be used in constructing detail message
*/
@ -129,8 +127,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified <code>float</code>, which is converted to a
* string as defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1.
* string as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param detailMessage value to be used in constructing detail message
*/
@ -141,8 +139,8 @@ public class AssertionError extends Error {
/**
* Constructs an AssertionError with its detail message derived
* from the specified <code>double</code>, which is converted to a
* string as defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1.
* string as defined in section 15.18.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @param detailMessage value to be used in constructing detail message
*/

View File

@ -251,9 +251,9 @@ public final class Byte extends Number implements Comparable<Byte> {
* </blockquote>
*
* <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
* are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
* of the <a href="http://java.sun.com/docs/books/jls/html/">Java
* Language Specification</a>.
* are as defined in section 3.10.1 of
* <cite>The Java&trade; Language Specification</cite>,
* except that underscores are not accepted between digits.
*
* <p>The sequence of characters following an optional
* sign and/or radix specifier ("{@code 0x}", "{@code 0X}",

View File

@ -4182,9 +4182,11 @@ class Character implements java.io.Serializable, Comparable<Character> {
aliases.put("AVST", AVESTAN);
aliases.put("BALI", BALINESE);
aliases.put("BAMU", BAMUM);
aliases.put("BATK", BATAK);
aliases.put("BENG", BENGALI);
aliases.put("BOPO", BOPOMOFO);
aliases.put("BRAI", BRAILLE);
aliases.put("BRAH", BRAHMI);
aliases.put("BUGI", BUGINESE);
aliases.put("BUHD", BUHID);
aliases.put("CANS", CANADIAN_ABORIGINAL);
@ -4228,6 +4230,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
aliases.put("LISU", LISU);
aliases.put("LYCI", LYCIAN);
aliases.put("LYDI", LYDIAN);
aliases.put("MAND", MANDAIC);
aliases.put("MLYM", MALAYALAM);
aliases.put("MONG", MONGOLIAN);
aliases.put("MTEI", MEETEI_MAYEK);

View File

@ -95,8 +95,8 @@ import sun.reflect.annotation.*;
* </pre></blockquote>
*
* <p> It is also possible to get the {@code Class} object for a named
* type (or for void) using a class literal
* (JLS Section <A HREF="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530">15.8.2</A>).
* type (or for void) using a class literal. See Section 15.8.2 of
* <cite>The Java&trade; Language Specification</cite>.
* For example:
*
* <p> <blockquote>
@ -521,7 +521,8 @@ public final
*
* <p> If this class object represents a reference type that is not an
* array type then the binary name of the class is returned, as specified
* by the Java Language Specification, Second Edition.
* by
* <cite>The Java&trade; Language Specification</cite>.
*
* <p> If this class object represents a primitive type or void, then the
* name returned is a {@code String} equal to the Java language
@ -630,8 +631,8 @@ public final
* the type variables declared by this generic declaration
* @throws java.lang.reflect.GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in the Java Virtual Machine Specification,
* 3rd edition
* the format specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @since 1.5
*/
public TypeVariable<Class<T>>[] getTypeParameters() {
@ -675,8 +676,8 @@ public final
* returned.
*
* @throws java.lang.reflect.GenericSignatureFormatError if the generic
* class signature does not conform to the format specified in the
* Java Virtual Machine Specification, 3rd edition
* class signature does not conform to the format specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the generic superclass
* refers to a non-existent type declaration
* @throws java.lang.reflect.MalformedParameterizedTypeException if the
@ -798,7 +799,8 @@ public final
*
* @throws java.lang.reflect.GenericSignatureFormatError
* if the generic class signature does not conform to the format
* specified in the Java Virtual Machine Specification, 3rd edition
* specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the generic
* superinterfaces refers to a non-existent type declaration
* @throws java.lang.reflect.MalformedParameterizedTypeException

View File

@ -160,8 +160,8 @@ import sun.security.util.SecurityConstants;
* <h4> <a name="name">Binary names</a> </h4>
*
* <p> Any class name provided as a {@link String} parameter to methods in
* <tt>ClassLoader</tt> must be a binary name as defined by the <a
* href="http://java.sun.com/docs/books/jls/">Java Language Specification</a>.
* <tt>ClassLoader</tt> must be a binary name as defined by
* <cite>The Java&trade; Language Specification</cite>.
*
* <p> Examples of valid class names include:
* <blockquote><pre>
@ -531,9 +531,8 @@ public abstract class ClassLoader {
* @param b
* The bytes that make up the class data. The bytes in positions
* <tt>off</tt> through <tt>off+len-1</tt> should have the format
* of a valid class file as defined by the <a
* href="http://java.sun.com/docs/books/vmspec/">Java Virtual
* Machine Specification</a>.
* of a valid class file as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @param off
* The start offset in <tt>b</tt> of the class data
@ -597,9 +596,8 @@ public abstract class ClassLoader {
* @param b
* The bytes that make up the class data. The bytes in positions
* <tt>off</tt> through <tt>off+len-1</tt> should have the format
* of a valid class file as defined by the <a
* href="http://java.sun.com/docs/books/vmspec/">Java Virtual
* Machine Specification</a>.
* of a valid class file as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @param off
* The start offset in <tt>b</tt> of the class data
@ -748,9 +746,8 @@ public abstract class ClassLoader {
* @param b
* The bytes that make up the class data. The bytes in positions
* <tt>off</tt> through <tt>off+len-1</tt> should have the format
* of a valid class file as defined by the <a
* href="http://java.sun.com/docs/books/vmspec/">Java Virtual
* Machine Specification</a>.
* of a valid class file as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @param off
* The start offset in <tt>b</tt> of the class data
@ -838,8 +835,7 @@ public abstract class ClassLoader {
* The bytes that make up the class data. The bytes from positions
* <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
* </tt> should have the format of a valid class file as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
* Machine Specification</a>.
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @param protectionDomain
* The ProtectionDomain of the class, or <tt>null</tt>.
@ -998,9 +994,8 @@ public abstract class ClassLoader {
* Links the specified class. This (misleadingly named) method may be
* used by a class loader to link a class. If the class <tt>c</tt> has
* already been linked, then this method simply returns. Otherwise, the
* class is linked as described in the "Execution" chapter of the <a
* href="http://java.sun.com/docs/books/jls/">Java Language
* Specification</a>.
* class is linked as described in the "Execution" chapter of
* <cite>The Java&trade; Language Specification</cite>.
* </p>
*
* @param c
@ -2034,8 +2029,8 @@ public abstract class ClassLoader {
* The name of the package whose package default assertion status
* is to be set. A <tt>null</tt> value indicates the unnamed
* package that is "current"
* (<a href="http://java.sun.com/docs/books/jls/">Java Language
* Specification</a>, section 7.4.2).
* (see section 7.4.2 of
* <cite>The Java&trade; Language Specification</cite>.)
*
* @param enabled
* <tt>true</tt> if classes loaded by this classloader and

View File

@ -392,9 +392,10 @@ public final class Double extends Number implements Comparable<Double> {
* where <i>Sign</i>, <i>FloatingPointLiteral</i>,
* <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
* <i>FloatTypeSuffix</i> are as defined in the lexical structure
* sections of the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>. If {@code s} does not have the form of
* sections of
* <cite>The Java&trade; Language Specification</cite>,
* except that underscores are not accepted between digits.
* If {@code s} does not have the form of
* a <i>FloatValue</i>, then a {@code NumberFormatException}
* is thrown. Otherwise, {@code s} is regarded as
* representing an exact decimal value in the usual
@ -464,8 +465,8 @@ public final class Double extends Number implements Comparable<Double> {
* // Since this method allows integer-only strings as input
* // in addition to strings of floating-point literals, the
* // two sub-patterns below are simplifications of the grammar
* // productions from the Java Language Specification, 2nd
* // edition, section 3.10.2.
* // productions from section 3.10.2 of
* // <cite>The Java&trade; Language Specification</cite>.
*
* // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
* "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+

View File

@ -36,9 +36,8 @@ import java.io.ObjectStreamException;
*
* More information about enums, including descriptions of the
* implicitly declared methods synthesized by the compiler, can be
* found in <i>The Java&trade; Language Specification, Third
* Edition</i>, <a
* href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9">&sect;8.9</a>.
* found in section 8.9 of
* <cite>The Java&trade; Language Specification</cite>.
*
* <p> Note that when using an enumeration type as the type of a set
* or as the type of the keys in a map, specialized and efficient

View File

@ -43,7 +43,7 @@ package java.lang;
*
* @author Frank Yellin
* @see java.lang.ThreadDeath
* @jls3 11.2 Compile-Time Checking of Exceptions
* @jls 11.2 Compile-Time Checking of Exceptions
* @since JDK1.0
*/
public class Error extends Throwable {

View File

@ -39,7 +39,7 @@ package java.lang;
*
* @author Frank Yellin
* @see java.lang.Error
* @jls3 11.2 Compile-Time Checking of Exceptions
* @jls 11.2 Compile-Time Checking of Exceptions
* @since JDK1.0
*/
public class Exception extends Throwable {

View File

@ -353,9 +353,10 @@ public final class Float extends Number implements Comparable<Float> {
* where <i>Sign</i>, <i>FloatingPointLiteral</i>,
* <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
* <i>FloatTypeSuffix</i> are as defined in the lexical structure
* sections of the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>. If {@code s} does not have the form of
* sections of
* <cite>The Java&trade; Language Specification</cite>,
* except that underscores are not accepted between digits.
* If {@code s} does not have the form of
* a <i>FloatValue</i>, then a {@code NumberFormatException}
* is thrown. Otherwise, {@code s} is regarded as
* representing an exact decimal value in the usual

View File

@ -918,9 +918,9 @@ public final class Integer extends Number implements Comparable<Integer> {
* </blockquote>
*
* <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
* are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
* of the <a href="http://java.sun.com/docs/books/jls/html/">Java
* Language Specification</a>.
* are as defined in section 3.10.1 of
* <cite>The Java&trade; Language Specification</cite>,
* except that underscores are not accepted between digits.
*
* <p>The sequence of characters following an optional
* sign and/or radix specifier ("{@code 0x}", "{@code 0X}",

View File

@ -598,9 +598,9 @@ public final class Long extends Number implements Comparable<Long> {
* </blockquote>
*
* <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
* are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
* of the <a href="http://java.sun.com/docs/books/jls/html/">Java
* Language Specification</a>.
* are as defined in section 3.10.1 of
* <cite>The Java&trade; Language Specification</cite>,
* except that underscores are not accepted between digits.
*
* <p>The sequence of characters following an optional
* sign and/or radix specifier ("{@code 0x}", "{@code 0X}",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2010, 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
@ -627,11 +627,9 @@ public final class Math {
}
/**
* Returns the closest {@code int} to the argument. The
* result is rounded to an integer by adding 1/2, taking the
* floor of the result, and casting the result to type {@code int}.
* In other words, the result is equal to the value of the expression:
* <p>{@code (int)Math.floor(a + 0.5f)}
* Returns the closest {@code int} to the argument, with ties
* rounding up.
*
* <p>
* Special cases:
* <ul><li>If the argument is NaN, the result is 0.
@ -649,17 +647,17 @@ public final class Math {
* @see java.lang.Integer#MIN_VALUE
*/
public static int round(float a) {
return (int)floor(a + 0.5f);
if (a != 0x1.fffffep-2f) // greatest float value less than 0.5
return (int)floor(a + 0.5f);
else
return 0;
}
/**
* Returns the closest {@code long} to the argument. The result
* is rounded to an integer by adding 1/2, taking the floor of the
* result, and casting the result to type {@code long}. In other
* words, the result is equal to the value of the expression:
* <p>{@code (long)Math.floor(a + 0.5d)}
* <p>
* Special cases:
* Returns the closest {@code long} to the argument, with ties
* rounding up.
*
* <p>Special cases:
* <ul><li>If the argument is NaN, the result is 0.
* <li>If the argument is negative infinity or any value less than or
* equal to the value of {@code Long.MIN_VALUE}, the result is
@ -676,7 +674,10 @@ public final class Math {
* @see java.lang.Long#MIN_VALUE
*/
public static long round(double a) {
return (long)floor(a + 0.5d);
if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5
return (long)floor(a + 0.5d);
else
return 0;
}
private static Random randomNumberGenerator;

View File

@ -58,9 +58,8 @@ public class Object {
*
* @return The {@code Class} object that represents the runtime
* class of this object.
* @see <a href="http://java.sun.com/docs/books/jls/">The Java
* Language Specification, Third Edition (15.8.2 Class
* Literals)</a>
* @see Class Literals, section 15.8.2 of
* <cite>The Java&trade; Language Specification</cite>.
*/
public final native Class<?> getClass();

View File

@ -43,7 +43,7 @@ import java.lang.annotation.*;
*
* @author Peter von der Ah&eacute;
* @author Joshua Bloch
* @jls3 9.6.1.4 Override
* @jls 9.6.1.4 Override
* @since 1.5
*/
@Target(ElementType.METHOD)

View File

@ -109,10 +109,9 @@ public class Package implements java.lang.reflect.AnnotatedElement {
/**
* Return the name of this package.
*
* @return The fully-qualified name of this package as defined in the
* <em>Java Language Specification, Third Edition</em>
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.5.3">
* &sect;6.5.3</a>, for example, {@code java.lang}
* @return The fully-qualified name of this package as defined in section 6.5.3 of
* <cite>The Java&trade; Language Specification</cite>,
* for example, {@code java.lang}
*/
public String getName() {
return pkgName;

View File

@ -37,7 +37,7 @@ package java.lang;
* propagate outside the method or constructor boundary.
*
* @author Frank Yellin
* @jls3 11.2 Compile-Time Checking of Exceptions
* @jls 11.2 Compile-Time Checking of Exceptions
* @since JDK1.0
*/
public class RuntimeException extends Exception {

View File

@ -70,8 +70,8 @@ import java.lang.annotation.*;
*
* </ul>
*
* @jls3 4.7 Reifiable Types
* @jls3 8.4.1 Formal Parameters
* @jls 4.7 Reifiable Types
* @jls 8.4.1 Formal Parameters
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)

View File

@ -256,9 +256,9 @@ public final class Short extends Number implements Comparable<Short> {
* </blockquote>
*
* <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
* are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
* of the <a href="http://java.sun.com/docs/books/jls/html/">Java
* Language Specification</a>.
* are as defined in section 3.10.1 of
* <cite>The Java&trade; Language Specification</cite>,
* except that underscores are not accepted between digits.
*
* <p>The sequence of characters following an optional
* sign and/or radix specifier ("{@code 0x}", "{@code 0X}",

View File

@ -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
@ -613,11 +613,8 @@ public final class StrictMath {
public static native double pow(double a, double b);
/**
* Returns the closest {@code int} to the argument. The
* result is rounded to an integer by adding 1/2, taking the
* floor of the result, and casting the result to type {@code int}.
* In other words, the result is equal to the value of the expression:
* <p>{@code (int)Math.floor(a + 0.5f)}
* Returns the closest {@code int} to the argument, with ties
* rounding up.
*
* <p>Special cases:
* <ul><li>If the argument is NaN, the result is 0.
@ -635,15 +632,12 @@ public final class StrictMath {
* @see java.lang.Integer#MIN_VALUE
*/
public static int round(float a) {
return (int)floor(a + 0.5f);
return Math.round(a);
}
/**
* Returns the closest {@code long} to the argument. The result
* is rounded to an integer by adding 1/2, taking the floor of the
* result, and casting the result to type {@code long}. In other
* words, the result is equal to the value of the expression:
* <p>{@code (long)Math.floor(a + 0.5d)}
* Returns the closest {@code long} to the argument, with ties
* rounding up.
*
* <p>Special cases:
* <ul><li>If the argument is NaN, the result is 0.
@ -662,7 +656,7 @@ public final class StrictMath {
* @see java.lang.Long#MIN_VALUE
*/
public static long round(double a) {
return (long)floor(a + 0.5d);
return Math.round(a);
}
private static Random randomNumberGenerator;

View File

@ -2819,8 +2819,8 @@ public final class String
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -2863,8 +2863,8 @@ public final class String
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
@ -3066,9 +3066,8 @@ public final class String
* if and only if <code>s.equals(t)</code> is <code>true</code>.
* <p>
* All literal strings and string-valued constant expressions are
* interned. String literals are defined in &sect;3.10.5 of the
* <a href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>
* interned. String literals are defined in section 3.10.5 of the
* <cite>The Java&trade; Language Specification</cite>.
*
* @return a string that has the same contents as this string, but is
* guaranteed to be from a pool of unique strings.

View File

@ -108,7 +108,7 @@ import java.util.*;
* @author unascribed
* @author Josh Bloch (Added exception chaining and programmatic access to
* stack trace in 1.4.)
* @jls3 11.2 Compile-Time Checking of Exceptions
* @jls 11.2 Compile-Time Checking of Exceptions
* @since JDK1.0
*/
public class Throwable implements Serializable {

View File

@ -31,9 +31,8 @@ package java.lang.annotation;
* an annotation type. Also note that this interface does not itself
* define an annotation type.
*
* More information about annotation types can be found in <i>The
* Java&trade; Language Specification, Third Edition</i>, <a
* href="http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6">&sect;9.6</a>.
* More information about annotation types can be found in section 9.6 of
* <cite>The Java&trade; Language Specification</cite>.
*
* @author Josh Bloch
* @since 1.5

View File

@ -36,9 +36,9 @@ import java.security.ProtectionDomain;
* to transform class files.
* The transformation occurs before the class is defined by the JVM.
* <P>
* Note the term <i>class file</i> is used as defined in the chapter
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#80959">The class File Format</a>
* of <i>The Java Virtual Machine Specification</i>, to mean a sequence
* Note the term <i>class file</i> is used as defined in section 3.1 of
* <cite>The Java&trade; Virtual Machine Specification</cite>,
* to mean a sequence
* of bytes in class file format, whether or not they reside in a file.
*
* @see java.lang.instrument.Instrumentation

View File

@ -434,8 +434,9 @@ public interface Instrumentation {
* avoiding these types of issues, is to use a unique package name for the
* instrumentation classes.
*
* <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
* Specification</a> specifies that a subsequent attempt to resolve a symbolic
* <p>
* <cite>The Java&trade; Virtual Machine Specification</cite>
* specifies that a subsequent attempt to resolve a symbolic
* reference that the Java virtual machine has previously unsuccessfully attempted
* to resolve always fails with the same error that was thrown as a result of the
* initial resolution attempt. Consequently, if the JAR file contains an entry
@ -487,8 +488,9 @@ public interface Instrumentation {
* getName()} method on the <code>jarfile</code> and this is provided as the
* parameter to the <code>appendToClassPathForInstrumentation</code> method.
*
* <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
* Specification</a> specifies that a subsequent attempt to resolve a symbolic
* <p>
* <cite>The Java&trade; Virtual Machine Specification</cite>
* specifies that a subsequent attempt to resolve a symbolic
* reference that the Java virtual machine has previously unsuccessfully attempted
* to resolve always fails with the same error that was thrown as a result of the
* initial resolution attempt. Consequently, if the JAR file contains an entry

View File

@ -194,8 +194,8 @@
* Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic}
* may force class initialization on their first invocation, just like the corresponding bytecodes.
* <p>
* The rules of section 5.4.3 of the
* <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73492">JVM Specification</a>
* The rules of section 5.4.3 of
* <cite>The Java&trade; Virtual Machine Specification</cite>
* apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle},
* and {@code CONSTANT_InvokeDynamic} constants,
* by the execution of {@code invokedynamic} and {@code ldc} instructions.

View File

@ -186,8 +186,8 @@ public final
* the type variables declared by this generic declaration
* @throws GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in the Java Virtual Machine Specification,
* 3rd edition
* the format specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @since 1.5
*/
public TypeVariable<Constructor<T>>[] getTypeParameters() {
@ -229,7 +229,8 @@ public final
* parameter types of the underlying method, in declaration order
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in the Java Virtual Machine Specification, 3rd edition
* specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the parameter
* types of the underlying method refers to a non-existent type
* declaration
@ -273,7 +274,8 @@ public final
* thrown by the underlying method
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in the Java Virtual Machine Specification, 3rd edition
* specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's
* {@code throws} clause refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if
@ -468,8 +470,8 @@ public final
*
* <p>If the constructor's declaring class is an inner class in a
* non-static context, the first argument to the constructor needs
* to be the enclosing instance; see <i>The Java Language
* Specification</i>, section 15.9.3.
* to be the enclosing instance; see section 15.9.3 of
* <cite>The Java&trade; Language Specification</cite>.
*
* <p>If the required access and argument checks succeed and the
* instantiation will proceed, the constructor's declaring class
@ -541,7 +543,8 @@ public final
* constructor; returns {@code false} otherwise.
*
* @return true if and only if this constructor is a synthetic
* constructor as defined by the Java Language Specification.
* constructor as defined by
* <cite>The Java&trade; Language Specification</cite>.
* @since 1.5
*/
public boolean isSynthetic() {

View File

@ -221,8 +221,8 @@ class Field extends AccessibleObject implements Member {
* @return a {@code Type} object that represents the declared type for
* the field represented by this {@code Field} object
* @throws GenericSignatureFormatError if the generic field
* signature does not conform to the format specified in the Java
* Virtual Machine Specification, 3rd edition
* signature does not conform to the format specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the generic type
* signature of the underlying field refers to a non-existent
* type declaration

View File

@ -42,8 +42,8 @@ public interface GenericDeclaration {
* the type variables declared by this generic declaration
* @throws GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in the Java Virtual Machine Specification,
* 3rd edition
* the format specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
*/
public TypeVariable<?>[] getTypeParameters();
}

View File

@ -194,8 +194,8 @@ public final
* the type variables declared by this generic declaration
* @throws GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in the Java Virtual Machine Specification,
* 3rd edition
* the format specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @since 1.5
*/
public TypeVariable<Method>[] getTypeParameters() {
@ -230,7 +230,8 @@ public final
* type of the underlying method
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in the Java Virtual Machine Specification, 3rd edition
* specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's
* return type refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if the
@ -275,7 +276,8 @@ public final
* parameter types of the underlying method, in declaration order
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in the Java Virtual Machine Specification, 3rd edition
* specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the parameter
* types of the underlying method refers to a non-existent type
* declaration
@ -319,7 +321,8 @@ public final
* thrown by the underlying method
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in the Java Virtual Machine Specification, 3rd edition
* specified in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's
* {@code throws} clause refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if

View File

@ -34,14 +34,8 @@ import sun.reflect.ReflectionFactory;
* constants to decode class and member access modifiers. The sets of
* modifiers are represented as integers with distinct bit positions
* representing different modifiers. The values for the constants
* representing the modifiers are taken from <a
* href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The
* Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification, Second
* edition</i></a> tables
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">4.1</a>,
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">4.4</a>,
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">4.5</a>, and
* <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88478">4.7</a>.
* representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @see Class#getModifiers()
* @see Member#getModifiers()
@ -214,14 +208,8 @@ class Modifier {
* public final synchronized strictfp
* </pre></blockquote>
* The modifier names are returned in an order consistent with the
* suggested modifier orderings given in <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html"><em>The
* Java Language Specification, Second Edition</em></a> sections
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#21613">&sect;8.1.1</a>,
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78091">&sect;8.3.1</a>,
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78188">&sect;8.4.3</a>,
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#42018">&sect;8.8.3</a>, and
* <a href="http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#235947">&sect;9.1.1</a>.
* suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
* <cite>The Java&trade; Language Specification</cite>.
* The full modifier ordering used by this method is:
* <blockquote> {@code
* public protected private abstract static final transient
@ -269,9 +257,8 @@ class Modifier {
}
/*
* Access modifier flag constants from <em>The Java Virtual
* Machine Specification, Second Edition</em>, tables 4.1, 4.4,
* 4.5, and 4.7.
* Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
* <cite>The Java&trade; Virtual Machine Specification</cite>
*/
/**
@ -403,7 +390,7 @@ class Modifier {
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a class.
*
* @jls3 8.1.1 Class Modifiers
* @jls 8.1.1 Class Modifiers
* @since 1.7
*/
public static int classModifiers() {
@ -416,7 +403,7 @@ class Modifier {
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to an inteface.
*
* @jls3 9.1.1 Interface Modifiers
* @jls 9.1.1 Interface Modifiers
* @since 1.7
*/
public static int interfaceModifiers() {
@ -429,7 +416,7 @@ class Modifier {
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a constructor.
*
* @jls3 8.8.3 Constructor Modifiers
* @jls 8.8.3 Constructor Modifiers
* @since 1.7
*/
public static int constructorModifiers() {
@ -442,7 +429,7 @@ class Modifier {
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a method.
*
* @jls3 8.4.3 Method Modifiers
* @jls 8.4.3 Method Modifiers
* @since 1.7
*/
public static int methodModifiers() {
@ -456,7 +443,7 @@ class Modifier {
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a field.
*
* @jls3 8.3.1 Field Modifiers
* @jls 8.3.1 Field Modifiers
* @since 1.7
*/
public static int fieldModifiers() {

View File

@ -2905,12 +2905,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Converts this {@code BigDecimal} to a {@code BigInteger}.
* This conversion is analogous to a <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code long} as defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: any fractional part of this
* This conversion is analogous to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code long} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* any fractional part of this
* {@code BigDecimal} will be discarded. Note that this
* conversion can lose information about the precision of the
* {@code BigDecimal} value.
@ -2942,13 +2941,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
/**
* Converts this {@code BigDecimal} to a {@code long}. This
* conversion is analogous to a <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code short} as defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: any fractional part of this
* Converts this {@code BigDecimal} to a {@code long}.
* This conversion is analogous to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code short} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* any fractional part of this
* {@code BigDecimal} will be discarded, and if the resulting
* "{@code BigInteger}" is too big to fit in a
* {@code long}, only the low-order 64 bits are returned.
@ -3011,13 +3009,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
/**
* Converts this {@code BigDecimal} to an {@code int}. This
* conversion is analogous to a <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code short} as defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: any fractional part of this
* Converts this {@code BigDecimal} to an {@code int}.
* This conversion is analogous to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code short} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* any fractional part of this
* {@code BigDecimal} will be discarded, and if the resulting
* "{@code BigInteger}" is too big to fit in an
* {@code int}, only the low-order 32 bits are returned.
@ -3095,12 +3092,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Converts this {@code BigDecimal} to a {@code float}.
* This conversion is similar to the <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code float} defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: if this {@code BigDecimal} has too great a
* This conversion is similar to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code float} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* if this {@code BigDecimal} has too great a
* magnitude to represent as a {@code float}, it will be
* converted to {@link Float#NEGATIVE_INFINITY} or {@link
* Float#POSITIVE_INFINITY} as appropriate. Note that even when
@ -3119,12 +3115,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Converts this {@code BigDecimal} to a {@code double}.
* This conversion is similar to the <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code float} as defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: if this {@code BigDecimal} has too great a
* This conversion is similar to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code float} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* if this {@code BigDecimal} has too great a
* magnitude represent as a {@code double}, it will be
* converted to {@link Double#NEGATIVE_INFINITY} or {@link
* Double#POSITIVE_INFINITY} as appropriate. Note that even when

View File

@ -2719,12 +2719,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Converts this BigInteger to an {@code int}. This
* conversion is analogous to a <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code long} to
* {@code int} as defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: if this BigInteger is too big to fit in an
* conversion is analogous to a
* <i>narrowing primitive conversion</i> from {@code long} to
* {@code int} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* if this BigInteger is too big to fit in an
* {@code int}, only the low-order 32 bits are returned.
* Note that this conversion can lose information about the
* overall magnitude of the BigInteger value as well as return a
@ -2740,12 +2739,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Converts this BigInteger to a {@code long}. This
* conversion is analogous to a <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code long} to
* {@code int} as defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: if this BigInteger is too big to fit in a
* conversion is analogous to a
* <i>narrowing primitive conversion</i> from {@code long} to
* {@code int} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* if this BigInteger is too big to fit in a
* {@code long}, only the low-order 64 bits are returned.
* Note that this conversion can lose information about the
* overall magnitude of the BigInteger value as well as return a
@ -2763,12 +2761,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Converts this BigInteger to a {@code float}. This
* conversion is similar to the <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code float} defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: if this BigInteger has too great a magnitude
* conversion is similar to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code float} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* if this BigInteger has too great a magnitude
* to represent as a {@code float}, it will be converted to
* {@link Float#NEGATIVE_INFINITY} or {@link
* Float#POSITIVE_INFINITY} as appropriate. Note that even when
@ -2784,12 +2781,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Converts this BigInteger to a {@code double}. This
* conversion is similar to the <a
* href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
* primitive conversion</i></a> from {@code double} to
* {@code float} defined in the <a
* href="http://java.sun.com/docs/books/jls/html/">Java Language
* Specification</a>: if this BigInteger has too great a magnitude
* conversion is similar to the
* <i>narrowing primitive conversion</i> from {@code double} to
* {@code float} as defined in section 5.1.3 of
* <cite>The Java&trade; Language Specification</cite>:
* if this BigInteger has too great a magnitude
* to represent as a {@code double}, it will be converted to
* {@link Double#NEGATIVE_INFINITY} or {@link
* Double#POSITIVE_INFINITY} as appropriate. Note that even when

View File

@ -118,10 +118,8 @@ public class SecureClassLoader extends ClassLoader {
* and without a trailing ".class" suffix.
* @param b the bytes that make up the class data. The bytes in
* positions <code>off</code> through <code>off+len-1</code>
* should have the format of a valid class file as defined
* by the
* <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>.
* should have the format of a valid class file as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* @param off the start offset in <code>b</code> of the class data
* @param len the length of the class data
* @param cs the associated CodeSource, or <code>null</code> if none
@ -157,9 +155,8 @@ public class SecureClassLoader extends ClassLoader {
* and without a trailing ".class" suffix.
* @param b the bytes that make up the class data. The bytes from positions
* <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt>
* should have the format of a valid class file as defined by the
* <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
* Machine Specification</a>.
* should have the format of a valid class file as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* @param cs the associated CodeSource, or <code>null</code> if none
* @return the <code>Class</code> object created from the data,
* and optional CodeSource.

View File

@ -80,7 +80,7 @@ public class DriverManager {
// List of registered JDBC drivers
private final static CopyOnWriteArrayList<Driver> registeredDrivers = new CopyOnWriteArrayList<Driver>();
private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<DriverInfo>();
private static volatile int loginTimeout = 0;
private static volatile java.io.PrintWriter logWriter = null;
private static volatile java.io.PrintStream logStream = null;
@ -265,22 +265,22 @@ public class DriverManager {
// Walk through the loaded registeredDrivers attempting to locate someone
// who understands the given URL.
for (Driver aDriver : registeredDrivers) {
for (DriverInfo aDriver : registeredDrivers) {
// If the caller does not have permission to load the driver then
// skip it.
if(isDriverAllowed(aDriver, callerCL)) {
if(isDriverAllowed(aDriver.driver, callerCL)) {
try {
if(aDriver.acceptsURL(url)) {
if(aDriver.driver.acceptsURL(url)) {
// Success!
println("getDriver returning " + aDriver.getClass().getName());
return (aDriver);
println("getDriver returning " + aDriver.driver.getClass().getName());
return (aDriver.driver);
}
} catch(SQLException sqe) {
// Drop through and try the next driver.
}
} else {
println(" skipping: " + aDriver.getClass().getName());
println(" skipping: " + aDriver.driver.getClass().getName());
}
}
@ -305,7 +305,7 @@ public class DriverManager {
/* Register the driver if it has not already been added to our list */
if(driver != null) {
registeredDrivers.addIfAbsent(driver);
registeredDrivers.addIfAbsent(new DriverInfo(driver));
} else {
// This is for compatibility with the original DriverManager
throw new NullPointerException();
@ -333,9 +333,10 @@ public class DriverManager {
ClassLoader callerCL = DriverManager.getCallerClassLoader();
println("DriverManager.deregisterDriver: " + driver);
if(registeredDrivers.contains(driver)) {
DriverInfo aDriver = new DriverInfo(driver);
if(registeredDrivers.contains(aDriver)) {
if (isDriverAllowed(driver, callerCL)) {
registeredDrivers.remove(driver);
registeredDrivers.remove(aDriver);
} else {
// If the caller does not have permission to load the driver then
// throw a SecurityException.
@ -363,11 +364,11 @@ public class DriverManager {
ClassLoader callerCL = DriverManager.getCallerClassLoader();
// Walk through the loaded registeredDrivers.
for(Driver aDriver : registeredDrivers) {
for(DriverInfo aDriver : registeredDrivers) {
// If the caller does not have permission to load the driver then
// skip it.
if(isDriverAllowed(aDriver, callerCL)) {
result.addElement(aDriver);
if(isDriverAllowed(aDriver.driver, callerCL)) {
result.addElement(aDriver.driver);
} else {
println(" skipping: " + aDriver.getClass().getName());
}
@ -482,8 +483,8 @@ public class DriverManager {
private static void loadInitialDrivers() {
String drivers;
try {
drivers = (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("jdbc.drivers");
}
});
@ -495,8 +496,8 @@ public class DriverManager {
// exposed as a java.sql.Driver.class service.
// ServiceLoader.load() replaces the sun.misc.Providers()
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
ServiceLoader<Driver> loadedDrivers = ServiceLoader.load(Driver.class);
Iterator driversIterator = loadedDrivers.iterator();
@ -569,16 +570,16 @@ public class DriverManager {
// Remember the first exception that gets raised so we can reraise it.
SQLException reason = null;
for(Driver aDriver : registeredDrivers) {
for(DriverInfo aDriver : registeredDrivers) {
// If the caller does not have permission to load the driver then
// skip it.
if(isDriverAllowed(aDriver, callerCL)) {
if(isDriverAllowed(aDriver.driver, callerCL)) {
try {
println(" trying " + aDriver.getClass().getName());
Connection con = aDriver.connect(url, info);
println(" trying " + aDriver.driver.getClass().getName());
Connection con = aDriver.driver.connect(url, info);
if (con != null) {
// Success!
println("getConnection returning " + aDriver.getClass().getName());
println("getConnection returning " + aDriver.driver.getClass().getName());
return (con);
}
} catch (SQLException ex) {
@ -607,3 +608,29 @@ public class DriverManager {
private static native ClassLoader getCallerClassLoader();
}
/*
* Wrapper class for registered Drivers in order to not expose Driver.equals()
* to avoid the capture of the Driver it being compared to as it might not
* normally have access.
*/
class DriverInfo {
final Driver driver;
DriverInfo(Driver driver) {
this.driver = driver;
}
public boolean equals(Object other) {
return (other instanceof DriverInfo)
&& this.driver == ((DriverInfo) other).driver;
}
public int hashCode() {
return driver.hashCode();
}
public String toString() {
return ("driver[className=" + driver + "]");
}
}

View File

@ -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
@ -137,7 +137,7 @@ import java.io.InputStream;
* to retrieve the next result from a sequence of multiple results.
*
* <P>The number, types and properties of a <code>ResultSet</code>
* object's columns are provided by the <code>ResulSetMetaData</code>
* object's columns are provided by the <code>ResultSetMetaData</code>
* object returned by the <code>ResultSet.getMetaData</code> method.
*
* @see Statement#executeQuery
@ -422,7 +422,7 @@ public interface ResultSet extends Wrapper, AutoCloseable {
* of this <code>ResultSet</code> object as
* a stream of ASCII characters. The value can then be read in chunks from the
* stream. This method is particularly
* suitable for retrieving large <char>LONGVARCHAR</char> values.
* suitable for retrieving large <code>LONGVARCHAR</code> values.
* The JDBC driver will
* do any necessary conversion from the database format into ASCII.
*

View File

@ -116,11 +116,11 @@ public final class SQLPermission extends BasicPermission {
/**
* Creates a new <code>SQLPermission</code> object with the specified name.
* The name is the symbolic name of the <code>SQLPermission</code>; currently,
* the only name allowed is "setLog".
* The name is the symbolic name of the <code>SQLPermission</code>.
*
* @param name the name of this <code>SQLPermission</code> object, which must
* be <code>setLog</code>
* be either {@code setLog}, {@code callAbort}, {@code setSyncFactory},
* or {@code setNetworkTimeout}
* @throws NullPointerException if <code>name</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>name</code> is empty.
@ -134,10 +134,11 @@ public final class SQLPermission extends BasicPermission {
* Creates a new <code>SQLPermission</code> object with the specified name.
* The name is the symbolic name of the <code>SQLPermission</code>; the
* actions <code>String</code> is currently unused and should be
* <code>null</code>.
* <code>null</code>.
*
* @param name the name of this <code>SQLPermission</code> object, which must
* be <code>setLog</code>
* be either {@code setLog}, {@code callAbort}, {@code setSyncFactory},
* or {@code setNetworkTimeout}
* @param actions should be <code>null</code>
* @throws NullPointerException if <code>name</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>name</code> is empty.

View File

@ -54,7 +54,7 @@ import java.util.StringTokenizer;
* As a result, the <code>Timestamp.equals(Object)</code>
* method is not symmetric with respect to the
* <code>java.util.Date.equals(Object)</code>
* method. Also, the <code>hashcode</code> method uses the underlying
* method. Also, the <code>hashCode</code> method uses the underlying
* <code>java.util.Date</code>
* implementation and therefore does not include nanos in its computation.
* <P>
@ -515,6 +515,18 @@ public class Timestamp extends java.util.Date {
}
}
/**
* {@inheritDoc}
*
* The {@code hashCode} method uses the underlying {@code java.util.Date}
* implementation and therefore does not include nanos in its computation.
*
*/
@Override
public int hashCode() {
return super.hashCode();
}
static final long serialVersionUID = 2745179027874758501L;
}

View File

@ -136,8 +136,8 @@ import java.util.Arrays;
* </pre>
* </blockquote>
* And the output result would be like the following:
* <pre>
* <blockquote>
* <pre>
* Format with -INF : is negative
* Format with -1.0 : is negative
* Format with 0 : is zero or fraction

View File

@ -30,7 +30,7 @@
*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
* http://creativecommons.org/licenses/publicdomain
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util;

View File

@ -29,7 +29,7 @@
* file:
*
* Written by Josh Bloch of Google Inc. and released to the public domain,
* as explained at http://creativecommons.org/licenses/publicdomain.
* as explained at http://creativecommons.org/publicdomain/zero/1.0/.
*/
package java.util;

View File

@ -30,7 +30,7 @@
*
* Written by Doug Lea and Josh Bloch with assistance from members of
* JCP JSR-166 Expert Group and released to the public domain, as explained
* at http://creativecommons.org/licenses/publicdomain
* at http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util;

View File

@ -106,7 +106,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
/**
* Distinguished non-null value for representing null values.
*/
private static final Object NULL = new Object();
private static final Object NULL = new Integer(0);
private Object maskNull(Object value) {
return (value == null ? NULL : value);
@ -116,7 +116,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
return (V) (value == NULL ? null : value);
}
private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
private static final Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
/**
* Creates an empty enum map with the specified key type.
@ -464,6 +464,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
public Iterator<Map.Entry<K,V>> iterator() {
return new EntryIterator();
}
public boolean contains(Object o) {
if (!(o instanceof Map.Entry))
return false;
@ -552,70 +553,82 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
}
}
/**
* Since we don't use Entry objects, we use the Iterator itself as entry.
*/
private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>>
implements Map.Entry<K,V>
{
private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>> {
private Entry lastReturnedEntry = null;
public Map.Entry<K,V> next() {
if (!hasNext())
throw new NoSuchElementException();
lastReturnedIndex = index++;
return this;
lastReturnedEntry = new Entry(index++);
return lastReturnedEntry;
}
public K getKey() {
checkLastReturnedIndexForEntryUse();
return keyUniverse[lastReturnedIndex];
public void remove() {
lastReturnedIndex =
((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
super.remove();
lastReturnedEntry.index = lastReturnedIndex;
lastReturnedEntry = null;
}
public V getValue() {
checkLastReturnedIndexForEntryUse();
return unmaskNull(vals[lastReturnedIndex]);
}
private class Entry implements Map.Entry<K,V> {
private int index;
public V setValue(V value) {
checkLastReturnedIndexForEntryUse();
V oldValue = unmaskNull(vals[lastReturnedIndex]);
vals[lastReturnedIndex] = maskNull(value);
return oldValue;
}
private Entry(int index) {
this.index = index;
}
public boolean equals(Object o) {
if (lastReturnedIndex < 0)
return o == this;
public K getKey() {
checkIndexForEntryUse();
return keyUniverse[index];
}
if (!(o instanceof Map.Entry))
return false;
Map.Entry e = (Map.Entry)o;
V ourValue = unmaskNull(vals[lastReturnedIndex]);
Object hisValue = e.getValue();
return e.getKey() == keyUniverse[lastReturnedIndex] &&
(ourValue == hisValue ||
(ourValue != null && ourValue.equals(hisValue)));
}
public V getValue() {
checkIndexForEntryUse();
return unmaskNull(vals[index]);
}
public int hashCode() {
if (lastReturnedIndex < 0)
return super.hashCode();
public V setValue(V value) {
checkIndexForEntryUse();
V oldValue = unmaskNull(vals[index]);
vals[index] = maskNull(value);
return oldValue;
}
Object value = vals[lastReturnedIndex];
return keyUniverse[lastReturnedIndex].hashCode()
^ (value == NULL ? 0 : value.hashCode());
}
public boolean equals(Object o) {
if (index < 0)
return o == this;
public String toString() {
if (lastReturnedIndex < 0)
return super.toString();
if (!(o instanceof Map.Entry))
return false;
return keyUniverse[lastReturnedIndex] + "="
+ unmaskNull(vals[lastReturnedIndex]);
}
Map.Entry e = (Map.Entry)o;
V ourValue = unmaskNull(vals[index]);
Object hisValue = e.getValue();
return (e.getKey() == keyUniverse[index] &&
(ourValue == hisValue ||
(ourValue != null && ourValue.equals(hisValue))));
}
private void checkLastReturnedIndexForEntryUse() {
if (lastReturnedIndex < 0)
throw new IllegalStateException("Entry was removed");
public int hashCode() {
if (index < 0)
return super.hashCode();
return entryHashCode(index);
}
public String toString() {
if (index < 0)
return super.toString();
return keyUniverse[index] + "="
+ unmaskNull(vals[index]);
}
private void checkIndexForEntryUse() {
if (index < 0)
throw new IllegalStateException("Entry was removed");
}
}
}
@ -631,10 +644,35 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
* @return <tt>true</tt> if the specified object is equal to this map
*/
public boolean equals(Object o) {
if (!(o instanceof EnumMap))
return super.equals(o);
if (this == o)
return true;
if (o instanceof EnumMap)
return equals((EnumMap)o);
if (!(o instanceof Map))
return false;
EnumMap em = (EnumMap)o;
Map<K,V> m = (Map<K,V>)o;
if (size != m.size())
return false;
for (int i = 0; i < keyUniverse.length; i++) {
if (null != vals[i]) {
K key = keyUniverse[i];
V value = unmaskNull(vals[i]);
if (null == value) {
if (!((null == m.get(key)) && m.containsKey(key)))
return false;
} else {
if (!value.equals(m.get(key)))
return false;
}
}
}
return true;
}
private boolean equals(EnumMap em) {
if (em.keyType != keyType)
return size == 0 && em.size == 0;
@ -649,6 +687,26 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
return true;
}
/**
* Returns the hash code value for this map. The hash code of a map is
* defined to be the sum of the hash codes of each entry in the map.
*/
public int hashCode() {
int h = 0;
for (int i = 0; i < keyUniverse.length; i++) {
if (null != vals[i]) {
h += entryHashCode(i);
}
}
return h;
}
private int entryHashCode(int index) {
return (keyUniverse[index].hashCode() ^ vals[index].hashCode());
}
/**
* Returns a shallow copy of this enum map. (The values themselves
* are not cloned.
@ -705,9 +763,13 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
s.writeInt(size);
// Write out keys and values (alternating)
for (Map.Entry<K,V> e : entrySet()) {
s.writeObject(e.getKey());
s.writeObject(e.getValue());
int entriesToBeWritten = size;
for (int i = 0; entriesToBeWritten > 0; i++) {
if (null != vals[i]) {
s.writeObject(keyUniverse[i]);
s.writeObject(unmaskNull(vals[i]));
entriesToBeWritten--;
}
}
}

View File

@ -1818,9 +1818,9 @@ import sun.misc.FormattedFloatingDecimal;
* </pre></blockquote>
*
* <p> The maximum number of arguments is limited by the maximum dimension of a
* Java array as defined by the <a
* href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
* Specification</a>. If the argument index is does not correspond to an
* Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* If the argument index is does not correspond to an
* available argument, then a {@link MissingFormatArgumentException} is thrown.
*
* <p> If there are more arguments than format specifiers, the extra arguments
@ -2403,8 +2403,7 @@ public final class Formatter implements Closeable, Flushable {
* string. If there are more arguments than format specifiers, the
* extra arguments are ignored. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>.
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format
@ -2443,8 +2442,7 @@ public final class Formatter implements Closeable, Flushable {
* string. If there are more arguments than format specifiers, the
* extra arguments are ignored. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -829,71 +829,82 @@ public class IdentityHashMap<K,V>
}
}
/**
* Since we don't use Entry objects, we use the Iterator
* itself as an entry.
*/
private class EntryIterator
extends IdentityHashMapIterator<Map.Entry<K,V>>
implements Map.Entry<K,V>
{
private Entry lastReturnedEntry = null;
public Map.Entry<K,V> next() {
nextIndex();
return this;
lastReturnedEntry = new Entry(nextIndex());
return lastReturnedEntry;
}
public K getKey() {
// Provide a better exception than out of bounds index
if (lastReturnedIndex < 0)
throw new IllegalStateException("Entry was removed");
return (K) unmaskNull(traversalTable[lastReturnedIndex]);
public void remove() {
lastReturnedIndex =
((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
super.remove();
lastReturnedEntry.index = lastReturnedIndex;
lastReturnedEntry = null;
}
public V getValue() {
// Provide a better exception than out of bounds index
if (lastReturnedIndex < 0)
throw new IllegalStateException("Entry was removed");
private class Entry implements Map.Entry<K,V> {
private int index;
return (V) traversalTable[lastReturnedIndex+1];
}
private Entry(int index) {
this.index = index;
}
public V setValue(V value) {
// It would be mean-spirited to proceed here if remove() called
if (lastReturnedIndex < 0)
throw new IllegalStateException("Entry was removed");
V oldValue = (V) traversalTable[lastReturnedIndex+1];
traversalTable[lastReturnedIndex+1] = value;
// if shadowing, force into main table
if (traversalTable != IdentityHashMap.this.table)
put((K) traversalTable[lastReturnedIndex], value);
return oldValue;
}
public K getKey() {
checkIndexForEntryUse();
return (K) unmaskNull(traversalTable[index]);
}
public boolean equals(Object o) {
if (lastReturnedIndex < 0)
return super.equals(o);
public V getValue() {
checkIndexForEntryUse();
return (V) traversalTable[index+1];
}
if (!(o instanceof Map.Entry))
return false;
Map.Entry e = (Map.Entry)o;
return e.getKey() == getKey() &&
e.getValue() == getValue();
}
public V setValue(V value) {
checkIndexForEntryUse();
V oldValue = (V) traversalTable[index+1];
traversalTable[index+1] = value;
// if shadowing, force into main table
if (traversalTable != IdentityHashMap.this.table)
put((K) traversalTable[index], value);
return oldValue;
}
public int hashCode() {
if (lastReturnedIndex < 0)
return super.hashCode();
public boolean equals(Object o) {
if (index < 0)
return super.equals(o);
return System.identityHashCode(getKey()) ^
System.identityHashCode(getValue());
}
if (!(o instanceof Map.Entry))
return false;
Map.Entry e = (Map.Entry)o;
return (e.getKey() == unmaskNull(traversalTable[index]) &&
e.getValue() == traversalTable[index+1]);
}
public String toString() {
if (lastReturnedIndex < 0)
return super.toString();
public int hashCode() {
if (lastReturnedIndex < 0)
return super.hashCode();
return getKey() + "=" + getValue();
return (System.identityHashCode(unmaskNull(traversalTable[index])) ^
System.identityHashCode(traversalTable[index+1]));
}
public String toString() {
if (index < 0)
return super.toString();
return (unmaskNull(traversalTable[index]) + "="
+ traversalTable[index+1]);
}
private void checkIndexForEntryUse() {
if (index < 0)
throw new IllegalStateException("Entry was removed");
}
}
}

View File

@ -51,13 +51,13 @@ import java.util.spi.LocaleNameProvider;
import sun.security.action.GetPropertyAction;
import sun.util.LocaleServiceProviderPool;
import sun.util.locale.AsciiUtil;
import sun.util.locale.BaseLocale;
import sun.util.locale.InternalLocaleBuilder;
import sun.util.locale.LanguageTag;
import sun.util.locale.LocaleExtensions;
import sun.util.locale.LocaleObjectCache;
import sun.util.locale.LocaleSyntaxException;
import sun.util.locale.LocaleUtils;
import sun.util.locale.ParseStatus;
import sun.util.locale.UnicodeLocaleExtension;
import sun.util.resources.LocaleData;
@ -412,59 +412,59 @@ public final class Locale implements Cloneable, Serializable {
/** Useful constant for language.
*/
static public final Locale ENGLISH = getInstance("en", "", "");
static public final Locale ENGLISH = createConstant("en", "");
/** Useful constant for language.
*/
static public final Locale FRENCH = getInstance("fr", "", "");
static public final Locale FRENCH = createConstant("fr", "");
/** Useful constant for language.
*/
static public final Locale GERMAN = getInstance("de", "", "");
static public final Locale GERMAN = createConstant("de", "");
/** Useful constant for language.
*/
static public final Locale ITALIAN = getInstance("it", "", "");
static public final Locale ITALIAN = createConstant("it", "");
/** Useful constant for language.
*/
static public final Locale JAPANESE = getInstance("ja", "", "");
static public final Locale JAPANESE = createConstant("ja", "");
/** Useful constant for language.
*/
static public final Locale KOREAN = getInstance("ko", "", "");
static public final Locale KOREAN = createConstant("ko", "");
/** Useful constant for language.
*/
static public final Locale CHINESE = getInstance("zh", "", "");
static public final Locale CHINESE = createConstant("zh", "");
/** Useful constant for language.
*/
static public final Locale SIMPLIFIED_CHINESE = getInstance("zh", "CN", "");
static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN");
/** Useful constant for language.
*/
static public final Locale TRADITIONAL_CHINESE = getInstance("zh", "TW", "");
static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW");
/** Useful constant for country.
*/
static public final Locale FRANCE = getInstance("fr", "FR", "");
static public final Locale FRANCE = createConstant("fr", "FR");
/** Useful constant for country.
*/
static public final Locale GERMANY = getInstance("de", "DE", "");
static public final Locale GERMANY = createConstant("de", "DE");
/** Useful constant for country.
*/
static public final Locale ITALY = getInstance("it", "IT", "");
static public final Locale ITALY = createConstant("it", "IT");
/** Useful constant for country.
*/
static public final Locale JAPAN = getInstance("ja", "JP", "");
static public final Locale JAPAN = createConstant("ja", "JP");
/** Useful constant for country.
*/
static public final Locale KOREA = getInstance("ko", "KR", "");
static public final Locale KOREA = createConstant("ko", "KR");
/** Useful constant for country.
*/
@ -480,19 +480,19 @@ public final class Locale implements Cloneable, Serializable {
/** Useful constant for country.
*/
static public final Locale UK = getInstance("en", "GB", "");
static public final Locale UK = createConstant("en", "GB");
/** Useful constant for country.
*/
static public final Locale US = getInstance("en", "US", "");
static public final Locale US = createConstant("en", "US");
/** Useful constant for country.
*/
static public final Locale CANADA = getInstance("en", "CA", "");
static public final Locale CANADA = createConstant("en", "CA");
/** Useful constant for country.
*/
static public final Locale CANADA_FRENCH = getInstance("fr", "CA", "");
static public final Locale CANADA_FRENCH = createConstant("fr", "CA");
/**
* Useful constant for the root locale. The root locale is the locale whose
@ -502,7 +502,7 @@ public final class Locale implements Cloneable, Serializable {
*
* @since 1.6
*/
static public final Locale ROOT = getInstance("", "", "");
static public final Locale ROOT = createConstant("", "");
/**
* The key for the private use extension ('x').
@ -532,14 +532,14 @@ public final class Locale implements Cloneable, Serializable {
private static final int DISPLAY_LANGUAGE = 0;
private static final int DISPLAY_COUNTRY = 1;
private static final int DISPLAY_VARIANT = 2;
private static final int DISPLAY_SCRIPT = 3;
private static final int DISPLAY_SCRIPT = 3;
/**
* Private constructor used by getInstance method
*/
private Locale(BaseLocale baseLocale, LocaleExtensions extensions) {
_baseLocale = baseLocale;
_extensions = extensions;
this.baseLocale = baseLocale;
this.localeExtensions = extensions;
}
/**
@ -572,8 +572,8 @@ public final class Locale implements Cloneable, Serializable {
if (language== null || country == null || variant == null) {
throw new NullPointerException();
}
_baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
_extensions = getCompatibilityExtensions(language, "", country, variant);
baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
localeExtensions = getCompatibilityExtensions(language, "", country, variant);
}
/**
@ -626,6 +626,15 @@ public final class Locale implements Cloneable, Serializable {
this(language, "", "");
}
/**
* This method must be called only for creating the Locale.*
* constants due to making shortcuts.
*/
private static Locale createConstant(String lang, String country) {
BaseLocale base = BaseLocale.createInstance(lang, country);
return getInstance(base, null);
}
/**
* Returns a <code>Locale</code> constructed from the given
* <code>language</code>, <code>country</code> and
@ -641,7 +650,7 @@ public final class Locale implements Cloneable, Serializable {
* @exception NullPointerException if any argument is null.
*/
static Locale getInstance(String language, String country, String variant) {
return getInstance(language, "", country, variant, LocaleExtensions.EMPTY_EXTENSIONS);
return getInstance(language, "", country, variant, null);
}
static Locale getInstance(String language, String script, String country,
@ -651,10 +660,6 @@ public final class Locale implements Cloneable, Serializable {
}
if (extensions == null) {
extensions = LocaleExtensions.EMPTY_EXTENSIONS;
}
if (extensions.equals(LocaleExtensions.EMPTY_EXTENSIONS)) {
extensions = getCompatibilityExtensions(language, script, country, variant);
}
@ -668,22 +673,33 @@ public final class Locale implements Cloneable, Serializable {
}
private static class Cache extends LocaleObjectCache<LocaleKey, Locale> {
public Cache() {
private Cache() {
}
@Override
protected Locale createObject(LocaleKey key) {
return new Locale(key._base, key._exts);
return new Locale(key.base, key.exts);
}
}
private static class LocaleKey {
private BaseLocale _base;
private LocaleExtensions _exts;
private static final class LocaleKey {
private final BaseLocale base;
private final LocaleExtensions exts;
private final int hash;
private LocaleKey(BaseLocale baseLocale, LocaleExtensions extensions) {
_base = baseLocale;
_exts = extensions;
base = baseLocale;
exts = extensions;
// Calculate the hash value here because it's always used.
int h = base.hashCode();
if (exts != null) {
h ^= exts.hashCode();
}
hash = h;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@ -692,11 +708,18 @@ public final class Locale implements Cloneable, Serializable {
return false;
}
LocaleKey other = (LocaleKey)obj;
return _base.equals(other._base) && _exts.equals(other._exts);
if (hash != other.hash || !base.equals(other.base)) {
return false;
}
if (exts == null) {
return other.exts == null;
}
return exts.equals(other.exts);
}
@Override
public int hashCode() {
return _base.hashCode() ^ _exts.hashCode();
return hash;
}
}
@ -981,7 +1004,7 @@ public final class Locale implements Cloneable, Serializable {
* @see #getDisplayLanguage
*/
public String getLanguage() {
return _baseLocale.getLanguage();
return baseLocale.getLanguage();
}
/**
@ -995,7 +1018,7 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public String getScript() {
return _baseLocale.getScript();
return baseLocale.getScript();
}
/**
@ -1007,7 +1030,7 @@ public final class Locale implements Cloneable, Serializable {
* @see #getDisplayCountry
*/
public String getCountry() {
return _baseLocale.getRegion();
return baseLocale.getRegion();
}
/**
@ -1017,7 +1040,7 @@ public final class Locale implements Cloneable, Serializable {
* @see #getDisplayVariant
*/
public String getVariant() {
return _baseLocale.getVariant();
return baseLocale.getVariant();
}
/**
@ -1039,7 +1062,7 @@ public final class Locale implements Cloneable, Serializable {
if (!LocaleExtensions.isValidKey(key)) {
throw new IllegalArgumentException("Ill-formed extension key: " + key);
}
return _extensions.getExtensionValue(key);
return (localeExtensions == null) ? null : localeExtensions.getExtensionValue(key);
}
/**
@ -1052,7 +1075,10 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public Set<Character> getExtensionKeys() {
return _extensions.getKeys();
if (localeExtensions == null) {
return Collections.emptySet();
}
return localeExtensions.getKeys();
}
/**
@ -1064,7 +1090,10 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public Set<String> getUnicodeLocaleAttributes() {
return _extensions.getUnicodeLocaleAttributes();
if (localeExtensions == null) {
return Collections.emptySet();
}
return localeExtensions.getUnicodeLocaleAttributes();
}
/**
@ -1085,7 +1114,7 @@ public final class Locale implements Cloneable, Serializable {
if (!UnicodeLocaleExtension.isKey(key)) {
throw new IllegalArgumentException("Ill-formed Unicode locale key: " + key);
}
return _extensions.getUnicodeLocaleType(key);
return (localeExtensions == null) ? null : localeExtensions.getUnicodeLocaleType(key);
}
/**
@ -1097,7 +1126,10 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public Set<String> getUnicodeLocaleKeys() {
return _extensions.getUnicodeLocaleKeys();
if (localeExtensions == null) {
return Collections.emptySet();
}
return localeExtensions.getUnicodeLocaleKeys();
}
/**
@ -1106,16 +1138,17 @@ public final class Locale implements Cloneable, Serializable {
* @return base locale of this Locale
*/
BaseLocale getBaseLocale() {
return _baseLocale;
return baseLocale;
}
/**
* Package local method returning the Locale's LocaleExtensions,
* used by ResourceBundle
* @return locale exnteions of this Locale
* Package private method returning the Locale's LocaleExtensions,
* used by ResourceBundle.
* @return locale exnteions of this Locale,
* or {@code null} if no extensions are defined
*/
LocaleExtensions getLocaleExtensions() {
return _extensions;
return localeExtensions;
}
/**
@ -1160,26 +1193,27 @@ public final class Locale implements Cloneable, Serializable {
* @see #getDisplayName
* @see #toLanguageTag
*/
@Override
public final String toString() {
boolean l = (_baseLocale.getLanguage().length() != 0);
boolean s = (_baseLocale.getScript().length() != 0);
boolean r = (_baseLocale.getRegion().length() != 0);
boolean v = (_baseLocale.getVariant().length() != 0);
boolean e = (_extensions.getID().length() != 0);
boolean l = (baseLocale.getLanguage().length() != 0);
boolean s = (baseLocale.getScript().length() != 0);
boolean r = (baseLocale.getRegion().length() != 0);
boolean v = (baseLocale.getVariant().length() != 0);
boolean e = (localeExtensions != null && localeExtensions.getID().length() != 0);
StringBuilder result = new StringBuilder(_baseLocale.getLanguage());
StringBuilder result = new StringBuilder(baseLocale.getLanguage());
if (r || (l && (v || s || e))) {
result.append('_')
.append(_baseLocale.getRegion()); // This may just append '_'
.append(baseLocale.getRegion()); // This may just append '_'
}
if (v && (l || r)) {
result.append('_')
.append(_baseLocale.getVariant());
.append(baseLocale.getVariant());
}
if (s && (l || r)) {
result.append("_#")
.append(_baseLocale.getScript());
.append(baseLocale.getScript());
}
if (e && (l || r)) {
@ -1187,7 +1221,7 @@ public final class Locale implements Cloneable, Serializable {
if (!s) {
result.append('#');
}
result.append(_extensions.getID());
result.append(localeExtensions.getID());
}
return result.toString();
@ -1261,7 +1295,7 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public String toLanguageTag() {
LanguageTag tag = LanguageTag.parseLocale(_baseLocale, _extensions);
LanguageTag tag = LanguageTag.parseLocale(baseLocale, localeExtensions);
StringBuilder buf = new StringBuilder();
String subtag = tag.getLanguage();
@ -1433,8 +1467,9 @@ public final class Locale implements Cloneable, Serializable {
bldr.setLanguageTag(tag);
BaseLocale base = bldr.getBaseLocale();
LocaleExtensions exts = bldr.getLocaleExtensions();
if (exts.isEmpty() && base.getVariant().length() > 0) {
exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), base.getRegion(), base.getVariant());
if (exts == null && base.getVariant().length() > 0) {
exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(),
base.getRegion(), base.getVariant());
}
return getInstance(base, exts);
}
@ -1454,7 +1489,7 @@ public final class Locale implements Cloneable, Serializable {
* three-letter language abbreviation is not available for this locale.
*/
public String getISO3Language() throws MissingResourceException {
String lang = _baseLocale.getLanguage();
String lang = baseLocale.getLanguage();
if (lang.length() == 3) {
return lang;
}
@ -1481,10 +1516,10 @@ public final class Locale implements Cloneable, Serializable {
* three-letter country abbreviation is not available for this locale.
*/
public String getISO3Country() throws MissingResourceException {
String country3 = getISO3Code(_baseLocale.getRegion(), LocaleISOData.isoCountryTable);
String country3 = getISO3Code(baseLocale.getRegion(), LocaleISOData.isoCountryTable);
if (country3 == null) {
throw new MissingResourceException("Couldn't find 3-letter country code for "
+ _baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
+ baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
}
return country3;
}
@ -1542,7 +1577,7 @@ public final class Locale implements Cloneable, Serializable {
* @exception NullPointerException if <code>inLocale</code> is <code>null</code>
*/
public String getDisplayLanguage(Locale inLocale) {
return getDisplayString(_baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
return getDisplayString(baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
}
/**
@ -1568,7 +1603,7 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public String getDisplayScript(Locale inLocale) {
return getDisplayString(_baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
return getDisplayString(baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
}
/**
@ -1603,7 +1638,7 @@ public final class Locale implements Cloneable, Serializable {
* @exception NullPointerException if <code>inLocale</code> is <code>null</code>
*/
public String getDisplayCountry(Locale inLocale) {
return getDisplayString(_baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
return getDisplayString(baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
}
private String getDisplayString(String code, Locale inLocale, int type) {
@ -1662,7 +1697,7 @@ public final class Locale implements Cloneable, Serializable {
* @exception NullPointerException if <code>inLocale</code> is <code>null</code>
*/
public String getDisplayVariant(Locale inLocale) {
if (_baseLocale.getVariant().length() == 0)
if (baseLocale.getVariant().length() == 0)
return "";
OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
@ -1758,7 +1793,7 @@ public final class Locale implements Cloneable, Serializable {
return formatList(variantNames, listPattern, listCompositionPattern);
}
}
ArrayList<String> names = new ArrayList<String>(4);
ArrayList<String> names = new ArrayList<>(4);
if (languageName.length() != 0) {
names.add(languageName);
}
@ -1833,10 +1868,14 @@ public final class Locale implements Cloneable, Serializable {
* Since Locales are often used in hashtables, caches the value
* for speed.
*/
@Override
public int hashCode() {
int hc = hashCodeValue;
if (hc == 0) {
hc = _baseLocale.hashCode() ^ _extensions.hashCode();
hc = baseLocale.hashCode();
if (localeExtensions != null) {
hc ^= localeExtensions.hashCode();
}
hashCodeValue = hc;
}
return hc;
@ -1851,21 +1890,26 @@ public final class Locale implements Cloneable, Serializable {
*
* @return true if this Locale is equal to the specified object.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) // quick check
return true;
if (!(obj instanceof Locale))
return false;
BaseLocale otherBase = ((Locale)obj)._baseLocale;
LocaleExtensions otherExt = ((Locale)obj)._extensions;
return _baseLocale.equals(otherBase) && _extensions.equals(otherExt);
BaseLocale otherBase = ((Locale)obj).baseLocale;
if (!baseLocale.equals(otherBase)) {
return false;
}
if (localeExtensions == null) {
return ((Locale)obj).localeExtensions == null;
}
return localeExtensions.equals(((Locale)obj).localeExtensions);
}
// ================= privates =====================================
private transient BaseLocale _baseLocale;
private transient LocaleExtensions _extensions;
private transient BaseLocale baseLocale;
private transient LocaleExtensions localeExtensions;
/**
* Calculated hashcode
@ -1883,7 +1927,7 @@ public final class Locale implements Cloneable, Serializable {
*/
private String[] getDisplayVariantArray(OpenListResourceBundle bundle, Locale inLocale) {
// Split the variant name into tokens separated by '_'.
StringTokenizer tokenizer = new StringTokenizer(_baseLocale.getVariant(), "_");
StringTokenizer tokenizer = new StringTokenizer(baseLocale.getVariant(), "_");
String[] names = new String[tokenizer.countTokens()];
// For each variant token, lookup the display name. If
@ -1996,11 +2040,11 @@ public final class Locale implements Cloneable, Serializable {
*/
private void writeObject(ObjectOutputStream out) throws IOException {
ObjectOutputStream.PutField fields = out.putFields();
fields.put("language", _baseLocale.getLanguage());
fields.put("script", _baseLocale.getScript());
fields.put("country", _baseLocale.getRegion());
fields.put("variant", _baseLocale.getVariant());
fields.put("extensions", _extensions.getID());
fields.put("language", baseLocale.getLanguage());
fields.put("script", baseLocale.getScript());
fields.put("country", baseLocale.getRegion());
fields.put("variant", baseLocale.getVariant());
fields.put("extensions", localeExtensions == null ? "" : localeExtensions.getID());
fields.put("hashcode", -1); // place holder just for backward support
out.writeFields();
}
@ -2020,13 +2064,17 @@ public final class Locale implements Cloneable, Serializable {
String country = (String)fields.get("country", "");
String variant = (String)fields.get("variant", "");
String extStr = (String)fields.get("extensions", "");
_baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
try {
InternalLocaleBuilder bldr = new InternalLocaleBuilder();
bldr.setExtensions(extStr);
_extensions = bldr.getLocaleExtensions();
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage());
baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
if (extStr.length() > 0) {
try {
InternalLocaleBuilder bldr = new InternalLocaleBuilder();
bldr.setExtensions(extStr);
localeExtensions = bldr.getLocaleExtensions();
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage());
}
} else {
localeExtensions = null;
}
}
@ -2045,8 +2093,8 @@ public final class Locale implements Cloneable, Serializable {
* @throws java.io.ObjectStreamException
*/
private Object readResolve() throws java.io.ObjectStreamException {
return getInstance(_baseLocale.getLanguage(), _baseLocale.getScript(),
_baseLocale.getRegion(), _baseLocale.getVariant(), _extensions);
return getInstance(baseLocale.getLanguage(), baseLocale.getScript(),
baseLocale.getRegion(), baseLocale.getVariant(), localeExtensions);
}
private static volatile String[] isoLanguages = null;
@ -2056,7 +2104,7 @@ public final class Locale implements Cloneable, Serializable {
private static String convertOldISOCodes(String language) {
// we accept both the old and the new ISO codes for the languages whose ISO
// codes have changed, but we always store the OLD code, for backward compatibility
language = AsciiUtil.toLowerString(language).intern();
language = LocaleUtils.toLowerString(language).intern();
if (language == "he") {
return "iw";
} else if (language == "yi") {
@ -2068,19 +2116,22 @@ public final class Locale implements Cloneable, Serializable {
}
}
private static LocaleExtensions getCompatibilityExtensions(String language, String script, String country, String variant) {
LocaleExtensions extensions = LocaleExtensions.EMPTY_EXTENSIONS;
private static LocaleExtensions getCompatibilityExtensions(String language,
String script,
String country,
String variant) {
LocaleExtensions extensions = null;
// Special cases for backward compatibility support
if (AsciiUtil.caseIgnoreMatch(language, "ja")
if (LocaleUtils.caseIgnoreMatch(language, "ja")
&& script.length() == 0
&& AsciiUtil.caseIgnoreMatch(country, "JP")
&& AsciiUtil.caseIgnoreMatch(variant, "JP")) {
&& LocaleUtils.caseIgnoreMatch(country, "jp")
&& "JP".equals(variant)) {
// ja_JP_JP -> u-ca-japanese (calendar = japanese)
extensions = LocaleExtensions.CALENDAR_JAPANESE;
} else if (AsciiUtil.caseIgnoreMatch(language, "th")
} else if (LocaleUtils.caseIgnoreMatch(language, "th")
&& script.length() == 0
&& AsciiUtil.caseIgnoreMatch(country, "TH")
&& AsciiUtil.caseIgnoreMatch(variant, "TH")) {
&& LocaleUtils.caseIgnoreMatch(country, "th")
&& "TH".equals(variant)) {
// th_TH_TH -> u-nu-thai (numbersystem = thai)
extensions = LocaleExtensions.NUMBER_THAI;
}
@ -2196,7 +2247,7 @@ public final class Locale implements Cloneable, Serializable {
* @since 1.7
*/
public static final class Builder {
private InternalLocaleBuilder _locbld;
private final InternalLocaleBuilder localeBuilder;
/**
* Constructs an empty Builder. The default value of all
@ -2204,7 +2255,7 @@ public final class Locale implements Cloneable, Serializable {
* empty string.
*/
public Builder() {
_locbld = new InternalLocaleBuilder();
localeBuilder = new InternalLocaleBuilder();
}
/**
@ -2229,7 +2280,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setLocale(Locale locale) {
try {
_locbld.setLocale(locale._baseLocale, locale._extensions);
localeBuilder.setLocale(locale.baseLocale, locale.localeExtensions);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2259,8 +2310,7 @@ public final class Locale implements Cloneable, Serializable {
if (sts.isError()) {
throw new IllformedLocaleException(sts.getErrorMessage(), sts.getErrorIndex());
}
_locbld.setLanguageTag(tag);
localeBuilder.setLanguageTag(tag);
return this;
}
@ -2279,7 +2329,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setLanguage(String language) {
try {
_locbld.setLanguage(language);
localeBuilder.setLanguage(language);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2300,7 +2350,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setScript(String script) {
try {
_locbld.setScript(script);
localeBuilder.setScript(script);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2325,7 +2375,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setRegion(String region) {
try {
_locbld.setRegion(region);
localeBuilder.setRegion(region);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2352,7 +2402,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setVariant(String variant) {
try {
_locbld.setVariant(variant);
localeBuilder.setVariant(variant);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2384,7 +2434,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setExtension(char key, String value) {
try {
_locbld.setExtension(key, value);
localeBuilder.setExtension(key, value);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2414,7 +2464,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder setUnicodeLocaleKeyword(String key, String type) {
try {
_locbld.setUnicodeLocaleKeyword(key, type);
localeBuilder.setUnicodeLocaleKeyword(key, type);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2435,7 +2485,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder addUnicodeLocaleAttribute(String attribute) {
try {
_locbld.addUnicodeLocaleAttribute(attribute);
localeBuilder.addUnicodeLocaleAttribute(attribute);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2458,7 +2508,7 @@ public final class Locale implements Cloneable, Serializable {
*/
public Builder removeUnicodeLocaleAttribute(String attribute) {
try {
_locbld.removeUnicodeLocaleAttribute(attribute);
localeBuilder.removeUnicodeLocaleAttribute(attribute);
} catch (LocaleSyntaxException e) {
throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
}
@ -2471,7 +2521,7 @@ public final class Locale implements Cloneable, Serializable {
* @return This builder.
*/
public Builder clear() {
_locbld.clear();
localeBuilder.clear();
return this;
}
@ -2483,7 +2533,7 @@ public final class Locale implements Cloneable, Serializable {
* @see #setExtension(char, String)
*/
public Builder clearExtensions() {
_locbld.clearExtensions();
localeBuilder.clearExtensions();
return this;
}
@ -2498,9 +2548,9 @@ public final class Locale implements Cloneable, Serializable {
* @return A Locale.
*/
public Locale build() {
BaseLocale baseloc = _locbld.getBaseLocale();
LocaleExtensions extensions = _locbld.getLocaleExtensions();
if (extensions.isEmpty() && baseloc.getVariant().length() > 0) {
BaseLocale baseloc = localeBuilder.getBaseLocale();
LocaleExtensions extensions = localeBuilder.getLocaleExtensions();
if (extensions == null && baseloc.getVariant().length() > 0) {
extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(),
baseloc.getRegion(), baseloc.getVariant());
}

View File

@ -30,7 +30,7 @@
*
* Written by Doug Lea and Josh Bloch with assistance from members of JCP
* JSR-166 Expert Group and released to the public domain, as explained at
* http://creativecommons.org/licenses/publicdomain
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util;

View File

@ -30,7 +30,7 @@
*
* Written by Doug Lea and Josh Bloch with assistance from members of JCP
* JSR-166 Expert Group and released to the public domain, as explained at
* http://creativecommons.org/licenses/publicdomain
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util;

View File

@ -68,8 +68,9 @@ import java.io.BufferedWriter;
* methods work the same way as the load(Reader)/store(Writer, String) pair, except
* the input/output stream is encoded in ISO 8859-1 character encoding.
* Characters that cannot be directly represented in this encoding can be written using
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>
* ; only a single 'u' character is allowed in an escape
* Unicode escapes as defined in section 3.3 of
* <cite>The Java&trade; Language Specification</cite>;
* only a single 'u' character is allowed in an escape
* sequence. The native2ascii tool can be used to convert property files to and
* from other character encodings.
*
@ -272,11 +273,8 @@ class Properties extends Hashtable<Object,Object> {
* <a name="unicodeescapes"></a>
* Characters in keys and elements can be represented in escape
* sequences similar to those used for character and string literals
* (see <a
* href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">&sect;3.3</a>
* and <a
* href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6">&sect;3.10.6</a>
* of the <i>Java Language Specification</i>).
* (see sections 3.3 and 3.10.6 of
* <cite>The Java&trade; Language Specification</cite>).
*
* The differences from the character escape sequences and Unicode
* escapes used for characters and strings are:
@ -326,8 +324,9 @@ class Properties extends Hashtable<Object,Object> {
* {@link #load(java.io.Reader) load(Reader)} and is assumed to use
* the ISO 8859-1 character encoding; that is each byte is one Latin1
* character. Characters not in Latin1, and certain special characters,
* are represented in keys and elements using
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>.
* are represented in keys and elements using Unicode escapes as defined in
* section 3.3 of
* <cite>The Java&trade; Language Specification</cite>.
* <p>
* The specified stream remains open after this method returns.
*

Some files were not shown because too many files have changed in this diff Show More