This commit is contained in:
Dean Long 2015-10-27 01:45:03 -04:00
commit 19aba3bac9
565 changed files with 32707 additions and 16741 deletions

View File

@ -327,3 +327,6 @@ c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
6521875cb63e1d0121b30af56ebbc36db078c4c6 jdk9-b82
f61a63b7d1e52e307abc0bfc751203155d362ec4 jdk9-b83
51b2db2fa04c16d767b66113dbf08c5349ce382a jdk9-b84
8392405ab038b22e69a3728e17dbdd9e3d3a22ed jdk9-b85
7db0663a5e968059fa7c772172187ebd60b6492d jdk9-b86
1a52a30674cd28c24d4d388150336121f2e9ddf9 jdk9-b87

View File

@ -327,3 +327,6 @@ b8afcf91331d78626a583ec1b63164468d6f4181 jdk9-b81
42b56d1f418523ecb61a49d7493302c80c8009cc jdk9-b82
ce5c14d97d95084504c32b9320cb33cce4235588 jdk9-b83
1c8134475511ffe6726677e1418a89a7a45e92d6 jdk9-b84
1f345217c9bab05f192d00cf1665b3286c49ccdb jdk9-b85
2aa1daf98d3e2ee37f20f6858c53cc37020f6937 jdk9-b86
fd4f4f7561074dc0dbc1772c8489c7b902b6b8a9 jdk9-b87

View File

@ -288,7 +288,7 @@ AC_DEFUN([BASIC_SETUP_TOOL],
# Publish this variable in the help.
AC_ARG_VAR($1, [Override default value for $1])
if test "x[$]$1" = x; then
if [[ -z "${$1+x}" ]]; then
# The variable is not set by user, try to locate tool using the code snippet
$2
else
@ -312,25 +312,32 @@ AC_DEFUN([BASIC_SETUP_TOOL],
# for unknown variables in the end.
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
# Check if the provided tool contains a complete path.
tool_specified="[$]$1"
tool_basename="${tool_specified##*/}"
if test "x$tool_basename" = "x$tool_specified"; then
# A command without a complete path is provided, search $PATH.
AC_MSG_NOTICE([Will search for user supplied tool $1=$tool_basename])
AC_PATH_PROG($1, $tool_basename)
if test "x[$]$1" = x; then
AC_MSG_ERROR([User supplied tool $tool_basename could not be found])
fi
else
# Otherwise we believe it is a complete path. Use it as it is.
AC_MSG_NOTICE([Will use user supplied tool $1=$tool_specified])
# Check if we try to supply an empty value
if test "x[$]$1" = x; then
AC_MSG_NOTICE([Setting user supplied tool $1= (no value)])
AC_MSG_CHECKING([for $1])
if test ! -x "$tool_specified"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([User supplied tool $1=$tool_specified does not exist or is not executable])
AC_MSG_RESULT([disabled])
else
# Check if the provided tool contains a complete path.
tool_specified="[$]$1"
tool_basename="${tool_specified##*/}"
if test "x$tool_basename" = "x$tool_specified"; then
# A command without a complete path is provided, search $PATH.
AC_MSG_NOTICE([Will search for user supplied tool $1=$tool_basename])
AC_PATH_PROG($1, $tool_basename)
if test "x[$]$1" = x; then
AC_MSG_ERROR([User supplied tool $tool_basename could not be found])
fi
else
# Otherwise we believe it is a complete path. Use it as it is.
AC_MSG_NOTICE([Will use user supplied tool $1=$tool_specified])
AC_MSG_CHECKING([for $1])
if test ! -x "$tool_specified"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([User supplied tool $1=$tool_specified does not exist or is not executable])
fi
AC_MSG_RESULT([$tool_specified])
fi
AC_MSG_RESULT([$tool_specified])
fi
fi
fi
@ -376,9 +383,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
[
# Start with tools that do not need have cross compilation support
# and can be expected to be found in the default PATH. These tools are
# used by configure. Nor are these tools expected to be found in the
# devkit from the builddeps server either, since they are
# needed to download the devkit.
# used by configure.
# First are all the simple required tools.
BASIC_REQUIRE_PROGS(BASENAME, basename)
@ -437,6 +442,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
BASIC_PATH_PROGS(READLINK, [greadlink readlink])
BASIC_PATH_PROGS(DF, df)
BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
BASIC_PATH_PROGS(NICE, nice)
])
# Setup basic configuration paths, and platform-specific stuff related to PATHs.

View File

@ -108,12 +108,6 @@ AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
fi
])
# Test: Is bootjdk available from builddeps?
AC_DEFUN([BOOTJDK_CHECK_BUILDDEPS],
[
BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=maybe], [BOOT_JDK_FOUND=no])
])
# Test: Is $JAVA_HOME set?
AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
[
@ -276,9 +270,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
fi
# Test: Is bootjdk available from builddeps?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS])
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])

View File

@ -1,66 +0,0 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This is a configuration example using builddeps
# that are downloaded from an ftp server.
# This is how you use it:
#configure --with-builddeps-server=ftp://builddeps.server/adir \
# --with-builddeps-conf=..../builddeps.conf.example
# --with-builddeps-dir=/localdisk/mybuilddeps
# Translate a configuration triplet/quadruplet into something
# known by this configuration file.
# If no rewrite was found, then rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME}
REWRITE_i686_pc_linux_gnu=i686-unknown-linux-gnu
REWRITE_i386_pc_solaris2_10=i686-sun-solaris2_10
# The needed cups builddeps are platform independent header files.
# I.e. they need not be part of the devkit.
builddep_cups=lib/cups_1_3_9.zip
builddep_cups_CFLAGS=-I${depdir}
# The devkit is the cross compiler tools and sys-roots
# for the build platform.
builddep_devkit=sdk/sdk-${rewritten_build}-20110921.tar.gz
# The freetype dependency is partly platform dependent.
# It is stored inside the sys-root.
builddep_freetype2=sdk/sdk-${rewritten_build}-20110921.tar.gz
builddep_freetype2_CFLAGS=-I${depdir}/${rewritten_target}/sys-root/usr/include/freetype2
builddep_freetype2_LIBS=-lfreetype
# There are many other build dependencies, but they are implicitly
# found inside the devkit sys-root.
# The boot jdk runs on the build system and is used to compile and run
# Java build tools and of course, the bootstrap javac.
builddep_bootjdk_BUILD_i386_pc_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-i586-17_nov_2011.zip
builddep_bootjdk_BUILD_x86_64_pc_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-x64-17_nov_2011.zip
builddep_bootjdk_BUILD_i686_unknown_linux_gnu=java/jdk-7u2-fcs-bin-b13-linux-i586-17_nov_2011.zip
builddep_bootjdk_BUILD_x86_64_unknown_linux_gnu=java/jdk-7u2-fcs-bin-b13-linux-x64-17_nov_2011.zip
builddep_bootjdk_BUILD_sparc_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-sparc-17_nov_2011.zip
builddep_bootjdk_BUILD_sparcv9_solaris2=java/jdk-7u2-fcs-bin-b13-solaris-sparcv9-17_nov_2011.zip
builddep_bootjdk_BUILD_i386_pc_windows=java/jdk-7u2-fcs-bin-b13-windows-i586-17_nov_2011.zip
builddep_bootjdk_BUILD_x86_64_pc_windows=java/jdk-7u2-fcs-bin-b13-windows-x64-17_nov_2011.zip
builddep_bootjdk_ROOT=${depdir}/jdk7_02/jdk1.7.0_02

View File

@ -1,247 +0,0 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. 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.
#
AC_DEFUN_ONCE([BDEPS_SCAN_FOR_BUILDDEPS],
[
define(LIST_OF_BUILD_DEPENDENCIES,)
if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
if test "x$with_builddeps_conf" != x; then
AC_MSG_CHECKING([for supplied builddeps configuration file])
builddepsfile=$with_builddeps_conf
if test -s $builddepsfile; then
. $builddepsfile
AC_MSG_RESULT([loaded!])
else
AC_MSG_ERROR([The given builddeps conf file $with_builddeps_conf could not be loaded!])
fi
else
AC_MSG_CHECKING([for builddeps.conf files in sources...])
builddepsfile=`mktemp`
touch $builddepsfile
# Put all found confs into a single file.
find ${SRC_ROOT} -name builddeps.conf -exec cat \{\} \; >> $builddepsfile
# Source the file to acquire the variables
if test -s $builddepsfile; then
. $builddepsfile
AC_MSG_RESULT([found at least one!])
else
AC_MSG_ERROR([Could not find any builddeps.conf at all!])
fi
fi
# Create build and target names that use _ instead of "-" and ".".
# This is necessary to use them in variable names.
build_var=`echo ${OPENJDK_BUILD_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
target_var=`echo ${OPENJDK_TARGET_AUTOCONF_NAME} | tr '-' '_' | tr '.' '_'`
# Extract rewrite information for build and target
eval rewritten_build=\${REWRITE_${build_var}}
if test "x$rewritten_build" = x; then
rewritten_build=${OPENJDK_BUILD_AUTOCONF_NAME}
echo Build stays the same $rewritten_build
else
echo Rewriting build for builddeps into $rewritten_build
fi
eval rewritten_target=\${REWRITE_${target_var}}
if test "x$rewritten_target" = x; then
rewritten_target=${OPENJDK_TARGET_AUTOCONF_NAME}
echo Target stays the same $rewritten_target
else
echo Rewriting target for builddeps into $rewritten_target
fi
rewritten_build_var=`echo ${rewritten_build} | tr '-' '_' | tr '.' '_'`
rewritten_target_var=`echo ${rewritten_target} | tr '-' '_' | tr '.' '_'`
fi
AC_CHECK_PROGS(BDEPS_UNZIP, [7z unzip])
if test "x$BDEPS_UNZIP" = x7z; then
BDEPS_UNZIP="7z x"
fi
AC_CHECK_PROGS(BDEPS_FTP, [wget lftp ftp])
])
AC_DEFUN([BDEPS_FTPGET],
[
# $1 is the ftp://abuilddeps.server.com/libs/cups.zip
# $2 is the local file name for the downloaded file.
VALID_TOOL=no
if test "x$BDEPS_FTP" = xwget; then
VALID_TOOL=yes
wget -O $2 $1
fi
if test "x$BDEPS_FTP" = xlftp; then
VALID_TOOL=yes
lftp -c "get $1 -o $2"
fi
if test "x$BDEPS_FTP" = xftp; then
VALID_TOOL=yes
FTPSERVER=`echo $1 | cut -f 3 -d '/'`
FTPPATH=`echo $1 | cut -f 4- -d '/'`
FTPUSERPWD=${FTPSERVER%%@*}
if test "x$FTPSERVER" != "x$FTPUSERPWD"; then
FTPUSER=${userpwd%%:*}
FTPPWD=${userpwd#*@}
FTPSERVER=${FTPSERVER#*@}
else
FTPUSER=ftp
FTPPWD=ftp
fi
# the "pass" command does not work on some
# ftp clients (read ftp.exe) but if it works,
# passive mode is better!
( \
echo "user $FTPUSER $FTPPWD" ; \
echo "pass" ; \
echo "bin" ; \
echo "get $FTPPATH $2" ; \
) | ftp -in $FTPSERVER
fi
if test "x$VALID_TOOL" != xyes; then
AC_MSG_ERROR([I do not know how to use the tool: $BDEPS_FTP])
fi
])
AC_DEFUN([BDEPS_CHECK_MODULE],
[
define([LIST_OF_BUILD_DEPENDENCIES],LIST_OF_BUILD_DEPENDENCIES[$2=$3'\n'])
if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
# Source the builddeps file again, to make sure it uses the latest variables!
. $builddepsfile
# Look for a target and build machine specific resource!
eval resource=\${builddep_$2_BUILD_${rewritten_build_var}_TARGET_${rewritten_target_var}}
if test "x$resource" = x; then
# Ok, lets instead look for a target specific resource
eval resource=\${builddep_$2_TARGET_${rewritten_target_var}}
fi
if test "x$resource" = x; then
# Ok, lets instead look for a build specific resource
eval resource=\${builddep_$2_BUILD_${rewritten_build_var}}
fi
if test "x$resource" = x; then
# Ok, lets instead look for a generic resource
# (The $2 comes from M4 and not the shell, thus no need for eval here.)
resource=${builddep_$2}
fi
if test "x$resource" != x; then
AC_MSG_NOTICE([Using builddeps $resource for $2])
# If the resource in the builddeps.conf file is an existing directory,
# for example /java/linux/cups
if test -d ${resource}; then
depdir=${resource}
else
BDEPS_FETCH($2, $resource, $with_builddeps_server, $with_builddeps_dir, depdir)
fi
# Source the builddeps file again, because in the previous command, the depdir
# was updated to point at the current build dependency install directory.
. $builddepsfile
# Now extract variables from the builddeps.conf files.
theroot=${builddep_$2_ROOT}
thecflags=${builddep_$2_CFLAGS}
thelibs=${builddep_$2_LIBS}
if test "x$depdir" = x; then
AC_MSG_ERROR([Could not download build dependency $2])
fi
$1=$depdir
if test "x$theroot" != x; then
$1="$theroot"
fi
if test "x$thecflags" != x; then
$1_CFLAGS="$thecflags"
fi
if test "x$thelibs" != x; then
$1_LIBS="$thelibs"
fi
m4_default([$4], [:])
m4_ifvaln([$5], [else $5])
fi
m4_ifvaln([$5], [else $5])
fi
])
AC_DEFUN([BDEPS_FETCH],
[
# $1 is for example mymodule
# $2 is for example libs/general/libmymod_1_2_3.zip
# $3 is for example ftp://mybuilddeps.myserver.com/builddeps
# $4 is for example /localhome/builddeps
# $5 is the name of the variable into which we store the depdir, eg MYMOD
# Will download ftp://mybuilddeps.myserver.com/builddeps/libs/general/libmymod_1_2_3.zip and
# unzip into the directory: /localhome/builddeps/libmymod_1_2_3
filename=`basename $2`
filebase=`echo $filename | sed 's/\.[[^\.]]*$//'`
filebase=${filename%%.*}
extension=${filename#*.}
installdir=$4/$filebase
if test ! -f $installdir/$filename.unpacked; then
AC_MSG_NOTICE([Downloading build dependency $1 from $3/$2 and installing into $installdir])
if test ! -d $installdir; then
mkdir -p $installdir
fi
if test ! -d $installdir; then
AC_MSG_ERROR([Could not create directory $installdir])
fi
tmpfile=`mktemp $installdir/$1.XXXXXXXXX`
touch $tmpfile
if test ! -f $tmpfile; then
AC_MSG_ERROR([Could not create files in directory $installdir])
fi
BDEPS_FTPGET([$3/$2] , [$tmpfile])
mv $tmpfile $installdir/$filename
if test ! -s $installdir/$filename; then
AC_MSG_ERROR([Could not download $3/$2])
fi
case "$extension" in
zip) echo "Unzipping $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; $BDEPS_UNZIP $installdir/$filename > /dev/null && touch $installdir/$filename.unpacked)
;;
tar.gz) echo "Untaring $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
;;
tgz) echo "Untaring $installdir/$filename..."
(cd $installdir ; rm -f $installdir/$filename.unpacked ; tar xzf $installdir/$filename && touch $installdir/$filename.unpacked)
;;
*) AC_MSG_ERROR([Cannot handle build depency archive with extension $extension])
;;
esac
fi
if test -f $installdir/$filename.unpacked; then
$5=$installdir
fi
])
AC_DEFUN_ONCE([BDEPS_CONFIGURE_BUILDDEPS],
[
AC_ARG_WITH(builddeps-conf, [AS_HELP_STRING([--with-builddeps-conf],
[use this configuration file for the builddeps])])
AC_ARG_WITH(builddeps-server, [AS_HELP_STRING([--with-builddeps-server],
[download and use build dependencies from this server url])])
AC_ARG_WITH(builddeps-dir, [AS_HELP_STRING([--with-builddeps-dir],
[store downloaded build dependencies here @<:@/localhome/builddeps@:>@])],
[],
[with_builddeps_dir=/localhome/builddeps])
AC_ARG_WITH(builddeps-group, [AS_HELP_STRING([--with-builddeps-group],
[chgrp the downloaded build dependencies to this group])])
])

View File

@ -39,7 +39,6 @@ m4_include([build-aux/pkg.m4])
# Include these first...
m4_include([basics.m4])
m4_include([basics_windows.m4])
m4_include([builddeps.m4])
# ... then the rest
m4_include([boot-jdk.m4])
m4_include([build-performance.m4])
@ -121,12 +120,6 @@ PKG_PROG_PKG_CONFIG
# After basic tools have been setup, we can check build os specific details.
PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
# Setup builddeps, for automatic downloading of tools we need.
# This is needed before we can call BDEPS_CHECK_MODULE, which is done in
# boot-jdk setup, but we need to have basic tools setup first.
BDEPS_CONFIGURE_BUILDDEPS
BDEPS_SCAN_FOR_BUILDDEPS
###############################################################################
#
# Determine OpenJDK variants, options and version numbers.
@ -211,14 +204,8 @@ JDKOPT_SETUP_CODE_COVERAGE
# After we have toolchain, we can compile fixpath. It's needed by the lib checks.
BASIC_COMPILE_FIXPATH
LIB_SETUP_INIT
LIB_SETUP_X11
LIB_SETUP_CUPS
LIB_SETUP_FREETYPE
LIB_SETUP_ALSA
LIB_SETUP_MISC_LIBS
LIB_SETUP_STATIC_LINK_LIBSTDCPP
LIB_SETUP_ON_WINDOWS
LIB_DETERMINE_DEPENDENCIES
LIB_SETUP_LIBRARIES
###############################################################################
#

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2015, 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 @@ AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
[
# Print a helpful message on how to acquire the necessary build dependency.
# $1 is the help tag: freetype, cups, pulse, alsa etc
# $1 is the help tag: freetype, cups, alsa etc
MISSING_DEPENDENCY=$1
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@ -109,8 +109,8 @@ apt_help() {
PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
freetype)
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
pulse)
PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
ffi)
PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;;
x11)
PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
ccache)
@ -130,8 +130,6 @@ yum_help() {
PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
freetype)
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
pulse)
PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
x11)
PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel" ;;
ccache)

View File

@ -0,0 +1,90 @@
#
# Copyright (c) 2011, 2015, 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.
#
################################################################################
# Setup alsa (Advanced Linux Sound Architecture)
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_ALSA],
[
AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa],
[specify prefix directory for the alsa package
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
AC_ARG_WITH(alsa-include, [AS_HELP_STRING([--with-alsa-include],
[specify directory for the alsa include files])])
AC_ARG_WITH(alsa-lib, [AS_HELP_STRING([--with-alsa-lib],
[specify directory for the alsa library])])
if test "x$NEEDS_LIB_ALSA" = xfalse; then
if test "x${with_alsa}" != x || test "x${with_alsa_include}" != x || test "x${with_alsa_lib}" != x; then
AC_MSG_WARN([alsa not used, so --with-alsa is ignored])
fi
ALSA_CFLAGS=
ALSA_LIBS=
else
ALSA_FOUND=no
if test "x${with_alsa}" = xno || test "x${with_alsa_include}" = xno || test "x${with_alsa_lib}" = xno; then
AC_MSG_ERROR([It is not possible to disable the use of alsa. Remove the --without-alsa option.])
fi
if test "x${with_alsa}" != x; then
ALSA_LIBS="-L${with_alsa}/lib -lasound"
ALSA_CFLAGS="-I${with_alsa}/include"
ALSA_FOUND=yes
fi
if test "x${with_alsa_include}" != x; then
ALSA_CFLAGS="-I${with_alsa_include}"
ALSA_FOUND=yes
fi
if test "x${with_alsa_lib}" != x; then
ALSA_LIBS="-L${with_alsa_lib} -lasound"
ALSA_FOUND=yes
fi
# Do not try pkg-config if we have a sysroot set.
if test "x$SYSROOT" = x; then
if test "x$ALSA_FOUND" = xno; then
PKG_CHECK_MODULES(ALSA, alsa, [ALSA_FOUND=yes], [ALSA_FOUND=no])
fi
fi
if test "x$ALSA_FOUND" = xno; then
AC_CHECK_HEADERS([alsa/asoundlib.h],
[
ALSA_FOUND=yes
ALSA_CFLAGS=-Iignoreme
ALSA_LIBS=-lasound
DEFAULT_ALSA=yes
],
[ALSA_FOUND=no]
)
fi
if test "x$ALSA_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([alsa])
AC_MSG_ERROR([Could not find alsa! $HELP_MSG])
fi
fi
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS)
])

View File

@ -0,0 +1,226 @@
#
# Copyright (c) 2011, 2015, 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.
#
################################################################################
# Setup bundled libraries.
#
# For libjpeg, giflib, libpng, lcms2 and zlib, the source is present in the
# OpenJDK repository. Default is to use these libraries as bundled, but they
# might be replaced by en external version by the user.
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
[
LIB_SETUP_LIBJPEG
LIB_SETUP_GIFLIB
LIB_SETUP_LIBPNG
LIB_SETUP_ZLIB
LIB_SETUP_LCMS
])
################################################################################
# Setup libjpeg
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
[
AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
[use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which libjpeg to use])
# default is bundled
DEFAULT_LIBJPEG=bundled
# if user didn't specify, use DEFAULT_LIBJPEG
if test "x${with_libjpeg}" = "x"; then
with_libjpeg=${DEFAULT_LIBJPEG}
fi
AC_MSG_RESULT(${with_libjpeg})
if test "x${with_libjpeg}" = "xbundled"; then
USE_EXTERNAL_LIBJPEG=false
elif test "x${with_libjpeg}" = "xsystem"; then
AC_CHECK_HEADER(jpeglib.h, [],
[ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
[ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
USE_EXTERNAL_LIBJPEG=true
else
AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBJPEG)
])
################################################################################
# Setup giflib
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
[
AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
[use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which giflib to use])
# default is bundled
DEFAULT_GIFLIB=bundled
# if user didn't specify, use DEFAULT_GIFLIB
if test "x${with_giflib}" = "x"; then
with_giflib=${DEFAULT_GIFLIB}
fi
AC_MSG_RESULT(${with_giflib})
if test "x${with_giflib}" = "xbundled"; then
USE_EXTERNAL_LIBGIF=false
elif test "x${with_giflib}" = "xsystem"; then
AC_CHECK_HEADER(gif_lib.h, [],
[ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
AC_CHECK_LIB(gif, DGifGetCode, [],
[ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
USE_EXTERNAL_LIBGIF=true
else
AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBGIF)
])
################################################################################
# Setup libpng
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
[
AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
[use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which libpng to use])
# default is bundled
DEFAULT_LIBPNG=bundled
# if user didn't specify, use DEFAULT_LIBPNG
if test "x${with_libpng}" = "x"; then
with_libpng=${DEFAULT_LIBPNG}
fi
if test "x${with_libpng}" = "xbundled"; then
USE_EXTERNAL_LIBPNG=false
AC_MSG_RESULT([bundled])
elif test "x${with_libpng}" = "xsystem"; then
PKG_CHECK_MODULES(PNG, libpng,
[ LIBPNG_FOUND=yes ],
[ LIBPNG_FOUND=no ])
if test "x${LIBPNG_FOUND}" = "xyes"; then
USE_EXTERNAL_LIBPNG=true
AC_MSG_RESULT([system])
else
AC_MSG_RESULT([system not found])
AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
fi
else
AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBPNG)
])
################################################################################
# Setup zlib
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
[
AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
[use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_CHECK_LIB(z, compress,
[ ZLIB_FOUND=yes ],
[ ZLIB_FOUND=no ])
AC_MSG_CHECKING([for which zlib to use])
DEFAULT_ZLIB=bundled
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# On macosx default is system...on others default is bundled
DEFAULT_ZLIB=system
fi
if test "x${ZLIB_FOUND}" != "xyes"; then
# If we don't find any system...set default to bundled
DEFAULT_ZLIB=bundled
fi
# If user didn't specify, use DEFAULT_ZLIB
if test "x${with_zlib}" = "x"; then
with_zlib=${DEFAULT_ZLIB}
fi
if test "x${with_zlib}" = "xbundled"; then
USE_EXTERNAL_LIBZ=false
AC_MSG_RESULT([bundled])
elif test "x${with_zlib}" = "xsystem"; then
if test "x${ZLIB_FOUND}" = "xyes"; then
USE_EXTERNAL_LIBZ=true
AC_MSG_RESULT([system])
else
AC_MSG_RESULT([system not found])
AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
fi
else
AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBZ)
])
################################################################################
# Setup lcms (Little CMS)
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LCMS],
[
AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which lcms to use])
DEFAULT_LCMS=bundled
# If user didn't specify, use DEFAULT_LCMS
if test "x${with_lcms}" = "x"; then
with_lcms=${DEFAULT_LCMS}
fi
if test "x${with_lcms}" = "xbundled"; then
USE_EXTERNAL_LCMS=false
AC_MSG_RESULT([bundled])
elif test "x${with_lcms}" = "xsystem"; then
AC_MSG_RESULT([system])
PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
if test "x${LCMS_FOUND}" = "xyes"; then
USE_EXTERNAL_LCMS=true
else
AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
fi
else
AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LCMS)
])

View File

@ -0,0 +1,87 @@
#
# Copyright (c) 2011, 2015, 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.
#
################################################################################
# Setup cups (Common Unix Printing System)
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_CUPS],
[
AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
[specify prefix directory for the cups package
(expecting the headers under PATH/include)])])
AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
[specify directory for the cups include files])])
if test "x$NEEDS_LIB_CUPS" = xfalse; then
if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
AC_MSG_WARN([cups not used, so --with-cups is ignored])
fi
CUPS_CFLAGS=
else
CUPS_FOUND=no
if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
fi
if test "x${with_cups}" != x; then
CUPS_CFLAGS="-I${with_cups}/include"
CUPS_FOUND=yes
fi
if test "x${with_cups_include}" != x; then
CUPS_CFLAGS="-I${with_cups_include}"
CUPS_FOUND=yes
fi
if test "x$CUPS_FOUND" = xno; then
# Are the cups headers installed in the default /usr/include location?
AC_CHECK_HEADERS([cups/cups.h cups/ppd.h], [
CUPS_FOUND=yes
CUPS_CFLAGS=
DEFAULT_CUPS=yes
])
fi
if test "x$CUPS_FOUND" = xno; then
# Getting nervous now? Lets poke around for standard Solaris third-party
# package installation locations.
AC_MSG_CHECKING([for cups headers])
if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
# An SFW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
# A CSW package seems to be installed!
CUPS_FOUND=yes
CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
fi
AC_MSG_RESULT([$CUPS_FOUND])
fi
if test "x$CUPS_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([cups])
AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
fi
fi
AC_SUBST(CUPS_CFLAGS)
])

114
common/autoconf/lib-ffi.m4 Normal file
View File

@ -0,0 +1,114 @@
#
# Copyright (c) 2015, 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.
#
################################################################################
# Setup libffi (Foreign Function Interface)
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
[
AC_ARG_WITH(libffi, [AS_HELP_STRING([--with-libffi],
[specify prefix directory for the libffi package
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
AC_ARG_WITH(libffi-include, [AS_HELP_STRING([--with-libffi-include],
[specify directory for the libffi include files])])
AC_ARG_WITH(libffi-lib, [AS_HELP_STRING([--with-libffi-lib],
[specify directory for the libffi library])])
if test "x$NEEDS_LIB_FFI" = xfalse; then
if test "x${with_libffi}" != x || test "x${with_libffi_include}" != x || test "x${with_libffi_lib}" != x; then
AC_MSG_WARN([libffi not used, so --with-libffi is ignored])
fi
LIBFFI_CFLAGS=
LIBFFI_LIBS=
else
LIBFFI_FOUND=no
if test "x${with_libffi}" = xno || test "x${with_libffi_include}" = xno || test "x${with_libffi_lib}" = xno; then
AC_MSG_ERROR([It is not possible to disable the use of libffi. Remove the --without-libffi option.])
fi
if test "x${with_libffi}" != x; then
LIBFFI_LIBS="-L${with_libffi}/lib -lffi"
LIBFFI_CFLAGS="-I${with_libffi}/include"
LIBFFI_FOUND=yes
fi
if test "x${with_libffi_include}" != x; then
LIBFFI_CFLAGS="-I${with_libffi_include}"
LIBFFI_FOUND=yes
fi
if test "x${with_libffi_lib}" != x; then
LIBFFI_LIBS="-L${with_libffi_lib} -lffi"
LIBFFI_FOUND=yes
fi
# Do not try pkg-config if we have a sysroot set.
if test "x$SYSROOT" = x; then
if test "x$LIBFFI_FOUND" = xno; then
# Figure out LIBFFI_CFLAGS and LIBFFI_LIBS
PKG_CHECK_MODULES([LIBFFI], [libffi], [LIBFFI_FOUND=yes], [LIBFFI_FOUND=no])
fi
fi
if test "x$LIBFFI_FOUND" = xno; then
AC_CHECK_HEADERS([ffi.h],
[
LIBFFI_FOUND=yes
LIBFFI_CFLAGS=
LIBFFI_LIBS=-lffi
],
[LIBFFI_FOUND=no]
)
fi
if test "x$LIBFFI_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([ffi])
AC_MSG_ERROR([Could not find libffi! $HELP_MSG])
fi
AC_MSG_CHECKING([if libffi works])
AC_LANG_PUSH(C)
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
OLD_LIBS="$LIBS"
LIBS="$LIBS $LIBFFI_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ffi.h>],
[
ffi_call(NULL, NULL, NULL, NULL);
return 0;
])],
[LIBFFI_WORKS=yes],
[LIBFFI_WORKS=no]
)
CFLAGS="$OLD_CFLAGS"
LIBS="$OLD_LIBS"
AC_LANG_POP(C)
AC_MSG_RESULT([$LIBFFI_WORKS])
if test "x$LIBFFI_WORKS" = xno; then
HELP_MSG_MISSING_DEPENDENCY([ffi])
AC_MSG_ERROR([Found libffi but could not link and compile with it. $HELP_MSG])
fi
fi
AC_SUBST(LIBFFI_CFLAGS)
AC_SUBST(LIBFFI_LIBS)
])

View File

@ -0,0 +1,420 @@
#
# Copyright (c) 2011, 2015, 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.
#
################################################################################
# Build the freetype lib from source
################################################################################
AC_DEFUN([LIB_BUILD_FREETYPE],
[
FREETYPE_SRC_PATH="$1"
BUILD_FREETYPE=yes
# Check if the freetype sources are acessible..
if ! test -d $FREETYPE_SRC_PATH; then
AC_MSG_WARN([--with-freetype-src specified, but can not find path "$FREETYPE_SRC_PATH" - ignoring --with-freetype-src])
BUILD_FREETYPE=no
fi
# ..and contain a vc2010 project file
vcxproj_path="$FREETYPE_SRC_PATH/builds/windows/vc2010/freetype.vcxproj"
if test "x$BUILD_FREETYPE" = xyes && ! test -s $vcxproj_path; then
AC_MSG_WARN([Can not find project file $vcxproj_path (you may try a newer freetype version) - ignoring --with-freetype-src])
BUILD_FREETYPE=no
fi
# Now check if configure found a version of 'msbuild.exe'
if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
AC_MSG_WARN([Can not find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src])
BUILD_FREETYPE=no
fi
# Ready to go..
if test "x$BUILD_FREETYPE" = xyes; then
# msbuild requires trailing slashes for output directories
freetype_lib_path="$FREETYPE_SRC_PATH/lib$OPENJDK_TARGET_CPU_BITS/"
freetype_lib_path_unix="$freetype_lib_path"
freetype_obj_path="$FREETYPE_SRC_PATH/obj$OPENJDK_TARGET_CPU_BITS/"
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(vcxproj_path)
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_lib_path)
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_obj_path)
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
freetype_platform=x64
else
freetype_platform=win32
fi
# The original freetype project file is for VS 2010 (i.e. 'v100'),
# so we have to adapt the toolset if building with any other toolsed (i.e. SDK).
# Currently 'PLATFORM_TOOLSET' is set in 'TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT'/
# 'TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT' in toolchain_windows.m4
AC_MSG_NOTICE([Trying to compile freetype sources with PlatformToolset=$PLATFORM_TOOLSET to $freetype_lib_path_unix ...])
# First we try to build the freetype.dll
$ECHO -e "@echo off\n"\
"$MSBUILD $vcxproj_path "\
"/p:PlatformToolset=$PLATFORM_TOOLSET "\
"/p:Configuration=\"Release Multithreaded\" "\
"/p:Platform=$freetype_platform "\
"/p:ConfigurationType=DynamicLibrary "\
"/p:TargetName=freetype "\
"/p:OutDir=\"$freetype_lib_path\" "\
"/p:IntDir=\"$freetype_obj_path\" > freetype.log" > freetype.bat
cmd /c freetype.bat
if test -s "$freetype_lib_path_unix/freetype.dll"; then
# If that succeeds we also build freetype.lib
$ECHO -e "@echo off\n"\
"$MSBUILD $vcxproj_path "\
"/p:PlatformToolset=$PLATFORM_TOOLSET "\
"/p:Configuration=\"Release Multithreaded\" "\
"/p:Platform=$freetype_platform "\
"/p:ConfigurationType=StaticLibrary "\
"/p:TargetName=freetype "\
"/p:OutDir=\"$freetype_lib_path\" "\
"/p:IntDir=\"$freetype_obj_path\" >> freetype.log" > freetype.bat
cmd /c freetype.bat
if test -s "$freetype_lib_path_unix/freetype.lib"; then
# Once we build both, lib and dll, set freetype lib and include path appropriately
POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_SRC_PATH/include"
POTENTIAL_FREETYPE_LIB_PATH="$freetype_lib_path_unix"
AC_MSG_NOTICE([Compiling freetype sources succeeded! (see freetype.log for build results)])
else
BUILD_FREETYPE=no
fi
else
BUILD_FREETYPE=no
fi
fi
])
################################################################################
# Check if a potential freeype library match is correct and usable
################################################################################
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
[
POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
POTENTIAL_FREETYPE_LIB_PATH="$2"
METHOD="$3"
# Let's start with an optimistic view of the world :-)
FOUND_FREETYPE=yes
# First look for the canonical freetype main include file ft2build.h.
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# Fail.
FOUND_FREETYPE=no
fi
fi
if test "x$FOUND_FREETYPE" = xyes; then
# Include file found, let's continue the sanity check.
AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
# Reset to default value
FREETYPE_BASE_NAME=freetype
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
if test "x$OPENJDK_TARGET_OS" = xmacosx \
&& test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
# On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
# for the .6 version explicitly.
FREETYPE_BASE_NAME=freetype.6
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
AC_MSG_NOTICE([Compensating for missing symlink by using version 6 explicitly])
else
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
FOUND_FREETYPE=no
fi
else
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# On Windows, we will need both .lib and .dll file.
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location.])
FOUND_FREETYPE=no
fi
elif test "x$OPENJDK_TARGET_OS" = xsolaris \
&& test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
# Found lib in isa dir, use that instead.
POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
AC_MSG_NOTICE([Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead])
fi
fi
fi
if test "x$FOUND_FREETYPE" = xyes; then
BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_INCLUDE_PATH)
BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_LIB_PATH)
FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
AC_MSG_CHECKING([for freetype includes])
AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
AC_MSG_CHECKING([for freetype libraries])
AC_MSG_RESULT([$FREETYPE_LIB_PATH])
fi
])
################################################################################
# Setup freetype (The FreeType2 font rendering library)
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
[
AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
[specify prefix directory for the freetype package
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
[specify directory for the freetype include files])])
AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
[specify directory for the freetype library])])
AC_ARG_WITH(freetype-src, [AS_HELP_STRING([--with-freetype-src],
[specify directory with freetype sources to automatically build the library (experimental, Windows-only)])])
AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
[disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
# Need to specify explicitly since it needs to be overridden on some versions of macosx
FREETYPE_BASE_NAME=freetype
FREETYPE_CFLAGS=
FREETYPE_LIBS=
FREETYPE_BUNDLE_LIB_PATH=
if test "x$NEEDS_LIB_FREETYPE" = xfalse; then
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x || test "x$with_freetype_src" != x; then
AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
fi
if test "x$enable_freetype_bundling" != x; then
AC_MSG_WARN([freetype not used, so --enable-freetype-bundling is ignored])
fi
else
# freetype is needed to build; go get it!
BUNDLE_FREETYPE="$enable_freetype_bundling"
if test "x$with_freetype_src" != x; then
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# Try to build freetype if --with-freetype-src was given on Windows
LIB_BUILD_FREETYPE([$with_freetype_src])
if test "x$BUILD_FREETYPE" = xyes; then
# Okay, we built it. Check that it works.
LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype-src])
if test "x$FOUND_FREETYPE" != xyes; then
AC_MSG_ERROR([Can not use the built freetype at location given by --with-freetype-src])
fi
else
AC_MSG_NOTICE([User specified --with-freetype-src but building freetype failed. (see freetype.log for build results)])
AC_MSG_ERROR([Consider building freetype manually and using --with-freetype instead.])
fi
else
AC_MSG_WARN([--with-freetype-src is currently only supported on Windows - ignoring])
fi
fi
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
# User has specified settings
if test "x$BUNDLE_FREETYPE" = x; then
# If not specified, default is to bundle freetype
BUNDLE_FREETYPE=yes
fi
if test "x$with_freetype" != x; then
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
fi
# Allow --with-freetype-lib and --with-freetype-include to override
if test "x$with_freetype_include" != x; then
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
fi
if test "x$with_freetype_lib" != x; then
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
fi
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
# Okay, we got it. Check that it works.
LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
if test "x$FOUND_FREETYPE" != xyes; then
AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype])
fi
else
# User specified only one of lib or include. This is an error.
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
AC_MSG_NOTICE([User specified --with-freetype-lib but not --with-freetype-include])
AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
else
AC_MSG_NOTICE([User specified --with-freetype-include but not --with-freetype-lib])
AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
fi
fi
else
# User did not specify settings, but we need freetype. Try to locate it.
if test "x$BUNDLE_FREETYPE" = x; then
# If not specified, default is to bundle freetype only on windows
if test "x$OPENJDK_TARGET_OS" = xwindows; then
BUNDLE_FREETYPE=yes
else
BUNDLE_FREETYPE=no
fi
fi
# If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
if test "x$SYSROOT" = x; then
if test "x$FOUND_FREETYPE" != xyes; then
# Check modules using pkg-config, but only if we have it (ugly output results otherwise)
if test "x$PKG_CONFIG" != x; then
PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
if test "x$FOUND_FREETYPE" = xyes; then
# On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
# 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
fi
# PKG_CHECK_MODULES will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
if test "x$BUNDLE_FREETYPE" = xyes; then
AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
FOUND_FREETYPE=no
else
AC_MSG_CHECKING([for freetype])
AC_MSG_RESULT([yes (using pkg-config)])
fi
fi
fi
fi
fi
if test "x$FOUND_FREETYPE" != xyes; then
# Check in well-known locations
if test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
else
FREETYPE_BASE_DIR="$SYSROOT/usr"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr/sfw"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
if test "x$FOUND_FREETYPE" != xyes; then
FREETYPE_BASE_DIR="$SYSROOT/usr"
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
else
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
if test "x$FOUND_FREETYPE" != xyes; then
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
fi
fi
fi
fi
fi # end check in well-known locations
if test "x$FOUND_FREETYPE" != xyes; then
HELP_MSG_MISSING_DEPENDENCY([freetype])
AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
fi
fi # end user specified settings
# Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
if test "x$FREETYPE_CFLAGS" = x; then
BASIC_FIXUP_PATH(FREETYPE_INCLUDE_PATH)
if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
else
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
fi
fi
if test "x$FREETYPE_LIBS" = x; then
BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
if test "x$OPENJDK_TARGET_OS" = xwindows; then
FREETYPE_LIBS="$FREETYPE_LIB_PATH/$FREETYPE_BASE_NAME.lib"
else
FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
fi
fi
# Try to compile it
AC_MSG_CHECKING([if we can compile and link with freetype])
AC_LANG_PUSH(C++)
PREV_CXXCFLAGS="$CXXFLAGS"
PREV_LIBS="$LIBS"
PREV_CXX="$CXX"
CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
LIBS="$LIBS $FREETYPE_LIBS"
CXX="$FIXPATH $CXX"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include<ft2build.h>
#include FT_FREETYPE_H
int main () {
FT_Init_FreeType(NULL);
return 0;
}
]])],
[
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
HELP_MSG_MISSING_DEPENDENCY([freetype])
AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
]
)
CXXCFLAGS="$PREV_CXXFLAGS"
LIBS="$PREV_LIBS"
CXX="$PREV_CXX"
AC_LANG_POP(C++)
AC_MSG_CHECKING([if we should bundle freetype])
if test "x$BUNDLE_FREETYPE" = xyes; then
FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
fi
AC_MSG_RESULT([$BUNDLE_FREETYPE])
fi # end freetype needed
AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
])

120
common/autoconf/lib-std.m4 Normal file
View File

@ -0,0 +1,120 @@
#
# Copyright (c) 2011, 2015, 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.
#
################################################################################
# Setup the standard C/C++ runtime libraries.
#
# Most importantly, determine if stdc++ should be linked statically or
# dynamically.
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
[
# statically link libstdc++ before C++ ABI is stablized on Linux unless
# dynamic build is configured on command line.
AC_ARG_WITH([stdc++lib], [AS_HELP_STRING([--with-stdc++lib=<static>,<dynamic>,<default>],
[force linking of the C++ runtime on Linux to either static or dynamic, default is static with dynamic as fallback])],
[
if test "x$with_stdc__lib" != xdynamic && test "x$with_stdc__lib" != xstatic \
&& test "x$with_stdc__lib" != xdefault; then
AC_MSG_ERROR([Bad parameter value --with-stdc++lib=$with_stdc__lib!])
fi
],
[with_stdc__lib=default]
)
if test "x$OPENJDK_TARGET_OS" = xlinux; then
# Test if -lstdc++ works.
AC_MSG_CHECKING([if dynamic link of stdc++ is possible])
AC_LANG_PUSH(C++)
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -lstdc++"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
[has_dynamic_libstdcxx=yes],
[has_dynamic_libstdcxx=no])
CXXFLAGS="$OLD_CXXFLAGS"
AC_LANG_POP(C++)
AC_MSG_RESULT([$has_dynamic_libstdcxx])
# Test if stdc++ can be linked statically.
AC_MSG_CHECKING([if static link of stdc++ is possible])
STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
AC_LANG_PUSH(C++)
OLD_LIBS="$LIBS"
OLD_CXX="$CXX"
LIBS="$STATIC_STDCXX_FLAGS"
CXX="$CC"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
[has_static_libstdcxx=yes],
[has_static_libstdcxx=no])
LIBS="$OLD_LIBS"
CXX="$OLD_CXX"
AC_LANG_POP(C++)
AC_MSG_RESULT([$has_static_libstdcxx])
if test "x$has_static_libstdcxx" = xno && test "x$has_dynamic_libstdcxx" = xno; then
AC_MSG_ERROR([Cannot link to stdc++, neither dynamically nor statically!])
fi
if test "x$with_stdc__lib" = xstatic && test "x$has_static_libstdcxx" = xno; then
AC_MSG_ERROR([Static linking of libstdc++ was not possible!])
fi
if test "x$with_stdc__lib" = xdynamic && test "x$has_dynamic_libstdcxx" = xno; then
AC_MSG_ERROR([Dynamic linking of libstdc++ was not possible!])
fi
# If dynamic was requested, it's available since it would fail above otherwise.
# If dynamic wasn't requested, go with static unless it isn't available.
AC_MSG_CHECKING([how to link with libstdc++])
if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
LIBCXX="$LIBCXX -lstdc++"
LDCXX="$CXX"
STATIC_CXX_SETTING="STATIC_CXX=false"
AC_MSG_RESULT([dynamic])
else
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
LDCXX="$CC"
STATIC_CXX_SETTING="STATIC_CXX=true"
AC_MSG_RESULT([static])
fi
fi
AC_SUBST(STATIC_CXX_SETTING)
# libCrun is the c++ runtime-library with SunStudio (roughly the equivalent of gcc's libstdc++.so)
if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
fi
# TODO better (platform agnostic) test
if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$LIBCXX" = x && test "x$TOOLCHAIN_TYPE" = xgcc; then
LIBCXX="-lstdc++"
fi
AC_SUBST(LIBCXX)
# Setup Windows runtime dlls
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
fi
])

135
common/autoconf/lib-x11.m4 Normal file
View File

@ -0,0 +1,135 @@
#
# Copyright (c) 2011, 2015, 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.
#
################################################################################
# Setup X11 Windows system
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_X11],
[
if test "x$NEEDS_LIB_X11" = xfalse; then
if test "x${with_x}" != x; then
AC_MSG_WARN([X11 is not used, so --with-x is ignored])
fi
X_CFLAGS=
X_LIBS=
else
if test "x${with_x}" = xno; then
AC_MSG_ERROR([It is not possible to disable the use of X11. Remove the --without-x option.])
fi
if test "x${with_x}" != x && test "x${with_x}" != xyes; then
# The user has specified a X11 base directory. Use it for includes and
# libraries, unless explicitely overridden.
if test "x$x_includes" = xNONE; then
x_includes="${with_x}/include"
fi
if test "x$x_libraries" = xNONE; then
x_libraries="${with_x}/lib"
fi
else
# Check if the user has specified sysroot, but not --with-x, --x-includes or --x-libraries.
# Make a simple check for the libraries at the sysroot, and setup --x-includes and
# --x-libraries for the sysroot, if that seems to be correct.
if test "x$SYSROOT" != "x"; then
if test "x$x_includes" = xNONE; then
if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then
x_includes="$SYSROOT/usr/X11R6/include"
elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then
x_includes="$SYSROOT/usr/include"
fi
fi
if test "x$x_libraries" = xNONE; then
if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
x_libraries="$SYSROOT/usr/X11R6/lib"
elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
x_libraries="$SYSROOT/usr/lib64"
elif test -f "$SYSROOT/usr/lib/libX11.so"; then
x_libraries="$SYSROOT/usr/lib"
fi
fi
fi
fi
# Now let autoconf do it's magic
AC_PATH_X
AC_PATH_XTRA
# AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling
# this doesn't make sense so we remove it.
if test "x$COMPILE_TYPE" = xcross; then
X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'`
fi
if test "x$no_x" = xyes; then
HELP_MSG_MISSING_DEPENDENCY([x11])
AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin"
X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions"
X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \
-R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR"
fi
AC_LANG_PUSH(C)
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
# Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
[X11_HEADERS_OK=yes],
[X11_HEADERS_OK=no; break],
[
# include <X11/Xlib.h>
# include <X11/Xutil.h>
]
)
if test "x$X11_HEADERS_OK" = xno; then
HELP_MSG_MISSING_DEPENDENCY([x11])
AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
fi
# If XLinearGradient isn't available in Xrender.h, signal that it needs to be
# defined in libawt_xawt.
AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],
[[XLinearGradient x;]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"])
CFLAGS="$OLD_CFLAGS"
AC_LANG_POP(C)
fi # NEEDS_LIB_X11
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
])

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ REQUIRED_OS_NAME:=@REQUIRED_OS_NAME@
REQUIRED_OS_VERSION:=@REQUIRED_OS_VERSION@
@SET_OPENJDK@
LIBM:=-lm
LIBM:=@LIBM@
LIBDL:=@LIBDL@
# colon or semicolon
@ -499,6 +499,7 @@ LN:=@LN@
MKDIR:=@MKDIR@
MV:=@MV@
NAWK:=@NAWK@
NICE:=@NICE@
PATCH:=@PATCH@
PRINTF:=@PRINTF@
PWD:=@THEPWDCMD@

View File

@ -327,3 +327,6 @@ d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
c20d8ebddaa6fb09cc81d3edf3d1d05f4232700a jdk9-b82
ca8a1719588424f6e04e943790c7fcb7cb0b8c8f jdk9-b83
df70bb200356fec686681f0295c50cc3ed43c3b3 jdk9-b84
3ec06af1368924469f7ce60a00324bac55eaeecc jdk9-b85
0a3f0d25c201b40575a7c3920fce4d6f4d3ae310 jdk9-b86
a5c40ac9b916ff44d512ee764fa919ed2097e149 jdk9-b87

View File

@ -487,3 +487,6 @@ e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
1c453a12be3036d482abef1dd470f8aff536b6b9 jdk9-b82
3ed0df2c553a80e0e26b91a6ce08806ea17a066a jdk9-b83
184c4328444974edd6b3b490b9d0177ace7e331c jdk9-b84
03845376ea9dbf9690b6a9cfb4ed63f8cc0541c0 jdk9-b85
1ae4191359d811a51512f17dca80ffe79837a5ff jdk9-b86
d7ffd16382fe7071181b967932b47cff6d1312e1 jdk9-b87

View File

@ -23,8 +23,8 @@
import sun.hotspot.WhiteBox;
import sun.misc.Unsafe;
import sun.misc.IOUtils;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
@ -109,7 +109,13 @@ public class TestAnonymousClassUnloading {
// (1) Load an anonymous version of this class using the corresponding Unsafe method
URL classUrl = TestAnonymousClassUnloading.class.getResource("TestAnonymousClassUnloading.class");
URLConnection connection = classUrl.openConnection();
byte[] classBytes = IOUtils.readFully(connection.getInputStream(), connection.getContentLength(), true);
int length = connection.getContentLength();
byte[] classBytes = connection.getInputStream().readAllBytes();
if (length != -1 && classBytes.length != length) {
throw new IOException("Expected:" + length + ", actual: " + classBytes.length);
}
Class<?> anonymousClass = UNSAFE.defineAnonymousClass(TestAnonymousClassUnloading.class, classBytes, null);
// (2) Make sure all paths of doWork are profiled and compiled

View File

@ -72,8 +72,10 @@ public class VictimClassLoader extends ClassLoader {
}
static byte[] readFully(java.io.InputStream in, int len) throws java.io.IOException {
// Warning here:
return sun.misc.IOUtils.readFully(in, len, true);
byte[] b = in.readAllBytes();
if (len != -1 && b.length != len)
throw new java.io.IOException("Expected:" + len + ", actual:" + b.length);
return b;
}
public void finalize() {

View File

@ -327,3 +327,6 @@ f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
53fe3c103b6fdf48e2b2676c0c4818ef5a10fa21 jdk9-b82
497bc2654e11684b11de46744227883d7e760f35 jdk9-b83
91795d86744f3074d1e59b1e75d9c851c098688f jdk9-b84
1d9850c1b35c74e8b5c17970ed5d46dc0fc33f06 jdk9-b85
88d9b1f6b73e0c46fcb5ccabe1231a30ce758a22 jdk9-b86
eb435c878c2cbbfb043d0b205f4d5bd6faffd44a jdk9-b87

View File

@ -330,3 +330,6 @@ e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
52d9ad2536ba6c6f1cc5561c0a0ee2b4847fd62c jdk9-b82
d7ee8157f4feced67924e421225c6f844079a03d jdk9-b83
51729143f8fe038f52cf55720c4c1f89267f5948 jdk9-b84
67b626ec730d2601d95ef036d06be34b37fa9ce6 jdk9-b85
5289646179079394890a34a898a8ab70fcde0331 jdk9-b86
f7dba191a38cfc29665b0d77174615a530803297 jdk9-b87

View File

@ -30,6 +30,7 @@ import com.sun.tools.internal.xjc.BadCommandLineException;
import com.sun.xml.internal.bind.util.Which;
import javax.lang.model.SourceVersion;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticCollector;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
@ -248,7 +249,12 @@ public class SchemaGenerator {
if (episode != null)
r.setEpisodeFile(episode);
task.setProcessors(Collections.singleton(r));
return task.call();
boolean res = task.call();
//Print messages generated by compiler
for (Diagnostic<? extends JavaFileObject> d : diagnostics.getDiagnostics()) {
System.err.println(d.toString());
}
return res;
}
}

View File

@ -327,3 +327,7 @@ fdc13a2d32867ca3c57b7fa2620c6b59c83168cb jdk9-b81
b10b64263b563e21f055c881444f625ec618b826 jdk9-b82
d11f25ce3c545823f53bb978d454a4d2901abac3 jdk9-b83
757ef7f6d0042934edea3e0bf616fad2c1a22789 jdk9-b84
fe40b31c0e526d357cf5b62044fea006e43b53a5 jdk9-b85
e8a66c0b05d786a282a7ff1d7eb4989afa30c891 jdk9-b86
110fc90bdfa0fe59606c047c2301ed75d2bad6cf jdk9-b87
6e50b992bef4def597a5033e696e5b1d4fe5b294 jdk9-b88

View File

@ -136,101 +136,179 @@ class CharacterData00 extends CharacterData {
if ((val & $$maskLowerCase) != 0) {
if ((val & $$maskCaseOffset) == $$maskCaseOffset) {
switch(ch) {
// map the offset overflow chars
case 0x0130 : mapChar = 0x0069; break;
case 0x2126 : mapChar = 0x03C9; break;
case 0x212A : mapChar = 0x006B; break;
case 0x212B : mapChar = 0x00E5; break;
// map the titlecase chars with both a 1:M uppercase map
// and a lowercase map
case 0x1F88 : mapChar = 0x1F80; break;
case 0x1F89 : mapChar = 0x1F81; break;
case 0x1F8A : mapChar = 0x1F82; break;
case 0x1F8B : mapChar = 0x1F83; break;
case 0x1F8C : mapChar = 0x1F84; break;
case 0x1F8D : mapChar = 0x1F85; break;
case 0x1F8E : mapChar = 0x1F86; break;
case 0x1F8F : mapChar = 0x1F87; break;
case 0x1F98 : mapChar = 0x1F90; break;
case 0x1F99 : mapChar = 0x1F91; break;
case 0x1F9A : mapChar = 0x1F92; break;
case 0x1F9B : mapChar = 0x1F93; break;
case 0x1F9C : mapChar = 0x1F94; break;
case 0x1F9D : mapChar = 0x1F95; break;
case 0x1F9E : mapChar = 0x1F96; break;
case 0x1F9F : mapChar = 0x1F97; break;
case 0x1FA8 : mapChar = 0x1FA0; break;
case 0x1FA9 : mapChar = 0x1FA1; break;
case 0x1FAA : mapChar = 0x1FA2; break;
case 0x1FAB : mapChar = 0x1FA3; break;
case 0x1FAC : mapChar = 0x1FA4; break;
case 0x1FAD : mapChar = 0x1FA5; break;
case 0x1FAE : mapChar = 0x1FA6; break;
case 0x1FAF : mapChar = 0x1FA7; break;
case 0x1FBC : mapChar = 0x1FB3; break;
case 0x1FCC : mapChar = 0x1FC3; break;
case 0x1FFC : mapChar = 0x1FF3; break;
case 0x023A : mapChar = 0x2C65; break;
case 0x023E : mapChar = 0x2C66; break;
case 0x10A0 : mapChar = 0x2D00; break;
case 0x10A1 : mapChar = 0x2D01; break;
case 0x10A2 : mapChar = 0x2D02; break;
case 0x10A3 : mapChar = 0x2D03; break;
case 0x10A4 : mapChar = 0x2D04; break;
case 0x10A5 : mapChar = 0x2D05; break;
case 0x10A6 : mapChar = 0x2D06; break;
case 0x10A7 : mapChar = 0x2D07; break;
case 0x10A8 : mapChar = 0x2D08; break;
case 0x10A9 : mapChar = 0x2D09; break;
case 0x10AA : mapChar = 0x2D0A; break;
case 0x10AB : mapChar = 0x2D0B; break;
case 0x10AC : mapChar = 0x2D0C; break;
case 0x10AD : mapChar = 0x2D0D; break;
case 0x10AE : mapChar = 0x2D0E; break;
case 0x10AF : mapChar = 0x2D0F; break;
case 0x10B0 : mapChar = 0x2D10; break;
case 0x10B1 : mapChar = 0x2D11; break;
case 0x10B2 : mapChar = 0x2D12; break;
case 0x10B3 : mapChar = 0x2D13; break;
case 0x10B4 : mapChar = 0x2D14; break;
case 0x10B5 : mapChar = 0x2D15; break;
case 0x10B6 : mapChar = 0x2D16; break;
case 0x10B7 : mapChar = 0x2D17; break;
case 0x10B8 : mapChar = 0x2D18; break;
case 0x10B9 : mapChar = 0x2D19; break;
case 0x10BA : mapChar = 0x2D1A; break;
case 0x10BB : mapChar = 0x2D1B; break;
case 0x10BC : mapChar = 0x2D1C; break;
case 0x10BD : mapChar = 0x2D1D; break;
case 0x10BE : mapChar = 0x2D1E; break;
case 0x10BF : mapChar = 0x2D1F; break;
case 0x10C0 : mapChar = 0x2D20; break;
case 0x10C1 : mapChar = 0x2D21; break;
case 0x10C2 : mapChar = 0x2D22; break;
case 0x10C3 : mapChar = 0x2D23; break;
case 0x10C4 : mapChar = 0x2D24; break;
case 0x10C5 : mapChar = 0x2D25; break;
case 0x10C7 : mapChar = 0x2D27; break;
case 0x10CD : mapChar = 0x2D2D; break;
case 0x1E9E : mapChar = 0x00DF; break;
case 0x2C62 : mapChar = 0x026B; break;
case 0x2C63 : mapChar = 0x1D7D; break;
case 0x2C64 : mapChar = 0x027D; break;
case 0x2C6D : mapChar = 0x0251; break;
case 0x2C6E : mapChar = 0x0271; break;
case 0x2C6F : mapChar = 0x0250; break;
case 0x2C70 : mapChar = 0x0252; break;
case 0x2C7E : mapChar = 0x023F; break;
case 0x2C7F : mapChar = 0x0240; break;
case 0xA77D : mapChar = 0x1D79; break;
case 0xA78D : mapChar = 0x0265; break;
case 0xA7AA : mapChar = 0x0266; break;
case 0xA7AB : mapChar = 0x025C; break;
case 0xA7AC : mapChar = 0x0261; break;
case 0xA7AD : mapChar = 0x026C; break;
case 0xA7B0 : mapChar = 0x029E; break;
case 0xA7B1 : mapChar = 0x0287; break;
case 0x0130: mapChar = 0x0069; break;
case 0x023A: mapChar = 0x2C65; break;
case 0x023E: mapChar = 0x2C66; break;
case 0x10A0: mapChar = 0x2D00; break;
case 0x10A1: mapChar = 0x2D01; break;
case 0x10A2: mapChar = 0x2D02; break;
case 0x10A3: mapChar = 0x2D03; break;
case 0x10A4: mapChar = 0x2D04; break;
case 0x10A5: mapChar = 0x2D05; break;
case 0x10A6: mapChar = 0x2D06; break;
case 0x10A7: mapChar = 0x2D07; break;
case 0x10A8: mapChar = 0x2D08; break;
case 0x10A9: mapChar = 0x2D09; break;
case 0x10AA: mapChar = 0x2D0A; break;
case 0x10AB: mapChar = 0x2D0B; break;
case 0x10AC: mapChar = 0x2D0C; break;
case 0x10AD: mapChar = 0x2D0D; break;
case 0x10AE: mapChar = 0x2D0E; break;
case 0x10AF: mapChar = 0x2D0F; break;
case 0x10B0: mapChar = 0x2D10; break;
case 0x10B1: mapChar = 0x2D11; break;
case 0x10B2: mapChar = 0x2D12; break;
case 0x10B3: mapChar = 0x2D13; break;
case 0x10B4: mapChar = 0x2D14; break;
case 0x10B5: mapChar = 0x2D15; break;
case 0x10B6: mapChar = 0x2D16; break;
case 0x10B7: mapChar = 0x2D17; break;
case 0x10B8: mapChar = 0x2D18; break;
case 0x10B9: mapChar = 0x2D19; break;
case 0x10BA: mapChar = 0x2D1A; break;
case 0x10BB: mapChar = 0x2D1B; break;
case 0x10BC: mapChar = 0x2D1C; break;
case 0x10BD: mapChar = 0x2D1D; break;
case 0x10BE: mapChar = 0x2D1E; break;
case 0x10BF: mapChar = 0x2D1F; break;
case 0x10C0: mapChar = 0x2D20; break;
case 0x10C1: mapChar = 0x2D21; break;
case 0x10C2: mapChar = 0x2D22; break;
case 0x10C3: mapChar = 0x2D23; break;
case 0x10C4: mapChar = 0x2D24; break;
case 0x10C5: mapChar = 0x2D25; break;
case 0x10C7: mapChar = 0x2D27; break;
case 0x10CD: mapChar = 0x2D2D; break;
case 0x13A0: mapChar = 0xAB70; break;
case 0x13A1: mapChar = 0xAB71; break;
case 0x13A2: mapChar = 0xAB72; break;
case 0x13A3: mapChar = 0xAB73; break;
case 0x13A4: mapChar = 0xAB74; break;
case 0x13A5: mapChar = 0xAB75; break;
case 0x13A6: mapChar = 0xAB76; break;
case 0x13A7: mapChar = 0xAB77; break;
case 0x13A8: mapChar = 0xAB78; break;
case 0x13A9: mapChar = 0xAB79; break;
case 0x13AA: mapChar = 0xAB7A; break;
case 0x13AB: mapChar = 0xAB7B; break;
case 0x13AC: mapChar = 0xAB7C; break;
case 0x13AD: mapChar = 0xAB7D; break;
case 0x13AE: mapChar = 0xAB7E; break;
case 0x13AF: mapChar = 0xAB7F; break;
case 0x13B0: mapChar = 0xAB80; break;
case 0x13B1: mapChar = 0xAB81; break;
case 0x13B2: mapChar = 0xAB82; break;
case 0x13B3: mapChar = 0xAB83; break;
case 0x13B4: mapChar = 0xAB84; break;
case 0x13B5: mapChar = 0xAB85; break;
case 0x13B6: mapChar = 0xAB86; break;
case 0x13B7: mapChar = 0xAB87; break;
case 0x13B8: mapChar = 0xAB88; break;
case 0x13B9: mapChar = 0xAB89; break;
case 0x13BA: mapChar = 0xAB8A; break;
case 0x13BB: mapChar = 0xAB8B; break;
case 0x13BC: mapChar = 0xAB8C; break;
case 0x13BD: mapChar = 0xAB8D; break;
case 0x13BE: mapChar = 0xAB8E; break;
case 0x13BF: mapChar = 0xAB8F; break;
case 0x13C0: mapChar = 0xAB90; break;
case 0x13C1: mapChar = 0xAB91; break;
case 0x13C2: mapChar = 0xAB92; break;
case 0x13C3: mapChar = 0xAB93; break;
case 0x13C4: mapChar = 0xAB94; break;
case 0x13C5: mapChar = 0xAB95; break;
case 0x13C6: mapChar = 0xAB96; break;
case 0x13C7: mapChar = 0xAB97; break;
case 0x13C8: mapChar = 0xAB98; break;
case 0x13C9: mapChar = 0xAB99; break;
case 0x13CA: mapChar = 0xAB9A; break;
case 0x13CB: mapChar = 0xAB9B; break;
case 0x13CC: mapChar = 0xAB9C; break;
case 0x13CD: mapChar = 0xAB9D; break;
case 0x13CE: mapChar = 0xAB9E; break;
case 0x13CF: mapChar = 0xAB9F; break;
case 0x13D0: mapChar = 0xABA0; break;
case 0x13D1: mapChar = 0xABA1; break;
case 0x13D2: mapChar = 0xABA2; break;
case 0x13D3: mapChar = 0xABA3; break;
case 0x13D4: mapChar = 0xABA4; break;
case 0x13D5: mapChar = 0xABA5; break;
case 0x13D6: mapChar = 0xABA6; break;
case 0x13D7: mapChar = 0xABA7; break;
case 0x13D8: mapChar = 0xABA8; break;
case 0x13D9: mapChar = 0xABA9; break;
case 0x13DA: mapChar = 0xABAA; break;
case 0x13DB: mapChar = 0xABAB; break;
case 0x13DC: mapChar = 0xABAC; break;
case 0x13DD: mapChar = 0xABAD; break;
case 0x13DE: mapChar = 0xABAE; break;
case 0x13DF: mapChar = 0xABAF; break;
case 0x13E0: mapChar = 0xABB0; break;
case 0x13E1: mapChar = 0xABB1; break;
case 0x13E2: mapChar = 0xABB2; break;
case 0x13E3: mapChar = 0xABB3; break;
case 0x13E4: mapChar = 0xABB4; break;
case 0x13E5: mapChar = 0xABB5; break;
case 0x13E6: mapChar = 0xABB6; break;
case 0x13E7: mapChar = 0xABB7; break;
case 0x13E8: mapChar = 0xABB8; break;
case 0x13E9: mapChar = 0xABB9; break;
case 0x13EA: mapChar = 0xABBA; break;
case 0x13EB: mapChar = 0xABBB; break;
case 0x13EC: mapChar = 0xABBC; break;
case 0x13ED: mapChar = 0xABBD; break;
case 0x13EE: mapChar = 0xABBE; break;
case 0x13EF: mapChar = 0xABBF; break;
case 0x1E9E: mapChar = 0x00DF; break;
case 0x1F88: mapChar = 0x1F80; break;
case 0x1F89: mapChar = 0x1F81; break;
case 0x1F8A: mapChar = 0x1F82; break;
case 0x1F8B: mapChar = 0x1F83; break;
case 0x1F8C: mapChar = 0x1F84; break;
case 0x1F8D: mapChar = 0x1F85; break;
case 0x1F8E: mapChar = 0x1F86; break;
case 0x1F8F: mapChar = 0x1F87; break;
case 0x1F98: mapChar = 0x1F90; break;
case 0x1F99: mapChar = 0x1F91; break;
case 0x1F9A: mapChar = 0x1F92; break;
case 0x1F9B: mapChar = 0x1F93; break;
case 0x1F9C: mapChar = 0x1F94; break;
case 0x1F9D: mapChar = 0x1F95; break;
case 0x1F9E: mapChar = 0x1F96; break;
case 0x1F9F: mapChar = 0x1F97; break;
case 0x1FA8: mapChar = 0x1FA0; break;
case 0x1FA9: mapChar = 0x1FA1; break;
case 0x1FAA: mapChar = 0x1FA2; break;
case 0x1FAB: mapChar = 0x1FA3; break;
case 0x1FAC: mapChar = 0x1FA4; break;
case 0x1FAD: mapChar = 0x1FA5; break;
case 0x1FAE: mapChar = 0x1FA6; break;
case 0x1FAF: mapChar = 0x1FA7; break;
case 0x1FBC: mapChar = 0x1FB3; break;
case 0x1FCC: mapChar = 0x1FC3; break;
case 0x1FFC: mapChar = 0x1FF3; break;
case 0x2126: mapChar = 0x03C9; break;
case 0x212A: mapChar = 0x006B; break;
case 0x212B: mapChar = 0x00E5; break;
case 0x2C62: mapChar = 0x026B; break;
case 0x2C63: mapChar = 0x1D7D; break;
case 0x2C64: mapChar = 0x027D; break;
case 0x2C6D: mapChar = 0x0251; break;
case 0x2C6E: mapChar = 0x0271; break;
case 0x2C6F: mapChar = 0x0250; break;
case 0x2C70: mapChar = 0x0252; break;
case 0x2C7E: mapChar = 0x023F; break;
case 0x2C7F: mapChar = 0x0240; break;
case 0xA77D: mapChar = 0x1D79; break;
case 0xA78D: mapChar = 0x0265; break;
case 0xA7AA: mapChar = 0x0266; break;
case 0xA7AB: mapChar = 0x025C; break;
case 0xA7AC: mapChar = 0x0261; break;
case 0xA7AD: mapChar = 0x026C; break;
case 0xA7B0: mapChar = 0x029E; break;
case 0xA7B1: mapChar = 0x0287; break;
case 0xA7B2: mapChar = 0x029D; break;
case 0xA7B3: mapChar = 0xAB53; break;
// default mapChar is already set, so no
// need to redo it here.
// default : mapChar = ch;
@ -251,98 +329,176 @@ class CharacterData00 extends CharacterData {
if ((val & $$maskUpperCase) != 0) {
if ((val & $$maskCaseOffset) == $$maskCaseOffset) {
switch(ch) {
// map chars with overflow offsets
case 0x00B5 : mapChar = 0x039C; break;
case 0x017F : mapChar = 0x0053; break;
case 0x1FBE : mapChar = 0x0399; break;
// map char that have both a 1:1 and 1:M map
case 0x1F80 : mapChar = 0x1F88; break;
case 0x1F81 : mapChar = 0x1F89; break;
case 0x1F82 : mapChar = 0x1F8A; break;
case 0x1F83 : mapChar = 0x1F8B; break;
case 0x1F84 : mapChar = 0x1F8C; break;
case 0x1F85 : mapChar = 0x1F8D; break;
case 0x1F86 : mapChar = 0x1F8E; break;
case 0x1F87 : mapChar = 0x1F8F; break;
case 0x1F90 : mapChar = 0x1F98; break;
case 0x1F91 : mapChar = 0x1F99; break;
case 0x1F92 : mapChar = 0x1F9A; break;
case 0x1F93 : mapChar = 0x1F9B; break;
case 0x1F94 : mapChar = 0x1F9C; break;
case 0x1F95 : mapChar = 0x1F9D; break;
case 0x1F96 : mapChar = 0x1F9E; break;
case 0x1F97 : mapChar = 0x1F9F; break;
case 0x1FA0 : mapChar = 0x1FA8; break;
case 0x1FA1 : mapChar = 0x1FA9; break;
case 0x1FA2 : mapChar = 0x1FAA; break;
case 0x1FA3 : mapChar = 0x1FAB; break;
case 0x1FA4 : mapChar = 0x1FAC; break;
case 0x1FA5 : mapChar = 0x1FAD; break;
case 0x1FA6 : mapChar = 0x1FAE; break;
case 0x1FA7 : mapChar = 0x1FAF; break;
case 0x1FB3 : mapChar = 0x1FBC; break;
case 0x1FC3 : mapChar = 0x1FCC; break;
case 0x1FF3 : mapChar = 0x1FFC; break;
case 0x023F : mapChar = 0x2C7E; break;
case 0x0240 : mapChar = 0x2C7F; break;
case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break;
case 0x0252 : mapChar = 0x2C70; break;
case 0x025C : mapChar = 0xA7AB; break;
case 0x0261 : mapChar = 0xA7AC; break;
case 0x0265 : mapChar = 0xA78D; break;
case 0x0266 : mapChar = 0xA7AA; break;
case 0x026B : mapChar = 0x2C62; break;
case 0x026C : mapChar = 0xA7AD; break;
case 0x0271 : mapChar = 0x2C6E; break;
case 0x0287 : mapChar = 0xA7B1; break;
case 0x029E : mapChar = 0xA7B0; break;
case 0x027D : mapChar = 0x2C64; break;
case 0x1D79 : mapChar = 0xA77D; break;
case 0x1D7D : mapChar = 0x2C63; break;
case 0x2C65 : mapChar = 0x023A; break;
case 0x2C66 : mapChar = 0x023E; break;
case 0x2D00 : mapChar = 0x10A0; break;
case 0x2D01 : mapChar = 0x10A1; break;
case 0x2D02 : mapChar = 0x10A2; break;
case 0x2D03 : mapChar = 0x10A3; break;
case 0x2D04 : mapChar = 0x10A4; break;
case 0x2D05 : mapChar = 0x10A5; break;
case 0x2D06 : mapChar = 0x10A6; break;
case 0x2D07 : mapChar = 0x10A7; break;
case 0x2D08 : mapChar = 0x10A8; break;
case 0x2D09 : mapChar = 0x10A9; break;
case 0x2D0A : mapChar = 0x10AA; break;
case 0x2D0B : mapChar = 0x10AB; break;
case 0x2D0C : mapChar = 0x10AC; break;
case 0x2D0D : mapChar = 0x10AD; break;
case 0x2D0E : mapChar = 0x10AE; break;
case 0x2D0F : mapChar = 0x10AF; break;
case 0x2D10 : mapChar = 0x10B0; break;
case 0x2D11 : mapChar = 0x10B1; break;
case 0x2D12 : mapChar = 0x10B2; break;
case 0x2D13 : mapChar = 0x10B3; break;
case 0x2D14 : mapChar = 0x10B4; break;
case 0x2D15 : mapChar = 0x10B5; break;
case 0x2D16 : mapChar = 0x10B6; break;
case 0x2D17 : mapChar = 0x10B7; break;
case 0x2D18 : mapChar = 0x10B8; break;
case 0x2D19 : mapChar = 0x10B9; break;
case 0x2D1A : mapChar = 0x10BA; break;
case 0x2D1B : mapChar = 0x10BB; break;
case 0x2D1C : mapChar = 0x10BC; break;
case 0x2D1D : mapChar = 0x10BD; break;
case 0x2D1E : mapChar = 0x10BE; break;
case 0x2D1F : mapChar = 0x10BF; break;
case 0x2D20 : mapChar = 0x10C0; break;
case 0x2D21 : mapChar = 0x10C1; break;
case 0x2D22 : mapChar = 0x10C2; break;
case 0x2D23 : mapChar = 0x10C3; break;
case 0x2D24 : mapChar = 0x10C4; break;
case 0x2D25 : mapChar = 0x10C5; break;
case 0x2D27 : mapChar = 0x10C7; break;
case 0x2D2D : mapChar = 0x10CD; break;
case 0x017F: mapChar = 0x0053; break;
case 0x023F: mapChar = 0x2C7E; break;
case 0x0240: mapChar = 0x2C7F; break;
case 0x0250: mapChar = 0x2C6F; break;
case 0x0251: mapChar = 0x2C6D; break;
case 0x0252: mapChar = 0x2C70; break;
case 0x025C: mapChar = 0xA7AB; break;
case 0x0261: mapChar = 0xA7AC; break;
case 0x0265: mapChar = 0xA78D; break;
case 0x0266: mapChar = 0xA7AA; break;
case 0x026B: mapChar = 0x2C62; break;
case 0x026C: mapChar = 0xA7AD; break;
case 0x0271: mapChar = 0x2C6E; break;
case 0x027D: mapChar = 0x2C64; break;
case 0x0287: mapChar = 0xA7B1; break;
case 0x029D: mapChar = 0xA7B2; break;
case 0x029E: mapChar = 0xA7B0; break;
case 0x1D79: mapChar = 0xA77D; break;
case 0x1D7D: mapChar = 0x2C63; break;
case 0x1F80: mapChar = 0x1F88; break;
case 0x1F81: mapChar = 0x1F89; break;
case 0x1F82: mapChar = 0x1F8A; break;
case 0x1F83: mapChar = 0x1F8B; break;
case 0x1F84: mapChar = 0x1F8C; break;
case 0x1F85: mapChar = 0x1F8D; break;
case 0x1F86: mapChar = 0x1F8E; break;
case 0x1F87: mapChar = 0x1F8F; break;
case 0x1F90: mapChar = 0x1F98; break;
case 0x1F91: mapChar = 0x1F99; break;
case 0x1F92: mapChar = 0x1F9A; break;
case 0x1F93: mapChar = 0x1F9B; break;
case 0x1F94: mapChar = 0x1F9C; break;
case 0x1F95: mapChar = 0x1F9D; break;
case 0x1F96: mapChar = 0x1F9E; break;
case 0x1F97: mapChar = 0x1F9F; break;
case 0x1FA0: mapChar = 0x1FA8; break;
case 0x1FA1: mapChar = 0x1FA9; break;
case 0x1FA2: mapChar = 0x1FAA; break;
case 0x1FA3: mapChar = 0x1FAB; break;
case 0x1FA4: mapChar = 0x1FAC; break;
case 0x1FA5: mapChar = 0x1FAD; break;
case 0x1FA6: mapChar = 0x1FAE; break;
case 0x1FA7: mapChar = 0x1FAF; break;
case 0x1FB3: mapChar = 0x1FBC; break;
case 0x1FBE: mapChar = 0x0399; break;
case 0x1FC3: mapChar = 0x1FCC; break;
case 0x1FF3: mapChar = 0x1FFC; break;
case 0x2C65: mapChar = 0x023A; break;
case 0x2C66: mapChar = 0x023E; break;
case 0x2D00: mapChar = 0x10A0; break;
case 0x2D01: mapChar = 0x10A1; break;
case 0x2D02: mapChar = 0x10A2; break;
case 0x2D03: mapChar = 0x10A3; break;
case 0x2D04: mapChar = 0x10A4; break;
case 0x2D05: mapChar = 0x10A5; break;
case 0x2D06: mapChar = 0x10A6; break;
case 0x2D07: mapChar = 0x10A7; break;
case 0x2D08: mapChar = 0x10A8; break;
case 0x2D09: mapChar = 0x10A9; break;
case 0x2D0A: mapChar = 0x10AA; break;
case 0x2D0B: mapChar = 0x10AB; break;
case 0x2D0C: mapChar = 0x10AC; break;
case 0x2D0D: mapChar = 0x10AD; break;
case 0x2D0E: mapChar = 0x10AE; break;
case 0x2D0F: mapChar = 0x10AF; break;
case 0x2D10: mapChar = 0x10B0; break;
case 0x2D11: mapChar = 0x10B1; break;
case 0x2D12: mapChar = 0x10B2; break;
case 0x2D13: mapChar = 0x10B3; break;
case 0x2D14: mapChar = 0x10B4; break;
case 0x2D15: mapChar = 0x10B5; break;
case 0x2D16: mapChar = 0x10B6; break;
case 0x2D17: mapChar = 0x10B7; break;
case 0x2D18: mapChar = 0x10B8; break;
case 0x2D19: mapChar = 0x10B9; break;
case 0x2D1A: mapChar = 0x10BA; break;
case 0x2D1B: mapChar = 0x10BB; break;
case 0x2D1C: mapChar = 0x10BC; break;
case 0x2D1D: mapChar = 0x10BD; break;
case 0x2D1E: mapChar = 0x10BE; break;
case 0x2D1F: mapChar = 0x10BF; break;
case 0x2D20: mapChar = 0x10C0; break;
case 0x2D21: mapChar = 0x10C1; break;
case 0x2D22: mapChar = 0x10C2; break;
case 0x2D23: mapChar = 0x10C3; break;
case 0x2D24: mapChar = 0x10C4; break;
case 0x2D25: mapChar = 0x10C5; break;
case 0x2D27: mapChar = 0x10C7; break;
case 0x2D2D: mapChar = 0x10CD; break;
case 0xAB53: mapChar = 0xA7B3; break;
case 0xAB70: mapChar = 0x13A0; break;
case 0xAB71: mapChar = 0x13A1; break;
case 0xAB72: mapChar = 0x13A2; break;
case 0xAB73: mapChar = 0x13A3; break;
case 0xAB74: mapChar = 0x13A4; break;
case 0xAB75: mapChar = 0x13A5; break;
case 0xAB76: mapChar = 0x13A6; break;
case 0xAB77: mapChar = 0x13A7; break;
case 0xAB78: mapChar = 0x13A8; break;
case 0xAB79: mapChar = 0x13A9; break;
case 0xAB7A: mapChar = 0x13AA; break;
case 0xAB7B: mapChar = 0x13AB; break;
case 0xAB7C: mapChar = 0x13AC; break;
case 0xAB7D: mapChar = 0x13AD; break;
case 0xAB7E: mapChar = 0x13AE; break;
case 0xAB7F: mapChar = 0x13AF; break;
case 0xAB80: mapChar = 0x13B0; break;
case 0xAB81: mapChar = 0x13B1; break;
case 0xAB82: mapChar = 0x13B2; break;
case 0xAB83: mapChar = 0x13B3; break;
case 0xAB84: mapChar = 0x13B4; break;
case 0xAB85: mapChar = 0x13B5; break;
case 0xAB86: mapChar = 0x13B6; break;
case 0xAB87: mapChar = 0x13B7; break;
case 0xAB88: mapChar = 0x13B8; break;
case 0xAB89: mapChar = 0x13B9; break;
case 0xAB8A: mapChar = 0x13BA; break;
case 0xAB8B: mapChar = 0x13BB; break;
case 0xAB8C: mapChar = 0x13BC; break;
case 0xAB8D: mapChar = 0x13BD; break;
case 0xAB8E: mapChar = 0x13BE; break;
case 0xAB8F: mapChar = 0x13BF; break;
case 0xAB90: mapChar = 0x13C0; break;
case 0xAB91: mapChar = 0x13C1; break;
case 0xAB92: mapChar = 0x13C2; break;
case 0xAB93: mapChar = 0x13C3; break;
case 0xAB94: mapChar = 0x13C4; break;
case 0xAB95: mapChar = 0x13C5; break;
case 0xAB96: mapChar = 0x13C6; break;
case 0xAB97: mapChar = 0x13C7; break;
case 0xAB98: mapChar = 0x13C8; break;
case 0xAB99: mapChar = 0x13C9; break;
case 0xAB9A: mapChar = 0x13CA; break;
case 0xAB9B: mapChar = 0x13CB; break;
case 0xAB9C: mapChar = 0x13CC; break;
case 0xAB9D: mapChar = 0x13CD; break;
case 0xAB9E: mapChar = 0x13CE; break;
case 0xAB9F: mapChar = 0x13CF; break;
case 0xABA0: mapChar = 0x13D0; break;
case 0xABA1: mapChar = 0x13D1; break;
case 0xABA2: mapChar = 0x13D2; break;
case 0xABA3: mapChar = 0x13D3; break;
case 0xABA4: mapChar = 0x13D4; break;
case 0xABA5: mapChar = 0x13D5; break;
case 0xABA6: mapChar = 0x13D6; break;
case 0xABA7: mapChar = 0x13D7; break;
case 0xABA8: mapChar = 0x13D8; break;
case 0xABA9: mapChar = 0x13D9; break;
case 0xABAA: mapChar = 0x13DA; break;
case 0xABAB: mapChar = 0x13DB; break;
case 0xABAC: mapChar = 0x13DC; break;
case 0xABAD: mapChar = 0x13DD; break;
case 0xABAE: mapChar = 0x13DE; break;
case 0xABAF: mapChar = 0x13DF; break;
case 0xABB0: mapChar = 0x13E0; break;
case 0xABB1: mapChar = 0x13E1; break;
case 0xABB2: mapChar = 0x13E2; break;
case 0xABB3: mapChar = 0x13E3; break;
case 0xABB4: mapChar = 0x13E4; break;
case 0xABB5: mapChar = 0x13E5; break;
case 0xABB6: mapChar = 0x13E6; break;
case 0xABB7: mapChar = 0x13E7; break;
case 0xABB8: mapChar = 0x13E8; break;
case 0xABB9: mapChar = 0x13E9; break;
case 0xABBA: mapChar = 0x13EA; break;
case 0xABBB: mapChar = 0x13EB; break;
case 0xABBC: mapChar = 0x13EC; break;
case 0xABBD: mapChar = 0x13ED; break;
case 0xABBE: mapChar = 0x13EE; break;
case 0xABBF: mapChar = 0x13EF; break;
// ch must have a 1:M case mapping, but we
// can't handle it here. Return ch.
// since mapChar is already set, no need
@ -420,6 +576,8 @@ class CharacterData00 extends CharacterData {
switch (ch) {
case 0x0BF1: retval = 100; break; // TAMIL NUMBER ONE HUNDRED
case 0x0BF2: retval = 1000; break; // TAMIL NUMBER ONE THOUSAND
case 0x0D71: retval = 100; break; // MALAYALAM NUMBER ONE HUNDRED
case 0x0D72: retval = 1000; break; // MALAYALAM NUMBER ONE THOUSAND
case 0x1375: retval = 40; break; // ETHIOPIC NUMBER FORTY
case 0x1376: retval = 50; break; // ETHIOPIC NUMBER FIFTY
case 0x1377: retval = 60; break; // ETHIOPIC NUMBER SIXTY
@ -440,14 +598,15 @@ class CharacterData00 extends CharacterData {
case 0x2180: retval = 1000; break; // ROMAN NUMERAL ONE THOUSAND C D
case 0x2181: retval = 5000; break; // ROMAN NUMERAL FIVE THOUSAND
case 0x2182: retval = 10000; break; // ROMAN NUMERAL TEN THOUSAND
case 0x324B: retval = 40; break;
case 0x324C: retval = 50; break;
case 0x324D: retval = 60; break;
case 0x324E: retval = 70; break;
case 0x324F: retval = 80; break;
case 0x325C: retval = 32; break;
case 0x2186: retval = 50; break; // ROMAN NUMERAL FIFTY EARLY FORM
case 0x2187: retval = 50000; break; // ROMAN NUMERAL FIFTY THOUSAND
case 0x2188: retval = 100000; break; // ROMAN NUMERAL ONE HUNDRED THOUSAND
case 0x324B: retval = 40; break; // CIRCLED NUMBER FORTY ON BLACK SQUARE
case 0x324C: retval = 50; break; // CIRCLED NUMBER FIFTY ON BLACK SQUARE
case 0x324D: retval = 60; break; // CIRCLED NUMBER SIXTY ON BLACK SQUARE
case 0x324E: retval = 70; break; // CIRCLED NUMBER SEVENTY ON BLACK SQUARE
case 0x324F: retval = 80; break; // CIRCLED NUMBER EIGHTY ON BLACK SQUARE
case 0x325C: retval = 32; break; // CIRCLED NUMBER THIRTY TWO
case 0x325D: retval = 33; break; // CIRCLED NUMBER THIRTY THREE
case 0x325E: retval = 34; break; // CIRCLED NUMBER THIRTY FOUR
case 0x325F: retval = 35; break; // CIRCLED NUMBER THIRTY FIVE
@ -466,13 +625,6 @@ class CharacterData00 extends CharacterData {
case 0x32BD: retval = 48; break; // CIRCLED NUMBER FORTY EIGHT
case 0x32BE: retval = 49; break; // CIRCLED NUMBER FORTY NINE
case 0x32BF: retval = 50; break; // CIRCLED NUMBER FIFTY
case 0x0D71: retval = 100; break; // MALAYALAM NUMBER ONE HUNDRED
case 0x0D72: retval = 1000; break; // MALAYALAM NUMBER ONE THOUSAND
case 0x2186: retval = 50; break; // ROMAN NUMERAL FIFTY EARLY FORM
case 0x2187: retval = 50000; break; // ROMAN NUMERAL FIFTY THOUSAND
case 0x2188: retval = 100000; break; // ROMAN NUMERAL ONE HUNDRED THOUSAND
default: retval = -2; break;
}
break;
@ -553,70 +705,149 @@ class CharacterData00 extends CharacterData {
}
else {
switch(ch) {
// map overflow characters
case 0x00B5 : mapChar = 0x039C; break;
case 0x017F : mapChar = 0x0053; break;
case 0x1FBE : mapChar = 0x0399; break;
case 0x023F : mapChar = 0x2C7E; break;
case 0x0240 : mapChar = 0x2C7F; break;
case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break;
case 0x0252 : mapChar = 0x2C70; break;
case 0x025C : mapChar = 0xA7AB; break;
case 0x0261 : mapChar = 0xA7AC; break;
case 0x0265 : mapChar = 0xA78D; break;
case 0x0266 : mapChar = 0xA7AA; break;
case 0x026B : mapChar = 0x2C62; break;
case 0x026C : mapChar = 0xA7AD; break;
case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break;
case 0x0287 : mapChar = 0xA7B1; break;
case 0x029E : mapChar = 0xA7B0; break;
case 0x1D79 : mapChar = 0xA77D; break;
case 0x1D7D : mapChar = 0x2C63; break;
case 0x2C65 : mapChar = 0x023A; break;
case 0x2C66 : mapChar = 0x023E; break;
case 0x2D00 : mapChar = 0x10A0; break;
case 0x2D01 : mapChar = 0x10A1; break;
case 0x2D02 : mapChar = 0x10A2; break;
case 0x2D03 : mapChar = 0x10A3; break;
case 0x2D04 : mapChar = 0x10A4; break;
case 0x2D05 : mapChar = 0x10A5; break;
case 0x2D06 : mapChar = 0x10A6; break;
case 0x2D07 : mapChar = 0x10A7; break;
case 0x2D08 : mapChar = 0x10A8; break;
case 0x2D09 : mapChar = 0x10A9; break;
case 0x2D0A : mapChar = 0x10AA; break;
case 0x2D0B : mapChar = 0x10AB; break;
case 0x2D0C : mapChar = 0x10AC; break;
case 0x2D0D : mapChar = 0x10AD; break;
case 0x2D0E : mapChar = 0x10AE; break;
case 0x2D0F : mapChar = 0x10AF; break;
case 0x2D10 : mapChar = 0x10B0; break;
case 0x2D11 : mapChar = 0x10B1; break;
case 0x2D12 : mapChar = 0x10B2; break;
case 0x2D13 : mapChar = 0x10B3; break;
case 0x2D14 : mapChar = 0x10B4; break;
case 0x2D15 : mapChar = 0x10B5; break;
case 0x2D16 : mapChar = 0x10B6; break;
case 0x2D17 : mapChar = 0x10B7; break;
case 0x2D18 : mapChar = 0x10B8; break;
case 0x2D19 : mapChar = 0x10B9; break;
case 0x2D1A : mapChar = 0x10BA; break;
case 0x2D1B : mapChar = 0x10BB; break;
case 0x2D1C : mapChar = 0x10BC; break;
case 0x2D1D : mapChar = 0x10BD; break;
case 0x2D1E : mapChar = 0x10BE; break;
case 0x2D1F : mapChar = 0x10BF; break;
case 0x2D20 : mapChar = 0x10C0; break;
case 0x2D21 : mapChar = 0x10C1; break;
case 0x2D22 : mapChar = 0x10C2; break;
case 0x2D23 : mapChar = 0x10C3; break;
case 0x2D24 : mapChar = 0x10C4; break;
case 0x2D25 : mapChar = 0x10C5; break;
case 0x2D27 : mapChar = 0x10C7; break;
case 0x2D2D : mapChar = 0x10CD; break;
case 0x017F: mapChar = 0x0053; break;
case 0x023F: mapChar = 0x2C7E; break;
case 0x0240: mapChar = 0x2C7F; break;
case 0x0250: mapChar = 0x2C6F; break;
case 0x0251: mapChar = 0x2C6D; break;
case 0x0252: mapChar = 0x2C70; break;
case 0x025C: mapChar = 0xA7AB; break;
case 0x0261: mapChar = 0xA7AC; break;
case 0x0265: mapChar = 0xA78D; break;
case 0x0266: mapChar = 0xA7AA; break;
case 0x026B: mapChar = 0x2C62; break;
case 0x026C: mapChar = 0xA7AD; break;
case 0x0271: mapChar = 0x2C6E; break;
case 0x027D: mapChar = 0x2C64; break;
case 0x0287: mapChar = 0xA7B1; break;
case 0x029D: mapChar = 0xA7B2; break;
case 0x029E: mapChar = 0xA7B0; break;
case 0x1D79: mapChar = 0xA77D; break;
case 0x1D7D: mapChar = 0x2C63; break;
case 0x1FBE: mapChar = 0x0399; break;
case 0x2C65: mapChar = 0x023A; break;
case 0x2C66: mapChar = 0x023E; break;
case 0x2D00: mapChar = 0x10A0; break;
case 0x2D01: mapChar = 0x10A1; break;
case 0x2D02: mapChar = 0x10A2; break;
case 0x2D03: mapChar = 0x10A3; break;
case 0x2D04: mapChar = 0x10A4; break;
case 0x2D05: mapChar = 0x10A5; break;
case 0x2D06: mapChar = 0x10A6; break;
case 0x2D07: mapChar = 0x10A7; break;
case 0x2D08: mapChar = 0x10A8; break;
case 0x2D09: mapChar = 0x10A9; break;
case 0x2D0A: mapChar = 0x10AA; break;
case 0x2D0B: mapChar = 0x10AB; break;
case 0x2D0C: mapChar = 0x10AC; break;
case 0x2D0D: mapChar = 0x10AD; break;
case 0x2D0E: mapChar = 0x10AE; break;
case 0x2D0F: mapChar = 0x10AF; break;
case 0x2D10: mapChar = 0x10B0; break;
case 0x2D11: mapChar = 0x10B1; break;
case 0x2D12: mapChar = 0x10B2; break;
case 0x2D13: mapChar = 0x10B3; break;
case 0x2D14: mapChar = 0x10B4; break;
case 0x2D15: mapChar = 0x10B5; break;
case 0x2D16: mapChar = 0x10B6; break;
case 0x2D17: mapChar = 0x10B7; break;
case 0x2D18: mapChar = 0x10B8; break;
case 0x2D19: mapChar = 0x10B9; break;
case 0x2D1A: mapChar = 0x10BA; break;
case 0x2D1B: mapChar = 0x10BB; break;
case 0x2D1C: mapChar = 0x10BC; break;
case 0x2D1D: mapChar = 0x10BD; break;
case 0x2D1E: mapChar = 0x10BE; break;
case 0x2D1F: mapChar = 0x10BF; break;
case 0x2D20: mapChar = 0x10C0; break;
case 0x2D21: mapChar = 0x10C1; break;
case 0x2D22: mapChar = 0x10C2; break;
case 0x2D23: mapChar = 0x10C3; break;
case 0x2D24: mapChar = 0x10C4; break;
case 0x2D25: mapChar = 0x10C5; break;
case 0x2D27: mapChar = 0x10C7; break;
case 0x2D2D: mapChar = 0x10CD; break;
case 0xAB53: mapChar = 0xA7B3; break;
case 0xAB70: mapChar = 0x13A0; break;
case 0xAB71: mapChar = 0x13A1; break;
case 0xAB72: mapChar = 0x13A2; break;
case 0xAB73: mapChar = 0x13A3; break;
case 0xAB74: mapChar = 0x13A4; break;
case 0xAB75: mapChar = 0x13A5; break;
case 0xAB76: mapChar = 0x13A6; break;
case 0xAB77: mapChar = 0x13A7; break;
case 0xAB78: mapChar = 0x13A8; break;
case 0xAB79: mapChar = 0x13A9; break;
case 0xAB7A: mapChar = 0x13AA; break;
case 0xAB7B: mapChar = 0x13AB; break;
case 0xAB7C: mapChar = 0x13AC; break;
case 0xAB7D: mapChar = 0x13AD; break;
case 0xAB7E: mapChar = 0x13AE; break;
case 0xAB7F: mapChar = 0x13AF; break;
case 0xAB80: mapChar = 0x13B0; break;
case 0xAB81: mapChar = 0x13B1; break;
case 0xAB82: mapChar = 0x13B2; break;
case 0xAB83: mapChar = 0x13B3; break;
case 0xAB84: mapChar = 0x13B4; break;
case 0xAB85: mapChar = 0x13B5; break;
case 0xAB86: mapChar = 0x13B6; break;
case 0xAB87: mapChar = 0x13B7; break;
case 0xAB88: mapChar = 0x13B8; break;
case 0xAB89: mapChar = 0x13B9; break;
case 0xAB8A: mapChar = 0x13BA; break;
case 0xAB8B: mapChar = 0x13BB; break;
case 0xAB8C: mapChar = 0x13BC; break;
case 0xAB8D: mapChar = 0x13BD; break;
case 0xAB8E: mapChar = 0x13BE; break;
case 0xAB8F: mapChar = 0x13BF; break;
case 0xAB90: mapChar = 0x13C0; break;
case 0xAB91: mapChar = 0x13C1; break;
case 0xAB92: mapChar = 0x13C2; break;
case 0xAB93: mapChar = 0x13C3; break;
case 0xAB94: mapChar = 0x13C4; break;
case 0xAB95: mapChar = 0x13C5; break;
case 0xAB96: mapChar = 0x13C6; break;
case 0xAB97: mapChar = 0x13C7; break;
case 0xAB98: mapChar = 0x13C8; break;
case 0xAB99: mapChar = 0x13C9; break;
case 0xAB9A: mapChar = 0x13CA; break;
case 0xAB9B: mapChar = 0x13CB; break;
case 0xAB9C: mapChar = 0x13CC; break;
case 0xAB9D: mapChar = 0x13CD; break;
case 0xAB9E: mapChar = 0x13CE; break;
case 0xAB9F: mapChar = 0x13CF; break;
case 0xABA0: mapChar = 0x13D0; break;
case 0xABA1: mapChar = 0x13D1; break;
case 0xABA2: mapChar = 0x13D2; break;
case 0xABA3: mapChar = 0x13D3; break;
case 0xABA4: mapChar = 0x13D4; break;
case 0xABA5: mapChar = 0x13D5; break;
case 0xABA6: mapChar = 0x13D6; break;
case 0xABA7: mapChar = 0x13D7; break;
case 0xABA8: mapChar = 0x13D8; break;
case 0xABA9: mapChar = 0x13D9; break;
case 0xABAA: mapChar = 0x13DA; break;
case 0xABAB: mapChar = 0x13DB; break;
case 0xABAC: mapChar = 0x13DC; break;
case 0xABAD: mapChar = 0x13DD; break;
case 0xABAE: mapChar = 0x13DE; break;
case 0xABAF: mapChar = 0x13DF; break;
case 0xABB0: mapChar = 0x13E0; break;
case 0xABB1: mapChar = 0x13E1; break;
case 0xABB2: mapChar = 0x13E2; break;
case 0xABB3: mapChar = 0x13E3; break;
case 0xABB4: mapChar = 0x13E4; break;
case 0xABB5: mapChar = 0x13E5; break;
case 0xABB6: mapChar = 0x13E6; break;
case 0xABB7: mapChar = 0x13E7; break;
case 0xABB8: mapChar = 0x13E8; break;
case 0xABB9: mapChar = 0x13E9; break;
case 0xABBA: mapChar = 0x13EA; break;
case 0xABBB: mapChar = 0x13EB; break;
case 0xABBC: mapChar = 0x13EC; break;
case 0xABBD: mapChar = 0x13ED; break;
case 0xABBE: mapChar = 0x13EE; break;
case 0xABBF: mapChar = 0x13EF; break;
default : mapChar = Character.ERROR; break;
}
}

View File

@ -243,36 +243,35 @@ class CharacterData01 extends CharacterData {
case 0x10131: retval = 70000; break; // AEGEAN NUMBER SEVENTY THOUSAND
case 0x10132: retval = 80000; break; // AEGEAN NUMBER EIGHTY THOUSAND
case 0x10133: retval = 90000; break; // AEGEAN NUMBER NINETY THOUSAND
case 0x10323: retval = 50; break; // OLD ITALIC NUMERAL FIFTY
case 0x10144: retval = 50; break; // ACROPHONIC ATTIC FIFTY
case 0x10145: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED
case 0x10146: retval = 5000; break; // ACROPHONIC ATTIC FIVE THOUSAND
case 0x10147: retval = 50000; break; // ACROPHONIC ATTIC FIFTY THOUSAND
case 0x1014A: retval = 50; break; // ACROPHONIC ATTIC FIFTY TALENTS
case 0x1014B: retval = 100; break; // ACROPHONIC ATTIC ONE HUNDRED TALENTS
case 0x1014C: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED TALENTS
case 0x1014D: retval = 1000; break; // ACROPHONIC ATTIC ONE THOUSAND TALENTS
case 0x1014E: retval = 5000; break; // ACROPHONIC ATTIC FIVE THOUSAND TALENTS
case 0x10151: retval = 50; break; // ACROPHONIC ATTIC FIFTY STATERS
case 0x10152: retval = 100; break; // ACROPHONIC ATTIC ONE HUNDRED STATERS
case 0x10153: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED STATERS
case 0x10154: retval = 1000; break; // ACROPHONIC ATTIC ONE THOUSAND STATERS
case 0x10155: retval = 10000; break; // ACROPHONIC ATTIC TEN THOUSAND STATERS
case 0x10156: retval = 50000; break; // ACROPHONIC ATTIC FIFTY THOUSAND STATERS
case 0x10166: retval = 50; break; // ACROPHONIC TROEZENIAN FIFTY
case 0x10167: retval = 50; break; // ACROPHONIC TROEZENIAN FIFTY ALTERNATE FORM
case 0x10168: retval = 50; break; // ACROPHONIC HERMIONIAN FIFTY
case 0x10169: retval = 50; break; // ACROPHONIC THESPIAN FIFTY
case 0x1016A: retval = 100; break; // ACROPHONIC THESPIAN ONE HUNDRED
case 0x1016B: retval = 300; break; // ACROPHONIC THESPIAN THREE HUNDRED
case 0x1016C: retval = 500; break; // ACROPHONIC EPIDAUREAN FIVE HUNDRED
case 0x1016D: retval = 500; break; // ACROPHONIC TROEZENIAN FIVE HUNDRED
case 0x1016E: retval = 500; break; // ACROPHONIC THESPIAN FIVE HUNDRED
case 0x1016F: retval = 500; break; // ACROPHONIC CARYSTIAN FIVE HUNDRED
case 0x10170: retval = 500; break; // ACROPHONIC NAXIAN FIVE HUNDRED
case 0x10171: retval = 1000; break; // ACROPHONIC THESPIAN ONE THOUSAND
case 0x10172: retval = 5000; break; // ACROPHONIC THESPIAN FIVE THOUSAND
case 0x10174: retval = 50; break; // ACROPHONIC STRATIAN FIFTY MNAS
case 0x10144: retval = 50; break; // GREEK ACROPHONIC ATTIC FIFTY
case 0x10145: retval = 500; break; // GREEK ACROPHONIC ATTIC FIVE HUNDRED
case 0x10146: retval = 5000; break; // GREEK ACROPHONIC ATTIC FIVE THOUSAND
case 0x10147: retval = 50000; break; // GREEK ACROPHONIC ATTIC FIFTY THOUSAND
case 0x1014A: retval = 50; break; // GREEK ACROPHONIC ATTIC FIFTY TALENTS
case 0x1014B: retval = 100; break; // GREEK ACROPHONIC ATTIC ONE HUNDRED TALENTS
case 0x1014C: retval = 500; break; // GREEK ACROPHONIC ATTIC FIVE HUNDRED TALENTS
case 0x1014D: retval = 1000; break; // GREEK ACROPHONIC ATTIC ONE THOUSAND TALENTS
case 0x1014E: retval = 5000; break; // GREEK ACROPHONIC ATTIC FIVE THOUSAND TALENTS
case 0x10151: retval = 50; break; // GREEK ACROPHONIC ATTIC FIFTY STATERS
case 0x10152: retval = 100; break; // GREEK ACROPHONIC ATTIC ONE HUNDRED STATERS
case 0x10153: retval = 500; break; // GREEK ACROPHONIC ATTIC FIVE HUNDRED STATERS
case 0x10154: retval = 1000; break; // GREEK ACROPHONIC ATTIC ONE THOUSAND STATERS
case 0x10155: retval = 10000; break; // GREEK ACROPHONIC ATTIC TEN THOUSAND STATERS
case 0x10156: retval = 50000; break; // GREEK ACROPHONIC ATTIC FIFTY THOUSAND STATERS
case 0x10166: retval = 50; break; // GREEK ACROPHONIC TROEZENIAN FIFTY
case 0x10167: retval = 50; break; // GREEK ACROPHONIC TROEZENIAN FIFTY ALTERNATE FORM
case 0x10168: retval = 50; break; // GREEK ACROPHONIC HERMIONIAN FIFTY
case 0x10169: retval = 50; break; // GREEK ACROPHONIC THESPIAN FIFTY
case 0x1016A: retval = 100; break; // GREEK ACROPHONIC THESPIAN ONE HUNDRED
case 0x1016B: retval = 300; break; // GREEK ACROPHONIC THESPIAN THREE HUNDRED
case 0x1016C: retval = 500; break; // GREEK ACROPHONIC EPIDAUREAN FIVE HUNDRED
case 0x1016D: retval = 500; break; // GREEK ACROPHONIC TROEZENIAN FIVE HUNDRED
case 0x1016E: retval = 500; break; // GREEK ACROPHONIC THESPIAN FIVE HUNDRED
case 0x1016F: retval = 500; break; // GREEK ACROPHONIC CARYSTIAN FIVE HUNDRED
case 0x10170: retval = 500; break; // GREEK ACROPHONIC NAXIAN FIVE HUNDRED
case 0x10171: retval = 1000; break; // GREEK ACROPHONIC THESPIAN ONE THOUSAND
case 0x10172: retval = 5000; break; // GREEK ACROPHONIC THESPIAN FIVE THOUSAND
case 0x10174: retval = 50; break; // GREEK ACROPHONIC STRATIAN FIFTY MNAS
case 0x102ED: retval = 40; break; // COPTIC EPACT NUMBER FORTY
case 0x102EE: retval = 50; break; // COPTIC EPACT NUMBER FIFTY
case 0x102EF: retval = 60; break; // COPTIC EPACT NUMBER SIXTY
@ -288,6 +287,7 @@ class CharacterData01 extends CharacterData {
case 0x102F9: retval = 700; break; // COPTIC EPACT NUMBER SEVEN HUNDRED
case 0x102FA: retval = 800; break; // COPTIC EPACT NUMBER EIGHT HUNDRED
case 0x102FB: retval = 900; break; // COPTIC EPACT NUMBER NINE HUNDRED
case 0x10323: retval = 50; break; // OLD ITALIC NUMERAL FIFTY
case 0x10341: retval = 90; break; // GOTHIC LETTER NINETY
case 0x1034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED
case 0x103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED
@ -295,7 +295,48 @@ class CharacterData01 extends CharacterData {
case 0x1085E: retval = 1000; break; // IMPERIAL ARAMAIC NUMBER ONE THOUSAND
case 0x1085F: retval = 10000; break; // IMPERIAL ARAMAIC NUMBER TEN THOUSAND
case 0x108AF: retval = 100; break; // NABATAEAN NUMBER ONE HUNDRED
case 0x108FF: retval = 100; break; // HATRAN NUMBER ONE HUNDRED
case 0x10919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED
case 0x109CC: retval = 40; break; // MEROITIC CURSIVE NUMBER FORTY
case 0x109CD: retval = 50; break; // MEROITIC CURSIVE NUMBER FIFTY
case 0x109CE: retval = 60; break; // MEROITIC CURSIVE NUMBER SIXTY
case 0x109CF: retval = 70; break; // MEROITIC CURSIVE NUMBER SEVENTY
case 0x109D2: retval = 100; break; // MEROITIC CURSIVE NUMBER ONE HUNDRED
case 0x109D3: retval = 200; break; // MEROITIC CURSIVE NUMBER TWO HUNDRED
case 0x109D4: retval = 300; break; // MEROITIC CURSIVE NUMBER THREE HUNDRED
case 0x109D5: retval = 400; break; // MEROITIC CURSIVE NUMBER FOUR HUNDRED
case 0x109D6: retval = 500; break; // MEROITIC CURSIVE NUMBER FIVE HUNDRED
case 0x109D7: retval = 600; break; // MEROITIC CURSIVE NUMBER SIX HUNDRED
case 0x109D8: retval = 700; break; // MEROITIC CURSIVE NUMBER SEVEN HUNDRED
case 0x109D9: retval = 800; break; // MEROITIC CURSIVE NUMBER EIGHT HUNDRED
case 0x109DA: retval = 900; break; // MEROITIC CURSIVE NUMBER NINE HUNDRED
case 0x109DB: retval = 1000; break; // MEROITIC CURSIVE NUMBER ONE THOUSAND
case 0x109DC: retval = 2000; break; // MEROITIC CURSIVE NUMBER TWO THOUSAND
case 0x109DD: retval = 3000; break; // MEROITIC CURSIVE NUMBER THREE THOUSAND
case 0x109DE: retval = 4000; break; // MEROITIC CURSIVE NUMBER FOUR THOUSAND
case 0x109DF: retval = 5000; break; // MEROITIC CURSIVE NUMBER FIVE THOUSAND
case 0x109E0: retval = 6000; break; // MEROITIC CURSIVE NUMBER SIX THOUSAND
case 0x109E1: retval = 7000; break; // MEROITIC CURSIVE NUMBER SEVEN THOUSAND
case 0x109E2: retval = 8000; break; // MEROITIC CURSIVE NUMBER EIGHT THOUSAND
case 0x109E3: retval = 9000; break; // MEROITIC CURSIVE NUMBER NINE THOUSAND
case 0x109E4: retval = 10000; break; // MEROITIC CURSIVE NUMBER TEN THOUSAND
case 0x109E5: retval = 20000; break; // MEROITIC CURSIVE NUMBER TWENTY THOUSAND
case 0x109E6: retval = 30000; break; // MEROITIC CURSIVE NUMBER THIRTY THOUSAND
case 0x109E7: retval = 40000; break; // MEROITIC CURSIVE NUMBER FORTY THOUSAND
case 0x109E8: retval = 50000; break; // MEROITIC CURSIVE NUMBER FIFTY THOUSAND
case 0x109E9: retval = 60000; break; // MEROITIC CURSIVE NUMBER SIXTY THOUSAND
case 0x109EA: retval = 70000; break; // MEROITIC CURSIVE NUMBER SEVENTY THOUSAND
case 0x109EB: retval = 80000; break; // MEROITIC CURSIVE NUMBER EIGHTY THOUSAND
case 0x109EC: retval = 90000; break; // MEROITIC CURSIVE NUMBER NINETY THOUSAND
case 0x109ED: retval = 100000; break; // MEROITIC CURSIVE NUMBER ONE HUNDRED THOUSAND
case 0x109EE: retval = 200000; break; // MEROITIC CURSIVE NUMBER TWO HUNDRED THOUSAND
case 0x109EF: retval = 300000; break; // MEROITIC CURSIVE NUMBER THREE HUNDRED THOUSAND
case 0x109F0: retval = 400000; break; // MEROITIC CURSIVE NUMBER FOUR HUNDRED THOUSAND
case 0x109F1: retval = 500000; break; // MEROITIC CURSIVE NUMBER FIVE HUNDRED THOUSAND
case 0x109F2: retval = 600000; break; // MEROITIC CURSIVE NUMBER SIX HUNDRED THOUSAND
case 0x109F3: retval = 700000; break; // MEROITIC CURSIVE NUMBER SEVEN HUNDRED THOUSAND
case 0x109F4: retval = 800000; break; // MEROITIC CURSIVE NUMBER EIGHT HUNDRED THOUSAND
case 0x109F5: retval = 900000; break; // MEROITIC CURSIVE NUMBER NINE HUNDRED THOUSAND
case 0x10A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED
case 0x10A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND
case 0x10A7E: retval = 50; break; // OLD SOUTH ARABIAN NUMBER FIFTY
@ -305,6 +346,9 @@ class CharacterData01 extends CharacterData {
case 0x10B7E: retval = 100; break; // INSCRIPTIONAL PAHLAVI NUMBER ONE HUNDRED
case 0x10B7F: retval = 1000; break; // INSCRIPTIONAL PAHLAVI NUMBER ONE THOUSAND
case 0x10BAF: retval = 100; break; // PSALTER PAHLAVI NUMBER ONE HUNDRED
case 0x10CFD: retval = 50; break; // OLD HUNGARIAN NUMBER FIFTY
case 0x10CFE: retval = 100; break; // OLD HUNGARIAN NUMBER ONE HUNDRED
case 0x10CFF: retval = 1000; break; // OLD HUNGARIAN NUMBER ONE THOUSAND
case 0x10E6C: retval = 40; break; // RUMI NUMBER FORTY
case 0x10E6D: retval = 50; break; // RUMI NUMBER FIFTY
case 0x10E6E: retval = 60; break; // RUMI NUMBER SIXTY

View File

@ -1,8 +1,8 @@
# PropList-7.0.0.txt
# Date: 2014-02-19, 15:51:26 GMT [MD]
# PropList-8.0.0.txt
# Date: 2015-05-16, 17:50:38 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2014 Unicode, Inc.
# Copyright (c) 1991-2015 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see http://www.unicode.org/reports/tr44/
@ -189,18 +189,22 @@ FF64 ; Terminal_Punctuation # Po HALFWIDTH IDEOGRAPHIC COMMA
11141..11143 ; Terminal_Punctuation # Po [3] CHAKMA DANDA..CHAKMA QUESTION MARK
111C5..111C6 ; Terminal_Punctuation # Po [2] SHARADA DANDA..SHARADA DOUBLE DANDA
111CD ; Terminal_Punctuation # Po SHARADA SUTRA MARK
111DE..111DF ; Terminal_Punctuation # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2
11238..1123C ; Terminal_Punctuation # Po [5] KHOJKI DANDA..KHOJKI DOUBLE SECTION MARK
112A9 ; Terminal_Punctuation # Po MULTANI SECTION MARK
115C2..115C5 ; Terminal_Punctuation # Po [4] SIDDHAM DANDA..SIDDHAM SEPARATOR BAR
115C9 ; Terminal_Punctuation # Po SIDDHAM END OF TEXT MARK
115C9..115D7 ; Terminal_Punctuation # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES
11641..11642 ; Terminal_Punctuation # Po [2] MODI DANDA..MODI DOUBLE DANDA
1173C..1173E ; Terminal_Punctuation # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI
12470..12474 ; Terminal_Punctuation # Po [5] CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER..CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON
16A6E..16A6F ; Terminal_Punctuation # Po [2] MRO DANDA..MRO DOUBLE DANDA
16AF5 ; Terminal_Punctuation # Po BASSA VAH FULL STOP
16B37..16B39 ; Terminal_Punctuation # Po [3] PAHAWH HMONG SIGN VOS THOM..PAHAWH HMONG SIGN CIM CHEEM
16B44 ; Terminal_Punctuation # Po PAHAWH HMONG SIGN XAUS
1BC9F ; Terminal_Punctuation # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP
1DA87..1DA8A ; Terminal_Punctuation # Po [4] SIGNWRITING COMMA..SIGNWRITING COLON
# Total code points: 214
# Total code points: 238
# ================================================
@ -425,7 +429,7 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L
081B..0823 ; Other_Alphabetic # Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A
0825..0827 ; Other_Alphabetic # Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U
0829..082C ; Other_Alphabetic # Mn [4] SAMARITAN VOWEL SIGN LONG I..SAMARITAN VOWEL SIGN SUKUN
08E4..08E9 ; Other_Alphabetic # Mn [6] ARABIC CURLY FATHA..ARABIC CURLY KASRATAN
08E3..08E9 ; Other_Alphabetic # Mn [7] ARABIC TURNED DAMMA BELOW..ARABIC CURLY KASRATAN
08F0..0902 ; Other_Alphabetic # Mn [19] ARABIC OPEN FATHATAN..DEVANAGARI SIGN ANUSVARA
0903 ; Other_Alphabetic # Mc DEVANAGARI SIGN VISARGA
093A ; Other_Alphabetic # Mn DEVANAGARI VOWEL SIGN OE
@ -560,8 +564,6 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L
1930..1931 ; Other_Alphabetic # Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA
1932 ; Other_Alphabetic # Mn LIMBU SMALL LETTER ANUSVARA
1933..1938 ; Other_Alphabetic # Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA
19B0..19C0 ; Other_Alphabetic # Mc [17] NEW TAI LUE VOWEL SIGN VOWEL SHORTENER..NEW TAI LUE VOWEL SIGN IY
19C8..19C9 ; Other_Alphabetic # Mc [2] NEW TAI LUE TONE MARK-1..NEW TAI LUE TONE MARK-2
1A17..1A18 ; Other_Alphabetic # Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U
1A19..1A1A ; Other_Alphabetic # Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O
1A1B ; Other_Alphabetic # Mn BUGINESE VOWEL SIGN AE
@ -605,7 +607,7 @@ FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH L
24B6..24E9 ; Other_Alphabetic # So [52] CIRCLED LATIN CAPITAL LETTER A..CIRCLED LATIN SMALL LETTER Z
2DE0..2DFF ; Other_Alphabetic # Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS
A674..A67B ; Other_Alphabetic # Mn [8] COMBINING CYRILLIC LETTER UKRAINIAN IE..COMBINING CYRILLIC LETTER OMEGA
A69F ; Other_Alphabetic # Mn COMBINING CYRILLIC LETTER IOTIFIED E
A69E..A69F ; Other_Alphabetic # Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E
A823..A824 ; Other_Alphabetic # Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I
A825..A826 ; Other_Alphabetic # Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E
A827 ; Other_Alphabetic # Mc SYLOTI NAGRI VOWEL SIGN OO
@ -672,7 +674,7 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA
112DF ; Other_Alphabetic # Mn KHUDAWADI SIGN ANUSVARA
112E0..112E2 ; Other_Alphabetic # Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II
112E3..112E8 ; Other_Alphabetic # Mn [6] KHUDAWADI VOWEL SIGN U..KHUDAWADI VOWEL SIGN AU
11301 ; Other_Alphabetic # Mn GRANTHA SIGN CANDRABINDU
11300..11301 ; Other_Alphabetic # Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU
11302..11303 ; Other_Alphabetic # Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA
1133E..1133F ; Other_Alphabetic # Mc [2] GRANTHA VOWEL SIGN AA..GRANTHA VOWEL SIGN I
11340 ; Other_Alphabetic # Mn GRANTHA VOWEL SIGN II
@ -693,6 +695,7 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA
115B8..115BB ; Other_Alphabetic # Mc [4] SIDDHAM VOWEL SIGN E..SIDDHAM VOWEL SIGN AU
115BC..115BD ; Other_Alphabetic # Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA
115BE ; Other_Alphabetic # Mc SIDDHAM SIGN VISARGA
115DC..115DD ; Other_Alphabetic # Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU
11630..11632 ; Other_Alphabetic # Mc [3] MODI VOWEL SIGN AA..MODI VOWEL SIGN II
11633..1163A ; Other_Alphabetic # Mn [8] MODI VOWEL SIGN U..MODI VOWEL SIGN AI
1163B..1163C ; Other_Alphabetic # Mc [2] MODI VOWEL SIGN O..MODI VOWEL SIGN AU
@ -704,6 +707,11 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA
116AD ; Other_Alphabetic # Mn TAKRI VOWEL SIGN AA
116AE..116AF ; Other_Alphabetic # Mc [2] TAKRI VOWEL SIGN I..TAKRI VOWEL SIGN II
116B0..116B5 ; Other_Alphabetic # Mn [6] TAKRI VOWEL SIGN U..TAKRI VOWEL SIGN AU
1171D..1171F ; Other_Alphabetic # Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA
11720..11721 ; Other_Alphabetic # Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL SIGN AA
11722..11725 ; Other_Alphabetic # Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU
11726 ; Other_Alphabetic # Mc AHOM VOWEL SIGN E
11727..1172A ; Other_Alphabetic # Mn [4] AHOM VOWEL SIGN AW..AHOM VOWEL SIGN AM
16B30..16B36 ; Other_Alphabetic # Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM
16F51..16F7E ; Other_Alphabetic # Mc [46] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN NG
1BC9E ; Other_Alphabetic # Mn DUPLOYAN DOUBLE MARK
@ -720,15 +728,16 @@ FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA
3021..3029 ; Ideographic # Nl [9] HANGZHOU NUMERAL ONE..HANGZHOU NUMERAL NINE
3038..303A ; Ideographic # Nl [3] HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY
3400..4DB5 ; Ideographic # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5
4E00..9FCC ; Ideographic # Lo [20941] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FCC
4E00..9FD5 ; Ideographic # Lo [20950] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FD5
F900..FA6D ; Ideographic # Lo [366] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA6D
FA70..FAD9 ; Ideographic # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9
20000..2A6D6 ; Ideographic # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6
2A700..2B734 ; Ideographic # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734
2B740..2B81D ; Ideographic # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D
2B820..2CEA1 ; Ideographic # Lo [5762] CJK UNIFIED IDEOGRAPH-2B820..CJK UNIFIED IDEOGRAPH-2CEA1
2F800..2FA1D ; Ideographic # Lo [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D
# Total code points: 75633
# Total code points: 81404
# ================================================
@ -773,7 +782,7 @@ FA70..FAD9 ; Ideographic # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COM
07EB..07F3 ; Diacritic # Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE
07F4..07F5 ; Diacritic # Lm [2] NKO HIGH TONE APOSTROPHE..NKO LOW TONE APOSTROPHE
0818..0819 ; Diacritic # Mn [2] SAMARITAN MARK OCCLUSION..SAMARITAN MARK DAGESH
08E4..08FE ; Diacritic # Mn [27] ARABIC CURLY FATHA..ARABIC DAMMA WITH DOT
08E3..08FE ; Diacritic # Mn [28] ARABIC TURNED DAMMA BELOW..ARABIC DAMMA WITH DOT
093C ; Diacritic # Mn DEVANAGARI SIGN NUKTA
094D ; Diacritic # Mn DEVANAGARI SIGN VIRAMA
0951..0954 ; Diacritic # Mn [4] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI ACUTE ACCENT
@ -877,7 +886,7 @@ AB5C..AB5F ; Diacritic # Lm [4] MODIFIER LETTER SMALL HENG..MODIFIER LETTER
ABEC ; Diacritic # Mc MEETEI MAYEK LUM IYEK
ABED ; Diacritic # Mn MEETEI MAYEK APUN IYEK
FB1E ; Diacritic # Mn HEBREW POINT JUDEO-SPANISH VARIKA
FE20..FE2D ; Diacritic # Mn [14] COMBINING LIGATURE LEFT HALF..COMBINING CONJOINING MACRON BELOW
FE20..FE2F ; Diacritic # Mn [16] COMBINING LIGATURE LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF
FF3E ; Diacritic # Sk FULLWIDTH CIRCUMFLEX ACCENT
FF40 ; Diacritic # Sk FULLWIDTH GRAVE ACCENT
FF70 ; Diacritic # Lm HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
@ -889,6 +898,7 @@ FFE3 ; Diacritic # Sk FULLWIDTH MACRON
11133..11134 ; Diacritic # Mn [2] CHAKMA VIRAMA..CHAKMA MAAYYAA
11173 ; Diacritic # Mn MAHAJANI SIGN NUKTA
111C0 ; Diacritic # Mc SHARADA SIGN VIRAMA
111CA..111CC ; Diacritic # Mn [3] SHARADA SIGN NUKTA..SHARADA EXTRA SHORT VOWEL MARK
11235 ; Diacritic # Mc KHOJKI SIGN VIRAMA
11236 ; Diacritic # Mn KHOJKI SIGN NUKTA
112E9..112EA ; Diacritic # Mn [2] KHUDAWADI SIGN NUKTA..KHUDAWADI SIGN VIRAMA
@ -901,6 +911,7 @@ FFE3 ; Diacritic # Sk FULLWIDTH MACRON
1163F ; Diacritic # Mn MODI SIGN VIRAMA
116B6 ; Diacritic # Mc TAKRI SIGN VIRAMA
116B7 ; Diacritic # Mn TAKRI SIGN NUKTA
1172B ; Diacritic # Mn AHOM SIGN KILLER
16AF0..16AF4 ; Diacritic # Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE
16F8F..16F92 ; Diacritic # Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW
16F93..16F9F ; Diacritic # Lm [13] MIAO LETTER TONE-2..MIAO LETTER REFORMED TONE-8
@ -911,7 +922,7 @@ FFE3 ; Diacritic # Sk FULLWIDTH MACRON
1D1AA..1D1AD ; Diacritic # Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO
1E8D0..1E8D6 ; Diacritic # Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS
# Total code points: 766
# Total code points: 773
# ================================================
@ -1053,7 +1064,7 @@ FF9E..FF9F ; Other_Grapheme_Extend # Lm [2] HALFWIDTH KATAKANA VOICED SOUND
# ================================================
3400..4DB5 ; Unified_Ideograph # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5
4E00..9FCC ; Unified_Ideograph # Lo [20941] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FCC
4E00..9FD5 ; Unified_Ideograph # Lo [20950] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FD5
FA0E..FA0F ; Unified_Ideograph # Lo [2] CJK COMPATIBILITY IDEOGRAPH-FA0E..CJK COMPATIBILITY IDEOGRAPH-FA0F
FA11 ; Unified_Ideograph # Lo CJK COMPATIBILITY IDEOGRAPH-FA11
FA13..FA14 ; Unified_Ideograph # Lo [2] CJK COMPATIBILITY IDEOGRAPH-FA13..CJK COMPATIBILITY IDEOGRAPH-FA14
@ -1064,8 +1075,9 @@ FA27..FA29 ; Unified_Ideograph # Lo [3] CJK COMPATIBILITY IDEOGRAPH-FA27..C
20000..2A6D6 ; Unified_Ideograph # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6
2A700..2B734 ; Unified_Ideograph # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734
2B740..2B81D ; Unified_Ideograph # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D
2B820..2CEA1 ; Unified_Ideograph # Lo [5762] CJK UNIFIED IDEOGRAPH-2B820..CJK UNIFIED IDEOGRAPH-2CEA1
# Total code points: 74617
# Total code points: 80388
# ================================================
@ -1094,9 +1106,9 @@ E01F0..E0FFF ; Other_Default_Ignorable_Code_Point # Cn [3600] <reserved-E01F0>.
2329 ; Deprecated # Ps LEFT-POINTING ANGLE BRACKET
232A ; Deprecated # Pe RIGHT-POINTING ANGLE BRACKET
E0001 ; Deprecated # Cf LANGUAGE TAG
E0020..E007F ; Deprecated # Cf [96] TAG SPACE..CANCEL TAG
E007F ; Deprecated # Cf CANCEL TAG
# Total code points: 111
# Total code points: 16
# ================================================
@ -1138,11 +1150,13 @@ E0020..E007F ; Deprecated # Cf [96] TAG SPACE..CANCEL TAG
0E40..0E44 ; Logical_Order_Exception # Lo [5] THAI CHARACTER SARA E..THAI CHARACTER SARA AI MAIMALAI
0EC0..0EC4 ; Logical_Order_Exception # Lo [5] LAO VOWEL SIGN E..LAO VOWEL SIGN AI
19B5..19B7 ; Logical_Order_Exception # Lo [3] NEW TAI LUE VOWEL SIGN E..NEW TAI LUE VOWEL SIGN O
19BA ; Logical_Order_Exception # Lo NEW TAI LUE VOWEL SIGN AY
AAB5..AAB6 ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL E..TAI VIET VOWEL O
AAB9 ; Logical_Order_Exception # Lo TAI VIET VOWEL UEA
AABB..AABC ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL AUE..TAI VIET VOWEL AY
# Total code points: 15
# Total code points: 19
# ================================================
@ -1213,18 +1227,22 @@ FF61 ; STerm # Po HALFWIDTH IDEOGRAPHIC FULL STOP
11141..11143 ; STerm # Po [3] CHAKMA DANDA..CHAKMA QUESTION MARK
111C5..111C6 ; STerm # Po [2] SHARADA DANDA..SHARADA DOUBLE DANDA
111CD ; STerm # Po SHARADA SUTRA MARK
111DE..111DF ; STerm # Po [2] SHARADA SECTION MARK-1..SHARADA SECTION MARK-2
11238..11239 ; STerm # Po [2] KHOJKI DANDA..KHOJKI DOUBLE DANDA
1123B..1123C ; STerm # Po [2] KHOJKI SECTION MARK..KHOJKI DOUBLE SECTION MARK
112A9 ; STerm # Po MULTANI SECTION MARK
115C2..115C3 ; STerm # Po [2] SIDDHAM DANDA..SIDDHAM DOUBLE DANDA
115C9 ; STerm # Po SIDDHAM END OF TEXT MARK
115C9..115D7 ; STerm # Po [15] SIDDHAM END OF TEXT MARK..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES
11641..11642 ; STerm # Po [2] MODI DANDA..MODI DOUBLE DANDA
1173C..1173E ; STerm # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI
16A6E..16A6F ; STerm # Po [2] MRO DANDA..MRO DOUBLE DANDA
16AF5 ; STerm # Po BASSA VAH FULL STOP
16B37..16B38 ; STerm # Po [2] PAHAWH HMONG SIGN VOS THOM..PAHAWH HMONG SIGN VOS TSHAB CEEB
16B44 ; STerm # Po PAHAWH HMONG SIGN XAUS
1BC9F ; STerm # Po DUPLOYAN PUNCTUATION CHINOOK FULL STOP
1DA88 ; STerm # Po SIGNWRITING FULL STOP
# Total code points: 99
# Total code points: 120
# ================================================
@ -1432,7 +1450,9 @@ E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION S
2BBD..2BC8 ; Pattern_Syntax # So [12] BALLOT BOX WITH LIGHT X..BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED
2BC9 ; Pattern_Syntax # Cn <reserved-2BC9>
2BCA..2BD1 ; Pattern_Syntax # So [8] TOP HALF BLACK CIRCLE..UNCERTAINTY SIGN
2BD2..2BFF ; Pattern_Syntax # Cn [46] <reserved-2BD2>..<reserved-2BFF>
2BD2..2BEB ; Pattern_Syntax # Cn [26] <reserved-2BD2>..<reserved-2BEB>
2BEC..2BEF ; Pattern_Syntax # So [4] LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS..DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS
2BF0..2BFF ; Pattern_Syntax # Cn [16] <reserved-2BF0>..<reserved-2BFF>
2E00..2E01 ; Pattern_Syntax # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER
2E02 ; Pattern_Syntax # Pi LEFT SUBSTITUTION BRACKET
2E03 ; Pattern_Syntax # Pf RIGHT SUBSTITUTION BRACKET

View File

@ -1,10 +1,16 @@
# Scripts-7.0.0.txt
# Date: 2014-05-15, 00:11:35 GMT [MD]
# Scripts-8.0.0.txt
# Date: 2015-03-11, 22:29:42 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2014 Unicode, Inc.
# Copyright (c) 1991-2015 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see http://www.unicode.org/reports/tr44/
# For more information, see:
# UAX #24, Unicode Script Property: http://www.unicode.org/reports/tr24/
# Especially the sections:
# http://www.unicode.org/reports/tr24/#Assignment_Script_Values
# http://www.unicode.org/reports/tr24/#Assignment_ScriptX_Values
#
# ================================================
@ -89,7 +95,6 @@
061C ; Common # Cf ARABIC LETTER MARK
061F ; Common # Po ARABIC QUESTION MARK
0640 ; Common # Lm ARABIC TATWEEL
0660..0669 ; Common # Nd [10] ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE
06DD ; Common # Cf ARABIC END OF AYAH
0964..0965 ; Common # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA
0E3F ; Common # Sc THAI CURRENCY SYMBOL BAHT
@ -148,7 +153,7 @@
208A..208C ; Common # Sm [3] SUBSCRIPT PLUS SIGN..SUBSCRIPT EQUALS SIGN
208D ; Common # Ps SUBSCRIPT LEFT PARENTHESIS
208E ; Common # Pe SUBSCRIPT RIGHT PARENTHESIS
20A0..20BD ; Common # Sc [30] EURO-CURRENCY SIGN..RUBLE SIGN
20A0..20BE ; Common # Sc [31] EURO-CURRENCY SIGN..LARI SIGN
2100..2101 ; Common # So [2] ACCOUNT OF..ADDRESSED TO THE SUBJECT
2102 ; Common # L& DOUBLE-STRUCK CAPITAL C
2103..2106 ; Common # So [4] DEGREE CELSIUS..CADA UNA
@ -182,6 +187,7 @@
214F ; Common # So SYMBOL FOR SAMARITAN SOURCE
2150..215F ; Common # No [16] VULGAR FRACTION ONE SEVENTH..FRACTION NUMERATOR ONE
2189 ; Common # No VULGAR FRACTION ZERO THIRDS
218A..218B ; Common # So [2] TURNED DIGIT TWO..TURNED DIGIT THREE
2190..2194 ; Common # Sm [5] LEFTWARDS ARROW..LEFT RIGHT ARROW
2195..2199 ; Common # So [5] UP DOWN ARROW..SOUTH WEST ARROW
219A..219B ; Common # Sm [2] LEFTWARDS ARROW WITH STROKE..RIGHTWARDS ARROW WITH STROKE
@ -304,6 +310,7 @@
2B98..2BB9 ; Common # So [34] THREE-D TOP-LIGHTED LEFTWARDS EQUILATERAL ARROWHEAD..UP ARROWHEAD IN A RECTANGLE BOX
2BBD..2BC8 ; Common # So [12] BALLOT BOX WITH LIGHT X..BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED
2BCA..2BD1 ; Common # So [8] TOP HALF BLACK CIRCLE..UNCERTAINTY SIGN
2BEC..2BEF ; Common # So [4] LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS..DOWNWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS
2E00..2E01 ; Common # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER
2E02 ; Common # Pi LEFT SUBSTITUTION BRACKET
2E03 ; Common # Pf RIGHT SUBSTITUTION BRACKET
@ -512,7 +519,7 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR
1D173..1D17A ; Common # Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE
1D183..1D184 ; Common # So [2] MUSICAL SYMBOL ARPEGGIATO UP..MUSICAL SYMBOL ARPEGGIATO DOWN
1D18C..1D1A9 ; Common # So [30] MUSICAL SYMBOL RINFORZANDO..MUSICAL SYMBOL DEGREE SLASH
1D1AE..1D1DD ; Common # So [48] MUSICAL SYMBOL PEDAL MARK..MUSICAL SYMBOL PES SUBPUNCTIS
1D1AE..1D1E8 ; Common # So [59] MUSICAL SYMBOL PEDAL MARK..MUSICAL SYMBOL KIEVAN FLAT SIGN
1D300..1D356 ; Common # So [87] MONOGRAM FOR EARTH..TETRAGRAM FOR FOSTERING
1D360..1D371 ; Common # No [18] COUNTING ROD UNIT DIGIT ONE..COUNTING ROD TENS DIGIT NINE
1D400..1D454 ; Common # L& [85] MATHEMATICAL BOLD CAPITAL A..MATHEMATICAL ITALIC SMALL G
@ -571,16 +578,11 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR
1F210..1F23A ; Common # So [43] SQUARED CJK UNIFIED IDEOGRAPH-624B..SQUARED CJK UNIFIED IDEOGRAPH-55B6
1F240..1F248 ; Common # So [9] TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-672C..TORTOISE SHELL BRACKETED CJK UNIFIED IDEOGRAPH-6557
1F250..1F251 ; Common # So [2] CIRCLED IDEOGRAPH ADVANTAGE..CIRCLED IDEOGRAPH ACCEPT
1F300..1F32C ; Common # So [45] CYCLONE..WIND BLOWING FACE
1F330..1F37D ; Common # So [78] CHESTNUT..FORK AND KNIFE WITH PLATE
1F380..1F3CE ; Common # So [79] RIBBON..RACING CAR
1F3D4..1F3F7 ; Common # So [36] SNOW CAPPED MOUNTAIN..LABEL
1F400..1F4FE ; Common # So [255] RAT..PORTABLE STEREO
1F500..1F54A ; Common # So [75] TWISTED RIGHTWARDS ARROWS..DOVE OF PEACE
1F550..1F579 ; Common # So [42] CLOCK FACE ONE OCLOCK..JOYSTICK
1F300..1F3FA ; Common # So [251] CYCLONE..AMPHORA
1F3FB..1F3FF ; Common # Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6
1F400..1F579 ; Common # So [378] RAT..JOYSTICK
1F57B..1F5A3 ; Common # So [41] LEFT HAND TELEPHONE RECEIVER..BLACK DOWN POINTING BACKHAND INDEX
1F5A5..1F642 ; Common # So [158] DESKTOP COMPUTER..SLIGHTLY SMILING FACE
1F645..1F6CF ; Common # So [139] FACE WITH NO GOOD GESTURE..BED
1F5A5..1F6D0 ; Common # So [300] DESKTOP COMPUTER..PLACE OF WORSHIP
1F6E0..1F6EC ; Common # So [13] HAMMER AND WRENCH..AIRPLANE ARRIVING
1F6F0..1F6F3 ; Common # So [4] SATELLITE..PASSENGER SHIP
1F700..1F773 ; Common # So [116] ALCHEMICAL SYMBOL FOR QUINTESSENCE..ALCHEMICAL SYMBOL FOR HALF OUNCE
@ -590,10 +592,13 @@ FFFC..FFFD ; Common # So [2] OBJECT REPLACEMENT CHARACTER..REPLACEMENT CHAR
1F850..1F859 ; Common # So [10] LEFTWARDS SANS-SERIF ARROW..UP DOWN SANS-SERIF ARROW
1F860..1F887 ; Common # So [40] WIDE-HEADED LEFTWARDS LIGHT BARB ARROW..WIDE-HEADED SOUTH WEST VERY HEAVY BARB ARROW
1F890..1F8AD ; Common # So [30] LEFTWARDS TRIANGLE ARROWHEAD..WHITE ARROW SHAFT WIDTH TWO THIRDS
1F910..1F918 ; Common # So [9] ZIPPER-MOUTH FACE..SIGN OF THE HORNS
1F980..1F984 ; Common # So [5] CRAB..UNICORN FACE
1F9C0 ; Common # So CHEESE WEDGE
E0001 ; Common # Cf LANGUAGE TAG
E0020..E007F ; Common # Cf [96] TAG SPACE..CANCEL TAG
# Total code points: 7129
# Total code points: 7179
# ================================================
@ -635,20 +640,21 @@ A722..A76F ; Latin # L& [78] LATIN CAPITAL LETTER EGYPTOLOGICAL ALEF..LATIN
A770 ; Latin # Lm MODIFIER LETTER US
A771..A787 ; Latin # L& [23] LATIN SMALL LETTER DUM..LATIN SMALL LETTER INSULAR T
A78B..A78E ; Latin # L& [4] LATIN CAPITAL LETTER SALTILLO..LATIN SMALL LETTER L WITH RETROFLEX HOOK AND BELT
A78F ; Latin # Lo LATIN LETTER SINOLOGICAL DOT
A790..A7AD ; Latin # L& [30] LATIN CAPITAL LETTER N WITH DESCENDER..LATIN CAPITAL LETTER L WITH BELT
A7B0..A7B1 ; Latin # L& [2] LATIN CAPITAL LETTER TURNED K..LATIN CAPITAL LETTER TURNED T
A7B0..A7B7 ; Latin # L& [8] LATIN CAPITAL LETTER TURNED K..LATIN SMALL LETTER OMEGA
A7F7 ; Latin # Lo LATIN EPIGRAPHIC LETTER SIDEWAYS I
A7F8..A7F9 ; Latin # Lm [2] MODIFIER LETTER CAPITAL H WITH STROKE..MODIFIER LETTER SMALL LIGATURE OE
A7FA ; Latin # L& LATIN LETTER SMALL CAPITAL TURNED M
A7FB..A7FF ; Latin # Lo [5] LATIN EPIGRAPHIC LETTER REVERSED F..LATIN EPIGRAPHIC LETTER ARCHAIC M
AB30..AB5A ; Latin # L& [43] LATIN SMALL LETTER BARRED ALPHA..LATIN SMALL LETTER Y WITH SHORT RIGHT LEG
AB5C..AB5F ; Latin # Lm [4] MODIFIER LETTER SMALL HENG..MODIFIER LETTER SMALL U WITH LEFT HOOK
AB64 ; Latin # L& LATIN SMALL LETTER INVERTED ALPHA
AB60..AB64 ; Latin # L& [5] LATIN SMALL LETTER SAKHA YAT..LATIN SMALL LETTER INVERTED ALPHA
FB00..FB06 ; Latin # L& [7] LATIN SMALL LIGATURE FF..LATIN SMALL LIGATURE ST
FF21..FF3A ; Latin # L& [26] FULLWIDTH LATIN CAPITAL LETTER A..FULLWIDTH LATIN CAPITAL LETTER Z
FF41..FF5A ; Latin # L& [26] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH LATIN SMALL LETTER Z
# Total code points: 1338
# Total code points: 1349
# ================================================
@ -731,9 +737,10 @@ A67E ; Cyrillic # Po CYRILLIC KAVYKA
A67F ; Cyrillic # Lm CYRILLIC PAYEROK
A680..A69B ; Cyrillic # L& [28] CYRILLIC CAPITAL LETTER DWE..CYRILLIC SMALL LETTER CROSSED O
A69C..A69D ; Cyrillic # Lm [2] MODIFIER LETTER CYRILLIC HARD SIGN..MODIFIER LETTER CYRILLIC SOFT SIGN
A69F ; Cyrillic # Mn COMBINING CYRILLIC LETTER IOTIFIED E
A69E..A69F ; Cyrillic # Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E
FE2E..FE2F ; Cyrillic # Mn [2] COMBINING CYRILLIC TITLO LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF
# Total code points: 431
# Total code points: 434
# ================================================
@ -788,6 +795,7 @@ FB46..FB4F ; Hebrew # Lo [10] HEBREW LETTER TSADI WITH DAGESH..HEBREW LIGATU
0620..063F ; Arabic # Lo [32] ARABIC LETTER KASHMIRI YEH..ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE
0641..064A ; Arabic # Lo [10] ARABIC LETTER FEH..ARABIC LETTER YEH
0656..065F ; Arabic # Mn [10] ARABIC SUBSCRIPT ALEF..ARABIC WAVY HAMZA BELOW
0660..0669 ; Arabic # Nd [10] ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE
066A..066D ; Arabic # Po [4] ARABIC PERCENT SIGN..ARABIC FIVE POINTED STAR
066E..066F ; Arabic # Lo [2] ARABIC LETTER DOTLESS BEH..ARABIC LETTER DOTLESS QAF
0671..06D3 ; Arabic # Lo [99] ARABIC LETTER ALEF WASLA..ARABIC LETTER YEH BARREE WITH HAMZA ABOVE
@ -806,8 +814,8 @@ FB46..FB4F ; Hebrew # Lo [10] HEBREW LETTER TSADI WITH DAGESH..HEBREW LIGATU
06FD..06FE ; Arabic # So [2] ARABIC SIGN SINDHI AMPERSAND..ARABIC SIGN SINDHI POSTPOSITION MEN
06FF ; Arabic # Lo ARABIC LETTER HEH WITH INVERTED V
0750..077F ; Arabic # Lo [48] ARABIC LETTER BEH WITH THREE DOTS HORIZONTALLY BELOW..ARABIC LETTER KAF WITH TWO DOTS ABOVE
08A0..08B2 ; Arabic # Lo [19] ARABIC LETTER BEH WITH SMALL V BELOW..ARABIC LETTER ZAIN WITH INVERTED V ABOVE
08E4..08FF ; Arabic # Mn [28] ARABIC CURLY FATHA..ARABIC MARK SIDEWAYS NOON GHUNNA
08A0..08B4 ; Arabic # Lo [21] ARABIC LETTER BEH WITH SMALL V BELOW..ARABIC LETTER KAF WITH DOT BELOW
08E3..08FF ; Arabic # Mn [29] ARABIC TURNED DAMMA BELOW..ARABIC MARK SIDEWAYS NOON GHUNNA
FB50..FBB1 ; Arabic # Lo [98] ARABIC LETTER ALEF WASLA ISOLATED FORM..ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM
FBB2..FBC1 ; Arabic # Sk [16] ARABIC SYMBOL DOT ABOVE..ARABIC SYMBOL SMALL TAH BELOW
FBD3..FD3D ; Arabic # Lo [363] ARABIC LETTER NG ISOLATED FORM..ARABIC LIGATURE ALEF WITH FATHATAN ISOLATED FORM
@ -854,7 +862,7 @@ FE76..FEFC ; Arabic # Lo [135] ARABIC FATHA ISOLATED FORM..ARABIC LIGATURE LA
1EEAB..1EEBB ; Arabic # Lo [17] ARABIC MATHEMATICAL DOUBLE-STRUCK LAM..ARABIC MATHEMATICAL DOUBLE-STRUCK GHAIN
1EEF0..1EEF1 ; Arabic # Sm [2] ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL..ARABIC MATHEMATICAL OPERATOR HAH WITH DAL
# Total code points: 1244
# Total code points: 1257
# ================================================
@ -902,8 +910,10 @@ A8E0..A8F1 ; Devanagari # Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING
A8F2..A8F7 ; Devanagari # Lo [6] DEVANAGARI SIGN SPACING CANDRABINDU..DEVANAGARI SIGN CANDRABINDU AVAGRAHA
A8F8..A8FA ; Devanagari # Po [3] DEVANAGARI SIGN PUSHPIKA..DEVANAGARI CARET
A8FB ; Devanagari # Lo DEVANAGARI HEADSTROKE
A8FC ; Devanagari # Po DEVANAGARI SIGN SIDDHAM
A8FD ; Devanagari # Lo DEVANAGARI JAIN OM
# Total code points: 152
# Total code points: 154
# ================================================
@ -987,8 +997,9 @@ A8FB ; Devanagari # Lo DEVANAGARI HEADSTROKE
0AE6..0AEF ; Gujarati # Nd [10] GUJARATI DIGIT ZERO..GUJARATI DIGIT NINE
0AF0 ; Gujarati # Po GUJARATI ABBREVIATION SIGN
0AF1 ; Gujarati # Sc GUJARATI RUPEE SIGN
0AF9 ; Gujarati # Lo GUJARATI LETTER ZHA
# Total code points: 84
# Total code points: 85
# ================================================
@ -1064,14 +1075,14 @@ A8FB ; Devanagari # Lo DEVANAGARI HEADSTROKE
0C46..0C48 ; Telugu # Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI
0C4A..0C4D ; Telugu # Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA
0C55..0C56 ; Telugu # Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK
0C58..0C59 ; Telugu # Lo [2] TELUGU LETTER TSA..TELUGU LETTER DZA
0C58..0C5A ; Telugu # Lo [3] TELUGU LETTER TSA..TELUGU LETTER RRRA
0C60..0C61 ; Telugu # Lo [2] TELUGU LETTER VOCALIC RR..TELUGU LETTER VOCALIC LL
0C62..0C63 ; Telugu # Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL
0C66..0C6F ; Telugu # Nd [10] TELUGU DIGIT ZERO..TELUGU DIGIT NINE
0C78..0C7E ; Telugu # No [7] TELUGU FRACTION DIGIT ZERO FOR ODD POWERS OF FOUR..TELUGU FRACTION DIGIT THREE FOR EVEN POWERS OF FOUR
0C7F ; Telugu # So TELUGU SIGN TUUMU
# Total code points: 95
# Total code points: 96
# ================================================
@ -1115,14 +1126,14 @@ A8FB ; Devanagari # Lo DEVANAGARI HEADSTROKE
0D4D ; Malayalam # Mn MALAYALAM SIGN VIRAMA
0D4E ; Malayalam # Lo MALAYALAM LETTER DOT REPH
0D57 ; Malayalam # Mc MALAYALAM AU LENGTH MARK
0D60..0D61 ; Malayalam # Lo [2] MALAYALAM LETTER VOCALIC RR..MALAYALAM LETTER VOCALIC LL
0D5F..0D61 ; Malayalam # Lo [3] MALAYALAM LETTER ARCHAIC II..MALAYALAM LETTER VOCALIC LL
0D62..0D63 ; Malayalam # Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL
0D66..0D6F ; Malayalam # Nd [10] MALAYALAM DIGIT ZERO..MALAYALAM DIGIT NINE
0D70..0D75 ; Malayalam # No [6] MALAYALAM NUMBER TEN..MALAYALAM FRACTION THREE QUARTERS
0D79 ; Malayalam # So MALAYALAM DATE MARK
0D7A..0D7F ; Malayalam # Lo [6] MALAYALAM LETTER CHILLU NN..MALAYALAM LETTER CHILLU K
# Total code points: 99
# Total code points: 100
# ================================================
@ -1358,9 +1369,11 @@ AB28..AB2E ; Ethiopic # Lo [7] ETHIOPIC SYLLABLE BBA..ETHIOPIC SYLLABLE BBO
# ================================================
13A0..13F4 ; Cherokee # Lo [85] CHEROKEE LETTER A..CHEROKEE LETTER YV
13A0..13F5 ; Cherokee # L& [86] CHEROKEE LETTER A..CHEROKEE LETTER MV
13F8..13FD ; Cherokee # L& [6] CHEROKEE SMALL LETTER YE..CHEROKEE SMALL LETTER MV
AB70..ABBF ; Cherokee # L& [80] CHEROKEE SMALL LETTER A..CHEROKEE SMALL LETTER YA
# Total code points: 85
# Total code points: 172
# ================================================
@ -1472,15 +1485,16 @@ FF71..FF9D ; Katakana # Lo [45] HALFWIDTH KATAKANA LETTER A..HALFWIDTH KATAK
3038..303A ; Han # Nl [3] HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY
303B ; Han # Lm VERTICAL IDEOGRAPHIC ITERATION MARK
3400..4DB5 ; Han # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5
4E00..9FCC ; Han # Lo [20941] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FCC
4E00..9FD5 ; Han # Lo [20950] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FD5
F900..FA6D ; Han # Lo [366] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA6D
FA70..FAD9 ; Han # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9
20000..2A6D6 ; Han # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6
2A700..2B734 ; Han # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734
2B740..2B81D ; Han # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D
2B820..2CEA1 ; Han # Lo [5762] CJK UNIFIED IDEOGRAPH-2B820..CJK UNIFIED IDEOGRAPH-2CEA1
2F800..2FA1D ; Han # Lo [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D
# Total code points: 75963
# Total code points: 81734
# ================================================
@ -1680,9 +1694,7 @@ E0100..E01EF ; Inherited # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-2
# ================================================
1980..19AB ; New_Tai_Lue # Lo [44] NEW TAI LUE LETTER HIGH QA..NEW TAI LUE LETTER LOW SUA
19B0..19C0 ; New_Tai_Lue # Mc [17] NEW TAI LUE VOWEL SIGN VOWEL SHORTENER..NEW TAI LUE VOWEL SIGN IY
19C1..19C7 ; New_Tai_Lue # Lo [7] NEW TAI LUE LETTER FINAL V..NEW TAI LUE LETTER FINAL B
19C8..19C9 ; New_Tai_Lue # Mc [2] NEW TAI LUE TONE MARK-1..NEW TAI LUE TONE MARK-2
19B0..19C9 ; New_Tai_Lue # Lo [26] NEW TAI LUE VOWEL SIGN VOWEL SHORTENER..NEW TAI LUE TONE MARK-2
19D0..19D9 ; New_Tai_Lue # Nd [10] NEW TAI LUE DIGIT ZERO..NEW TAI LUE DIGIT NINE
19DA ; New_Tai_Lue # No NEW TAI LUE THAM DIGIT ONE
19DE..19DF ; New_Tai_Lue # So [2] NEW TAI LUE SIGN LAE..NEW TAI LUE SIGN LAEV
@ -1770,11 +1782,12 @@ A828..A82B ; Syloti_Nagri # So [4] SYLOTI NAGRI POETRY MARK-1..SYLOTI NAGRI
# ================================================
12000..12398 ; Cuneiform # Lo [921] CUNEIFORM SIGN A..CUNEIFORM SIGN UM TIMES ME
12000..12399 ; Cuneiform # Lo [922] CUNEIFORM SIGN A..CUNEIFORM SIGN U U
12400..1246E ; Cuneiform # Nl [111] CUNEIFORM NUMERIC SIGN TWO ASH..CUNEIFORM NUMERIC SIGN NINE U VARIANT FORM
12470..12474 ; Cuneiform # Po [5] CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER..CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON
12480..12543 ; Cuneiform # Lo [196] CUNEIFORM SIGN AB TIMES NUN TENU..CUNEIFORM SIGN ZU5 TIMES THREE DISH TENU
# Total code points: 1037
# Total code points: 1234
# ================================================
@ -2151,9 +2164,12 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI
# ================================================
109A0..109B7 ; Meroitic_Cursive # Lo [24] MEROITIC CURSIVE LETTER A..MEROITIC CURSIVE LETTER DA
109BC..109BD ; Meroitic_Cursive # No [2] MEROITIC CURSIVE FRACTION ELEVEN TWELFTHS..MEROITIC CURSIVE FRACTION ONE HALF
109BE..109BF ; Meroitic_Cursive # Lo [2] MEROITIC CURSIVE LOGOGRAM RMT..MEROITIC CURSIVE LOGOGRAM IMN
109C0..109CF ; Meroitic_Cursive # No [16] MEROITIC CURSIVE NUMBER ONE..MEROITIC CURSIVE NUMBER SEVENTY
109D2..109FF ; Meroitic_Cursive # No [46] MEROITIC CURSIVE NUMBER ONE HUNDRED..MEROITIC CURSIVE FRACTION TEN TWELFTHS
# Total code points: 26
# Total code points: 90
# ================================================
@ -2180,12 +2196,16 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI
111B6..111BE ; Sharada # Mn [9] SHARADA VOWEL SIGN U..SHARADA VOWEL SIGN O
111BF..111C0 ; Sharada # Mc [2] SHARADA VOWEL SIGN AU..SHARADA SIGN VIRAMA
111C1..111C4 ; Sharada # Lo [4] SHARADA SIGN AVAGRAHA..SHARADA OM
111C5..111C8 ; Sharada # Po [4] SHARADA DANDA..SHARADA SEPARATOR
111C5..111C9 ; Sharada # Po [5] SHARADA DANDA..SHARADA SANDHI MARK
111CA..111CC ; Sharada # Mn [3] SHARADA SIGN NUKTA..SHARADA EXTRA SHORT VOWEL MARK
111CD ; Sharada # Po SHARADA SUTRA MARK
111D0..111D9 ; Sharada # Nd [10] SHARADA DIGIT ZERO..SHARADA DIGIT NINE
111DA ; Sharada # Lo SHARADA EKAM
111DB ; Sharada # Po SHARADA SIGN SIDDHAM
111DC ; Sharada # Lo SHARADA HEADSTROKE
111DD..111DF ; Sharada # Po [3] SHARADA CONTINUATION SIGN..SHARADA SECTION MARK-2
# Total code points: 85
# Total code points: 94
# ================================================
@ -2243,7 +2263,7 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI
# ================================================
11301 ; Grantha # Mn GRANTHA SIGN CANDRABINDU
11300..11301 ; Grantha # Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU
11302..11303 ; Grantha # Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA
11305..1130C ; Grantha # Lo [8] GRANTHA LETTER A..GRANTHA LETTER VOCALIC L
1130F..11310 ; Grantha # Lo [2] GRANTHA LETTER EE..GRANTHA LETTER AI
@ -2258,13 +2278,14 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI
11341..11344 ; Grantha # Mc [4] GRANTHA VOWEL SIGN U..GRANTHA VOWEL SIGN VOCALIC RR
11347..11348 ; Grantha # Mc [2] GRANTHA VOWEL SIGN EE..GRANTHA VOWEL SIGN AI
1134B..1134D ; Grantha # Mc [3] GRANTHA VOWEL SIGN OO..GRANTHA SIGN VIRAMA
11350 ; Grantha # Lo GRANTHA OM
11357 ; Grantha # Mc GRANTHA AU LENGTH MARK
1135D..11361 ; Grantha # Lo [5] GRANTHA SIGN PLUTA..GRANTHA LETTER VOCALIC LL
11362..11363 ; Grantha # Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL
11366..1136C ; Grantha # Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX
11370..11374 ; Grantha # Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA
# Total code points: 83
# Total code points: 85
# ================================================
@ -2407,9 +2428,11 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI
115BC..115BD ; Siddham # Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA
115BE ; Siddham # Mc SIDDHAM SIGN VISARGA
115BF..115C0 ; Siddham # Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA
115C1..115C9 ; Siddham # Po [9] SIDDHAM SIGN SIDDHAM..SIDDHAM END OF TEXT MARK
115C1..115D7 ; Siddham # Po [23] SIDDHAM SIGN SIDDHAM..SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES
115D8..115DB ; Siddham # Lo [4] SIDDHAM LETTER THREE-CIRCLE ALTERNATE I..SIDDHAM LETTER ALTERNATE U
115DC..115DD ; Siddham # Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU
# Total code points: 72
# Total code points: 92
# ================================================
@ -2448,4 +2471,69 @@ ABF0..ABF9 ; Meetei_Mayek # Nd [10] MEETEI MAYEK DIGIT ZERO..MEETEI MAYEK DI
# Total code points: 84
# ================================================
11700..11719 ; Ahom # Lo [26] AHOM LETTER KA..AHOM LETTER JHA
1171D..1171F ; Ahom # Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA
11720..11721 ; Ahom # Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL SIGN AA
11722..11725 ; Ahom # Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU
11726 ; Ahom # Mc AHOM VOWEL SIGN E
11727..1172B ; Ahom # Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN KILLER
11730..11739 ; Ahom # Nd [10] AHOM DIGIT ZERO..AHOM DIGIT NINE
1173A..1173B ; Ahom # No [2] AHOM NUMBER TEN..AHOM NUMBER TWENTY
1173C..1173E ; Ahom # Po [3] AHOM SIGN SMALL SECTION..AHOM SIGN RULAI
1173F ; Ahom # So AHOM SYMBOL VI
# Total code points: 57
# ================================================
14400..14646 ; Anatolian_Hieroglyphs # Lo [583] ANATOLIAN HIEROGLYPH A001..ANATOLIAN HIEROGLYPH A530
# Total code points: 583
# ================================================
108E0..108F2 ; Hatran # Lo [19] HATRAN LETTER ALEPH..HATRAN LETTER QOPH
108F4..108F5 ; Hatran # Lo [2] HATRAN LETTER SHIN..HATRAN LETTER TAW
108FB..108FF ; Hatran # No [5] HATRAN NUMBER ONE..HATRAN NUMBER ONE HUNDRED
# Total code points: 26
# ================================================
11280..11286 ; Multani # Lo [7] MULTANI LETTER A..MULTANI LETTER GA
11288 ; Multani # Lo MULTANI LETTER GHA
1128A..1128D ; Multani # Lo [4] MULTANI LETTER CA..MULTANI LETTER JJA
1128F..1129D ; Multani # Lo [15] MULTANI LETTER NYA..MULTANI LETTER BA
1129F..112A8 ; Multani # Lo [10] MULTANI LETTER BHA..MULTANI LETTER RHA
112A9 ; Multani # Po MULTANI SECTION MARK
# Total code points: 38
# ================================================
10C80..10CB2 ; Old_Hungarian # L& [51] OLD HUNGARIAN CAPITAL LETTER A..OLD HUNGARIAN CAPITAL LETTER US
10CC0..10CF2 ; Old_Hungarian # L& [51] OLD HUNGARIAN SMALL LETTER A..OLD HUNGARIAN SMALL LETTER US
10CFA..10CFF ; Old_Hungarian # No [6] OLD HUNGARIAN NUMBER ONE..OLD HUNGARIAN NUMBER ONE THOUSAND
# Total code points: 108
# ================================================
1D800..1D9FF ; SignWriting # So [512] SIGNWRITING HAND-FIST INDEX..SIGNWRITING HEAD
1DA00..1DA36 ; SignWriting # Mn [55] SIGNWRITING HEAD RIM..SIGNWRITING AIR SUCKING IN
1DA37..1DA3A ; SignWriting # So [4] SIGNWRITING AIR BLOW SMALL ROTATIONS..SIGNWRITING BREATH EXHALE
1DA3B..1DA6C ; SignWriting # Mn [50] SIGNWRITING MOUTH CLOSED NEUTRAL..SIGNWRITING EXCITEMENT
1DA6D..1DA74 ; SignWriting # So [8] SIGNWRITING SHOULDER HIP SPINE..SIGNWRITING TORSO-FLOORPLANE TWISTING
1DA75 ; SignWriting # Mn SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS
1DA76..1DA83 ; SignWriting # So [14] SIGNWRITING LIMB COMBINATION..SIGNWRITING LOCATION DEPTH
1DA84 ; SignWriting # Mn SIGNWRITING LOCATION HEAD NECK
1DA85..1DA86 ; SignWriting # So [2] SIGNWRITING LOCATION TORSO..SIGNWRITING LOCATION LIMBS DIGITS
1DA87..1DA8B ; SignWriting # Po [5] SIGNWRITING COMMA..SIGNWRITING PARENTHESIS
1DA9B..1DA9F ; SignWriting # Mn [5] SIGNWRITING FILL MODIFIER-2..SIGNWRITING FILL MODIFIER-6
1DAA1..1DAAF ; SignWriting # Mn [15] SIGNWRITING ROTATION MODIFIER-2..SIGNWRITING ROTATION MODIFIER-16
# Total code points: 672
# EOF

View File

@ -1,5 +1,5 @@
# SpecialCasing-7.0.0.txt
# Date: 2014-03-18, 07:18:02 GMT [MD]
# SpecialCasing-8.0.0.txt
# Date: 2014-12-16, 23:08:04 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2014 Unicode, Inc.

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
7.0.0
8.0.0

View File

@ -70,7 +70,7 @@ $(GENDATA_JAVA_SECURITY): $(BUILD_TOOLS) $(GENDATA_JAVA_SECURITY_SRC) $(RESTRICT
$(ECHO) "Generating java.security"
$(MKDIR) -p $(@D)
$(TOOL_MAKEJAVASECURITY) $(GENDATA_JAVA_SECURITY_SRC) $@ $(OPENJDK_TARGET_OS) \
$(RESTRICTED_PKGS_SRC) || exit 1
$(OPENJDK_TARGET_CPU_ARCH) $(RESTRICTED_PKGS_SRC) || exit 1
TARGETS += $(GENDATA_JAVA_SECURITY)

View File

@ -41,71 +41,4 @@ $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FI
GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
#
# Generate beaninfo java files
#
BEANINFO_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/java.desktop
DOCLET_DATA_DIR := $(JDK_TOPDIR)/make/data/swingbeaninfo
# javax.swing package
BEANS = AbstractButton Box JComponent JApplet JButton \
JCheckBox JCheckBoxMenuItem JComboBox JColorChooser \
JDesktopPane JDialog JEditorPane JFileChooser JFrame \
JFormattedTextField JInternalFrame JLabel JLayeredPane \
JList JMenu JMenuBar JMenuItem JOptionPane JPanel \
JPasswordField JPopupMenu JProgressBar JRadioButton \
JRadioButtonMenuItem JScrollBar JScrollPane JSeparator \
JSlider JSplitPane JSpinner JTabbedPane JTable \
JTextArea JTextField JTextPane JToggleButton JToolBar \
JTree JWindow
# javax.swing.text package
BEANS_TEXT = JTextComponent
BEANS_SRC = $(BEANS:%=$(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/%.java) \
$(BEANS_TEXT:%=$(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/text/%.java)
# Dummy variable so far, in the old build system it was false by default
SWINGBEAN_DEBUG_FLAG = false
# GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes
# LocaleDataMetaInfo needs to be generated before running this to avoid confusing errors
# in the build log.
$(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \
$(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java \
$(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS_JDK)
$(ECHO) Generating beaninfo
$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
-sourcepath $(call PathList,\
$(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
$(SUPPORT_OUTPUTDIR)/gensrc/java.base) \
-doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
-x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
-t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
-docletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
-XDignore.symbol.file=true \
-classpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(BEANS_SRC) $(LOG_INFO)
# Move the JTextComponent into its proper package directory.
$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing/text
$(MV) $(BEANINFO_OUTPUTDIR)/javax/swing/JTextComponentBeanInfo.java \
$(BEANINFO_OUTPUTDIR)/javax/swing/text/JTextComponentBeanInfo.java
$(TOUCH) $@
# This file is the part of dt.jar
# For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo
# Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing instead?
$(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java: \
$(DOCLET_DATA_DIR)/javax/swing/SwingBeanInfoBase.java
$(call install-file)
# This file is the part of dt.jar
# For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo
# Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/swing instead?
$(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java: \
$(DOCLET_DATA_DIR)/sun/swing/BeanInfoUtils.java
$(call install-file)
GENSRC_SWING_BEANINFO = $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo
GENSRC_JAVA_DESKTOP += $(GENSRC_SWING_BEANINFO) $(GENSRC_SWING_NIMBUS)
GENSRC_JAVA_DESKTOP += $(GENSRC_SWING_NIMBUS)

View File

@ -1,10 +1,12 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2015, 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.
# 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
@ -21,23 +23,9 @@
# questions.
#
# This is a configuration example using an nfs-mount /java
# it will use the builddeps directly from the nfs mounted directory.
# This is how you use it:
include LauncherCommon.gmk
#configure --with-builddeps-conf=..../builddeps.conf.nfs.example
REWRITE_i686_pc_linux_gnu=i686-unknown-linux-gnu
REWRITE_i386_pc_solaris2_10=i686-sun-solaris2_10
DEVTOOLS=/java/devtools
builddep_cups=${DEVTOOLS}/linux/cups/include
builddep_cups_CFLAGS=-I${depdir}
JDK_ROOT=/java/re/jdk/7u4/latest/binaries
builddep_bootjdk_BUILD_i386_pc_solaris2=${JDK_ROOT}/solaris-i586
builddep_bootjdk_BUILD_x86_64_pc_solaris2=${JDK_ROOT}/solaris-amd64
builddep_bootjdk_BUILD_i686_unknown_linux_gnu=${JDK_ROOT}/linux-i586
builddep_bootjdk_BUILD_x86_64_unknown_linux_gnu=${JDK_ROOT}/linux-amd64
builddep_bootjdk_ROOT=
$(eval $(call SetupLauncher,jshell, \
-DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.internal.jshell.tool.JShellTool"$(COMMA) }'))

View File

@ -40,7 +40,7 @@ UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
ifeq ($(USE_EXTERNAL_LIBZ), true)
UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB
UNPACKEXE_ZIPOBJS := -lz
UNPACKEXE_LIBS := -lz
else
UNPACKEXE_CFLAGS += -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
@ -90,9 +90,9 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_linux := -lc, \
LDFLAGS_linux := , \
LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
LDFLAGS_SUFFIX := $(LIBCXX), \
LDFLAGS_SUFFIX := $(UNPACKEXE_LIBS) $(LIBCXX), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
PROGRAM := unpack200, \

View File

@ -391,6 +391,8 @@ LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
$(LIBJAVA_HEADER_FLAGS) \
#
# The fast floor code loses precision.
LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
ifeq ($(USE_EXTERNAL_LCMS), true)
# If we're using an external library, we'll just need the wrapper part.
@ -498,10 +500,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
DISABLED_WARNINGS_clang := logical-op-parentheses, \
DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
LDFLAGS_SUFFIX := $(LIBJPEG_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=javajpeg.dll" \

View File

@ -152,7 +152,6 @@ SUNWprivate_1.1 {
Java_java_lang_StrictMath_log10;
Java_java_lang_StrictMath_sin;
Java_java_lang_StrictMath_sqrt;
Java_java_lang_StrictMath_cbrt;
Java_java_lang_StrictMath_tan;
Java_java_lang_StrictMath_cosh;
Java_java_lang_StrictMath_sinh;

View File

@ -28,6 +28,7 @@ package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Formatter;
import java.util.HashSet;
import java.util.HashMap;
@ -285,15 +286,16 @@ class ResourceBundleGenerator implements BundleGenerator {
out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
parentTag);
}
String[] childlen = toLocaleList(metaInfo.get(key), true).split(" ");
String[] children = toLocaleList(metaInfo.get(key), true).split(" ");
Arrays.sort(children);
out.printf(" new String[] {\n" +
" ");
int count = 0;
for (int i = 0; i < childlen.length; i++) {
String child = childlen[i];
for (int i = 0; i < children.length; i++) {
String child = children[i];
out.printf("\"%s\", ", child);
count += child.length() + 4;
if (i != childlen.length - 1 && count > 64) {
if (i != children.length - 1 && count > 64) {
out.printf("\n ");
count = 0;
}

View File

@ -50,19 +50,21 @@ public class MakeJavaSecurity {
public static void main(String[] args) throws Exception {
if (args.length < 3) {
if (args.length < 4) {
System.err.println("Usage: java MakeJavaSecurity " +
"[input java.security file name] " +
"[output java.security file name] " +
"[openjdk target os] " +
"[openjdk target cpu architecture]" +
"[more restricted packages file name?]");
System.exit(1);
System.exit(1);
}
// more restricted packages
List<String> extraLines;
if (args.length == 4) {
extraLines = Files.readAllLines(Paths.get(args[3]));
if (args.length == 5) {
extraLines = Files.readAllLines(Paths.get(args[4]));
} else {
extraLines = Collections.emptyList();
}
@ -96,7 +98,11 @@ public class MakeJavaSecurity {
mode = 0;
iter.remove();
} else if (line.startsWith("#ifdef ")) {
mode = line.endsWith(args[2])?1:2;
if (line.indexOf('-') > 0) {
mode = line.endsWith(args[2]+"-"+args[3]) ? 1 : 2;
} else {
mode = line.endsWith(args[2]) ? 1 : 2;
}
iter.remove();
} else if (line.startsWith("#ifndef ")) {
mode = line.endsWith(args[2])?2:1;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, 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
@ -57,13 +57,13 @@ import sun.util.spi.CalendarProvider;
public class HostLocaleProviderAdapterImpl {
// per supported locale instances
private static ConcurrentMap<Locale, SoftReference<AtomicReferenceArray<String>>> dateFormatPatternsMap =
private static final ConcurrentMap<Locale, SoftReference<AtomicReferenceArray<String>>> dateFormatPatternsMap =
new ConcurrentHashMap<>(2);
private static ConcurrentMap<Locale, SoftReference<AtomicReferenceArray<String>>> numberFormatPatternsMap =
private static final ConcurrentMap<Locale, SoftReference<AtomicReferenceArray<String>>> numberFormatPatternsMap =
new ConcurrentHashMap<>(2);
private static ConcurrentMap<Locale, SoftReference<DateFormatSymbols>> dateFormatSymbolsMap =
private static final ConcurrentMap<Locale, SoftReference<DateFormatSymbols>> dateFormatSymbolsMap =
new ConcurrentHashMap<>(2);
private static ConcurrentMap<Locale, SoftReference<DecimalFormatSymbols>> decimalFormatSymbolsMap =
private static final ConcurrentMap<Locale, SoftReference<DecimalFormatSymbols>> decimalFormatSymbolsMap =
new ConcurrentHashMap<>(2);
// locale categories

View File

@ -189,6 +189,9 @@ public class ObjectStreamClass implements Serializable {
/** superclass descriptor appearing in stream */
private ObjectStreamClass superDesc;
/** true if, and only if, the object has been correctly initialized */
private boolean initialized;
/**
* Initializes native code.
*/
@ -266,6 +269,7 @@ public class ObjectStreamClass implements Serializable {
if (cl == null) {
return null;
}
requireInitialized();
if (System.getSecurityManager() != null) {
Class<?> caller = Reflection.getCallerClass();
if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) {
@ -533,6 +537,7 @@ public class ObjectStreamClass implements Serializable {
name, "unmatched serializable field(s) declared");
}
}
initialized = true;
}
/**
@ -550,6 +555,14 @@ public class ObjectStreamClass implements Serializable {
ObjectStreamClass superDesc)
throws InvalidClassException
{
ObjectStreamClass osc = null;
if (cl != null) {
osc = lookup(cl, true);
if (!osc.isProxy) {
throw new InvalidClassException(
"cannot bind proxy descriptor to a non-proxy class");
}
}
this.cl = cl;
this.resolveEx = resolveEx;
this.superDesc = superDesc;
@ -557,21 +570,17 @@ public class ObjectStreamClass implements Serializable {
serializable = true;
suid = Long.valueOf(0);
fields = NO_FIELDS;
if (cl != null) {
localDesc = lookup(cl, true);
if (!localDesc.isProxy) {
throw new InvalidClassException(
"cannot bind proxy descriptor to a non-proxy class");
}
if (osc != null) {
localDesc = osc;
name = localDesc.name;
externalizable = localDesc.externalizable;
cons = localDesc.cons;
writeReplaceMethod = localDesc.writeReplaceMethod;
readResolveMethod = localDesc.readResolveMethod;
deserializeEx = localDesc.deserializeEx;
cons = localDesc.cons;
}
fieldRefl = getReflector(fields, localDesc);
initialized = true;
}
/**
@ -583,11 +592,57 @@ public class ObjectStreamClass implements Serializable {
ObjectStreamClass superDesc)
throws InvalidClassException
{
long suid = Long.valueOf(model.getSerialVersionUID());
ObjectStreamClass osc = null;
if (cl != null) {
osc = lookup(cl, true);
if (osc.isProxy) {
throw new InvalidClassException(
"cannot bind non-proxy descriptor to a proxy class");
}
if (model.isEnum != osc.isEnum) {
throw new InvalidClassException(model.isEnum ?
"cannot bind enum descriptor to a non-enum class" :
"cannot bind non-enum descriptor to an enum class");
}
if (model.serializable == osc.serializable &&
!cl.isArray() &&
suid != osc.getSerialVersionUID()) {
throw new InvalidClassException(osc.name,
"local class incompatible: " +
"stream classdesc serialVersionUID = " + suid +
", local class serialVersionUID = " +
osc.getSerialVersionUID());
}
if (!classNamesEqual(model.name, osc.name)) {
throw new InvalidClassException(osc.name,
"local class name incompatible with stream class " +
"name \"" + model.name + "\"");
}
if (!model.isEnum) {
if ((model.serializable == osc.serializable) &&
(model.externalizable != osc.externalizable)) {
throw new InvalidClassException(osc.name,
"Serializable incompatible with Externalizable");
}
if ((model.serializable != osc.serializable) ||
(model.externalizable != osc.externalizable) ||
!(model.serializable || model.externalizable)) {
deserializeEx = new ExceptionInfo(
osc.name, "class invalid for deserialization");
}
}
}
this.cl = cl;
this.resolveEx = resolveEx;
this.superDesc = superDesc;
name = model.name;
suid = Long.valueOf(model.getSerialVersionUID());
this.suid = suid;
isProxy = false;
isEnum = model.isEnum;
serializable = model.serializable;
@ -598,53 +653,8 @@ public class ObjectStreamClass implements Serializable {
primDataSize = model.primDataSize;
numObjFields = model.numObjFields;
if (cl != null) {
localDesc = lookup(cl, true);
if (localDesc.isProxy) {
throw new InvalidClassException(
"cannot bind non-proxy descriptor to a proxy class");
}
if (isEnum != localDesc.isEnum) {
throw new InvalidClassException(isEnum ?
"cannot bind enum descriptor to a non-enum class" :
"cannot bind non-enum descriptor to an enum class");
}
if (serializable == localDesc.serializable &&
!cl.isArray() &&
suid.longValue() != localDesc.getSerialVersionUID())
{
throw new InvalidClassException(localDesc.name,
"local class incompatible: " +
"stream classdesc serialVersionUID = " + suid +
", local class serialVersionUID = " +
localDesc.getSerialVersionUID());
}
if (!classNamesEqual(name, localDesc.name)) {
throw new InvalidClassException(localDesc.name,
"local class name incompatible with stream class " +
"name \"" + name + "\"");
}
if (!isEnum) {
if ((serializable == localDesc.serializable) &&
(externalizable != localDesc.externalizable))
{
throw new InvalidClassException(localDesc.name,
"Serializable incompatible with Externalizable");
}
if ((serializable != localDesc.serializable) ||
(externalizable != localDesc.externalizable) ||
!(serializable || externalizable))
{
deserializeEx = new ExceptionInfo(
localDesc.name, "class invalid for deserialization");
}
}
cons = localDesc.cons;
if (osc != null) {
localDesc = osc;
writeObjectMethod = localDesc.writeObjectMethod;
readObjectMethod = localDesc.readObjectMethod;
readObjectNoDataMethod = localDesc.readObjectNoDataMethod;
@ -653,10 +663,13 @@ public class ObjectStreamClass implements Serializable {
if (deserializeEx == null) {
deserializeEx = localDesc.deserializeEx;
}
cons = localDesc.cons;
}
fieldRefl = getReflector(fields, localDesc);
// reassign to matched fields so as to reflect local unshared settings
fields = fieldRefl.getFields();
initialized = true;
}
/**
@ -758,12 +771,21 @@ public class ObjectStreamClass implements Serializable {
return resolveEx;
}
/**
* Throws InternalError if not initialized.
*/
private final void requireInitialized() {
if (!initialized)
throw new InternalError("Unexpected call when not initialized");
}
/**
* Throws an InvalidClassException if object instances referencing this
* class descriptor should not be allowed to deserialize. This method does
* not apply to deserialization of enum constants.
*/
void checkDeserialize() throws InvalidClassException {
requireInitialized();
if (deserializeEx != null) {
throw deserializeEx.newInvalidClassException();
}
@ -775,6 +797,7 @@ public class ObjectStreamClass implements Serializable {
* not apply to serialization of enum constants.
*/
void checkSerialize() throws InvalidClassException {
requireInitialized();
if (serializeEx != null) {
throw serializeEx.newInvalidClassException();
}
@ -788,6 +811,7 @@ public class ObjectStreamClass implements Serializable {
* does not apply to deserialization of enum constants.
*/
void checkDefaultSerialize() throws InvalidClassException {
requireInitialized();
if (defaultSerializeEx != null) {
throw defaultSerializeEx.newInvalidClassException();
}
@ -799,6 +823,7 @@ public class ObjectStreamClass implements Serializable {
* of the subclass descriptor's bound class.
*/
ObjectStreamClass getSuperDesc() {
requireInitialized();
return superDesc;
}
@ -809,6 +834,7 @@ public class ObjectStreamClass implements Serializable {
* associated with this descriptor.
*/
ObjectStreamClass getLocalDesc() {
requireInitialized();
return localDesc;
}
@ -851,6 +877,7 @@ public class ObjectStreamClass implements Serializable {
* otherwise.
*/
boolean isProxy() {
requireInitialized();
return isProxy;
}
@ -859,6 +886,7 @@ public class ObjectStreamClass implements Serializable {
* otherwise.
*/
boolean isEnum() {
requireInitialized();
return isEnum;
}
@ -867,6 +895,7 @@ public class ObjectStreamClass implements Serializable {
* otherwise.
*/
boolean isExternalizable() {
requireInitialized();
return externalizable;
}
@ -875,6 +904,7 @@ public class ObjectStreamClass implements Serializable {
* otherwise.
*/
boolean isSerializable() {
requireInitialized();
return serializable;
}
@ -883,6 +913,7 @@ public class ObjectStreamClass implements Serializable {
* has written its data in 1.2 (block data) format, false otherwise.
*/
boolean hasBlockExternalData() {
requireInitialized();
return hasBlockExternalData;
}
@ -892,6 +923,7 @@ public class ObjectStreamClass implements Serializable {
* writeObject() method, false otherwise.
*/
boolean hasWriteObjectData() {
requireInitialized();
return hasWriteObjectData;
}
@ -903,6 +935,7 @@ public class ObjectStreamClass implements Serializable {
* accessible no-arg constructor. Otherwise, returns false.
*/
boolean isInstantiable() {
requireInitialized();
return (cons != null);
}
@ -912,6 +945,7 @@ public class ObjectStreamClass implements Serializable {
* returns false.
*/
boolean hasWriteObjectMethod() {
requireInitialized();
return (writeObjectMethod != null);
}
@ -921,6 +955,7 @@ public class ObjectStreamClass implements Serializable {
* returns false.
*/
boolean hasReadObjectMethod() {
requireInitialized();
return (readObjectMethod != null);
}
@ -930,6 +965,7 @@ public class ObjectStreamClass implements Serializable {
* Otherwise, returns false.
*/
boolean hasReadObjectNoDataMethod() {
requireInitialized();
return (readObjectNoDataMethod != null);
}
@ -938,6 +974,7 @@ public class ObjectStreamClass implements Serializable {
* defines a conformant writeReplace method. Otherwise, returns false.
*/
boolean hasWriteReplaceMethod() {
requireInitialized();
return (writeReplaceMethod != null);
}
@ -946,6 +983,7 @@ public class ObjectStreamClass implements Serializable {
* defines a conformant readResolve method. Otherwise, returns false.
*/
boolean hasReadResolveMethod() {
requireInitialized();
return (readResolveMethod != null);
}
@ -962,6 +1000,7 @@ public class ObjectStreamClass implements Serializable {
throws InstantiationException, InvocationTargetException,
UnsupportedOperationException
{
requireInitialized();
if (cons != null) {
try {
return cons.newInstance();
@ -983,6 +1022,7 @@ public class ObjectStreamClass implements Serializable {
void invokeWriteObject(Object obj, ObjectOutputStream out)
throws IOException, UnsupportedOperationException
{
requireInitialized();
if (writeObjectMethod != null) {
try {
writeObjectMethod.invoke(obj, new Object[]{ out });
@ -1012,6 +1052,7 @@ public class ObjectStreamClass implements Serializable {
throws ClassNotFoundException, IOException,
UnsupportedOperationException
{
requireInitialized();
if (readObjectMethod != null) {
try {
readObjectMethod.invoke(obj, new Object[]{ in });
@ -1042,6 +1083,7 @@ public class ObjectStreamClass implements Serializable {
void invokeReadObjectNoData(Object obj)
throws IOException, UnsupportedOperationException
{
requireInitialized();
if (readObjectNoDataMethod != null) {
try {
readObjectNoDataMethod.invoke(obj, (Object[]) null);
@ -1070,6 +1112,7 @@ public class ObjectStreamClass implements Serializable {
Object invokeWriteReplace(Object obj)
throws IOException, UnsupportedOperationException
{
requireInitialized();
if (writeReplaceMethod != null) {
try {
return writeReplaceMethod.invoke(obj, (Object[]) null);
@ -1099,6 +1142,7 @@ public class ObjectStreamClass implements Serializable {
Object invokeReadResolve(Object obj)
throws IOException, UnsupportedOperationException
{
requireInitialized();
if (readResolveMethod != null) {
try {
return readResolveMethod.invoke(obj, (Object[]) null);

File diff suppressed because it is too large Load Diff

View File

@ -99,6 +99,64 @@ class FdLibm {
return Double.longBitsToDouble((transX & 0x0000_0000_FFFF_FFFFL)|( ((long)high)) << 32 );
}
/**
* cbrt(x)
* Return cube root of x
*/
public static class Cbrt {
// unsigned
private static final int B1 = 715094163; /* B1 = (682-0.03306235651)*2**20 */
private static final int B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */
private static final double C = 0x1.15f15f15f15f1p-1; // 19/35 ~= 5.42857142857142815906e-01
private static final double D = -0x1.691de2532c834p-1; // -864/1225 ~= 7.05306122448979611050e-01
private static final double E = 0x1.6a0ea0ea0ea0fp0; // 99/70 ~= 1.41428571428571436819e+00
private static final double F = 0x1.9b6db6db6db6ep0; // 45/28 ~= 1.60714285714285720630e+00
private static final double G = 0x1.6db6db6db6db7p-2; // 5/14 ~= 3.57142857142857150787e-01
public static strictfp double compute(double x) {
double t = 0.0;
double sign;
if (x == 0.0 || !Double.isFinite(x))
return x; // Handles signed zeros properly
sign = (x < 0.0) ? -1.0: 1.0;
x = Math.abs(x); // x <- |x|
// Rough cbrt to 5 bits
if (x < 0x1.0p-1022) { // subnormal number
t = 0x1.0p54; // set t= 2**54
t *= x;
t = __HI(t, __HI(t)/3 + B2);
} else {
int hx = __HI(x); // high word of x
t = __HI(t, hx/3 + B1);
}
// New cbrt to 23 bits, may be implemented in single precision
double r, s, w;
r = t * t/x;
s = C + r*t;
t *= G + F/(s + E + D/s);
// Chopped to 20 bits and make it larger than cbrt(x)
t = __LO(t, 0);
t = __HI(t, __HI(t) + 0x00000001);
// One step newton iteration to 53 bits with error less than 0.667 ulps
s = t * t; // t*t is exact
r = x / s;
w = t + t;
r = (r - t)/(w + r); // r-s is exact
t = t + t*r;
// Restore the original sign bit
return sign * t;
}
}
/**
* hypot(x,y)
*

View File

@ -307,7 +307,9 @@ public final class StrictMath {
* @return the cube root of {@code a}.
* @since 1.5
*/
public static native double cbrt(double a);
public static double cbrt(double a) {
return FdLibm.Cbrt.compute(a);
}
/**
* Computes the remainder operation on two arguments as prescribed

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2015, 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
@ -834,7 +834,7 @@ import jdk.internal.org.objectweb.asm.Type;
static MethodHandle makeCbmhCtor(Class<? extends BoundMethodHandle> cbmh, String types) {
try {
return LOOKUP.findStatic(cbmh, "make", MethodType.fromMethodDescriptorString(makeSignature(types, false), null));
return LOOKUP.findStatic(cbmh, "make", MethodType.fromDescriptor(makeSignature(types, false), null));
} catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | TypeNotPresentException e) {
throw newInternalError(e);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -141,7 +141,7 @@ import java.util.Objects;
synchronized (this) {
if (type instanceof String) {
String sig = (String) type;
MethodType res = MethodType.fromMethodDescriptorString(sig, getClassLoader());
MethodType res = MethodType.fromDescriptor(sig, getClassLoader());
type = res;
} else if (type instanceof Object[]) {
Object[] typeInfo = (Object[]) type;
@ -206,7 +206,7 @@ import java.util.Objects;
synchronized (this) {
if (type instanceof String) {
String sig = (String) type;
MethodType mtype = MethodType.fromMethodDescriptorString("()"+sig, getClassLoader());
MethodType mtype = MethodType.fromDescriptor("()"+sig, getClassLoader());
Class<?> res = mtype.returnType();
type = res;
}

View File

@ -383,7 +383,7 @@ class MethodHandleNatives {
if (type instanceof MethodType)
return (MethodType) type;
else
return MethodType.fromMethodDescriptorString((String)type, callerClass.getClassLoader());
return MethodType.fromDescriptor((String)type, callerClass.getClassLoader());
}
// Tracing logic:
static MemberName linkMethodTracing(Class<?> callerClass, int refKind,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2015, 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
@ -1057,6 +1057,23 @@ class MethodType implements java.io.Serializable {
*/
public static MethodType fromMethodDescriptorString(String descriptor, ClassLoader loader)
throws IllegalArgumentException, TypeNotPresentException
{
return fromDescriptor(descriptor,
(loader == null) ? ClassLoader.getSystemClassLoader() : loader);
}
/**
* Same as {@link #fromMethodDescriptorString(String, ClassLoader)}, but
* {@code null} ClassLoader means the bootstrap loader is used here.
* <p>
* IMPORTANT: This method is preferable for JDK internal use as it more
* correctly interprets {@code null} ClassLoader than
* {@link #fromMethodDescriptorString(String, ClassLoader)}.
* Use of this method also avoids early initialization issues when system
* ClassLoader is not initialized yet.
*/
static MethodType fromDescriptor(String descriptor, ClassLoader loader)
throws IllegalArgumentException, TypeNotPresentException
{
if (!descriptor.startsWith("(") || // also generates NPE if needed
descriptor.indexOf(')') < 0 ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, 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
@ -131,7 +131,7 @@ class TypeConvertingMethodAdapter extends MethodVisitor {
}
private static String boxingDescriptor(Wrapper w) {
return String.format("(%s)L%s;", w.basicTypeChar(), wrapperName(w));
return "(" + w.basicTypeChar() + ")L" + wrapperName(w) + ";";
}
private static String unboxingDescriptor(Wrapper w) {

View File

@ -117,11 +117,13 @@ class Inet4Address extends InetAddress {
holder().address = address;
}
}
holder().originalHostName = hostName;
}
Inet4Address(String hostName, int address) {
holder().hostName = hostName;
holder().family = IPv4;
holder().address = address;
holder().originalHostName = hostName;
}
/**

View File

@ -221,7 +221,7 @@ class InetAddress implements java.io.Serializable {
*
* Note: May define a new public method in the future if necessary.
*/
private String originalHostName;
String originalHostName;
InetAddressHolder() {}

View File

@ -28,9 +28,9 @@ package java.net;
/**
* This interface defines a factory for {@code URL} stream
* protocol handlers.
* <p>
* It is used by the {@code URL} class to create a
* {@code URLStreamHandler} for a specific protocol.
*
* <p> A URL stream handler factory is used as specified in the
* {@linkplain java.net.URL#URL(String,String,int,String) URL constructor}.
*
* @author Arthur van Hoff
* @see java.net.URL

View File

@ -41,6 +41,9 @@ import java.net.URLStreamHandlerFactory;
* fully-qualified concrete URL stream handler provider class names, one per
* line.
*
* <p> URL stream handler providers are located at runtime, as specified in the
* {@linkplain java.net.URL#URL(String,String,int,String) URL constructor}.
*
* @since 1.9
*/
public abstract class URLStreamHandlerProvider

View File

@ -242,7 +242,7 @@ class Direct$Type$Buffer$RW$$BO$
}
private long ix(int i) {
return address + (i << $LG_BYTES_PER_VALUE$);
return address + ((long)i << $LG_BYTES_PER_VALUE$);
}
public $type$ get() {
@ -261,7 +261,7 @@ class Direct$Type$Buffer$RW$$BO$
public $Type$Buffer get($type$[] dst, int offset, int length) {
#if[rw]
if ((length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
checkBounds(offset, length, dst.length);
int pos = position();
int lim = limit();
@ -273,13 +273,13 @@ class Direct$Type$Buffer$RW$$BO$
#if[!byte]
if (order() != ByteOrder.nativeOrder())
Bits.copyTo$Memtype$Array(ix(pos), dst,
offset << $LG_BYTES_PER_VALUE$,
length << $LG_BYTES_PER_VALUE$);
(long)offset << $LG_BYTES_PER_VALUE$,
(long)length << $LG_BYTES_PER_VALUE$);
else
#end[!byte]
Bits.copyToArray(ix(pos), dst, arrayBaseOffset,
offset << $LG_BYTES_PER_VALUE$,
length << $LG_BYTES_PER_VALUE$);
(long)offset << $LG_BYTES_PER_VALUE$,
(long)length << $LG_BYTES_PER_VALUE$);
position(pos + length);
} else {
super.get(dst, offset, length);
@ -329,7 +329,7 @@ class Direct$Type$Buffer$RW$$BO$
if (srem > rem)
throw new BufferOverflowException();
unsafe.copyMemory(sb.ix(spos), ix(pos), srem << $LG_BYTES_PER_VALUE$);
unsafe.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
sb.position(spos + srem);
position(pos + srem);
} else if (src.hb != null) {
@ -353,7 +353,7 @@ class Direct$Type$Buffer$RW$$BO$
public $Type$Buffer put($type$[] src, int offset, int length) {
#if[rw]
if ((length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) {
if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) {
checkBounds(offset, length, src.length);
int pos = position();
int lim = limit();
@ -364,12 +364,16 @@ class Direct$Type$Buffer$RW$$BO$
#if[!byte]
if (order() != ByteOrder.nativeOrder())
Bits.copyFrom$Memtype$Array(src, offset << $LG_BYTES_PER_VALUE$,
ix(pos), length << $LG_BYTES_PER_VALUE$);
Bits.copyFrom$Memtype$Array(src,
(long)offset << $LG_BYTES_PER_VALUE$,
ix(pos),
(long)length << $LG_BYTES_PER_VALUE$);
else
#end[!byte]
Bits.copyFromArray(src, arrayBaseOffset, offset << $LG_BYTES_PER_VALUE$,
ix(pos), length << $LG_BYTES_PER_VALUE$);
Bits.copyFromArray(src, arrayBaseOffset,
(long)offset << $LG_BYTES_PER_VALUE$,
ix(pos),
(long)length << $LG_BYTES_PER_VALUE$);
position(pos + length);
} else {
super.put(src, offset, length);
@ -387,7 +391,7 @@ class Direct$Type$Buffer$RW$$BO$
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
unsafe.copyMemory(ix(pos), ix(0), rem << $LG_BYTES_PER_VALUE$);
unsafe.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
position(rem);
limit(capacity());
discardMark();

View File

@ -138,6 +138,13 @@ public class AlgorithmParameterGenerator {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the algorithm this
* parameter generator is associated with.
* See the AlgorithmParameterGenerator section in the <a href=

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -126,6 +126,13 @@ public class AlgorithmParameters {
* {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the algorithm requested.
* See the AlgorithmParameters section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameters">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, 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
@ -79,8 +79,10 @@ public abstract class AuthProvider extends Provider {
* this provider to obtain authentication information
* from the caller, which may be {@code null}
*
* @exception LoginException if the login operation fails
* @exception SecurityException if the caller does not pass a
* @throws IllegalStateException if the provider requires configuration
* and {@link configure} has not been called
* @throws LoginException if the login operation fails
* @throws SecurityException if the caller does not pass a
* security check for
* {@code SecurityPermission("authProvider.name")},
* where {@code name} is the value returned by
@ -92,8 +94,10 @@ public abstract class AuthProvider extends Provider {
/**
* Log out from this provider.
*
* @exception LoginException if the logout operation fails
* @exception SecurityException if the caller does not pass a
* @throws IllegalStateException if the provider requires configuration
* and {@link configure} has not been called
* @throws LoginException if the logout operation fails
* @throws SecurityException if the caller does not pass a
* security check for
* {@code SecurityPermission("authProvider.name")},
* where {@code name} is the value returned by
@ -118,7 +122,9 @@ public abstract class AuthProvider extends Provider {
* @param handler a {@code CallbackHandler} for obtaining
* authentication information, which may be {@code null}
*
* @exception SecurityException if the caller does not pass a
* @throws IllegalStateException if the provider requires configuration
* and {@link configure} has not been called
* @throws SecurityException if the caller does not pass a
* security check for
* {@code SecurityPermission("authProvider.name")},
* where {@code name} is the value returned by

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -153,6 +153,13 @@ public class KeyFactory {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the requested key algorithm.
* See the KeyFactory section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyFactory">

View File

@ -195,6 +195,13 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the standard string name of the algorithm.
* See the KeyPairGenerator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyPairGenerator">

View File

@ -841,6 +841,13 @@ public class KeyStore {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param type the type of keystore.
* See the KeyStore section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyStore">

View File

@ -146,6 +146,13 @@ public abstract class MessageDigest extends MessageDigestSpi {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the algorithm requested.
* See the MessageDigest section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#MessageDigest">

View File

@ -355,6 +355,13 @@ public abstract class Policy {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param type the specified Policy type. See the Policy section in the
* <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Policy">

View File

@ -187,12 +187,29 @@ public abstract class Provider extends Properties {
* is invalid.
* @return a provider configured with the supplied configuration argument.
*
* @since 1.9
* @since 9
*/
public Provider configure(String configArg) {
throw new UnsupportedOperationException("configure is not supported");
}
/**
* Check if this provider instance has been configured.
*
* @implSpec
* The default implementation returns true.
* Subclasses should override this method if the provider instance requires
* an explicit {@code configure} call after being constructed.
*
* @return true if no further configuration is needed, false otherwise.
*
* @since 9
*/
public boolean isConfigured() {
return true;
}
/**
* Returns the name of this provider.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -268,6 +268,13 @@ public class SecureRandom extends java.util.Random {
* This self-seeding will not occur if {@code setSeed} was
* previously called.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the RNG algorithm.
* See the SecureRandom section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#SecureRandom">

View File

@ -53,6 +53,17 @@ import java.util.StringTokenizer;
* </tr>
*
* <tr>
* <td>authProvider.{provider name}</td>
* <td>Allow the named provider to be an AuthProvider for login and
* logout operations. </td>
* <td>This allows the named provider to perform login and logout
* operations. The named provider must extend {@code AuthProvider}
* and care must be taken to grant to a trusted provider since
* login operations involve sensitive authentication information
* such as PINs and passwords. </td>
* </tr>
*
* <tr>
* <td>createAccessControlContext</td>
* <td>Creation of an AccessControlContext</td>
* <td>This allows someone to instantiate an AccessControlContext

View File

@ -203,6 +203,13 @@ public abstract class Signature extends SignatureSpi {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the standard name of the algorithm requested.
* See the Signature section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Signature">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, 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
@ -142,6 +142,13 @@ public class CertPathBuilder {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the requested {@code CertPathBuilder}
* algorithm. See the CertPathBuilder section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -143,6 +143,13 @@ public class CertPathValidator {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param algorithm the name of the requested {@code CertPathValidator}
* algorithm. See the CertPathValidator section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathValidator">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, 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
@ -201,6 +201,13 @@ public class CertStore {
* Note that the specified {@code CertStoreParameters} object is
* cloned.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param type the name of the requested {@code CertStore} type.
* See the CertStore section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertStore">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -163,6 +163,13 @@ public class CertificateFactory {
* <p> Note that the list of registered providers may be retrieved via
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @implNote
* The JDK Reference Implementation additionally uses the
* {@code jdk.security.provider.preferred} property to determine
* the preferred provider order for the specified algorithm. This
* may be different than the order of providers returned by
* {@link Security#getProviders() Security.getProviders()}.
*
* @param type the name of the requested certificate type.
* See the CertificateFactory section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory">

View File

@ -384,6 +384,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
*/
public String getCurrencySymbol()
{
initializeCurrency(locale);
return currencySymbol;
}
@ -396,6 +397,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
*/
public void setCurrencySymbol(String currency)
{
initializeCurrency(locale);
currencySymbol = currency;
}
@ -408,6 +410,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
*/
public String getInternationalCurrencySymbol()
{
initializeCurrency(locale);
return intlCurrencySymbol;
}
@ -429,6 +432,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
*/
public void setInternationalCurrencySymbol(String currencyCode)
{
initializeCurrency(locale);
intlCurrencySymbol = currencyCode;
currency = null;
if (currencyCode != null) {
@ -449,6 +453,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* @since 1.4
*/
public Currency getCurrency() {
initializeCurrency(locale);
return currency;
}
@ -468,6 +473,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
if (currency == null) {
throw new NullPointerException();
}
initializeCurrency(locale);
this.currency = currency;
intlCurrencySymbol = currency.getCurrencyCode();
currencySymbol = currency.getSymbol(locale);
@ -507,14 +513,15 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
{
return exponential;
}
/**
* Returns the string used to separate the mantissa from the exponent.
* Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
*
* @return the exponent separator string
* @see #setExponentSeparator(java.lang.String)
* @since 1.6
*/
/**
* Returns the string used to separate the mantissa from the exponent.
* Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
*
* @return the exponent separator string
* @see #setExponentSeparator(java.lang.String)
* @since 1.6
*/
public String getExponentSeparator()
{
return exponentialSeparator;
@ -528,22 +535,22 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
exponential = exp;
}
/**
* Sets the string used to separate the mantissa from the exponent.
* Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
*
* @param exp the exponent separator string
* @exception NullPointerException if <code>exp</code> is null
* @see #getExponentSeparator()
* @since 1.6
*/
/**
* Sets the string used to separate the mantissa from the exponent.
* Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
*
* @param exp the exponent separator string
* @exception NullPointerException if <code>exp</code> is null
* @see #getExponentSeparator()
* @since 1.6
*/
public void setExponentSeparator(String exp)
{
if (exp == null) {
throw new NullPointerException();
}
exponentialSeparator = exp;
}
}
//------------------------------------------------------------
@ -582,7 +589,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
patternSeparator == other.patternSeparator &&
infinity.equals(other.infinity) &&
NaN.equals(other.NaN) &&
currencySymbol.equals(other.currencySymbol) &&
getCurrencySymbol().equals(other.getCurrencySymbol()) && // possible currency init occurs here
intlCurrencySymbol.equals(other.intlCurrencySymbol) &&
currency == other.currency &&
monetarySeparator == other.monetarySeparator &&
@ -629,6 +636,24 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
infinity = numberElements[9];
NaN = numberElements[10];
// maybe filled with previously cached values, or null.
intlCurrencySymbol = (String) data[1];
currencySymbol = (String) data[2];
// Currently the monetary decimal separator is the same as the
// standard decimal separator for all locales that we support.
// If that changes, add a new entry to NumberElements.
monetarySeparator = decimalSeparator;
}
/**
* Lazy initialization for currency related fields
*/
private void initializeCurrency(Locale locale) {
if (currencyInitialized) {
return;
}
// Try to obtain the currency used in the locale's country.
// Check for empty country string separately because it's a valid
// country ID for Locale (and used for the C locale), but not a valid
@ -640,7 +665,16 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
// use default values below for compatibility
}
}
if (currency != null) {
// get resource bundle data
LocaleProviderAdapter adapter =
LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
// Avoid potential recursions
if (!(adapter instanceof ResourceBundleBasedAdapter)) {
adapter = LocaleProviderAdapter.getResourceBundleBased();
}
Object[] data = adapter.getLocaleResources(locale).getDecimalFormatSymbolsData();
intlCurrencySymbol = currency.getCurrencyCode();
if (data[1] != null && data[1] == intlCurrencySymbol) {
currencySymbol = (String) data[2];
@ -658,10 +692,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
}
currencySymbol = "\u00A4";
}
// Currently the monetary decimal separator is the same as the
// standard decimal separator for all locales that we support.
// If that changes, add a new entry to NumberElements.
monetarySeparator = decimalSeparator;
currencyInitialized = true;
}
/**
@ -705,6 +737,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
currency = Currency.getInstance(intlCurrencySymbol);
} catch (IllegalArgumentException e) {
}
currencyInitialized = true;
}
}
@ -820,16 +853,16 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
*/
private char exponential; // Field new in JDK 1.1.6
/**
* The string used to separate the mantissa from the exponent.
* Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
* <p>
* If both <code>exponential</code> and <code>exponentialSeparator</code>
* exist, this <code>exponentialSeparator</code> has the precedence.
*
* @serial
* @since 1.6
*/
/**
* The string used to separate the mantissa from the exponent.
* Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
* <p>
* If both <code>exponential</code> and <code>exponentialSeparator</code>
* exist, this <code>exponentialSeparator</code> has the precedence.
*
* @serial
* @since 1.6
*/
private String exponentialSeparator; // Field new in JDK 1.6
/**
@ -842,6 +875,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
// currency; only the ISO code is serialized.
private transient Currency currency;
private transient volatile boolean currencyInitialized = false;
// Proclaim JDK 1.1 FCS compatibility
static final long serialVersionUID = 5772796243397350300L;

View File

@ -758,7 +758,7 @@ public final class Instant
throw new UnsupportedTemporalTypeException("Unit must divide into a standard day without remainder");
}
long nod = (seconds % LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + nanos;
long result = (nod / dur) * dur;
long result = Math.floorDiv(nod, dur) * dur ;
return plusNanos(result - nod);
}

View File

@ -38,16 +38,16 @@ package java.util;
/**
* This class provides skeletal implementations of some {@link Queue}
* operations. The implementations in this class are appropriate when
* the base implementation does <em>not</em> allow <tt>null</tt>
* the base implementation does <em>not</em> allow {@code null}
* elements. Methods {@link #add add}, {@link #remove remove}, and
* {@link #element element} are based on {@link #offer offer}, {@link
* #poll poll}, and {@link #peek peek}, respectively, but throw
* exceptions instead of indicating failure via <tt>false</tt> or
* <tt>null</tt> returns.
* exceptions instead of indicating failure via {@code false} or
* {@code null} returns.
*
* <p>A <tt>Queue</tt> implementation that extends this class must
* <p>A {@code Queue} implementation that extends this class must
* minimally define a method {@link Queue#offer} which does not permit
* insertion of <tt>null</tt> elements, along with methods {@link
* insertion of {@code null} elements, along with methods {@link
* Queue#peek}, {@link Queue#poll}, {@link Collection#size}, and
* {@link Collection#iterator}. Typically, additional methods will be
* overridden as well. If these requirements cannot be met, consider
@ -59,7 +59,7 @@ package java.util;
*
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this queue
*/
public abstract class AbstractQueue<E>
extends AbstractCollection<E>
@ -74,14 +74,14 @@ public abstract class AbstractQueue<E>
/**
* Inserts the specified element into this queue if it is possible to do so
* immediately without violating capacity restrictions, returning
* <tt>true</tt> upon success and throwing an <tt>IllegalStateException</tt>
* {@code true} upon success and throwing an {@code IllegalStateException}
* if no space is currently available.
*
* <p>This implementation returns <tt>true</tt> if <tt>offer</tt> succeeds,
* else throws an <tt>IllegalStateException</tt>.
* <p>This implementation returns {@code true} if {@code offer} succeeds,
* else throws an {@code IllegalStateException}.
*
* @param e the element to add
* @return <tt>true</tt> (as specified by {@link Collection#add})
* @return {@code true} (as specified by {@link Collection#add})
* @throws IllegalStateException if the element cannot be added at this
* time due to capacity restrictions
* @throws ClassCastException if the class of the specified element
@ -103,7 +103,7 @@ public abstract class AbstractQueue<E>
* from {@link #poll poll} only in that it throws an exception if this
* queue is empty.
*
* <p>This implementation returns the result of <tt>poll</tt>
* <p>This implementation returns the result of {@code poll}
* unless the queue is empty.
*
* @return the head of this queue
@ -122,7 +122,7 @@ public abstract class AbstractQueue<E>
* differs from {@link #peek peek} only in that it throws an exception if
* this queue is empty.
*
* <p>This implementation returns the result of <tt>peek</tt>
* <p>This implementation returns the result of {@code peek}
* unless the queue is empty.
*
* @return the head of this queue
@ -141,7 +141,7 @@ public abstract class AbstractQueue<E>
* The queue will be empty after this call returns.
*
* <p>This implementation repeatedly invokes {@link #poll poll} until it
* returns <tt>null</tt>.
* returns {@code null}.
*/
public void clear() {
while (poll() != null)
@ -151,7 +151,7 @@ public abstract class AbstractQueue<E>
/**
* Adds all of the elements in the specified collection to this
* queue. Attempts to addAll of a queue to itself result in
* <tt>IllegalArgumentException</tt>. Further, the behavior of
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
@ -159,12 +159,12 @@ public abstract class AbstractQueue<E>
* and adds each element returned by the iterator to this
* queue, in turn. A runtime exception encountered while
* trying to add an element (including, in particular, a
* <tt>null</tt> element) may result in only some of the elements
* {@code null} element) may result in only some of the elements
* having been successfully added when the associated exception is
* thrown.
*
* @param c collection containing elements to be added to this queue
* @return <tt>true</tt> if this queue changed as a result of the call
* @return {@code true} if this queue changed as a result of the call
* @throws ClassCastException if the class of an element of the specified
* collection prevents it from being added to this queue
* @throws NullPointerException if the specified collection contains a

View File

@ -47,16 +47,18 @@ import java.util.function.Consumer;
* when used as a queue.
*
* <p>Most {@code ArrayDeque} operations run in amortized constant time.
* Exceptions include {@link #remove(Object) remove}, {@link
* #removeFirstOccurrence removeFirstOccurrence}, {@link #removeLastOccurrence
* removeLastOccurrence}, {@link #contains contains}, {@link #iterator
* iterator.remove()}, and the bulk operations, all of which run in linear
* time.
* Exceptions include
* {@link #remove(Object) remove},
* {@link #removeFirstOccurrence removeFirstOccurrence},
* {@link #removeLastOccurrence removeLastOccurrence},
* {@link #contains contains},
* {@link #iterator iterator.remove()},
* and the bulk operations, all of which run in linear time.
*
* <p>The iterators returned by this class's {@code iterator} method are
* <i>fail-fast</i>: If the deque is modified at any time after the iterator
* is created, in any way except through the iterator's own {@code remove}
* method, the iterator will generally throw a {@link
* <p>The iterators returned by this class's {@link #iterator() iterator}
* method are <em>fail-fast</em>: If the deque is modified at any time after
* the iterator is created, in any way except through the iterator's own
* {@code remove} method, the iterator will generally throw a {@link
* ConcurrentModificationException}. Thus, in the face of concurrent
* modification, the iterator fails quickly and cleanly, rather than risking
* arbitrary, non-deterministic behavior at an undetermined time in the
@ -80,7 +82,7 @@ import java.util.function.Consumer;
*
* @author Josh Bloch and Doug Lea
* @since 1.6
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this deque
*/
public class ArrayDeque<E> extends AbstractCollection<E>
implements Deque<E>, Cloneable, Serializable
@ -136,8 +138,8 @@ public class ArrayDeque<E> extends AbstractCollection<E>
initialCapacity |= (initialCapacity >>> 16);
initialCapacity++;
if (initialCapacity < 0) // Too many elements, must back off
initialCapacity >>>= 1;// Good luck allocating 2 ^ 30 elements
if (initialCapacity < 0) // Too many elements, must back off
initialCapacity >>>= 1; // Good luck allocating 2^30 elements
}
elements = new Object[initialCapacity];
}
@ -162,24 +164,6 @@ public class ArrayDeque<E> extends AbstractCollection<E>
tail = n;
}
/**
* Copies the elements from our element array into the specified array,
* in order (from first to last element in the deque). It is assumed
* that the array is large enough to hold all elements in the deque.
*
* @return its argument
*/
private <T> T[] copyElements(T[] a) {
if (head < tail) {
System.arraycopy(elements, head, a, 0, size());
} else if (head > tail) {
int headPortionLen = elements.length - head;
System.arraycopy(elements, head, a, 0, headPortionLen);
System.arraycopy(elements, 0, a, headPortionLen, tail);
}
return a;
}
/**
* Constructs an empty array deque with an initial capacity
* sufficient to hold 16 elements.
@ -292,25 +276,27 @@ public class ArrayDeque<E> extends AbstractCollection<E>
}
public E pollFirst() {
int h = head;
final Object[] elements = this.elements;
final int h = head;
@SuppressWarnings("unchecked")
E result = (E) elements[h];
// Element is null if deque empty
if (result == null)
return null;
elements[h] = null; // Must null out slot
head = (h + 1) & (elements.length - 1);
if (result != null) {
elements[h] = null; // Must null out slot
head = (h + 1) & (elements.length - 1);
}
return result;
}
public E pollLast() {
int t = (tail - 1) & (elements.length - 1);
final Object[] elements = this.elements;
final int t = (tail - 1) & (elements.length - 1);
@SuppressWarnings("unchecked")
E result = (E) elements[t];
if (result == null)
return null;
elements[t] = null;
tail = t;
if (result != null) {
elements[t] = null;
tail = t;
}
return result;
}
@ -360,17 +346,15 @@ public class ArrayDeque<E> extends AbstractCollection<E>
* @return {@code true} if the deque contained the specified element
*/
public boolean removeFirstOccurrence(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
Object x;
while ( (x = elements[i]) != null) {
if (o.equals(x)) {
delete(i);
return true;
if (o != null) {
int mask = elements.length - 1;
int i = head;
for (Object x; (x = elements[i]) != null; i = (i + 1) & mask) {
if (o.equals(x)) {
delete(i);
return true;
}
}
i = (i + 1) & mask;
}
return false;
}
@ -388,17 +372,15 @@ public class ArrayDeque<E> extends AbstractCollection<E>
* @return {@code true} if the deque contained the specified element
*/
public boolean removeLastOccurrence(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = (tail - 1) & mask;
Object x;
while ( (x = elements[i]) != null) {
if (o.equals(x)) {
delete(i);
return true;
if (o != null) {
int mask = elements.length - 1;
int i = (tail - 1) & mask;
for (Object x; (x = elements[i]) != null; i = (i - 1) & mask) {
if (o.equals(x)) {
delete(i);
return true;
}
}
i = (i - 1) & mask;
}
return false;
}
@ -535,7 +517,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
*
* @return true if elements moved backwards
*/
private boolean delete(int i) {
boolean delete(int i) {
checkInvariants();
final Object[] elements = this.elements;
final int mask = elements.length - 1;
@ -671,12 +653,12 @@ public class ArrayDeque<E> extends AbstractCollection<E>
}
}
/**
* This class is nearly a mirror-image of DeqIterator, using tail
* instead of head for initial cursor, and head instead of tail
* for fence.
*/
private class DescendingIterator implements Iterator<E> {
/*
* This class is nearly a mirror-image of DeqIterator, using
* tail instead of head for initial cursor, and head instead of
* tail for fence.
*/
private int cursor = tail;
private int fence = head;
private int lastRet = -1;
@ -717,15 +699,13 @@ public class ArrayDeque<E> extends AbstractCollection<E>
* @return {@code true} if this deque contains the specified element
*/
public boolean contains(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
Object x;
while ( (x = elements[i]) != null) {
if (o.equals(x))
return true;
i = (i + 1) & mask;
if (o != null) {
int mask = elements.length - 1;
int i = head;
for (Object x; (x = elements[i]) != null; i = (i + 1) & mask) {
if (o.equals(x))
return true;
}
}
return false;
}
@ -779,7 +759,14 @@ public class ArrayDeque<E> extends AbstractCollection<E>
* @return an array containing all of the elements in this deque
*/
public Object[] toArray() {
return copyElements(new Object[size()]);
final int head = this.head;
final int tail = this.tail;
boolean wrap = (tail < head);
int end = wrap ? tail + elements.length : tail;
Object[] a = Arrays.copyOfRange(elements, head, end);
if (wrap)
System.arraycopy(elements, 0, a, elements.length - head, tail);
return a;
}
/**
@ -804,7 +791,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
* The following code can be used to dump the deque into a newly
* allocated array of {@code String}:
*
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
@ -820,13 +807,22 @@ public class ArrayDeque<E> extends AbstractCollection<E>
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
int size = size();
if (a.length < size)
a = (T[])java.lang.reflect.Array.newInstance(
a.getClass().getComponentType(), size);
copyElements(a);
if (a.length > size)
a[size] = null;
final int head = this.head;
final int tail = this.tail;
boolean wrap = (tail < head);
int size = (tail - head) + (wrap ? elements.length : 0);
int firstLeg = size - (wrap ? tail : 0);
int len = a.length;
if (size > len) {
a = (T[]) Arrays.copyOfRange(elements, head, head + size,
a.getClass());
} else {
System.arraycopy(elements, head, a, 0, firstLeg);
if (size < len)
a[size] = null;
}
if (wrap)
System.arraycopy(elements, 0, a, firstLeg, tail);
return a;
}
@ -853,6 +849,8 @@ public class ArrayDeque<E> extends AbstractCollection<E>
/**
* Saves this deque to a stream (that is, serializes it).
*
* @param s the stream
* @throws java.io.IOException if an I/O error occurs
* @serialData The current size ({@code int}) of the deque,
* followed by all of its elements (each an object reference) in
* first-to-last order.
@ -872,6 +870,10 @@ public class ArrayDeque<E> extends AbstractCollection<E>
/**
* Reconstitutes this deque from a stream (that is, deserializes it).
* @param s the stream
* @throws ClassNotFoundException if the class of a serialized object
* could not be found
* @throws java.io.IOException if an I/O error occurs
*/
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
@ -910,7 +912,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
private int fence; // -1 until first use
private int index; // current index, modified on traverse/split
/** Creates new spliterator covering the given array and range */
/** Creates new spliterator covering the given array and range. */
DeqSpliterator(ArrayDeque<E> deq, int origin, int fence) {
this.deq = deq;
this.index = origin;
@ -932,7 +934,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
if (h > t)
t += n;
int m = ((h + t) >>> 1) & (n - 1);
return new DeqSpliterator<>(deq, h, index = m);
return new DeqSpliterator<E>(deq, h, index = m);
}
return null;
}
@ -957,7 +959,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
throw new NullPointerException();
Object[] a = deq.elements;
int m = a.length - 1, f = getFence(), i = index;
if (i != fence) {
if (i != f) {
@SuppressWarnings("unchecked") E e = (E)a[i];
index = (i + 1) & m;
if (e == null)

View File

@ -1,5 +1,4 @@
/*
* Copyright (c) 2012, 2013, 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
@ -22,20 +21,26 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.util;
/*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file:
*
* 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/publicdomain/zero/1.0/
*/
import java.util.concurrent.ForkJoinPool;
package java.util;
import java.util.concurrent.CountedCompleter;
import java.util.concurrent.ForkJoinPool;
import java.util.function.BinaryOperator;
import java.util.function.DoubleBinaryOperator;
import java.util.function.IntBinaryOperator;
import java.util.function.LongBinaryOperator;
import java.util.function.DoubleBinaryOperator;
/**
* ForkJoin tasks to perform Arrays.parallelPrefix operations.
@ -44,7 +49,7 @@ import java.util.function.DoubleBinaryOperator;
* @since 1.8
*/
class ArrayPrefixHelpers {
private ArrayPrefixHelpers() {}; // non-instantiable
private ArrayPrefixHelpers() {} // non-instantiable
/*
* Parallel prefix (aka cumulate, scan) task classes
@ -113,8 +118,8 @@ class ArrayPrefixHelpers {
this.lo = this.origin = lo; this.hi = this.fence = hi;
int p;
this.threshold =
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
}
/** Subtask constructor */
@ -141,9 +146,9 @@ class ArrayPrefixHelpers {
if (lt == null) { // first pass
int mid = (l + h) >>> 1;
f = rt = t.right =
new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
}
else { // possibly refork
T pin = t.in;
@ -183,7 +188,7 @@ class ArrayPrefixHelpers {
for (int b;;) {
if (((b = t.getPendingCount()) & FINISHED) != 0)
break outer; // already done
state = ((b & CUMULATE) != 0? FINISHED :
state = ((b & CUMULATE) != 0 ? FINISHED :
(l > org) ? SUMMED : (SUMMED|FINISHED));
if (t.compareAndSetPendingCount(b, b|state))
break;
@ -265,8 +270,8 @@ class ArrayPrefixHelpers {
this.lo = this.origin = lo; this.hi = this.fence = hi;
int p;
this.threshold =
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
}
/** Subtask constructor */
@ -293,9 +298,9 @@ class ArrayPrefixHelpers {
if (lt == null) { // first pass
int mid = (l + h) >>> 1;
f = rt = t.right =
new LongCumulateTask(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new LongCumulateTask(t, fn, a, org, fnc, th, l, mid);
new LongCumulateTask(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new LongCumulateTask(t, fn, a, org, fnc, th, l, mid);
}
else { // possibly refork
long pin = t.in;
@ -335,7 +340,7 @@ class ArrayPrefixHelpers {
for (int b;;) {
if (((b = t.getPendingCount()) & FINISHED) != 0)
break outer; // already done
state = ((b & CUMULATE) != 0? FINISHED :
state = ((b & CUMULATE) != 0 ? FINISHED :
(l > org) ? SUMMED : (SUMMED|FINISHED));
if (t.compareAndSetPendingCount(b, b|state))
break;
@ -415,8 +420,8 @@ class ArrayPrefixHelpers {
this.lo = this.origin = lo; this.hi = this.fence = hi;
int p;
this.threshold =
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
}
/** Subtask constructor */
@ -443,9 +448,9 @@ class ArrayPrefixHelpers {
if (lt == null) { // first pass
int mid = (l + h) >>> 1;
f = rt = t.right =
new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid);
new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid);
}
else { // possibly refork
double pin = t.in;
@ -485,7 +490,7 @@ class ArrayPrefixHelpers {
for (int b;;) {
if (((b = t.getPendingCount()) & FINISHED) != 0)
break outer; // already done
state = ((b & CUMULATE) != 0? FINISHED :
state = ((b & CUMULATE) != 0 ? FINISHED :
(l > org) ? SUMMED : (SUMMED|FINISHED));
if (t.compareAndSetPendingCount(b, b|state))
break;
@ -565,8 +570,8 @@ class ArrayPrefixHelpers {
this.lo = this.origin = lo; this.hi = this.fence = hi;
int p;
this.threshold =
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
(p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
<= MIN_PARTITION ? MIN_PARTITION : p;
}
/** Subtask constructor */
@ -593,9 +598,9 @@ class ArrayPrefixHelpers {
if (lt == null) { // first pass
int mid = (l + h) >>> 1;
f = rt = t.right =
new IntCumulateTask(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new IntCumulateTask(t, fn, a, org, fnc, th, l, mid);
new IntCumulateTask(t, fn, a, org, fnc, th, mid, h);
t = lt = t.left =
new IntCumulateTask(t, fn, a, org, fnc, th, l, mid);
}
else { // possibly refork
int pin = t.in;
@ -635,7 +640,7 @@ class ArrayPrefixHelpers {
for (int b;;) {
if (((b = t.getPendingCount()) & FINISHED) != 0)
break outer; // already done
state = ((b & CUMULATE) != 0? FINISHED :
state = ((b & CUMULATE) != 0 ? FINISHED :
(l > org) ? SUMMED : (SUMMED|FINISHED));
if (t.compareAndSetPendingCount(b, b|state))
break;

View File

@ -537,8 +537,9 @@ public class Collections {
* Copies all of the elements from one list into another. After the
* operation, the index of each copied element in the destination list
* will be identical to its index in the source list. The destination
* list must be at least as long as the source list. If it is longer, the
* remaining elements in the destination list are unaffected. <p>
* list's size must be greater than or equal to the source list's size.
* If it is greater, the remaining elements in the destination list are
* unaffected. <p>
*
* This method runs in linear time.
*

View File

@ -188,7 +188,7 @@ package java.util;
* @author Doug Lea
* @author Josh Bloch
* @since 1.6
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this deque
*/
public interface Deque<E> extends Queue<E> {
/**
@ -344,8 +344,7 @@ public interface Deque<E> extends Queue<E> {
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the first element {@code e} such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>
* (if such an element exists).
* {@code Objects.equals(o, e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
@ -353,10 +352,10 @@ public interface Deque<E> extends Queue<E> {
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
* deque does not permit null elements
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean removeFirstOccurrence(Object o);
@ -364,8 +363,7 @@ public interface Deque<E> extends Queue<E> {
* Removes the last occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the last element {@code e} such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>
* (if such an element exists).
* {@code Objects.equals(o, e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
@ -373,10 +371,10 @@ public interface Deque<E> extends Queue<E> {
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
* deque does not permit null elements
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean removeLastOccurrence(Object o);
@ -521,8 +519,7 @@ public interface Deque<E> extends Queue<E> {
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the first element {@code e} such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>
* (if such an element exists).
* {@code Objects.equals(o, e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
@ -532,27 +529,26 @@ public interface Deque<E> extends Queue<E> {
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
* deque does not permit null elements
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean remove(Object o);
/**
* Returns {@code true} if this deque contains the specified element.
* More formally, returns {@code true} if and only if this deque contains
* at least one element {@code e} such that
* <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
* at least one element {@code e} such that {@code Objects.equals(o, e)}.
*
* @param o element whose presence in this deque is to be tested
* @return {@code true} if this deque contains the specified element
* @throws ClassCastException if the type of the specified element
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null and this
* deque does not permit null elements
* (<a href="Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean contains(Object o);
@ -561,7 +557,7 @@ public interface Deque<E> extends Queue<E> {
*
* @return the number of elements in this deque
*/
public int size();
int size();
/**
* Returns an iterator over the elements in this deque in proper sequence.

View File

@ -38,30 +38,32 @@ package java.util;
/**
* A {@link SortedMap} extended with navigation methods returning the
* closest matches for given search targets. Methods
* {@code lowerEntry}, {@code floorEntry}, {@code ceilingEntry},
* and {@code higherEntry} return {@code Map.Entry} objects
* {@link #lowerEntry}, {@link #floorEntry}, {@link #ceilingEntry},
* and {@link #higherEntry} return {@code Map.Entry} objects
* associated with keys respectively less than, less than or equal,
* greater than or equal, and greater than a given key, returning
* {@code null} if there is no such key. Similarly, methods
* {@code lowerKey}, {@code floorKey}, {@code ceilingKey}, and
* {@code higherKey} return only the associated keys. All of these
* {@link #lowerKey}, {@link #floorKey}, {@link #ceilingKey}, and
* {@link #higherKey} return only the associated keys. All of these
* methods are designed for locating, not traversing entries.
*
* <p>A {@code NavigableMap} may be accessed and traversed in either
* ascending or descending key order. The {@code descendingMap}
* ascending or descending key order. The {@link #descendingMap}
* method returns a view of the map with the senses of all relational
* and directional methods inverted. The performance of ascending
* operations and views is likely to be faster than that of descending
* ones. Methods {@code subMap}, {@code headMap},
* and {@code tailMap} differ from the like-named {@code
* SortedMap} methods in accepting additional arguments describing
* whether lower and upper bounds are inclusive versus exclusive.
* Submaps of any {@code NavigableMap} must implement the {@code
* NavigableMap} interface.
* ones. Methods
* {@link #subMap(Object, boolean, Object, boolean) subMap(K, boolean, K, boolean)},
* {@link #headMap(Object, boolean) headMap(K, boolean)}, and
* {@link #tailMap(Object, boolean) tailMap(K, boolean)}
* differ from the like-named {@code SortedMap} methods in accepting
* additional arguments describing whether lower and upper bounds are
* inclusive versus exclusive. Submaps of any {@code NavigableMap}
* must implement the {@code NavigableMap} interface.
*
* <p>This interface additionally defines methods {@code firstEntry},
* {@code pollFirstEntry}, {@code lastEntry}, and
* {@code pollLastEntry} that return and/or remove the least and
* <p>This interface additionally defines methods {@link #firstEntry},
* {@link #pollFirstEntry}, {@link #lastEntry}, and
* {@link #pollLastEntry} that return and/or remove the least and
* greatest mappings, if any exist, else returning {@code null}.
*
* <p>Implementations of entry-returning methods are expected to
@ -80,7 +82,7 @@ package java.util;
* implement {@code NavigableMap}, but extensions and implementations
* of this interface are encouraged to override these methods to return
* {@code NavigableMap}. Similarly,
* {@link #keySet()} can be overriden to return {@code NavigableSet}.
* {@link #keySet()} can be overridden to return {@link NavigableSet}.
*
* <p>This interface is a member of the
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
@ -254,7 +256,7 @@ public interface NavigableMap<K,V> extends SortedMap<K,V> {
* operation), the results of the iteration are undefined.
*
* <p>The returned map has an ordering equivalent to
* <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
* {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}.
* The expression {@code m.descendingMap().descendingMap()} returns a
* view of {@code m} essentially equivalent to {@code m}.
*

View File

@ -37,26 +37,30 @@ package java.util;
/**
* A {@link SortedSet} extended with navigation methods reporting
* closest matches for given search targets. Methods {@code lower},
* {@code floor}, {@code ceiling}, and {@code higher} return elements
* closest matches for given search targets. Methods {@link #lower},
* {@link #floor}, {@link #ceiling}, and {@link #higher} return elements
* respectively less than, less than or equal, greater than or equal,
* and greater than a given element, returning {@code null} if there
* is no such element. A {@code NavigableSet} may be accessed and
* traversed in either ascending or descending order. The {@code
* descendingSet} method returns a view of the set with the senses of
* all relational and directional methods inverted. The performance of
* ascending operations and views is likely to be faster than that of
* descending ones. This interface additionally defines methods
* {@code pollFirst} and {@code pollLast} that return and remove the
* lowest and highest element, if one exists, else returning {@code
* null}. Methods {@code subSet}, {@code headSet},
* and {@code tailSet} differ from the like-named {@code
* SortedSet} methods in accepting additional arguments describing
* whether lower and upper bounds are inclusive versus exclusive.
* Subsets of any {@code NavigableSet} must implement the {@code
* NavigableSet} interface.
* is no such element.
*
* <p> The return values of navigation methods may be ambiguous in
* <p>A {@code NavigableSet} may be accessed and traversed in either
* ascending or descending order. The {@link #descendingSet} method
* returns a view of the set with the senses of all relational and
* directional methods inverted. The performance of ascending
* operations and views is likely to be faster than that of descending
* ones. This interface additionally defines methods {@link
* #pollFirst} and {@link #pollLast} that return and remove the lowest
* and highest element, if one exists, else returning {@code null}.
* Methods
* {@link #subSet(Object, boolean, Object, boolean) subSet(E, boolean, E, boolean)},
* {@link #headSet(Object, boolean) headSet(E, boolean)}, and
* {@link #tailSet(Object, boolean) tailSet(E, boolean)}
* differ from the like-named {@code SortedSet} methods in accepting
* additional arguments describing whether lower and upper bounds are
* inclusive versus exclusive. Subsets of any {@code NavigableSet}
* must implement the {@code NavigableSet} interface.
*
* <p>The return values of navigation methods may be ambiguous in
* implementations that permit {@code null} elements. However, even
* in this case the result can be disambiguated by checking
* {@code contains(null)}. To avoid such issues, implementations of
@ -172,7 +176,7 @@ public interface NavigableSet<E> extends SortedSet<E> {
* the iteration are undefined.
*
* <p>The returned set has an ordering equivalent to
* <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
* {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}.
* The expression {@code s.descendingSet().descendingSet()} returns a
* view of {@code s} essentially equivalent to {@code s}.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2015, 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
@ -281,6 +281,43 @@ public final class Objects {
return obj != null;
}
/**
* Returns the first argument if it is non-{@code null} and
* otherwise returns the non-{@code null} second argument.
*
* @param obj an object
* @param defaultObj a non-{@code null} object to return if the first argument
* is {@code null}
* @param <T> the type of the reference
* @return the first argument if it is non-{@code null} and
* otherwise the second argument if it is non-{@code null}
* @throws NullPointerException if both {@code obj} is null and
* {@code defaultObj} is {@code null}
* @since 9
*/
public static <T> T nonNullElse(T obj, T defaultObj) {
return (obj != null) ? obj : requireNonNull(defaultObj, "defaultObj");
}
/**
* Returns the first argument if it is non-{@code null} and otherwise
* returns the non-{@code null} value of {@code supplier.get()}.
*
* @param obj an object
* @param supplier of a non-{@code null} object to return if the first argument
* is {@code null}
* @param <T> the type of the first argument and return type
* @return the first argument if it is non-{@code null} and otherwise
* the value from {@code supplier.get()} if it is non-{@code null}
* @throws NullPointerException if both {@code obj} is null and
* either the {@code supplier} is {@code null} or
* the {@code supplier.get()} value is {@code null}
* @since 9
*/
public static <T> T nonNullElseGet(T obj, Supplier<? extends T> supplier) {
return (obj != null) ? obj : requireNonNull(requireNonNull(supplier, "supplier").get(), "supplier.get()");
}
/**
* Checks that the specified object reference is not {@code null} and
* throws a customized {@link NullPointerException} if it is.

View File

@ -31,21 +31,22 @@ import java.util.function.Supplier;
import java.util.stream.Stream;
/**
* A container object which may or may not contain a non-null value.
* If a value is present, {@code isPresent()} will return {@code true} and
* {@code get()} will return the value.
* A container object which may or may not contain a non-{@code null} value.
* If a value is present, {@code isPresent()} returns {@code true} and
* {@code get()} returns the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(java.lang.Object) orElse()}
* (return a default value if value not present) and
* {@link #ifPresent(java.util.function.Consumer) ifPresent()} (perform an
* action if the value is present).
* (returns a default value if no value is present) and
* {@link #ifPresent(java.util.function.Consumer) ifPresent()} (performs an
* action if a value is present).
*
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
* class; use of identity-sensitive operations (including reference equality
* ({@code ==}), identity hash code, or synchronization) on instances of
* {@code Optional} may have unpredictable results and should be avoided.
*
* @param <T> the type of value
* @since 1.8
*/
public final class Optional<T> {
@ -71,14 +72,15 @@ public final class Optional<T> {
/**
* Returns an empty {@code Optional} instance. No value is present for this
* Optional.
* {@code Optional}.
*
* @apiNote Though it may be tempting to do so, avoid testing if an object
* is empty by comparing with {@code ==} against instances returned by
* {@code Option.empty()}. There is no guarantee that it is a singleton.
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* {@code Optional.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
*
* @param <T> Type of the non-existent value
* @param <T> The type of the non-existent value
* @return an empty {@code Optional}
*/
public static<T> Optional<T> empty() {
@ -88,47 +90,47 @@ public final class Optional<T> {
}
/**
* Constructs an instance with the value present.
* Constructs an instance with the described value.
*
* @param value the non-null value to be present
* @throws NullPointerException if value is null
* @param value the non-{@code null} value to describe
* @throws NullPointerException if value is {@code null}
*/
private Optional(T value) {
this.value = Objects.requireNonNull(value);
}
/**
* Returns an {@code Optional} with the specified present non-null value.
* Returns an {@code Optional} describing the given non-{@code null}
* value.
*
* @param <T> the class of the value
* @param value the value to be present, which must be non-null
* @param value the value to describe, which must be non-{@code null}
* @param <T> the type of the value
* @return an {@code Optional} with the value present
* @throws NullPointerException if value is null
* @throws NullPointerException if value is {@code null}
*/
public static <T> Optional<T> of(T value) {
return new Optional<>(value);
}
/**
* Returns an {@code Optional} describing the specified value, if non-null,
* otherwise returns an empty {@code Optional}.
* Returns an {@code Optional} describing the given value, if
* non-{@code null}, otherwise returns an empty {@code Optional}.
*
* @param <T> the class of the value
* @param value the possibly-null value to describe
* @param value the possibly-{@code null} value to describe
* @param <T> the type of the value
* @return an {@code Optional} with a present value if the specified value
* is non-null, otherwise an empty {@code Optional}
* is non-{@code null}, otherwise an empty {@code Optional}
*/
public static <T> Optional<T> ofNullable(T value) {
return value == null ? empty() : of(value);
}
/**
* If a value is present in this {@code Optional}, returns the value,
* otherwise throws {@code NoSuchElementException}.
*
* @return the non-null value held by this {@code Optional}
* @throws NoSuchElementException if there is no value present
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the non-{@code null} value described by this {@code Optional}
* @throws NoSuchElementException if no value is present
* @see Optional#isPresent()
*/
public T get() {
@ -139,21 +141,21 @@ public final class Optional<T> {
}
/**
* Return {@code true} if there is a value present, otherwise {@code false}.
* If a value is present, returns {@code true}, otherwise {@code false}.
*
* @return {@code true} if there is a value present, otherwise {@code false}
* @return {@code true} if a value is present, otherwise {@code false}
*/
public boolean isPresent() {
return value != null;
}
/**
* If a value is present, perform the given action with the value,
* otherwise do nothing.
* If a value is present, performs the given action with the value,
* otherwise does nothing.
*
* @param action the action to be performed if a value is present
* @throws NullPointerException if a value is present and {@code action} is
* null
* @param action the action to be performed, if a value is present
* @throws NullPointerException if value is present and the given action is
* {@code null}
*/
public void ifPresent(Consumer<? super T> action) {
if (value != null) {
@ -162,15 +164,16 @@ public final class Optional<T> {
}
/**
* If a value is present, perform the given action with the value,
* otherwise perform the given empty-based action.
* If a value is present, performs the given action with the value,
* otherwise performs the given empty-based action.
*
* @param action the action to be performed if a value is present
* @param emptyAction the empty-based action to be performed if a value is
* not present
* @throws NullPointerException if a value is present and {@code action} is
* null, or a value is not present and {@code emptyAction} is null.
* @since 1.9
* @param action the action to be performed, if a value is present
* @param emptyAction the empty-based action to be performed, if no value is
* present
* @throws NullPointerException if a value is present and the given action
* is {@code null}, or no value is present and the given empty-based
* action is {@code null}.
* @since 9
*/
public void ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction) {
if (value != null) {
@ -182,14 +185,14 @@ public final class Optional<T> {
/**
* If a value is present, and the value matches the given predicate,
* return an {@code Optional} describing the value, otherwise return an
* returns an {@code Optional} describing the value, otherwise returns an
* empty {@code Optional}.
*
* @param predicate a predicate to apply to the value, if present
* @return an {@code Optional} describing the value of this {@code Optional}
* if a value is present and the value matches the given predicate,
* otherwise an empty {@code Optional}
* @throws NullPointerException if the predicate is null
* @param predicate the predicate to apply to a value, if present
* @return an {@code Optional} describing the value of this
* {@code Optional}, if a value is present and the value matches the
* given predicate, otherwise an empty {@code Optional}
* @throws NullPointerException if the predicate is {@code null}
*/
public Optional<T> filter(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@ -201,14 +204,18 @@ public final class Optional<T> {
}
/**
* If a value is present, apply the provided mapping function to it,
* and if the result is non-null, return an {@code Optional} describing the
* result. Otherwise return an empty {@code Optional}.
* If a value is present, returns an {@code Optional} describing (as if by
* {@link #ofNullable}) the result of applying the given mapping function to
* the value, otherwise returns an empty {@code Optional}.
*
* @apiNote This method supports post-processing on optional values, without
* <p>If the mapping function returns a {@code null} result then this method
* returns an empty {@code Optional}.
*
* @apiNote
* This method supports post-processing on {@code Optional} values, without
* the need to explicitly check for a return status. For example, the
* following code traverses a stream of file names, selects one that has
* not yet been processed, and then opens that file, returning an
* following code traverses a stream of file names, selects one that has not
* yet been processed, and then opens that file, returning an
* {@code Optional<FileInputStream>}:
*
* <pre>{@code
@ -222,12 +229,12 @@ public final class Optional<T> {
* {@code map} returns an {@code Optional<FileInputStream>} for the desired
* file if one exists.
*
* @param <U> The type of the result of the mapping function
* @param mapper a mapping function to apply to the value, if present
* @param mapper the mapping function to apply to a value, if present
* @param <U> The type of the value returned from the mapping function
* @return an {@code Optional} describing the result of applying a mapping
* function to the value of this {@code Optional}, if a value is present,
* otherwise an empty {@code Optional}
* @throws NullPointerException if the mapping function is null
* function to the value of this {@code Optional}, if a value is
* present, otherwise an empty {@code Optional}
* @throws NullPointerException if the mapping function is {@code null}
*/
public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
Objects.requireNonNull(mapper);
@ -239,21 +246,23 @@ public final class Optional<T> {
}
/**
* If a value is present, apply the provided {@code Optional}-bearing
* mapping function to it, return that result, otherwise return an empty
* {@code Optional}. This method is similar to {@link #map(Function)},
* but the provided mapper is one whose result is already an {@code Optional},
* and if invoked, {@code flatMap} does not wrap it with an additional
* If a value is present, returns the result of applying the given
* {@code Optional}-bearing mapping function to the value, otherwise returns
* an empty {@code Optional}.
*
* <p>This method is similar to {@link #map(Function)}, but the mapping
* function is one whose result is already an {@code Optional}, and if
* invoked, {@code flatMap} does not wrap it within an additional
* {@code Optional}.
*
* @param <U> The type parameter to the {@code Optional} returned by
* @param mapper a mapping function to apply to the value, if present
* the mapping function
* @param <U> The type of value of the {@code Optional} returned by the
* mapping function
* @param mapper the mapping function to apply to a value, if present
* @return the result of applying an {@code Optional}-bearing mapping
* function to the value of this {@code Optional}, if a value is present,
* otherwise an empty {@code Optional}
* @throws NullPointerException if the mapping function is null or returns
* a null result
* function to the value of this {@code Optional}, if a value is
* present, otherwise an empty {@code Optional}
* @throws NullPointerException if the mapping function is {@code null} or
* returns a {@code null} result
*/
public<U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper) {
Objects.requireNonNull(mapper);
@ -265,19 +274,41 @@ public final class Optional<T> {
}
/**
* If a value is present return a sequential {@link Stream} containing only
* that value, otherwise return an empty {@code Stream}.
* If a value is present, returns an {@code Optional} describing the value,
* otherwise returns an {@code Optional} produced by the supplying function.
*
* @apiNote This method can be used to transform a {@code Stream} of
* optional elements to a {@code Stream} of present value elements:
* @param supplier the supplying function that produces an {@code Optional}
* to be returned
* @return returns an {@code Optional} describing the value of this
* {@code Optional}, if a value is present, otherwise an
* {@code Optional} produced by the supplying function.
* @throws NullPointerException if the supplying function is {@code null} or
* produces a {@code null} result
* @since 9
*/
public Optional<T> or(Supplier<Optional<T>> supplier) {
Objects.requireNonNull(supplier);
if (isPresent()) {
return this;
} else {
return Objects.requireNonNull(supplier.get());
}
}
/**
* If a value is present, returns a sequential {@link Stream} containing
* only that value, otherwise returns an empty {@code Stream}.
*
* @apiNote
* This method can be used to transform a {@code Stream} of optional
* elements to a {@code Stream} of present value elements:
* <pre>{@code
* Stream<Optional<T>> os = ..
* Stream<T> s = os.flatMap(Optional::stream)
* }</pre>
*
* @return the optional value as a {@code Stream}
* @since 1.9
* @since 9
*/
public Stream<T> stream() {
if (!isPresent()) {
@ -288,10 +319,11 @@ public final class Optional<T> {
}
/**
* Return the value if present, otherwise return {@code other}.
* If a value is present, returns the value, otherwise returns
* {@code other}.
*
* @param other the value to be returned if there is no value present, may
* be null
* @param other the value to be returned, if no value is present.
* May be {@code null}.
* @return the value, if present, otherwise {@code other}
*/
public T orElse(T other) {
@ -299,34 +331,35 @@ public final class Optional<T> {
}
/**
* Return the value if present, otherwise invoke {@code other} and return
* the result of that invocation.
* If a value is present, returns the value, otherwise returns the result
* produced by the supplying function.
*
* @param other a {@code Supplier} whose result is returned if no value
* is present
* @return the value if present otherwise the result of {@code other.get()}
* @throws NullPointerException if value is not present and {@code other} is
* null
* @param supplier the supplying function that produces a value to be returned
* @return the value, if present, otherwise the result produced by the
* supplying function
* @throws NullPointerException if no value is present and the supplying
* function is {@code null}
*/
public T orElseGet(Supplier<? extends T> other) {
return value != null ? value : other.get();
public T orElseGet(Supplier<? extends T> supplier) {
return value != null ? value : supplier.get();
}
/**
* Return the contained value, if present, otherwise throw an exception
* to be created by the provided supplier.
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.
*
* @apiNote A method reference to the exception constructor with an empty
* argument list can be used as the supplier. For example,
* @apiNote
* A method reference to the exception constructor with an empty argument
* list can be used as the supplier. For example,
* {@code IllegalStateException::new}
*
* @param <X> Type of the exception to be thrown
* @param exceptionSupplier The supplier which will return the exception to
* be thrown
* @return the present value
* @throws X if there is no value present
* @throws NullPointerException if no value is present and
* {@code exceptionSupplier} is null
* @param exceptionSupplier the supplying function that produces an
* exception to be thrown
* @return the value, if present
* @throws X if no value is present
* @throws NullPointerException if no value is present and the exception
* supplying function is {@code null}
*/
public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
if (value != null) {
@ -337,8 +370,8 @@ public final class Optional<T> {
}
/**
* Indicates whether some other object is "equal to" this Optional. The
* other object is considered equal if:
* Indicates whether some other object is "equal to" this {@code Optional}.
* The other object is considered equal if:
* <ul>
* <li>it is also an {@code Optional} and;
* <li>both instances have no value present or;
@ -347,7 +380,7 @@ public final class Optional<T> {
*
* @param obj an object to be tested for equality
* @return {@code true} if the other object is "equal to" this object
* otherwise {@code false}
* otherwise {@code false}
*/
@Override
public boolean equals(Object obj) {
@ -364,10 +397,11 @@ public final class Optional<T> {
}
/**
* Returns the hash code value of the present value, if any, or 0 (zero) if
* no value is present.
* Returns the hash code of the value, if present, otherwise {@code 0}
* (zero) if no value is present.
*
* @return hash code value of the present value or 0 if no value is present
* @return hash code value of the present value or {@code 0} if no value is
* present
*/
@Override
public int hashCode() {
@ -375,13 +409,14 @@ public final class Optional<T> {
}
/**
* Returns a non-empty string representation of this Optional suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
* Returns a non-empty string representation of this {@code Optional}
* suitable for debugging. The exact presentation format is unspecified and
* may vary between implementations and versions.
*
* @implSpec If a value is present the result must include its string
* representation in the result. Empty and present Optionals must be
* unambiguously differentiable.
* @implSpec
* If a value is present the result must include its string representation
* in the result. Empty and present {@code Optional}s must be unambiguously
* differentiable.
*
* @return the string representation of this instance
*/

View File

@ -30,15 +30,15 @@ import java.util.function.Supplier;
import java.util.stream.DoubleStream;
/**
* A container object which may or may not contain a {@code double} value.
* If a value is present, {@code isPresent()} will return {@code true} and
* {@code getAsDouble()} will return the value.
* A container object which may or may not contain a {@code double} value. If a
* value is present, {@code isPresent()} returns {@code true} and
* {@code getAsDouble()} returns the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(double) orElse()}
* (return a default value if value not present) and
* {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (perform an
* action if the value is present).
* (returns a default value if no value is present) and
* {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (performs
* an action if a value is present).
*
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
* class; use of identity-sensitive operations (including reference equality
@ -71,12 +71,13 @@ public final class OptionalDouble {
}
/**
* Returns an empty {@code OptionalDouble} instance. No value is present for this
* OptionalDouble.
* Returns an empty {@code OptionalDouble} instance. No value is present
* for this {@code OptionalDouble}.
*
* @apiNote Though it may be tempting to do so, avoid testing if an object
* is empty by comparing with {@code ==} against instances returned by
* {@code Option.empty()}. There is no guarantee that it is a singleton.
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* {@code OptionalDouble.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
*
* @return an empty {@code OptionalDouble}.
@ -86,9 +87,9 @@ public final class OptionalDouble {
}
/**
* Construct an instance with the value present.
* Construct an instance with the described value.
*
* @param value the double value to be present.
* @param value the double value to describe.
*/
private OptionalDouble(double value) {
this.isPresent = true;
@ -96,9 +97,9 @@ public final class OptionalDouble {
}
/**
* Return an {@code OptionalDouble} with the specified value present.
* Returns an {@code OptionalDouble} describing the given value.
*
* @param value the value to be present
* @param value the value to describe
* @return an {@code OptionalDouble} with the value present
*/
public static OptionalDouble of(double value) {
@ -106,12 +107,11 @@ public final class OptionalDouble {
}
/**
* If a value is present in this {@code OptionalDouble}, returns the value,
* otherwise throws {@code NoSuchElementException}.
*
* @return the value held by this {@code OptionalDouble}
* @throws NoSuchElementException if there is no value present
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the value described by this {@code OptionalDouble}
* @throws NoSuchElementException if no value is present
* @see OptionalDouble#isPresent()
*/
public double getAsDouble() {
@ -122,21 +122,21 @@ public final class OptionalDouble {
}
/**
* Return {@code true} if there is a value present, otherwise {@code false}.
* If a value is present, returns {@code true}, otherwise {@code false}.
*
* @return {@code true} if there is a value present, otherwise {@code false}
* @return {@code true} if a value is present, otherwise {@code false}
*/
public boolean isPresent() {
return isPresent;
}
/**
* If a value is present, perform the given action with the value,
* otherwise do nothing.
* If a value is present, performs the given action with the value,
* otherwise does nothing.
*
* @param action the action to be performed if a value is present
* @throws NullPointerException if a value is present and {@code action} is
* null
* @param action the action to be performed, if a value is present
* @throws NullPointerException if value is present and the given action is
* {@code null}
*/
public void ifPresent(DoubleConsumer action) {
if (isPresent) {
@ -145,15 +145,16 @@ public final class OptionalDouble {
}
/**
* If a value is present, perform the given action with the value,
* otherwise perform the given empty-based action.
* If a value is present, performs the given action with the value,
* otherwise performs the given empty-based action.
*
* @param action the action to be performed if a value is present
* @param emptyAction the empty-based action to be performed if a value is
* not present
* @throws NullPointerException if a value is present and {@code action} is
* null, or a value is not present and {@code emptyAction} is null.
* @since 1.9
* @param action the action to be performed, if a value is present
* @param emptyAction the empty-based action to be performed, if no value is
* present
* @throws NullPointerException if a value is present and the given action
* is {@code null}, or no value is present and the given empty-based
* action is {@code null}.
* @since 9
*/
public void ifPresentOrElse(DoubleConsumer action, Runnable emptyAction) {
if (isPresent) {
@ -164,19 +165,20 @@ public final class OptionalDouble {
}
/**
* If a value is present return a sequential {@link DoubleStream} containing
* only that value, otherwise return an empty {@code DoubleStream}.
*
* @apiNote This method can be used to transform a {@code Stream} of
* optional doubles to a {@code DoubleStream} of present doubles:
* If a value is present, returns a sequential {@link DoubleStream}
* containing only that value, otherwise returns an empty
* {@code DoubleStream}.
*
* @apiNote
* This method can be used to transform a {@code Stream} of optional doubles
* to a {@code DoubleStream} of present doubles:
* <pre>{@code
* Stream<OptionalDouble> os = ..
* DoubleStream s = os.flatMapToDouble(OptionalDouble::stream)
* }</pre>
*
* @return the optional value as a {@code DoubleStream}
* @since 1.9
* @since 9
*/
public DoubleStream stream() {
if (isPresent) {
@ -187,9 +189,10 @@ public final class OptionalDouble {
}
/**
* Return the value if present, otherwise return {@code other}.
* If a value is present, returns the value, otherwise returns
* {@code other}.
*
* @param other the value to be returned if there is no value present
* @param other the value to be returned, if no value is present
* @return the value, if present, otherwise {@code other}
*/
public double orElse(double other) {
@ -197,34 +200,35 @@ public final class OptionalDouble {
}
/**
* Return the value if present, otherwise invoke {@code other} and return
* the result of that invocation.
* If a value is present, returns the value, otherwise returns the result
* produced by the supplying function.
*
* @param other a {@code DoubleSupplier} whose result is returned if no value
* is present
* @return the value if present otherwise the result of {@code other.getAsDouble()}
* @throws NullPointerException if value is not present and {@code other} is
* null
* @param supplier the supplying function that produces a value to be returned
* @return the value, if present, otherwise the result produced by the
* supplying function
* @throws NullPointerException if no value is present and the supplying
* function is {@code null}
*/
public double orElseGet(DoubleSupplier other) {
return isPresent ? value : other.getAsDouble();
public double orElseGet(DoubleSupplier supplier) {
return isPresent ? value : supplier.getAsDouble();
}
/**
* Return the contained value, if present, otherwise throw an exception
* to be created by the provided supplier.
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.
*
* @apiNote A method reference to the exception constructor with an empty
* argument list can be used as the supplier. For example,
* @apiNote
* A method reference to the exception constructor with an empty argument
* list can be used as the supplier. For example,
* {@code IllegalStateException::new}
*
* @param <X> Type of the exception to be thrown
* @param exceptionSupplier The supplier which will return the exception to
* be thrown
* @return the present value
* @throws X if there is no value present
* @throws NullPointerException if no value is present and
* {@code exceptionSupplier} is null
* @param exceptionSupplier the supplying function that produces an
* exception to be thrown
* @return the value, if present
* @throws X if no value is present
* @throws NullPointerException if no value is present and the exception
* supplying function is {@code null}
*/
public<X extends Throwable> double orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
if (isPresent) {
@ -235,17 +239,18 @@ public final class OptionalDouble {
}
/**
* Indicates whether some other object is "equal to" this OptionalDouble. The
* other object is considered equal if:
* Indicates whether some other object is "equal to" this
* {@code OptionalDouble}. The other object is considered equal if:
* <ul>
* <li>it is also an {@code OptionalDouble} and;
* <li>both instances have no value present or;
* <li>the present values are "equal to" each other via {@code Double.compare() == 0}.
* <li>the present values are "equal to" each other via
* {@code Double.compare() == 0}.
* </ul>
*
* @param obj an object to be tested for equality
* @return {@code true} if the other object is "equal to" this object
* otherwise {@code false}
* otherwise {@code false}
*/
@Override
public boolean equals(Object obj) {
@ -264,10 +269,11 @@ public final class OptionalDouble {
}
/**
* Returns the hash code value of the present value, if any, or 0 (zero) if
* no value is present.
* Returns the hash code of the value, if present, otherwise {@code 0}
* (zero) if no value is present.
*
* @return hash code value of the present value or 0 if no value is present
* @return hash code value of the present value or {@code 0} if no value is
* present
*/
@Override
public int hashCode() {
@ -275,14 +281,13 @@ public final class OptionalDouble {
}
/**
* {@inheritDoc}
* Returns a non-empty string representation of this {@code OptionalDouble}
* suitable for debugging. The exact presentation format is unspecified and
* may vary between implementations and versions.
*
* Returns a non-empty string representation of this object suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
*
* @implSpec If a value is present the result must include its string
* representation in the result. Empty and present instances must be
* @implSpec
* If a value is present the result must include its string representation
* in the result. Empty and present {@code OptionalDouble}s must be
* unambiguously differentiable.
*
* @return the string representation of this instance

View File

@ -30,15 +30,15 @@ import java.util.function.Supplier;
import java.util.stream.IntStream;
/**
* A container object which may or may not contain a {@code int} value.
* If a value is present, {@code isPresent()} will return {@code true} and
* {@code getAsInt()} will return the value.
* A container object which may or may not contain an {@code int} value. If a
* value is present, {@code isPresent()} returns {@code true} and
* {@code getAsInt()} returns the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(int) orElse()}
* (return a default value if value not present) and
* {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (perform an
* action if the value is present).
* (returns a default value if no value is present) and
* {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (performs an
* action if a value is present).
*
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
* class; use of identity-sensitive operations (including reference equality
@ -71,24 +71,25 @@ public final class OptionalInt {
}
/**
* Returns an empty {@code OptionalInt} instance. No value is present for this
* OptionalInt.
* Returns an empty {@code OptionalInt} instance. No value is present for
* this {@code OptionalInt}.
*
* @apiNote Though it may be tempting to do so, avoid testing if an object
* is empty by comparing with {@code ==} against instances returned by
* {@code Option.empty()}. There is no guarantee that it is a singleton.
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* {@code OptionalInt.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
*
* @return an empty {@code OptionalInt}
* @return an empty {@code OptionalInt}
*/
public static OptionalInt empty() {
return EMPTY;
}
/**
* Construct an instance with the value present.
* Construct an instance with the described value.
*
* @param value the int value to be present
* @param value the int value to describe
*/
private OptionalInt(int value) {
this.isPresent = true;
@ -96,9 +97,9 @@ public final class OptionalInt {
}
/**
* Return an {@code OptionalInt} with the specified value present.
* Returns an {@code OptionalInt} describing the given value.
*
* @param value the value to be present
* @param value the value to describe
* @return an {@code OptionalInt} with the value present
*/
public static OptionalInt of(int value) {
@ -106,12 +107,11 @@ public final class OptionalInt {
}
/**
* If a value is present in this {@code OptionalInt}, returns the value,
* otherwise throws {@code NoSuchElementException}.
*
* @return the value held by this {@code OptionalInt}
* @throws NoSuchElementException if there is no value present
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the value described by this {@code OptionalInt}
* @throws NoSuchElementException if no value is present
* @see OptionalInt#isPresent()
*/
public int getAsInt() {
@ -122,21 +122,21 @@ public final class OptionalInt {
}
/**
* Return {@code true} if there is a value present, otherwise {@code false}.
* If a value is present, returns {@code true}, otherwise {@code false}.
*
* @return {@code true} if there is a value present, otherwise {@code false}
* @return {@code true} if a value is present, otherwise {@code false}
*/
public boolean isPresent() {
return isPresent;
}
/**
* If a value is present, perform the given action with the value,
* otherwise do nothing.
* If a value is present, performs the given action with the value,
* otherwise does nothing.
*
* @param action the action to be performed if a value is present
* @throws NullPointerException if value is present and {@code action} is
* null
* @param action the action to be performed, if a value is present
* @throws NullPointerException if value is present and the given action is
* {@code null}
*/
public void ifPresent(IntConsumer action) {
if (isPresent) {
@ -145,15 +145,16 @@ public final class OptionalInt {
}
/**
* If a value is present, perform the given action with the value,
* otherwise perform the given empty-based action.
* If a value is present, performs the given action with the value,
* otherwise performs the given empty-based action.
*
* @param action the action to be performed if a value is present
* @param emptyAction the empty-based action to be performed if a value is
* not present
* @throws NullPointerException if a value is present and {@code action} is
* null, or a value is not present and {@code emptyAction} is null.
* @since 1.9
* @param action the action to be performed, if a value is present
* @param emptyAction the empty-based action to be performed, if no value is
* present
* @throws NullPointerException if a value is present and the given action
* is {@code null}, or no value is present and the given empty-based
* action is {@code null}.
* @since 9
*/
public void ifPresentOrElse(IntConsumer action, Runnable emptyAction) {
if (isPresent) {
@ -164,19 +165,19 @@ public final class OptionalInt {
}
/**
* If a value is present return a sequential {@link IntStream} containing
* only that value, otherwise return an empty {@code IntStream}.
*
* @apiNote This method can be used to transform a {@code Stream} of
* optional integers to an {@code IntStream} of present integers:
* If a value is present, returns a sequential {@link IntStream} containing
* only that value, otherwise returns an empty {@code IntStream}.
*
* @apiNote
* This method can be used to transform a {@code Stream} of optional
* integers to an {@code IntStream} of present integers:
* <pre>{@code
* Stream<OptionalInt> os = ..
* IntStream s = os.flatMapToInt(OptionalInt::stream)
* }</pre>
*
* @return the optional value as an {@code IntStream}
* @since 1.9
* @since 9
*/
public IntStream stream() {
if (isPresent) {
@ -187,9 +188,10 @@ public final class OptionalInt {
}
/**
* Return the value if present, otherwise return {@code other}.
* If a value is present, returns the value, otherwise returns
* {@code other}.
*
* @param other the value to be returned if there is no value present
* @param other the value to be returned, if no value is present
* @return the value, if present, otherwise {@code other}
*/
public int orElse(int other) {
@ -197,34 +199,35 @@ public final class OptionalInt {
}
/**
* Return the value if present, otherwise invoke {@code other} and return
* the result of that invocation.
* If a value is present, returns the value, otherwise returns the result
* produced by the supplying function.
*
* @param other a {@code IntSupplier} whose result is returned if no value
* is present
* @return the value if present otherwise the result of {@code other.getAsInt()}
* @throws NullPointerException if value is not present and {@code other} is
* null
* @param supplier the supplying function that produces a value to be returned
* @return the value, if present, otherwise the result produced by the
* supplying function
* @throws NullPointerException if no value is present and the supplying
* function is {@code null}
*/
public int orElseGet(IntSupplier other) {
return isPresent ? value : other.getAsInt();
public int orElseGet(IntSupplier supplier) {
return isPresent ? value : supplier.getAsInt();
}
/**
* Return the contained value, if present, otherwise throw an exception
* to be created by the provided supplier.
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.
*
* @apiNote A method reference to the exception constructor with an empty
* argument list can be used as the supplier. For example,
* @apiNote
* A method reference to the exception constructor with an empty argument
* list can be used as the supplier. For example,
* {@code IllegalStateException::new}
*
* @param <X> Type of the exception to be thrown
* @param exceptionSupplier The supplier which will return the exception to
* be thrown
* @return the present value
* @throws X if there is no value present
* @throws NullPointerException if no value is present and
* {@code exceptionSupplier} is null
* @param exceptionSupplier the supplying function that produces an
* exception to be thrown
* @return the value, if present
* @throws X if no value is present
* @throws NullPointerException if no value is present and the exception
* supplying function is {@code null}
*/
public<X extends Throwable> int orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
if (isPresent) {
@ -235,8 +238,8 @@ public final class OptionalInt {
}
/**
* Indicates whether some other object is "equal to" this OptionalInt. The
* other object is considered equal if:
* Indicates whether some other object is "equal to" this
* {@code OptionalInt}. The other object is considered equal if:
* <ul>
* <li>it is also an {@code OptionalInt} and;
* <li>both instances have no value present or;
@ -245,7 +248,7 @@ public final class OptionalInt {
*
* @param obj an object to be tested for equality
* @return {@code true} if the other object is "equal to" this object
* otherwise {@code false}
* otherwise {@code false}
*/
@Override
public boolean equals(Object obj) {
@ -264,10 +267,11 @@ public final class OptionalInt {
}
/**
* Returns the hash code value of the present value, if any, or 0 (zero) if
* no value is present.
* Returns the hash code of the value, if present, otherwise {@code 0}
* (zero) if no value is present.
*
* @return hash code value of the present value or 0 if no value is present
* @return hash code value of the present value or {@code 0} if no value is
* present
*/
@Override
public int hashCode() {
@ -275,14 +279,13 @@ public final class OptionalInt {
}
/**
* {@inheritDoc}
* Returns a non-empty string representation of this {@code OptionalInt}
* suitable for debugging. The exact presentation format is unspecified and
* may vary between implementations and versions.
*
* Returns a non-empty string representation of this object suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
*
* @implSpec If a value is present the result must include its string
* representation in the result. Empty and present instances must be
* @implSpec
* If a value is present the result must include its string representation
* in the result. Empty and present {@code OptionalInt}s must be
* unambiguously differentiable.
*
* @return the string representation of this instance

View File

@ -30,15 +30,15 @@ import java.util.function.Supplier;
import java.util.stream.LongStream;
/**
* A container object which may or may not contain a {@code long} value.
* If a value is present, {@code isPresent()} will return {@code true} and
* {@code getAsLong()} will return the value.
* A container object which may or may not contain a {@code long} value. If a
* value is present, {@code isPresent()} returns {@code true} and
* {@code getAsLong()} returns the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(long) orElse()}
* (return a default value if value not present) and
* {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (perform an
* action if the value is present).
* (returns a default value if no value is present) and
* {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (performs an
* action if a value is present).
*
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
* class; use of identity-sensitive operations (including reference equality
@ -71,24 +71,25 @@ public final class OptionalLong {
}
/**
* Returns an empty {@code OptionalLong} instance. No value is present for this
* OptionalLong.
* Returns an empty {@code OptionalLong} instance. No value is present for
* this {@code OptionalLong}.
*
* @apiNote Though it may be tempting to do so, avoid testing if an object
* is empty by comparing with {@code ==} against instances returned by
* {@code Option.empty()}. There is no guarantee that it is a singleton.
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* {@code OptionalLong.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
*
* @return an empty {@code OptionalLong}.
* @return an empty {@code OptionalLong}.
*/
public static OptionalLong empty() {
return EMPTY;
}
/**
* Construct an instance with the value present.
* Construct an instance with the described value.
*
* @param value the long value to be present
* @param value the long value to describe
*/
private OptionalLong(long value) {
this.isPresent = true;
@ -96,9 +97,9 @@ public final class OptionalLong {
}
/**
* Return an {@code OptionalLong} with the specified value present.
* Returns an {@code OptionalLong} describing the given value.
*
* @param value the value to be present
* @param value the value to describe
* @return an {@code OptionalLong} with the value present
*/
public static OptionalLong of(long value) {
@ -106,12 +107,11 @@ public final class OptionalLong {
}
/**
* If a value is present in this {@code OptionalLong}, returns the value,
* otherwise throws {@code NoSuchElementException}.
*
* @return the value held by this {@code OptionalLong}
* @throws NoSuchElementException if there is no value present
* If a value is present, returns the value, otherwise throws
* {@code NoSuchElementException}.
*
* @return the value described by this {@code OptionalLong}
* @throws NoSuchElementException if no value is present
* @see OptionalLong#isPresent()
*/
public long getAsLong() {
@ -122,21 +122,21 @@ public final class OptionalLong {
}
/**
* Return {@code true} if there is a value present, otherwise {@code false}.
* If a value is present, returns {@code true}, otherwise {@code false}.
*
* @return {@code true} if there is a value present, otherwise {@code false}
* @return {@code true} if a value is present, otherwise {@code false}
*/
public boolean isPresent() {
return isPresent;
}
/**
* If a value is present, perform the given action with the value,
* otherwise do nothing.
* If a value is present, performs the given action with the value,
* otherwise does nothing.
*
* @param action the action to be performed if a value is present
* @throws NullPointerException if a value is present and {@code action} is
* null
* @param action the action to be performed, if a value is present
* @throws NullPointerException if value is present and the given action is
* {@code null}
*/
public void ifPresent(LongConsumer action) {
if (isPresent) {
@ -145,15 +145,16 @@ public final class OptionalLong {
}
/**
* If a value is present, perform the given action with the value,
* otherwise perform the given empty-based action.
* If a value is present, performs the given action with the value,
* otherwise performs the given empty-based action.
*
* @param action the action to be performed if a value is present
* @param emptyAction the empty-based action to be performed if a value is
* not present
* @throws NullPointerException if a value is present and {@code action} is
* null, or a value is not present and {@code emptyAction} is null.
* @since 1.9
* @param action the action to be performed, if a value is present
* @param emptyAction the empty-based action to be performed, if no value is
* present
* @throws NullPointerException if a value is present and the given action
* is {@code null}, or no value is present and the given empty-based
* action is {@code null}.
* @since 9
*/
public void ifPresentOrElse(LongConsumer action, Runnable emptyAction) {
if (isPresent) {
@ -164,19 +165,19 @@ public final class OptionalLong {
}
/**
* If a value is present return a sequential {@link LongStream} containing
* only that value, otherwise return an empty {@code LongStream}.
*
* @apiNote This method can be used to transform a {@code Stream} of
* optional longs to a {@code LongStream} of present longs:
* If a value is present, returns a sequential {@link LongStream} containing
* only that value, otherwise returns an empty {@code LongStream}.
*
* @apiNote
* This method can be used to transform a {@code Stream} of optional longs
* to an {@code LongStream} of present longs:
* <pre>{@code
* Stream<OptionalLong> os = ..
* LongStream s = os.flatMapToLong(OptionalLong::stream)
* }</pre>
*
* @return the optional value as a {@code LongStream}
* @since 1.9
* @return the optional value as an {@code LongStream}
* @since 9
*/
public LongStream stream() {
if (isPresent) {
@ -187,9 +188,10 @@ public final class OptionalLong {
}
/**
* Return the value if present, otherwise return {@code other}.
* If a value is present, returns the value, otherwise returns
* {@code other}.
*
* @param other the value to be returned if there is no value present
* @param other the value to be returned, if no value is present
* @return the value, if present, otherwise {@code other}
*/
public long orElse(long other) {
@ -197,34 +199,35 @@ public final class OptionalLong {
}
/**
* Return the value if present, otherwise invoke {@code other} and return
* the result of that invocation.
* If a value is present, returns the value, otherwise returns the result
* produced by the supplying function.
*
* @param other a {@code LongSupplier} whose result is returned if no value
* is present
* @return the value if present otherwise the result of {@code other.getAsLong()}
* @throws NullPointerException if value is not present and {@code other} is
* null
* @param supplier the supplying function that produces a value to be returned
* @return the value, if present, otherwise the result produced by the
* supplying function
* @throws NullPointerException if no value is present and the supplying
* function is {@code null}
*/
public long orElseGet(LongSupplier other) {
return isPresent ? value : other.getAsLong();
public long orElseGet(LongSupplier supplier) {
return isPresent ? value : supplier.getAsLong();
}
/**
* Return the contained value, if present, otherwise throw an exception
* to be created by the provided supplier.
* If a value is present, returns the value, otherwise throws an exception
* produced by the exception supplying function.
*
* @apiNote A method reference to the exception constructor with an empty
* argument list can be used as the supplier. For example,
* @apiNote
* A method reference to the exception constructor with an empty argument
* list can be used as the supplier. For example,
* {@code IllegalStateException::new}
*
* @param <X> Type of the exception to be thrown
* @param exceptionSupplier The supplier which will return the exception to
* be thrown
* @return the present value
* @throws X if there is no value present
* @throws NullPointerException if no value is present and
* {@code exceptionSupplier} is null
* @param exceptionSupplier the supplying function that produces an
* exception to be thrown
* @return the value, if present
* @throws X if no value is present
* @throws NullPointerException if no value is present and the exception
* supplying function is {@code null}
*/
public<X extends Throwable> long orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
if (isPresent) {
@ -235,8 +238,8 @@ public final class OptionalLong {
}
/**
* Indicates whether some other object is "equal to" this OptionalLong. The
* other object is considered equal if:
* Indicates whether some other object is "equal to" this
* {@code OptionalLong}. The other object is considered equal if:
* <ul>
* <li>it is also an {@code OptionalLong} and;
* <li>both instances have no value present or;
@ -245,7 +248,7 @@ public final class OptionalLong {
*
* @param obj an object to be tested for equality
* @return {@code true} if the other object is "equal to" this object
* otherwise {@code false}
* otherwise {@code false}
*/
@Override
public boolean equals(Object obj) {
@ -264,10 +267,11 @@ public final class OptionalLong {
}
/**
* Returns the hash code value of the present value, if any, or 0 (zero) if
* no value is present.
* Returns the hash code of the value, if present, otherwise {@code 0}
* (zero) if no value is present.
*
* @return hash code value of the present value or 0 if no value is present
* @return hash code value of the present value or {@code 0} if no value is
* present
*/
@Override
public int hashCode() {
@ -275,14 +279,13 @@ public final class OptionalLong {
}
/**
* {@inheritDoc}
* Returns a non-empty string representation of this {@code OptionalLong}
* suitable for debugging. The exact presentation format is unspecified and
* may vary between implementations and versions.
*
* Returns a non-empty string representation of this object suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
*
* @implSpec If a value is present the result must include its string
* representation in the result. Empty and present instances must be
* @implSpec
* If a value is present the result must include its string representation
* in the result. Empty and present {@code OptionalLong}s must be
* unambiguously differentiable.
*
* @return the string representation of this instance

View File

@ -77,7 +77,7 @@ import java.util.function.Consumer;
*
* @since 1.5
* @author Josh Bloch, Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this queue
*/
public class PriorityQueue<E> extends AbstractQueue<E>
implements java.io.Serializable {
@ -99,7 +99,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
/**
* The number of elements in the priority queue.
*/
private int size = 0;
int size;
/**
* The comparator, or null if priority queue uses elements'
@ -111,7 +111,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* The number of times this priority queue has been
* <i>structurally modified</i>. See AbstractList for gory details.
*/
transient int modCount = 0; // non-private to simplify nested class access
transient int modCount; // non-private to simplify nested class access
/**
* Creates a {@code PriorityQueue} with the default initial
@ -448,7 +448,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* The following code can be used to dump the queue into a newly
* allocated array of {@code String}:
*
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
@ -489,7 +489,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* Index (into queue array) of element to be returned by
* subsequent call to next.
*/
private int cursor = 0;
private int cursor;
/**
* Index of element returned by most recent call to next,
@ -509,13 +509,13 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* We expect that most iterations, even those involving removals,
* will not need to store elements in this field.
*/
private ArrayDeque<E> forgetMeNot = null;
private ArrayDeque<E> forgetMeNot;
/**
* Element returned by the most recent call to next iff that
* element was drawn from the forgetMeNot list.
*/
private E lastRetElt = null;
private E lastRetElt;
/**
* The modCount value that the iterator believes that the backing
@ -609,7 +609,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* avoid missing traversing elements.
*/
@SuppressWarnings("unchecked")
private E removeAt(int i) {
E removeAt(int i) {
// assert i >= 0 && i < size;
modCount++;
int s = --size;
@ -756,6 +756,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* emitted (int), followed by all of its elements
* (each an {@code Object}) in the proper order.
* @param s the stream
* @throws java.io.IOException if an I/O error occurs
*/
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
@ -775,6 +776,9 @@ public class PriorityQueue<E> extends AbstractQueue<E>
* (that is, deserializes it).
*
* @param s the stream
* @throws ClassNotFoundException if the class of a serialized object
* could not be found
* @throws java.io.IOException if an I/O error occurs
*/
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
@ -822,9 +826,9 @@ public class PriorityQueue<E> extends AbstractQueue<E>
private int fence; // -1 until first use
private int expectedModCount; // initialized when fence set
/** Creates new spliterator covering the given range */
/** Creates new spliterator covering the given range. */
PriorityQueueSpliterator(PriorityQueue<E> pq, int origin, int fence,
int expectedModCount) {
int expectedModCount) {
this.pq = pq;
this.index = origin;
this.fence = fence;

View File

@ -139,7 +139,7 @@ package java.util;
* @see java.util.concurrent.PriorityBlockingQueue
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this queue
*/
public interface Queue<E> extends Collection<E> {
/**

View File

@ -26,13 +26,13 @@
package java.util;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.DoubleConsumer;
import java.util.function.IntConsumer;
import java.util.function.LongConsumer;
import java.util.function.DoubleConsumer;
import java.util.stream.StreamSupport;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.DoubleStream;
import java.util.stream.StreamSupport;
/**
* A generator of uniform pseudorandom values applicable for use in
@ -52,15 +52,15 @@ import java.util.stream.DoubleStream;
* types and ranges, but similar properties are expected to hold, at
* least approximately, for others as well. The <em>period</em>
* (length of any series of generated values before it repeats) is at
* least 2<sup>64</sup>. </li>
* least 2<sup>64</sup>.
*
* <li> Method {@link #split} constructs and returns a new
* <li>Method {@link #split} constructs and returns a new
* SplittableRandom instance that shares no mutable state with the
* current instance. However, with very high probability, the
* values collectively generated by the two objects have the same
* statistical properties as if the same quantity of values were
* generated by a single thread using a single {@code
* SplittableRandom} object. </li>
* SplittableRandom} object.
*
* <li>Instances of SplittableRandom are <em>not</em> thread-safe.
* They are designed to be split, not shared, across threads. For
@ -71,7 +71,7 @@ import java.util.stream.DoubleStream;
*
* <li>This class provides additional methods for generating random
* streams, that employ the above techniques when used in {@code
* stream.parallel()} mode.</li>
* stream.parallel()} mode.
*
* </ul>
*
@ -240,9 +240,9 @@ public final class SplittableRandom {
}
// IllegalArgumentException messages
static final String BadBound = "bound must be positive";
static final String BadRange = "bound must be greater than origin";
static final String BadSize = "size must be non-negative";
static final String BAD_BOUND = "bound must be positive";
static final String BAD_RANGE = "bound must be greater than origin";
static final String BAD_SIZE = "size must be non-negative";
/*
* Internal versions of nextX methods used by streams, as well as
@ -416,7 +416,7 @@ public final class SplittableRandom {
*/
public int nextInt(int bound) {
if (bound <= 0)
throw new IllegalArgumentException(BadBound);
throw new IllegalArgumentException(BAD_BOUND);
// Specialize internalNextInt for origin 0
int r = mix32(nextSeed());
int m = bound - 1;
@ -444,7 +444,7 @@ public final class SplittableRandom {
*/
public int nextInt(int origin, int bound) {
if (origin >= bound)
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return internalNextInt(origin, bound);
}
@ -468,7 +468,7 @@ public final class SplittableRandom {
*/
public long nextLong(long bound) {
if (bound <= 0)
throw new IllegalArgumentException(BadBound);
throw new IllegalArgumentException(BAD_BOUND);
// Specialize internalNextLong for origin 0
long r = mix64(nextSeed());
long m = bound - 1;
@ -496,7 +496,7 @@ public final class SplittableRandom {
*/
public long nextLong(long origin, long bound) {
if (origin >= bound)
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return internalNextLong(origin, bound);
}
@ -522,7 +522,7 @@ public final class SplittableRandom {
*/
public double nextDouble(double bound) {
if (!(bound > 0.0))
throw new IllegalArgumentException(BadBound);
throw new IllegalArgumentException(BAD_BOUND);
double result = (mix64(nextSeed()) >>> 11) * DOUBLE_UNIT * bound;
return (result < bound) ? result : // correct for rounding
Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1);
@ -541,7 +541,7 @@ public final class SplittableRandom {
*/
public double nextDouble(double origin, double bound) {
if (!(origin < bound))
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return internalNextDouble(origin, bound);
}
@ -569,7 +569,7 @@ public final class SplittableRandom {
*/
public IntStream ints(long streamSize) {
if (streamSize < 0L)
throw new IllegalArgumentException(BadSize);
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.intStream
(new RandomIntsSpliterator
(this, 0L, streamSize, Integer.MAX_VALUE, 0),
@ -610,9 +610,9 @@ public final class SplittableRandom {
public IntStream ints(long streamSize, int randomNumberOrigin,
int randomNumberBound) {
if (streamSize < 0L)
throw new IllegalArgumentException(BadSize);
throw new IllegalArgumentException(BAD_SIZE);
if (randomNumberOrigin >= randomNumberBound)
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.intStream
(new RandomIntsSpliterator
(this, 0L, streamSize, randomNumberOrigin, randomNumberBound),
@ -636,7 +636,7 @@ public final class SplittableRandom {
*/
public IntStream ints(int randomNumberOrigin, int randomNumberBound) {
if (randomNumberOrigin >= randomNumberBound)
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.intStream
(new RandomIntsSpliterator
(this, 0L, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound),
@ -655,7 +655,7 @@ public final class SplittableRandom {
*/
public LongStream longs(long streamSize) {
if (streamSize < 0L)
throw new IllegalArgumentException(BadSize);
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.longStream
(new RandomLongsSpliterator
(this, 0L, streamSize, Long.MAX_VALUE, 0L),
@ -696,9 +696,9 @@ public final class SplittableRandom {
public LongStream longs(long streamSize, long randomNumberOrigin,
long randomNumberBound) {
if (streamSize < 0L)
throw new IllegalArgumentException(BadSize);
throw new IllegalArgumentException(BAD_SIZE);
if (randomNumberOrigin >= randomNumberBound)
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.longStream
(new RandomLongsSpliterator
(this, 0L, streamSize, randomNumberOrigin, randomNumberBound),
@ -722,7 +722,7 @@ public final class SplittableRandom {
*/
public LongStream longs(long randomNumberOrigin, long randomNumberBound) {
if (randomNumberOrigin >= randomNumberBound)
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.longStream
(new RandomLongsSpliterator
(this, 0L, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound),
@ -741,7 +741,7 @@ public final class SplittableRandom {
*/
public DoubleStream doubles(long streamSize) {
if (streamSize < 0L)
throw new IllegalArgumentException(BadSize);
throw new IllegalArgumentException(BAD_SIZE);
return StreamSupport.doubleStream
(new RandomDoublesSpliterator
(this, 0L, streamSize, Double.MAX_VALUE, 0.0),
@ -784,9 +784,9 @@ public final class SplittableRandom {
public DoubleStream doubles(long streamSize, double randomNumberOrigin,
double randomNumberBound) {
if (streamSize < 0L)
throw new IllegalArgumentException(BadSize);
throw new IllegalArgumentException(BAD_SIZE);
if (!(randomNumberOrigin < randomNumberBound))
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.doubleStream
(new RandomDoublesSpliterator
(this, 0L, streamSize, randomNumberOrigin, randomNumberBound),
@ -810,7 +810,7 @@ public final class SplittableRandom {
*/
public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound) {
if (!(randomNumberOrigin < randomNumberBound))
throw new IllegalArgumentException(BadRange);
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.doubleStream
(new RandomDoublesSpliterator
(this, 0L, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound),
@ -825,7 +825,8 @@ public final class SplittableRandom {
* approach. The long and double versions of this class are
* identical except for types.
*/
static final class RandomIntsSpliterator implements Spliterator.OfInt {
private static final class RandomIntsSpliterator
implements Spliterator.OfInt {
final SplittableRandom rng;
long index;
final long fence;
@ -880,7 +881,8 @@ public final class SplittableRandom {
/**
* Spliterator for long streams.
*/
static final class RandomLongsSpliterator implements Spliterator.OfLong {
private static final class RandomLongsSpliterator
implements Spliterator.OfLong {
final SplittableRandom rng;
long index;
final long fence;
@ -936,7 +938,8 @@ public final class SplittableRandom {
/**
* Spliterator for double streams.
*/
static final class RandomDoublesSpliterator implements Spliterator.OfDouble {
private static final class RandomDoublesSpliterator
implements Spliterator.OfDouble {
final SplittableRandom rng;
long index;
final long fence;

View File

@ -34,7 +34,13 @@
*/
package java.util.concurrent;
import java.util.*;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/**
* Provides default implementations of {@link ExecutorService}
@ -51,7 +57,7 @@ import java.util.*;
* <p><b>Extension example</b>. Here is a sketch of a class
* that customizes {@link ThreadPoolExecutor} to use
* a {@code CustomTask} class instead of the default {@code FutureTask}:
* <pre> {@code
* <pre> {@code
* public class CustomThreadPoolExecutor extends ThreadPoolExecutor {
*
* static class CustomTask<V> implements RunnableFuture<V> {...}
@ -146,7 +152,7 @@ public abstract class AbstractExecutorService implements ExecutorService {
int ntasks = tasks.size();
if (ntasks == 0)
throw new IllegalArgumentException();
ArrayList<Future<T>> futures = new ArrayList<Future<T>>(ntasks);
ArrayList<Future<T>> futures = new ArrayList<>(ntasks);
ExecutorCompletionService<T> ecs =
new ExecutorCompletionService<T>(this);
@ -179,7 +185,7 @@ public abstract class AbstractExecutorService implements ExecutorService {
else if (active == 0)
break;
else if (timed) {
f = ecs.poll(nanos, TimeUnit.NANOSECONDS);
f = ecs.poll(nanos, NANOSECONDS);
if (f == null)
throw new TimeoutException();
nanos = deadline - System.nanoTime();
@ -204,8 +210,7 @@ public abstract class AbstractExecutorService implements ExecutorService {
throw ee;
} finally {
for (int i = 0, size = futures.size(); i < size; i++)
futures.get(i).cancel(true);
cancelAll(futures);
}
}
@ -229,8 +234,7 @@ public abstract class AbstractExecutorService implements ExecutorService {
throws InterruptedException {
if (tasks == null)
throw new NullPointerException();
ArrayList<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
boolean done = false;
ArrayList<Future<T>> futures = new ArrayList<>(tasks.size());
try {
for (Callable<T> t : tasks) {
RunnableFuture<T> f = newTaskFor(t);
@ -240,19 +244,15 @@ public abstract class AbstractExecutorService implements ExecutorService {
for (int i = 0, size = futures.size(); i < size; i++) {
Future<T> f = futures.get(i);
if (!f.isDone()) {
try {
f.get();
} catch (CancellationException ignore) {
} catch (ExecutionException ignore) {
}
try { f.get(); }
catch (CancellationException ignore) {}
catch (ExecutionException ignore) {}
}
}
done = true;
return futures;
} finally {
if (!done)
for (int i = 0, size = futures.size(); i < size; i++)
futures.get(i).cancel(true);
} catch (Throwable t) {
cancelAll(futures);
throw t;
}
}
@ -261,47 +261,52 @@ public abstract class AbstractExecutorService implements ExecutorService {
throws InterruptedException {
if (tasks == null)
throw new NullPointerException();
long nanos = unit.toNanos(timeout);
ArrayList<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
boolean done = false;
try {
final long nanos = unit.toNanos(timeout);
final long deadline = System.nanoTime() + nanos;
ArrayList<Future<T>> futures = new ArrayList<>(tasks.size());
int j = 0;
timedOut: try {
for (Callable<T> t : tasks)
futures.add(newTaskFor(t));
final long deadline = System.nanoTime() + nanos;
final int size = futures.size();
// Interleave time checks and calls to execute in case
// executor doesn't have any/much parallelism.
for (int i = 0; i < size; i++) {
if (((i == 0) ? nanos : deadline - System.nanoTime()) <= 0L)
break timedOut;
execute((Runnable)futures.get(i));
nanos = deadline - System.nanoTime();
if (nanos <= 0L)
return futures;
}
for (int i = 0; i < size; i++) {
Future<T> f = futures.get(i);
for (; j < size; j++) {
Future<T> f = futures.get(j);
if (!f.isDone()) {
if (nanos <= 0L)
return futures;
try {
f.get(nanos, TimeUnit.NANOSECONDS);
} catch (CancellationException ignore) {
} catch (ExecutionException ignore) {
} catch (TimeoutException toe) {
return futures;
try { f.get(deadline - System.nanoTime(), NANOSECONDS); }
catch (CancellationException ignore) {}
catch (ExecutionException ignore) {}
catch (TimeoutException timedOut) {
break timedOut;
}
nanos = deadline - System.nanoTime();
}
}
done = true;
return futures;
} finally {
if (!done)
for (int i = 0, size = futures.size(); i < size; i++)
futures.get(i).cancel(true);
} catch (Throwable t) {
cancelAll(futures);
throw t;
}
// Timed out before all the tasks could be completed; cancel remaining
cancelAll(futures, j);
return futures;
}
private static <T> void cancelAll(ArrayList<Future<T>> futures) {
cancelAll(futures, 0);
}
/** Cancels all futures with index at least j. */
private static <T> void cancelAll(ArrayList<Future<T>> futures, int j) {
for (int size = futures.size(); j < size; j++)
futures.get(j).cancel(true);
}
}

View File

@ -34,15 +34,18 @@
*/
package java.util.concurrent;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import java.lang.ref.WeakReference;
import java.util.AbstractQueue;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.lang.ref.WeakReference;
import java.util.Spliterators;
import java.util.Objects;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
/**
* A bounded {@linkplain BlockingQueue blocking queue} backed by an
@ -77,7 +80,7 @@ import java.util.Spliterator;
*
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this queue
*/
public class ArrayBlockingQueue<E> extends AbstractQueue<E>
implements BlockingQueue<E>, java.io.Serializable {
@ -121,12 +124,12 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* are known not to be any. Allows queue operations to update
* iterator state.
*/
transient Itrs itrs = null;
transient Itrs itrs;
// Internal helper methods
/**
* Circularly decrement i.
* Circularly decrements array index i.
*/
final int dec(int i) {
return ((i == 0) ? items.length : i) - 1;
@ -140,16 +143,6 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
return (E) items[i];
}
/**
* Throws NullPointerException if argument is null.
*
* @param v the element
*/
private static void checkNotNull(Object v) {
if (v == null)
throw new NullPointerException();
}
/**
* Inserts element at current put position, advances, and signals.
* Call only when holding lock.
@ -159,8 +152,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
// assert items[putIndex] == null;
final Object[] items = this.items;
items[putIndex] = x;
if (++putIndex == items.length)
putIndex = 0;
if (++putIndex == items.length) putIndex = 0;
count++;
notEmpty.signal();
}
@ -176,8 +168,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
@SuppressWarnings("unchecked")
E x = (E) items[takeIndex];
items[takeIndex] = null;
if (++takeIndex == items.length)
takeIndex = 0;
if (++takeIndex == items.length) takeIndex = 0;
count--;
if (itrs != null)
itrs.elementDequeued();
@ -198,8 +189,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
if (removeIndex == takeIndex) {
// removing front item; just advance
items[takeIndex] = null;
if (++takeIndex == items.length)
takeIndex = 0;
if (++takeIndex == items.length) takeIndex = 0;
count--;
if (itrs != null)
itrs.elementDequeued();
@ -207,19 +197,15 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
// an "interior" remove
// slide over all others up through putIndex.
final int putIndex = this.putIndex;
for (int i = removeIndex;;) {
int next = i + 1;
if (next == items.length)
next = 0;
if (next != putIndex) {
items[i] = items[next];
i = next;
} else {
items[i] = null;
this.putIndex = i;
for (int i = removeIndex, putIndex = this.putIndex;;) {
int pred = i;
if (++i == items.length) i = 0;
if (i == putIndex) {
items[pred] = null;
this.putIndex = pred;
break;
}
items[pred] = items[i];
}
count--;
if (itrs != null)
@ -283,10 +269,8 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
try {
int i = 0;
try {
for (E e : c) {
checkNotNull(e);
items[i++] = e;
}
for (E e : c)
items[i++] = Objects.requireNonNull(e);
} catch (ArrayIndexOutOfBoundsException ex) {
throw new IllegalArgumentException();
}
@ -322,7 +306,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* @throws NullPointerException if the specified element is null
*/
public boolean offer(E e) {
checkNotNull(e);
Objects.requireNonNull(e);
final ReentrantLock lock = this.lock;
lock.lock();
try {
@ -345,7 +329,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* @throws NullPointerException {@inheritDoc}
*/
public void put(E e) throws InterruptedException {
checkNotNull(e);
Objects.requireNonNull(e);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
@ -368,13 +352,13 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
checkNotNull(e);
Objects.requireNonNull(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length) {
if (nanos <= 0)
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
@ -413,7 +397,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
lock.lockInterruptibly();
try {
while (count == 0) {
if (nanos <= 0)
if (nanos <= 0L)
return null;
nanos = notEmpty.awaitNanos(nanos);
}
@ -492,11 +476,11 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
*/
public boolean remove(Object o) {
if (o == null) return false;
final Object[] items = this.items;
final ReentrantLock lock = this.lock;
lock.lock();
try {
if (count > 0) {
final Object[] items = this.items;
final int putIndex = this.putIndex;
int i = takeIndex;
do {
@ -504,8 +488,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
removeAt(i);
return true;
}
if (++i == items.length)
i = 0;
if (++i == items.length) i = 0;
} while (i != putIndex);
}
return false;
@ -524,18 +507,17 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
*/
public boolean contains(Object o) {
if (o == null) return false;
final Object[] items = this.items;
final ReentrantLock lock = this.lock;
lock.lock();
try {
if (count > 0) {
final Object[] items = this.items;
final int putIndex = this.putIndex;
int i = takeIndex;
do {
if (o.equals(items[i]))
return true;
if (++i == items.length)
i = 0;
if (++i == items.length) i = 0;
} while (i != putIndex);
}
return false;
@ -558,23 +540,18 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* @return an array containing all of the elements in this queue
*/
public Object[] toArray() {
Object[] a;
final ReentrantLock lock = this.lock;
lock.lock();
try {
final int count = this.count;
a = new Object[count];
int n = items.length - takeIndex;
if (count <= n)
System.arraycopy(items, takeIndex, a, 0, count);
else {
System.arraycopy(items, takeIndex, a, 0, n);
System.arraycopy(items, 0, a, n, count - n);
}
final Object[] items = this.items;
final int end = takeIndex + count;
final Object[] a = Arrays.copyOfRange(items, takeIndex, end);
if (end != putIndex)
System.arraycopy(items, 0, a, items.length - takeIndex, putIndex);
return a;
} finally {
lock.unlock();
}
return a;
}
/**
@ -598,7 +575,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* The following code can be used to dump the queue into a newly
* allocated array of {@code String}:
*
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
@ -614,53 +591,30 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
final Object[] items = this.items;
final ReentrantLock lock = this.lock;
lock.lock();
try {
final Object[] items = this.items;
final int count = this.count;
final int len = a.length;
if (len < count)
a = (T[])java.lang.reflect.Array.newInstance(
a.getClass().getComponentType(), count);
int n = items.length - takeIndex;
if (count <= n)
System.arraycopy(items, takeIndex, a, 0, count);
else {
System.arraycopy(items, takeIndex, a, 0, n);
System.arraycopy(items, 0, a, n, count - n);
final int firstLeg = Math.min(items.length - takeIndex, count);
if (a.length < count) {
a = (T[]) Arrays.copyOfRange(items, takeIndex, takeIndex + count,
a.getClass());
} else {
System.arraycopy(items, takeIndex, a, 0, firstLeg);
if (a.length > count)
a[count] = null;
}
if (len > count)
a[count] = null;
if (firstLeg < count)
System.arraycopy(items, 0, a, firstLeg, putIndex);
return a;
} finally {
lock.unlock();
}
return a;
}
public String toString() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
int k = count;
if (k == 0)
return "[]";
final Object[] items = this.items;
StringBuilder sb = new StringBuilder();
sb.append('[');
for (int i = takeIndex; ; ) {
Object e = items[i];
sb.append(e == this ? "(this Collection)" : e);
if (--k == 0)
return sb.append(']').toString();
sb.append(',').append(' ');
if (++i == items.length)
i = 0;
}
} finally {
lock.unlock();
}
return Helpers.collectionToString(this);
}
/**
@ -668,18 +622,17 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* The queue will be empty after this call returns.
*/
public void clear() {
final Object[] items = this.items;
final ReentrantLock lock = this.lock;
lock.lock();
try {
int k = count;
if (k > 0) {
final Object[] items = this.items;
final int putIndex = this.putIndex;
int i = takeIndex;
do {
items[i] = null;
if (++i == items.length)
i = 0;
if (++i == items.length) i = 0;
} while (i != putIndex);
takeIndex = putIndex;
count = 0;
@ -710,7 +663,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
* @throws IllegalArgumentException {@inheritDoc}
*/
public int drainTo(Collection<? super E> c, int maxElements) {
checkNotNull(c);
Objects.requireNonNull(c);
if (c == this)
throw new IllegalArgumentException();
if (maxElements <= 0)
@ -728,8 +681,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
E x = (E) items[take];
c.add(x);
items[take] = null;
if (++take == items.length)
take = 0;
if (++take == items.length) take = 0;
i++;
}
return n;
@ -832,13 +784,13 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
}
/** Incremented whenever takeIndex wraps around to 0 */
int cycles = 0;
int cycles;
/** Linked list of weak iterator references */
private Node head;
/** Used to expunge stale iterators */
private Node sweeper = null;
private Node sweeper;
private static final int SHORT_SWEEP_PROBES = 4;
private static final int LONG_SWEEP_PROBES = 16;
@ -1095,10 +1047,8 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
private int incCursor(int index) {
// assert lock.getHoldCount() == 1;
if (++index == items.length)
index = 0;
if (index == putIndex)
index = NONE;
if (++index == items.length) index = 0;
if (index == putIndex) index = NONE;
return index;
}
@ -1314,17 +1264,18 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
if (isDetached())
return true;
final int cycles = itrs.cycles;
final int takeIndex = ArrayBlockingQueue.this.takeIndex;
final int prevCycles = this.prevCycles;
final int prevTakeIndex = this.prevTakeIndex;
final int len = items.length;
int cycleDiff = cycles - prevCycles;
if (removedIndex < takeIndex)
cycleDiff++;
// distance from prevTakeIndex to removedIndex
final int removedDistance =
(cycleDiff * len) + (removedIndex - prevTakeIndex);
// assert removedDistance >= 0;
len * (itrs.cycles - this.prevCycles
+ ((removedIndex < takeIndex) ? 1 : 0))
+ (removedIndex - prevTakeIndex);
// assert itrs.cycles - this.prevCycles >= 0;
// assert itrs.cycles - this.prevCycles <= 1;
// assert removedDistance > 0;
// assert removedIndex != takeIndex;
int cursor = this.cursor;
if (cursor >= 0) {
int x = distance(cursor, prevTakeIndex, len);
@ -1353,7 +1304,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
else if (x > removedDistance)
this.nextIndex = nextIndex = dec(nextIndex);
}
else if (cursor < 0 && nextIndex < 0 && lastRet < 0) {
if (cursor < 0 && nextIndex < 0 && lastRet < 0) {
this.prevTakeIndex = DETACHED;
return true;
}
@ -1410,8 +1361,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
*/
public Spliterator<E> spliterator() {
return Spliterators.spliterator
(this, Spliterator.ORDERED | Spliterator.NONNULL |
Spliterator.CONCURRENT);
(this, (Spliterator.ORDERED |
Spliterator.NONNULL |
Spliterator.CONCURRENT));
}
}

View File

@ -34,7 +34,10 @@
*/
package java.util.concurrent;
import java.util.*;
import java.util.Deque;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* A {@link Deque} that additionally supports blocking operations that wait
@ -195,7 +198,7 @@ import java.util.*;
*
* @since 1.6
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this deque
*/
public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
/*
@ -401,9 +404,9 @@ public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean removeFirstOccurrence(Object o);
@ -419,9 +422,9 @@ public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
* @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean removeLastOccurrence(Object o);
@ -596,9 +599,9 @@ public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
* @return {@code true} if this deque changed as a result of the call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean remove(Object o);
@ -611,18 +614,18 @@ public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
* @return {@code true} if this deque contains the specified element
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
public boolean contains(Object o);
boolean contains(Object o);
/**
* Returns the number of elements in this deque.
*
* @return the number of elements in this deque
*/
public int size();
int size();
/**
* Returns an iterator over the elements in this deque in proper sequence.

View File

@ -127,7 +127,7 @@ import java.util.Queue;
* Usage example, based on a typical producer-consumer scenario.
* Note that a {@code BlockingQueue} can safely be used with multiple
* producers and multiple consumers.
* <pre> {@code
* <pre> {@code
* class Producer implements Runnable {
* private final BlockingQueue queue;
* Producer(BlockingQueue q) { queue = q; }
@ -175,7 +175,7 @@ import java.util.Queue;
*
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this queue
*/
public interface BlockingQueue<E> extends Queue<E> {
/**
@ -303,9 +303,9 @@ public interface BlockingQueue<E> extends Queue<E> {
* @return {@code true} if this queue changed as a result of the call
* @throws ClassCastException if the class of the specified element
* is incompatible with this queue
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean remove(Object o);
@ -318,11 +318,11 @@ public interface BlockingQueue<E> extends Queue<E> {
* @return {@code true} if this queue contains the specified element
* @throws ClassCastException if the class of the specified element
* is incompatible with this queue
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
public boolean contains(Object o);
boolean contains(Object o);
/**
* Removes all available elements from this queue and adds them

View File

@ -34,12 +34,11 @@
*/
package java.util.concurrent;
import java.util.function.Supplier;
import java.util.function.Consumer;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.BiFunction;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* A stage of a possibly asynchronous computation, that performs an
@ -56,9 +55,9 @@ import java.util.concurrent.Executor;
* For example, {@code stage.thenApply(x -> square(x)).thenAccept(x ->
* System.out.print(x)).thenRun(() -> System.out.println())}. An
* additional form (<em>compose</em>) applies functions of stages
* themselves, rather than their results. </li>
* themselves, rather than their results.
*
* <li> One stage's execution may be triggered by completion of a
* <li>One stage's execution may be triggered by completion of a
* single stage, or both of two stages, or either of two stages.
* Dependencies on a single stage are arranged using methods with
* prefix <em>then</em>. Those triggered by completion of
@ -66,9 +65,9 @@ import java.util.concurrent.Executor;
* effects, using correspondingly named methods. Those triggered by
* <em>either</em> of two stages make no guarantees about which of the
* results or effects are used for the dependent stage's
* computation.</li>
* computation.
*
* <li> Dependencies among stages control the triggering of
* <li>Dependencies among stages control the triggering of
* computations, but do not otherwise guarantee any particular
* ordering. Additionally, execution of a new stage's computations may
* be arranged in any of three ways: default execution, default
@ -81,7 +80,7 @@ import java.util.concurrent.Executor;
* properties, and might not even support concurrent execution, but
* are arranged for processing in a way that accommodates asynchrony.
*
* <li> Two method forms support processing whether the triggering
* <li>Two method forms support processing whether the triggering
* stage completed normally or exceptionally: Method {@link
* #whenComplete whenComplete} allows injection of an action
* regardless of outcome, otherwise preserving the outcome in its
@ -100,7 +99,7 @@ import java.util.concurrent.Executor;
* stage completes normally or exceptionally. In the case of method
* {@code whenComplete}, when the supplied action itself encounters an
* exception, then the stage exceptionally completes with this
* exception if not already completed exceptionally.</li>
* exception if not already completed exceptionally.
*
* </ul>
*
@ -587,7 +586,7 @@ public interface CompletionStage<T> {
/**
* Returns a new CompletionStage that, when this stage completes
* normally, is executed with this stage as the argument
* normally, is executed with this stage's result as the argument
* to the supplied function.
*
* See the {@link CompletionStage} documentation for rules
@ -603,7 +602,7 @@ public interface CompletionStage<T> {
/**
* Returns a new CompletionStage that, when this stage completes
* normally, is executed using this stage's default asynchronous
* execution facility, with this stage as the argument to the
* execution facility, with this stage's result as the argument to the
* supplied function.
*
* See the {@link CompletionStage} documentation for rules
@ -652,12 +651,14 @@ public interface CompletionStage<T> {
* Returns a new CompletionStage with the same result or exception as
* this stage, that executes the given action when this stage completes.
*
* <p>When this stage is complete, the given action is invoked with the
* result (or {@code null} if none) and the exception (or {@code null}
* if none) of this stage as arguments. The returned stage is completed
* when the action returns. If the supplied action itself encounters an
* exception, then the returned stage exceptionally completes with this
* exception unless this stage also completed exceptionally.
* <p>When this stage is complete, the given action is invoked
* with the result (or {@code null} if none) and the exception (or
* {@code null} if none) of this stage as arguments. The returned
* stage is completed when the action returns. If the supplied
* action itself encounters an exception, then the returned stage
* exceptionally completes with this exception unless this stage
* also completed exceptionally (in which case, the returned stage
* exceptionally completes with the original exception).
*
* @param action the action to perform
* @return the new CompletionStage

View File

@ -42,7 +42,6 @@ import java.lang.reflect.Type;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@ -51,14 +50,11 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.Spliterator;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Consumer;
import java.util.function.DoubleBinaryOperator;
import java.util.function.Function;
@ -154,43 +150,43 @@ import java.util.stream.Stream;
* being concurrently updated by other threads; for example, when
* computing a snapshot summary of the values in a shared registry.
* There are three kinds of operation, each with four forms, accepting
* functions with Keys, Values, Entries, and (Key, Value) arguments
* and/or return values. Because the elements of a ConcurrentHashMap
* are not ordered in any particular way, and may be processed in
* different orders in different parallel executions, the correctness
* of supplied functions should not depend on any ordering, or on any
* other objects or values that may transiently change while
* computation is in progress; and except for forEach actions, should
* ideally be side-effect-free. Bulk operations on {@link java.util.Map.Entry}
* objects do not support method {@code setValue}.
* functions with keys, values, entries, and (key, value) pairs as
* arguments and/or return values. Because the elements of a
* ConcurrentHashMap are not ordered in any particular way, and may be
* processed in different orders in different parallel executions, the
* correctness of supplied functions should not depend on any
* ordering, or on any other objects or values that may transiently
* change while computation is in progress; and except for forEach
* actions, should ideally be side-effect-free. Bulk operations on
* {@link java.util.Map.Entry} objects do not support method {@code
* setValue}.
*
* <ul>
* <li> forEach: Perform a given action on each element.
* <li>forEach: Performs a given action on each element.
* A variant form applies a given transformation on each element
* before performing the action.</li>
* before performing the action.
*
* <li> search: Return the first available non-null result of
* <li>search: Returns the first available non-null result of
* applying a given function on each element; skipping further
* search when a result is found.</li>
* search when a result is found.
*
* <li> reduce: Accumulate each element. The supplied reduction
* <li>reduce: Accumulates each element. The supplied reduction
* function cannot rely on ordering (more formally, it should be
* both associative and commutative). There are five variants:
*
* <ul>
*
* <li> Plain reductions. (There is not a form of this method for
* <li>Plain reductions. (There is not a form of this method for
* (key, value) function arguments since there is no corresponding
* return type.)</li>
* return type.)
*
* <li> Mapped reductions that accumulate the results of a given
* function applied to each element.</li>
* <li>Mapped reductions that accumulate the results of a given
* function applied to each element.
*
* <li> Reductions to scalar doubles, longs, and ints, using a
* given basis value.</li>
* <li>Reductions to scalar doubles, longs, and ints, using a
* given basis value.
*
* </ul>
* </li>
* </ul>
*
* <p>These bulk operations accept a {@code parallelismThreshold}
@ -576,7 +572,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* The number of bits used for generation stamp in sizeCtl.
* Must be at least 6 for 32bit arrays.
*/
private static int RESIZE_STAMP_BITS = 16;
private static final int RESIZE_STAMP_BITS = 16;
/**
* The maximum number of threads that can help resize.
@ -604,7 +600,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("segments", Segment[].class),
new ObjectStreamField("segmentMask", Integer.TYPE),
new ObjectStreamField("segmentShift", Integer.TYPE)
new ObjectStreamField("segmentShift", Integer.TYPE),
};
/* ---------------- Nodes -------------- */
@ -630,10 +626,12 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
this.next = next;
}
public final K getKey() { return key; }
public final V getValue() { return val; }
public final int hashCode() { return key.hashCode() ^ val.hashCode(); }
public final String toString(){ return key + "=" + val; }
public final K getKey() { return key; }
public final V getValue() { return val; }
public final int hashCode() { return key.hashCode() ^ val.hashCode(); }
public final String toString() {
return Helpers.mapEntryToString(key, val);
}
public final V setValue(V value) {
throw new UnsupportedOperationException();
}
@ -1057,6 +1055,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
p.val = value;
}
}
else if (f instanceof ReservationNode)
throw new IllegalStateException("Recursive update");
}
}
if (binCount != 0) {
@ -1159,6 +1159,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
}
}
else if (f instanceof ReservationNode)
throw new IllegalStateException("Recursive update");
}
}
if (validated) {
@ -1366,7 +1368,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
/**
* Stripped-down version of helper class used in previous version,
* declared for the sake of serialization compatibility
* declared for the sake of serialization compatibility.
*/
static class Segment<K,V> extends ReentrantLock implements Serializable {
private static final long serialVersionUID = 2249069246763182397L;
@ -1401,9 +1403,10 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
new Segment<?,?>[DEFAULT_CONCURRENCY_LEVEL];
for (int i = 0; i < segments.length; ++i)
segments[i] = new Segment<K,V>(LOAD_FACTOR);
s.putFields().put("segments", segments);
s.putFields().put("segmentShift", segmentShift);
s.putFields().put("segmentMask", segmentMask);
java.io.ObjectOutputStream.PutField streamFields = s.putFields();
streamFields.put("segments", segments);
streamFields.put("segmentShift", segmentShift);
streamFields.put("segmentMask", segmentMask);
s.writeFields();
Node<K,V>[] t;
@ -1620,9 +1623,9 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
/**
* Helper method for EntrySet.removeIf
* Helper method for EntrySetView.removeIf.
*/
boolean removeEntryIf(Predicate<? super Entry<K, V>> function) {
boolean removeEntryIf(Predicate<? super Entry<K,V>> function) {
if (function == null) throw new NullPointerException();
Node<K,V>[] t;
boolean removed = false;
@ -1640,9 +1643,9 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
/**
* Helper method for Values.removeIf
* Helper method for ValuesView.removeIf.
*/
boolean removeValueIf(Predicate<? super V> function) {
boolean removeValueIf(Predicate<? super V> function) {
if (function == null) throw new NullPointerException();
Node<K,V>[] t;
boolean removed = false;
@ -1716,7 +1719,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
if (fh >= 0) {
binCount = 1;
for (Node<K,V> e = f;; ++binCount) {
K ek; V ev;
K ek;
if (e.hash == h &&
((ek = e.key) == key ||
(ek != null && key.equals(ek)))) {
@ -1726,6 +1729,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
Node<K,V> pred = e;
if ((e = e.next) == null) {
if ((val = mappingFunction.apply(key)) != null) {
if (pred.next != null)
throw new IllegalStateException("Recursive update");
added = true;
pred.next = new Node<K,V>(h, key, val, null);
}
@ -1745,6 +1750,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
t.putTreeVal(h, key, val);
}
}
else if (f instanceof ReservationNode)
throw new IllegalStateException("Recursive update");
}
}
if (binCount != 0) {
@ -1840,6 +1847,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
}
}
else if (f instanceof ReservationNode)
throw new IllegalStateException("Recursive update");
}
}
if (binCount != 0)
@ -1931,6 +1940,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
if ((e = e.next) == null) {
val = remappingFunction.apply(key, null);
if (val != null) {
if (pred.next != null)
throw new IllegalStateException("Recursive update");
delta = 1;
pred.next =
new Node<K,V>(h, key, val, null);
@ -1963,6 +1974,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
setTabAt(tab, i, untreeify(t.first));
}
}
else if (f instanceof ReservationNode)
throw new IllegalStateException("Recursive update");
}
}
if (binCount != 0) {
@ -2072,6 +2085,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
setTabAt(tab, i, untreeify(t.first));
}
}
else if (f instanceof ReservationNode)
throw new IllegalStateException("Recursive update");
}
}
if (binCount != 0) {
@ -2089,12 +2104,13 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
// Hashtable legacy methods
/**
* Legacy method testing if some key maps into the specified value
* in this table. This method is identical in functionality to
* Tests if some key maps into the specified value in this table.
*
* <p>Note that this method is identical in functionality to
* {@link #containsValue(Object)}, and exists solely to ensure
* full compatibility with class {@link java.util.Hashtable},
* which supported this method prior to introduction of the
* Java Collections framework.
* Java Collections Framework.
*
* @param value a value to search for
* @return {@code true} if and only if some key maps to the
@ -2235,7 +2251,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
/**
* A place-holder node used in computeIfAbsent and compute
* A place-holder node used in computeIfAbsent and compute.
*/
static final class ReservationNode<K,V> extends Node<K,V> {
ReservationNode() {
@ -2384,17 +2400,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
break;
else if (tab == table) {
int rs = resizeStamp(n);
if (sc < 0) {
Node<K,V>[] nt;
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
sc == rs + MAX_RESIZERS || (nt = nextTable) == null ||
transferIndex <= 0)
break;
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1))
transfer(tab, nt);
}
else if (U.compareAndSwapInt(this, SIZECTL, sc,
(rs << RESIZE_STAMP_SHIFT) + 2))
if (U.compareAndSwapInt(this, SIZECTL, sc,
(rs << RESIZE_STAMP_SHIFT) + 2))
transfer(tab, null);
}
}
@ -2649,7 +2656,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* too small, in which case resizes instead.
*/
private final void treeifyBin(Node<K,V>[] tab, int index) {
Node<K,V> b; int n, sc;
Node<K,V> b; int n;
if (tab != null) {
if ((n = tab.length) < MIN_TREEIFY_CAPACITY)
tryPresize(n << 1);
@ -2693,7 +2700,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
/* ---------------- TreeNodes -------------- */
/**
* Nodes for use in TreeBins
* Nodes for use in TreeBins.
*/
static final class TreeNode<K,V> extends Node<K,V> {
TreeNode<K,V> parent; // red-black tree links
@ -2719,7 +2726,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
final TreeNode<K,V> findTreeNode(int h, Object k, Class<?> kc) {
if (k != null) {
TreeNode<K,V> p = this;
do {
do {
int ph, dir; K pk; TreeNode<K,V> q;
TreeNode<K,V> pl = p.left, pr = p.right;
if ((ph = p.hash) > h)
@ -2812,7 +2819,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
(kc = comparableClassFor(k)) == null) ||
(dir = compareComparables(kc, k, pk)) == 0)
dir = tieBreakOrder(k, pk);
TreeNode<K,V> xp = p;
TreeNode<K,V> xp = p;
if ((p = (dir <= 0) ? p.left : p.right) == null) {
x.parent = xp;
if (dir <= 0)
@ -3165,7 +3172,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
static <K,V> TreeNode<K,V> balanceDeletion(TreeNode<K,V> root,
TreeNode<K,V> x) {
for (TreeNode<K,V> xp, xpl, xpr;;) {
for (TreeNode<K,V> xp, xpl, xpr;;) {
if (x == null || x == root)
return root;
else if ((xp = x.parent) == null) {
@ -3256,7 +3263,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
/**
* Recursive invariant check
* Checks invariants recursively for the tree of Nodes rooted at t.
*/
static <K,V> boolean checkInvariants(TreeNode<K,V> t) {
TreeNode<K,V> tp = t.parent, tl = t.left, tr = t.right,
@ -3280,15 +3287,13 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
return true;
}
private static final sun.misc.Unsafe U;
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
private static final long LOCKSTATE;
static {
try {
U = sun.misc.Unsafe.getUnsafe();
Class<?> k = TreeBin.class;
LOCKSTATE = U.objectFieldOffset
(k.getDeclaredField("lockState"));
} catch (Exception e) {
(TreeBin.class.getDeclaredField("lockState"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
@ -3503,7 +3508,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
/**
* Exported Entry for EntryIterator
* Exported Entry for EntryIterator.
*/
static final class MapEntry<K,V> implements Map.Entry<K,V> {
final K key; // non-null
@ -3517,7 +3522,9 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
public K getKey() { return key; }
public V getValue() { return val; }
public int hashCode() { return key.hashCode() ^ val.hashCode(); }
public String toString() { return key + "=" + val; }
public String toString() {
return Helpers.mapEntryToString(key, val);
}
public boolean equals(Object o) {
Object k, v; Map.Entry<?,?> e;
@ -3554,7 +3561,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
this.est = est;
}
public Spliterator<K> trySplit() {
public KeySpliterator<K,V> trySplit() {
int i, f, h;
return (h = ((i = baseIndex) + (f = baseLimit)) >>> 1) <= i ? null :
new KeySpliterator<K,V>(tab, baseSize, baseLimit = h,
@ -3593,7 +3600,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
this.est = est;
}
public Spliterator<V> trySplit() {
public ValueSpliterator<K,V> trySplit() {
int i, f, h;
return (h = ((i = baseIndex) + (f = baseLimit)) >>> 1) <= i ? null :
new ValueSpliterator<K,V>(tab, baseSize, baseLimit = h,
@ -3633,7 +3640,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
this.est = est;
}
public Spliterator<Map.Entry<K,V>> trySplit() {
public EntrySpliterator<K,V> trySplit() {
int i, f, h;
return (h = ((i = baseIndex) + (f = baseLimit)) >>> 1) <= i ? null :
new EntrySpliterator<K,V>(tab, baseSize, baseLimit = h,
@ -4445,19 +4452,19 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
public abstract boolean contains(Object o);
public abstract boolean remove(Object o);
private static final String oomeMsg = "Required array size too large";
private static final String OOME_MSG = "Required array size too large";
public final Object[] toArray() {
long sz = map.mappingCount();
if (sz > MAX_ARRAY_SIZE)
throw new OutOfMemoryError(oomeMsg);
throw new OutOfMemoryError(OOME_MSG);
int n = (int)sz;
Object[] r = new Object[n];
int i = 0;
for (E e : this) {
if (i == n) {
if (n >= MAX_ARRAY_SIZE)
throw new OutOfMemoryError(oomeMsg);
throw new OutOfMemoryError(OOME_MSG);
if (n >= MAX_ARRAY_SIZE - (MAX_ARRAY_SIZE >>> 1) - 1)
n = MAX_ARRAY_SIZE;
else
@ -4473,7 +4480,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
public final <T> T[] toArray(T[] a) {
long sz = map.mappingCount();
if (sz > MAX_ARRAY_SIZE)
throw new OutOfMemoryError(oomeMsg);
throw new OutOfMemoryError(OOME_MSG);
int m = (int)sz;
T[] r = (a.length >= m) ? a :
(T[])java.lang.reflect.Array
@ -4483,7 +4490,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
for (E e : this) {
if (i == n) {
if (n >= MAX_ARRAY_SIZE)
throw new OutOfMemoryError(oomeMsg);
throw new OutOfMemoryError(OOME_MSG);
if (n >= MAX_ARRAY_SIZE - (MAX_ARRAY_SIZE >>> 1) - 1)
n = MAX_ARRAY_SIZE;
else
@ -4803,7 +4810,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
return added;
}
public boolean removeIf(Predicate<? super Entry<K, V>> filter) {
public boolean removeIf(Predicate<? super Entry<K,V>> filter) {
return map.removeEntryIf(filter);
}
@ -4878,7 +4885,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
/**
* Same as Traverser version
* Same as Traverser version.
*/
final Node<K,V> advance() {
Node<K,V> e;
@ -6323,38 +6330,40 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
// Unsafe mechanics
private static final sun.misc.Unsafe U;
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
private static final long SIZECTL;
private static final long TRANSFERINDEX;
private static final long BASECOUNT;
private static final long CELLSBUSY;
private static final long CELLVALUE;
private static final long ABASE;
private static final int ABASE;
private static final int ASHIFT;
static {
try {
U = sun.misc.Unsafe.getUnsafe();
Class<?> k = ConcurrentHashMap.class;
SIZECTL = U.objectFieldOffset
(k.getDeclaredField("sizeCtl"));
(ConcurrentHashMap.class.getDeclaredField("sizeCtl"));
TRANSFERINDEX = U.objectFieldOffset
(k.getDeclaredField("transferIndex"));
(ConcurrentHashMap.class.getDeclaredField("transferIndex"));
BASECOUNT = U.objectFieldOffset
(k.getDeclaredField("baseCount"));
(ConcurrentHashMap.class.getDeclaredField("baseCount"));
CELLSBUSY = U.objectFieldOffset
(k.getDeclaredField("cellsBusy"));
Class<?> ck = CounterCell.class;
(ConcurrentHashMap.class.getDeclaredField("cellsBusy"));
CELLVALUE = U.objectFieldOffset
(ck.getDeclaredField("value"));
Class<?> ak = Node[].class;
ABASE = U.arrayBaseOffset(ak);
int scale = U.arrayIndexScale(ak);
(CounterCell.class.getDeclaredField("value"));
ABASE = U.arrayBaseOffset(Node[].class);
int scale = U.arrayIndexScale(Node[].class);
if ((scale & (scale - 1)) != 0)
throw new Error("data type scale not a power of two");
throw new Error("array index scale not a power of two");
ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
} catch (Exception e) {
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
// Reduce the risk of rare disastrous classloading in first call to
// LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
Class<?> ensureLoaded = LockSupport.class;
}
}

View File

@ -36,11 +36,12 @@
package java.util.concurrent;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Queue;
import java.util.Spliterator;
import java.util.Spliterators;
@ -87,7 +88,7 @@ import java.util.function.Consumer;
* @since 1.7
* @author Doug Lea
* @author Martin Buchholz
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this deque
*/
public class ConcurrentLinkedDeque<E>
extends AbstractCollection<E>
@ -300,47 +301,45 @@ public class ConcurrentLinkedDeque<E>
* only be seen after publication via casNext or casPrev.
*/
Node(E item) {
UNSAFE.putObject(this, itemOffset, item);
U.putObject(this, ITEM, item);
}
boolean casItem(E cmp, E val) {
return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val);
return U.compareAndSwapObject(this, ITEM, cmp, val);
}
void lazySetNext(Node<E> val) {
UNSAFE.putOrderedObject(this, nextOffset, val);
U.putOrderedObject(this, NEXT, val);
}
boolean casNext(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val);
return U.compareAndSwapObject(this, NEXT, cmp, val);
}
void lazySetPrev(Node<E> val) {
UNSAFE.putOrderedObject(this, prevOffset, val);
U.putOrderedObject(this, PREV, val);
}
boolean casPrev(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, prevOffset, cmp, val);
return U.compareAndSwapObject(this, PREV, cmp, val);
}
// Unsafe mechanics
private static final sun.misc.Unsafe UNSAFE;
private static final long prevOffset;
private static final long itemOffset;
private static final long nextOffset;
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
private static final long PREV;
private static final long ITEM;
private static final long NEXT;
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class<?> k = Node.class;
prevOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("prev"));
itemOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("item"));
nextOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("next"));
} catch (Exception e) {
PREV = U.objectFieldOffset
(Node.class.getDeclaredField("prev"));
ITEM = U.objectFieldOffset
(Node.class.getDeclaredField("item"));
NEXT = U.objectFieldOffset
(Node.class.getDeclaredField("next"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
@ -350,8 +349,7 @@ public class ConcurrentLinkedDeque<E>
* Links e as first element.
*/
private void linkFirst(E e) {
checkNotNull(e);
final Node<E> newNode = new Node<E>(e);
final Node<E> newNode = new Node<E>(Objects.requireNonNull(e));
restartFromHead:
for (;;)
@ -383,8 +381,7 @@ public class ConcurrentLinkedDeque<E>
* Links e as last element.
*/
private void linkLast(E e) {
checkNotNull(e);
final Node<E> newNode = new Node<E>(e);
final Node<E> newNode = new Node<E>(Objects.requireNonNull(e));
restartFromTail:
for (;;)
@ -788,16 +785,6 @@ public class ConcurrentLinkedDeque<E>
// Minor convenience utilities
/**
* Throws NullPointerException if argument is null.
*
* @param v the element
*/
private static void checkNotNull(Object v) {
if (v == null)
throw new NullPointerException();
}
/**
* Returns element unless it is null, in which case throws
* NoSuchElementException.
@ -811,22 +798,6 @@ public class ConcurrentLinkedDeque<E>
return v;
}
/**
* Creates an array list and fills it with elements of this list.
* Used by toArray.
*
* @return the array list
*/
private ArrayList<E> toArrayList() {
ArrayList<E> list = new ArrayList<E>();
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null)
list.add(item);
}
return list;
}
/**
* Constructs an empty deque.
*/
@ -847,8 +818,7 @@ public class ConcurrentLinkedDeque<E>
// Copy c into a private chain of Nodes
Node<E> h = null, t = null;
for (E e : c) {
checkNotNull(e);
Node<E> newNode = new Node<E>(e);
Node<E> newNode = new Node<E>(Objects.requireNonNull(e));
if (h == null)
h = t = newNode;
else {
@ -1046,16 +1016,19 @@ public class ConcurrentLinkedDeque<E>
public void push(E e) { addFirst(e); }
/**
* Removes the first element {@code e} such that
* {@code o.equals(e)}, if such an element exists in this deque.
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the first element {@code e} such that
* {@code o.equals(e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
* @throws NullPointerException if the specified element is null
*/
public boolean removeFirstOccurrence(Object o) {
checkNotNull(o);
Objects.requireNonNull(o);
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null && o.equals(item) && p.casItem(item, null)) {
@ -1067,16 +1040,19 @@ public class ConcurrentLinkedDeque<E>
}
/**
* Removes the last element {@code e} such that
* {@code o.equals(e)}, if such an element exists in this deque.
* Removes the last occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the last element {@code e} such that
* {@code o.equals(e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
* @throws NullPointerException if the specified element is null
*/
public boolean removeLastOccurrence(Object o) {
checkNotNull(o);
Objects.requireNonNull(o);
for (Node<E> p = last(); p != null; p = pred(p)) {
E item = p.item;
if (item != null && o.equals(item) && p.casItem(item, null)) {
@ -1088,18 +1064,20 @@ public class ConcurrentLinkedDeque<E>
}
/**
* Returns {@code true} if this deque contains at least one
* element {@code e} such that {@code o.equals(e)}.
* Returns {@code true} if this deque contains the specified element.
* More formally, returns {@code true} if and only if this deque contains
* at least one element {@code e} such that {@code o.equals(e)}.
*
* @param o element whose presence in this deque is to be tested
* @return {@code true} if this deque contains the specified element
*/
public boolean contains(Object o) {
if (o == null) return false;
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null && o.equals(item))
return true;
if (o != null) {
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null && o.equals(item))
return true;
}
}
return false;
}
@ -1130,19 +1108,28 @@ public class ConcurrentLinkedDeque<E>
* @return the number of elements in this deque
*/
public int size() {
int count = 0;
for (Node<E> p = first(); p != null; p = succ(p))
if (p.item != null)
// Collection.size() spec says to max out
if (++count == Integer.MAX_VALUE)
break;
return count;
restartFromHead: for (;;) {
int count = 0;
for (Node<E> p = first(); p != null;) {
if (p.item != null)
if (++count == Integer.MAX_VALUE)
break; // @see Collection.size()
if (p == (p = p.next))
continue restartFromHead;
}
return count;
}
}
/**
* Removes the first element {@code e} such that
* {@code o.equals(e)}, if such an element exists in this deque.
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
* More formally, removes the first element {@code e} such that
* {@code o.equals(e)} (if such an element exists).
* Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* <p>This method is equivalent to {@link #removeFirstOccurrence(Object)}.
*
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
@ -1172,8 +1159,7 @@ public class ConcurrentLinkedDeque<E>
// Copy c into a private chain of Nodes
Node<E> beginningOfTheEnd = null, last = null;
for (E e : c) {
checkNotNull(e);
Node<E> newNode = new Node<E>(e);
Node<E> newNode = new Node<E>(Objects.requireNonNull(e));
if (beginningOfTheEnd == null)
beginningOfTheEnd = last = newNode;
else {
@ -1224,6 +1210,62 @@ public class ConcurrentLinkedDeque<E>
;
}
public String toString() {
String[] a = null;
restartFromHead: for (;;) {
int charLength = 0;
int size = 0;
for (Node<E> p = first(); p != null;) {
E item = p.item;
if (item != null) {
if (a == null)
a = new String[4];
else if (size == a.length)
a = Arrays.copyOf(a, 2 * size);
String s = item.toString();
a[size++] = s;
charLength += s.length();
}
if (p == (p = p.next))
continue restartFromHead;
}
if (size == 0)
return "[]";
return Helpers.toString(a, size, charLength);
}
}
private Object[] toArrayInternal(Object[] a) {
Object[] x = a;
restartFromHead: for (;;) {
int size = 0;
for (Node<E> p = first(); p != null;) {
E item = p.item;
if (item != null) {
if (x == null)
x = new Object[4];
else if (size == x.length)
x = Arrays.copyOf(x, 2 * (size + 4));
x[size++] = item;
}
if (p == (p = p.next))
continue restartFromHead;
}
if (x == null)
return new Object[0];
else if (a != null && size <= a.length) {
if (a != x)
System.arraycopy(x, 0, a, 0, size);
if (size < a.length)
a[size] = null;
return a;
}
return (size == x.length) ? x : Arrays.copyOf(x, size);
}
}
/**
* Returns an array containing all of the elements in this deque, in
* proper sequence (from first to last element).
@ -1238,7 +1280,7 @@ public class ConcurrentLinkedDeque<E>
* @return an array containing all of the elements in this deque
*/
public Object[] toArray() {
return toArrayList().toArray();
return toArrayInternal(null);
}
/**
@ -1264,7 +1306,7 @@ public class ConcurrentLinkedDeque<E>
* The following code can be used to dump the deque into a newly
* allocated array of {@code String}:
*
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
@ -1278,8 +1320,10 @@ public class ConcurrentLinkedDeque<E>
* this deque
* @throws NullPointerException if the specified array is null
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
return toArrayList().toArray(a);
if (a == null) throw new NullPointerException();
return (T[]) toArrayInternal(a);
}
/**
@ -1346,7 +1390,7 @@ public class ConcurrentLinkedDeque<E>
Node<E> p = (nextNode == null) ? startNode() : nextNode(nextNode);
for (;; p = nextNode(p)) {
if (p == null) {
// p might be active end or TERMINATOR node; both are OK
// might be at active end or TERMINATOR node; both are OK
nextNode = null;
nextItem = null;
break;
@ -1426,8 +1470,9 @@ public class ConcurrentLinkedDeque<E>
if (i > 0) {
batch = i;
return Spliterators.spliterator
(a, 0, i, Spliterator.ORDERED | Spliterator.NONNULL |
Spliterator.CONCURRENT);
(a, 0, i, (Spliterator.ORDERED |
Spliterator.NONNULL |
Spliterator.CONCURRENT));
}
}
}
@ -1539,8 +1584,7 @@ public class ConcurrentLinkedDeque<E>
// Read in elements until trailing null sentinel found
Node<E> h = null, t = null;
Object item;
while ((item = s.readObject()) != null) {
for (Object item; (item = s.readObject()) != null; ) {
@SuppressWarnings("unchecked")
Node<E> newNode = new Node<E>((E) item);
if (h == null)
@ -1555,31 +1599,29 @@ public class ConcurrentLinkedDeque<E>
}
private boolean casHead(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val);
return U.compareAndSwapObject(this, HEAD, cmp, val);
}
private boolean casTail(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val);
return U.compareAndSwapObject(this, TAIL, cmp, val);
}
// Unsafe mechanics
private static final sun.misc.Unsafe UNSAFE;
private static final long headOffset;
private static final long tailOffset;
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
private static final long HEAD;
private static final long TAIL;
static {
PREV_TERMINATOR = new Node<Object>();
PREV_TERMINATOR.next = PREV_TERMINATOR;
NEXT_TERMINATOR = new Node<Object>();
NEXT_TERMINATOR.prev = NEXT_TERMINATOR;
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class<?> k = ConcurrentLinkedDeque.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("tail"));
} catch (Exception e) {
HEAD = U.objectFieldOffset
(ConcurrentLinkedDeque.class.getDeclaredField("head"));
TAIL = U.objectFieldOffset
(ConcurrentLinkedDeque.class.getDeclaredField("tail"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}

View File

@ -36,10 +36,11 @@
package java.util.concurrent;
import java.util.AbstractQueue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Queue;
import java.util.Spliterator;
import java.util.Spliterators;
@ -60,9 +61,9 @@ import java.util.function.Consumer;
* does not permit the use of {@code null} elements.
*
* <p>This implementation employs an efficient <em>non-blocking</em>
* algorithm based on one described in <a
* href="http://www.cs.rochester.edu/u/michael/PODC96.html"> Simple,
* Fast, and Practical Non-Blocking and Blocking Concurrent Queue
* algorithm based on one described in
* <a href="http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf">
* Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue
* Algorithms</a> by Maged M. Michael and Michael L. Scott.
*
* <p>Iterators are <i>weakly consistent</i>, returning elements
@ -100,7 +101,7 @@ import java.util.function.Consumer;
*
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @param <E> the type of elements held in this queue
*/
public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
implements Queue<E>, java.io.Serializable {
@ -180,45 +181,28 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
private static class Node<E> {
volatile E item;
volatile Node<E> next;
}
/**
* Constructs a new node. Uses relaxed write because item can
* only be seen after publication via casNext.
*/
Node(E item) {
UNSAFE.putObject(this, itemOffset, item);
}
/**
* Returns a new node holding item. Uses relaxed write because item
* can only be seen after piggy-backing publication via casNext.
*/
static <E> Node<E> newNode(E item) {
Node<E> node = new Node<E>();
U.putObject(node, ITEM, item);
return node;
}
boolean casItem(E cmp, E val) {
return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val);
}
static <E> boolean casItem(Node<E> node, E cmp, E val) {
return U.compareAndSwapObject(node, ITEM, cmp, val);
}
void lazySetNext(Node<E> val) {
UNSAFE.putOrderedObject(this, nextOffset, val);
}
static <E> void lazySetNext(Node<E> node, Node<E> val) {
U.putOrderedObject(node, NEXT, val);
}
boolean casNext(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val);
}
// Unsafe mechanics
private static final sun.misc.Unsafe UNSAFE;
private static final long itemOffset;
private static final long nextOffset;
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class<?> k = Node.class;
itemOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("item"));
nextOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("next"));
} catch (Exception e) {
throw new Error(e);
}
}
static <E> boolean casNext(Node<E> node, Node<E> cmp, Node<E> val) {
return U.compareAndSwapObject(node, NEXT, cmp, val);
}
/**
@ -233,7 +217,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* - it is permitted for tail to lag behind head, that is, for tail
* to not be reachable from head!
*/
private transient volatile Node<E> head;
transient volatile Node<E> head;
/**
* A node from which the last node on list (that is, the unique
@ -253,7 +237,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* Creates a {@code ConcurrentLinkedQueue} that is initially empty.
*/
public ConcurrentLinkedQueue() {
head = tail = new Node<E>(null);
head = tail = newNode(null);
}
/**
@ -268,17 +252,16 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
public ConcurrentLinkedQueue(Collection<? extends E> c) {
Node<E> h = null, t = null;
for (E e : c) {
checkNotNull(e);
Node<E> newNode = new Node<E>(e);
Node<E> newNode = newNode(Objects.requireNonNull(e));
if (h == null)
h = t = newNode;
else {
t.lazySetNext(newNode);
lazySetNext(t, newNode);
t = newNode;
}
}
if (h == null)
h = t = new Node<E>(null);
h = t = newNode(null);
head = h;
tail = t;
}
@ -302,8 +285,9 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* as sentinel for succ(), below.
*/
final void updateHead(Node<E> h, Node<E> p) {
// assert h != null && p != null && (h == p || h.item == null);
if (h != p && casHead(h, p))
h.lazySetNext(h);
lazySetNext(h, h);
}
/**
@ -324,14 +308,13 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @throws NullPointerException if the specified element is null
*/
public boolean offer(E e) {
checkNotNull(e);
final Node<E> newNode = new Node<E>(e);
final Node<E> newNode = newNode(Objects.requireNonNull(e));
for (Node<E> t = tail, p = t;;) {
Node<E> q = p.next;
if (q == null) {
// p is last node
if (p.casNext(null, newNode)) {
if (casNext(p, null, newNode)) {
// Successful CAS is the linearization point
// for e to become an element of this queue,
// and for newNode to become "live".
@ -359,7 +342,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
for (Node<E> h = head, p = h, q;;) {
E item = p.item;
if (item != null && p.casItem(item, null)) {
if (item != null && casItem(p, item, null)) {
// Successful CAS is the linearization point
// for item to be removed from this queue.
if (p != h) // hop two nodes at a time
@ -446,13 +429,17 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return the number of elements in this queue
*/
public int size() {
int count = 0;
for (Node<E> p = first(); p != null; p = succ(p))
if (p.item != null)
// Collection.size() spec says to max out
if (++count == Integer.MAX_VALUE)
break;
return count;
restartFromHead: for (;;) {
int count = 0;
for (Node<E> p = first(); p != null;) {
if (p.item != null)
if (++count == Integer.MAX_VALUE)
break; // @see Collection.size()
if (p == (p = p.next))
continue restartFromHead;
}
return count;
}
}
/**
@ -464,11 +451,12 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return {@code true} if this queue contains the specified element
*/
public boolean contains(Object o) {
if (o == null) return false;
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null && o.equals(item))
return true;
if (o != null) {
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null && o.equals(item))
return true;
}
}
return false;
}
@ -485,19 +473,25 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return {@code true} if this queue changed as a result of the call
*/
public boolean remove(Object o) {
if (o == null) return false;
Node<E> pred = null;
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null &&
o.equals(item) &&
p.casItem(item, null)) {
Node<E> next = succ(p);
if (pred != null && next != null)
pred.casNext(p, next);
return true;
if (o != null) {
Node<E> next, pred = null;
for (Node<E> p = first(); p != null; pred = p, p = next) {
boolean removed = false;
E item = p.item;
if (item != null) {
if (!o.equals(item)) {
next = succ(p);
continue;
}
removed = casItem(p, item, null);
}
next = succ(p);
if (pred != null && next != null) // unlink
casNext(pred, p, next);
if (removed)
return true;
}
pred = p;
}
return false;
}
@ -522,12 +516,11 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
// Copy c into a private chain of Nodes
Node<E> beginningOfTheEnd = null, last = null;
for (E e : c) {
checkNotNull(e);
Node<E> newNode = new Node<E>(e);
Node<E> newNode = newNode(Objects.requireNonNull(e));
if (beginningOfTheEnd == null)
beginningOfTheEnd = last = newNode;
else {
last.lazySetNext(newNode);
lazySetNext(last, newNode);
last = newNode;
}
}
@ -539,7 +532,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
Node<E> q = p.next;
if (q == null) {
// p is last node
if (p.casNext(null, beginningOfTheEnd)) {
if (casNext(p, null, beginningOfTheEnd)) {
// Successful CAS is the linearization point
// for all elements to be added to this queue.
if (!casTail(t, last)) {
@ -565,6 +558,62 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
}
}
public String toString() {
String[] a = null;
restartFromHead: for (;;) {
int charLength = 0;
int size = 0;
for (Node<E> p = first(); p != null;) {
E item = p.item;
if (item != null) {
if (a == null)
a = new String[4];
else if (size == a.length)
a = Arrays.copyOf(a, 2 * size);
String s = item.toString();
a[size++] = s;
charLength += s.length();
}
if (p == (p = p.next))
continue restartFromHead;
}
if (size == 0)
return "[]";
return Helpers.toString(a, size, charLength);
}
}
private Object[] toArrayInternal(Object[] a) {
Object[] x = a;
restartFromHead: for (;;) {
int size = 0;
for (Node<E> p = first(); p != null;) {
E item = p.item;
if (item != null) {
if (x == null)
x = new Object[4];
else if (size == x.length)
x = Arrays.copyOf(x, 2 * (size + 4));
x[size++] = item;
}
if (p == (p = p.next))
continue restartFromHead;
}
if (x == null)
return new Object[0];
else if (a != null && size <= a.length) {
if (a != x)
System.arraycopy(x, 0, a, 0, size);
if (size < a.length)
a[size] = null;
return a;
}
return (size == x.length) ? x : Arrays.copyOf(x, size);
}
}
/**
* Returns an array containing all of the elements in this queue, in
* proper sequence.
@ -579,14 +628,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return an array containing all of the elements in this queue
*/
public Object[] toArray() {
// Use ArrayList to deal with resizing.
ArrayList<E> al = new ArrayList<E>();
for (Node<E> p = first(); p != null; p = succ(p)) {
E item = p.item;
if (item != null)
al.add(item);
}
return al.toArray();
return toArrayInternal(null);
}
/**
@ -610,7 +652,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
* The following code can be used to dump the queue into a newly
* allocated array of {@code String}:
*
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
* <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
*
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
@ -626,28 +668,8 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
// try to use sent-in array
int k = 0;
Node<E> p;
for (p = first(); p != null && k < a.length; p = succ(p)) {
E item = p.item;
if (item != null)
a[k++] = (T)item;
}
if (p == null) {
if (k < a.length)
a[k] = null;
return a;
}
// If won't fit, use ArrayList version
ArrayList<E> al = new ArrayList<E>();
for (Node<E> q = first(); q != null; q = succ(q)) {
E item = q.item;
if (item != null)
al.add(item);
}
return al.toArray(a);
if (a == null) throw new NullPointerException();
return (T[]) toArrayInternal(a);
}
/**
@ -683,54 +705,47 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
private Node<E> lastRet;
Itr() {
advance();
}
/**
* Moves to next valid node and returns item to return for
* next(), or null if no such.
*/
private E advance() {
lastRet = nextNode;
E x = nextItem;
Node<E> pred, p;
if (nextNode == null) {
p = first();
pred = null;
} else {
pred = nextNode;
p = succ(nextNode);
}
for (;;) {
if (p == null) {
nextNode = null;
nextItem = null;
return x;
}
E item = p.item;
if (item != null) {
nextNode = p;
nextItem = item;
return x;
} else {
// skip over nulls
Node<E> next = succ(p);
if (pred != null && next != null)
pred.casNext(p, next);
p = next;
restartFromHead: for (;;) {
Node<E> h, p, q;
for (p = h = head;; p = q) {
E item;
if ((item = p.item) != null) {
nextNode = p;
nextItem = item;
break;
}
else if ((q = p.next) == null)
break;
else if (p == q)
continue restartFromHead;
}
updateHead(h, p);
return;
}
}
public boolean hasNext() {
return nextNode != null;
return nextItem != null;
}
public E next() {
if (nextNode == null) throw new NoSuchElementException();
return advance();
final Node<E> pred = nextNode;
if (pred == null) throw new NoSuchElementException();
// assert nextItem != null;
lastRet = pred;
E item = null;
for (Node<E> p = succ(pred), q;; p = q) {
if (p == null || (item = p.item) != null) {
nextNode = p;
E x = nextItem;
nextItem = item;
return x;
}
// unlink deleted nodes
if ((q = succ(p)) != null)
casNext(pred, p, q);
}
}
public void remove() {
@ -780,19 +795,18 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
// Read in elements until trailing null sentinel found
Node<E> h = null, t = null;
Object item;
while ((item = s.readObject()) != null) {
for (Object item; (item = s.readObject()) != null; ) {
@SuppressWarnings("unchecked")
Node<E> newNode = new Node<E>((E) item);
Node<E> newNode = newNode((E) item);
if (h == null)
h = t = newNode;
else {
t.lazySetNext(newNode);
lazySetNext(t, newNode);
t = newNode;
}
}
if (h == null)
h = t = new Node<E>(null);
h = t = newNode(null);
head = h;
tail = t;
}
@ -829,8 +843,9 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
if (i > 0) {
batch = i;
return Spliterators.spliterator
(a, 0, i, Spliterator.ORDERED | Spliterator.NONNULL |
Spliterator.CONCURRENT);
(a, 0, i, (Spliterator.ORDERED |
Spliterator.NONNULL |
Spliterator.CONCURRENT));
}
}
return null;
@ -904,38 +919,32 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
return new CLQSpliterator<E>(this);
}
/**
* Throws NullPointerException if argument is null.
*
* @param v the element
*/
private static void checkNotNull(Object v) {
if (v == null)
throw new NullPointerException();
}
private boolean casTail(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val);
return U.compareAndSwapObject(this, TAIL, cmp, val);
}
private boolean casHead(Node<E> cmp, Node<E> val) {
return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val);
return U.compareAndSwapObject(this, HEAD, cmp, val);
}
// Unsafe mechanics
private static final sun.misc.Unsafe UNSAFE;
private static final long headOffset;
private static final long tailOffset;
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
private static final long HEAD;
private static final long TAIL;
private static final long ITEM;
private static final long NEXT;
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class<?> k = ConcurrentLinkedQueue.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("tail"));
} catch (Exception e) {
HEAD = U.objectFieldOffset
(ConcurrentLinkedQueue.class.getDeclaredField("head"));
TAIL = U.objectFieldOffset
(ConcurrentLinkedQueue.class.getDeclaredField("tail"));
ITEM = U.objectFieldOffset
(Node.class.getDeclaredField("item"));
NEXT = U.objectFieldOffset
(Node.class.getDeclaredField("next"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}

View File

@ -89,7 +89,7 @@ public interface ConcurrentMap<K,V> extends Map<K,V> {
return ((v = get(key)) != null) ? v : defaultValue;
}
/**
/**
* {@inheritDoc}
*
* @implSpec The default implementation is equivalent to, for this
@ -181,10 +181,10 @@ public interface ConcurrentMap<K,V> extends Map<K,V> {
* is not supported by this map
* @throws ClassCastException if the key or value is of an inappropriate
* type for this map
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key or value is null,
* and this map does not permit null keys or values
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean remove(Object key, Object value);

View File

@ -34,7 +34,9 @@
*/
package java.util.concurrent;
import java.util.*;
import java.util.NavigableMap;
import java.util.NavigableSet;
/**
* A {@link ConcurrentMap} supporting {@link NavigableMap} operations,
@ -101,7 +103,7 @@ public interface ConcurrentNavigableMap<K,V>
* reflected in the descending map, and vice-versa.
*
* <p>The returned map has an ordering equivalent to
* {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}.
* {@link java.util.Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}.
* The expression {@code m.descendingMap().descendingMap()} returns a
* view of {@code m} essentially equivalent to {@code m}.
*
@ -125,7 +127,7 @@ public interface ConcurrentNavigableMap<K,V>
*
* @return a navigable set view of the keys in this map
*/
public NavigableSet<K> navigableKeySet();
NavigableSet<K> navigableKeySet();
/**
* Returns a {@link NavigableSet} view of the keys contained in this map.
@ -163,5 +165,5 @@ public interface ConcurrentNavigableMap<K,V>
*
* @return a reverse order navigable set view of the keys in this map
*/
public NavigableSet<K> descendingKeySet();
NavigableSet<K> descendingKeySet();
}

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