mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-14 04:15:04 +00:00
Merge
This commit is contained in:
commit
d58d230d11
1
.hgtags
1
.hgtags
@ -346,3 +346,4 @@ f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
|
||||
80f67512daa15cf37b4825c1c62a675d524d7c49 jdk-9+101
|
||||
2dc4c11fe48831854916d53c3913bdb7d49023ea jdk-9+102
|
||||
4a652e4ca9523422149958673033e0ac740d5e1e jdk-9+103
|
||||
086c682bd8c5f195c324f61e2c61fbcd0226d63b jdk-9+104
|
||||
|
||||
@ -346,3 +346,4 @@ c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
|
||||
c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
|
||||
6406ecf5d39482623225bb1b3098c2cac6f7d450 jdk-9+102
|
||||
47d6462e514b2097663305a57d9c844c15d5b609 jdk-9+103
|
||||
9a38f8b4ba220708db198d08d82fd2144a64777d jdk-9+104
|
||||
|
||||
@ -573,6 +573,11 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
|
||||
|
||||
# Locate the directory of this script.
|
||||
AUTOCONF_DIR=$TOPDIR/common/autoconf
|
||||
|
||||
# Setup username (for use in adhoc version strings etc)
|
||||
# Outer [ ] to quote m4.
|
||||
[ USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
|
||||
AC_SUBST(USERNAME)
|
||||
])
|
||||
|
||||
# Evaluates platform specific overrides for devkit variables.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2016, 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
|
||||
@ -80,8 +80,9 @@ AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
# Solaris Studio does not have a concept of sysroot. Instead we must
|
||||
# make sure the default include and lib dirs are appended to each
|
||||
# compile and link command line.
|
||||
$1SYSROOT_CFLAGS="-I[$]$1SYSROOT/usr/include"
|
||||
# compile and link command line. Must also add -I-xbuiltin to enable
|
||||
# inlining of system functions and intrinsics.
|
||||
$1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
|
||||
$1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
|
||||
-L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
|
||||
-L[$]$1SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
|
||||
@ -425,7 +426,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
|
||||
# Add runtime stack smashing and undefined behavior checks.
|
||||
# Not all versions of gcc support -fstack-protector
|
||||
STACK_PROTECTOR_CFLAG="-fstack-protector-all"
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
|
||||
|
||||
CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
|
||||
CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
|
||||
@ -601,22 +602,22 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
|
||||
esac
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
# Force compatibility with i586 on 32 bit intel platforms.
|
||||
COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
|
||||
fi
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
|
||||
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
|
||||
case $OPENJDK_TARGET_CPU_ARCH in
|
||||
ppc )
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
esac
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
# Force compatibility with i586 on 32 bit intel platforms.
|
||||
COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
|
||||
fi
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
|
||||
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
|
||||
case $OPENJDK_TARGET_CPU_ARCH in
|
||||
ppc )
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
|
||||
|
||||
@ -917,6 +917,7 @@ JVM_VARIANTS
|
||||
JVM_INTERPRETER
|
||||
JDK_VARIANT
|
||||
SET_OPENJDK
|
||||
USERNAME
|
||||
CANONICAL_TOPDIR
|
||||
ORIGINAL_TOPDIR
|
||||
TOPDIR
|
||||
@ -3834,7 +3835,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
||||
|
||||
|
||||
#
|
||||
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2016, 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
|
||||
@ -4835,7 +4836,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1454146111
|
||||
DATE_WHEN_GENERATED=1454926898
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -15652,6 +15653,11 @@ $as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid."
|
||||
# Locate the directory of this script.
|
||||
AUTOCONF_DIR=$TOPDIR/common/autoconf
|
||||
|
||||
# Setup username (for use in adhoc version strings etc)
|
||||
# Outer [ ] to quote m4.
|
||||
USERNAME=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'`
|
||||
|
||||
|
||||
|
||||
# Check if it's a pure open build or if custom sources are to be used.
|
||||
|
||||
@ -23429,9 +23435,8 @@ $as_echo "$as_me: WARNING: --with-version-opt value has been sanitized from '$wi
|
||||
# Default is to calculate a string like this <timestamp>.<username>.<base dir name>
|
||||
timestamp=`$DATE '+%Y-%m-%d-%H%M%S'`
|
||||
# Outer [ ] to quote m4.
|
||||
username=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'`
|
||||
basedirname=`$BASENAME "$TOPDIR" | $TR -d -c '[a-z][A-Z][0-9].-'`
|
||||
VERSION_OPT="$timestamp.$username.$basedirname"
|
||||
VERSION_OPT="$timestamp.$USERNAME.$basedirname"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -29968,8 +29973,9 @@ fi
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
# Solaris Studio does not have a concept of sysroot. Instead we must
|
||||
# make sure the default include and lib dirs are appended to each
|
||||
# compile and link command line.
|
||||
SYSROOT_CFLAGS="-I$SYSROOT/usr/include"
|
||||
# compile and link command line. Must also add -I-xbuiltin to enable
|
||||
# inlining of system functions and intrinsics.
|
||||
SYSROOT_CFLAGS="-I-xbuiltin -I$SYSROOT/usr/include"
|
||||
SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
|
||||
-L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
|
||||
-L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
|
||||
@ -42361,8 +42367,9 @@ $as_echo "$BUILD_DEVKIT_ROOT" >&6; }
|
||||
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
# Solaris Studio does not have a concept of sysroot. Instead we must
|
||||
# make sure the default include and lib dirs are appended to each
|
||||
# compile and link command line.
|
||||
BUILD_SYSROOT_CFLAGS="-I$BUILD_SYSROOT/usr/include"
|
||||
# compile and link command line. Must also add -I-xbuiltin to enable
|
||||
# inlining of system functions and intrinsics.
|
||||
BUILD_SYSROOT_CFLAGS="-I-xbuiltin -I$BUILD_SYSROOT/usr/include"
|
||||
BUILD_SYSROOT_LDFLAGS="-L$BUILD_SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
|
||||
-L$BUILD_SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
|
||||
-L$BUILD_SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
|
||||
@ -46191,12 +46198,12 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
||||
|
||||
# Execute function body
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"" >&5
|
||||
$as_echo_n "checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$STACK_PROTECTOR_CFLAG -Werror\"" >&5
|
||||
$as_echo_n "checking if compiler supports \"$STACK_PROTECTOR_CFLAG -Werror\"... " >&6; }
|
||||
supports=yes
|
||||
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $STACK_PROTECTOR_CFLAG"
|
||||
CFLAGS="$CFLAGS $STACK_PROTECTOR_CFLAG -Werror"
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -46222,7 +46229,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
CFLAGS="$saved_cflags"
|
||||
|
||||
saved_cxxflags="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAG $STACK_PROTECTOR_CFLAG"
|
||||
CXXFLAGS="$CXXFLAG $STACK_PROTECTOR_CFLAG -Werror"
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -46441,22 +46448,22 @@ $as_echo "$supports" >&6; }
|
||||
esac
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
# Force compatibility with i586 on 32 bit intel platforms.
|
||||
COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
|
||||
fi
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
|
||||
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
|
||||
case $OPENJDK_TARGET_CPU_ARCH in
|
||||
ppc )
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
esac
|
||||
if test "x$OPENJDK_TARGET_CPU" = xx86; then
|
||||
# Force compatibility with i586 on 32 bit intel platforms.
|
||||
COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
|
||||
fi
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
|
||||
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
|
||||
case $OPENJDK_TARGET_CPU_ARCH in
|
||||
ppc )
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
|
||||
|
||||
@ -162,9 +162,8 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
|
||||
# Default is to calculate a string like this <timestamp>.<username>.<base dir name>
|
||||
timestamp=`$DATE '+%Y-%m-%d-%H%M%S'`
|
||||
# Outer [ ] to quote m4.
|
||||
[ username=`$ECHO "$USER" | $TR -d -c '[a-z][A-Z][0-9]'` ]
|
||||
[ basedirname=`$BASENAME "$TOPDIR" | $TR -d -c '[a-z][A-Z][0-9].-'` ]
|
||||
VERSION_OPT="$timestamp.$username.$basedirname"
|
||||
VERSION_OPT="$timestamp.$USERNAME.$basedirname"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -184,6 +184,7 @@ JDK_RC_PLATFORM_NAME:=@JDK_RC_PLATFORM_NAME@
|
||||
COMPANY_NAME:=@COMPANY_NAME@
|
||||
MACOSX_BUNDLE_NAME_BASE=@MACOSX_BUNDLE_NAME_BASE@
|
||||
MACOSX_BUNDLE_ID_BASE=@MACOSX_BUNDLE_ID_BASE@
|
||||
USERNAME:=@USERNAME@
|
||||
|
||||
# Different naming strings generated from the above information.
|
||||
RUNTIME_NAME=$(PRODUCT_NAME) $(PRODUCT_SUFFIX)
|
||||
|
||||
@ -346,3 +346,4 @@ ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
|
||||
30dfb3bd3d06b4bb80a087babc0d1841edba187b jdk-9+101
|
||||
9c4662334d933d299928d1f599d02ff50777cbf8 jdk-9+102
|
||||
0680fb7dae4da1ee6cf783c4b74184e3e08d3179 jdk-9+103
|
||||
e385e95e6101711d5c63e7b1a827e99b6ec7a1cc jdk-9+104
|
||||
|
||||
@ -506,3 +506,4 @@ bdb0acafc63c42e84d9d8195bf2e2b25ee9c3306 jdk-9+100
|
||||
9f45d3d57d6948cf526fbc2e2891a9a74ac6941a jdk-9+101
|
||||
d5239fc1b69749ae50793c61b899fcdacf3df857 jdk-9+102
|
||||
c5f55130b1b69510d9a6f4a3105b58e21cd7ffe1 jdk-9+103
|
||||
534c50395957c6025fb6627e93b35756f8d48a08 jdk-9+104
|
||||
|
||||
@ -346,3 +346,4 @@ d45bcd374f6057851e3c2dcd45607cd362afadfa jdk-9+100
|
||||
d3e834ff74e724a2b92a558e18e8cbf81c6dbc59 jdk-9+101
|
||||
9dcf193c0b6cf22c0e89e2dc705a2c0f520ae064 jdk-9+102
|
||||
bdbf2342b21bd8ecad1b4e6499a0dfb314952bd7 jdk-9+103
|
||||
58448465334e1d8bf1cfc09052783937b1cc21c0 jdk-9+104
|
||||
|
||||
@ -26,6 +26,8 @@
|
||||
package com.sun.org.apache.xalan.internal.utils;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
/**
|
||||
@ -415,6 +417,23 @@ public final class XMLSecurityManager {
|
||||
|
||||
}
|
||||
|
||||
// Array list to store printed warnings for each SAX parser used
|
||||
private static final CopyOnWriteArrayList<String> printedWarnings = new CopyOnWriteArrayList<>();
|
||||
|
||||
/**
|
||||
* Prints out warnings if a parser does not support the specified feature/property.
|
||||
*
|
||||
* @param parserClassName the name of the parser class
|
||||
* @param propertyName the property name
|
||||
* @param exception the exception thrown by the parser
|
||||
*/
|
||||
public static void printWarning(String parserClassName, String propertyName, SAXException exception) {
|
||||
String key = parserClassName+":"+propertyName;
|
||||
if (printedWarnings.addIfAbsent(key)) {
|
||||
System.err.println( "Warning: "+parserClassName+": "+exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from system properties, or those in jaxp.properties
|
||||
*
|
||||
|
||||
@ -489,18 +489,20 @@ public class Parser implements Constants, ContentHandler {
|
||||
}
|
||||
|
||||
final XMLReader reader = parser.getXMLReader();
|
||||
String lastProperty = "";
|
||||
try {
|
||||
XMLSecurityManager securityManager =
|
||||
(XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
|
||||
for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
|
||||
reader.setProperty(limit.apiProperty(), securityManager.getLimitValueAsString(limit));
|
||||
lastProperty = limit.apiProperty();
|
||||
reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
|
||||
}
|
||||
if (securityManager.printEntityCountInfo()) {
|
||||
lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
|
||||
parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
|
||||
}
|
||||
} catch (SAXException se) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ se.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
|
||||
}
|
||||
|
||||
return(parse(reader, input));
|
||||
|
||||
@ -29,7 +29,6 @@ import java.io.Reader;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
@ -39,7 +38,6 @@ import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.stax.StAXResult;
|
||||
import javax.xml.transform.stax.StAXSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
@ -111,8 +109,8 @@ public final class Util {
|
||||
reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
|
||||
xsltc.isSecureProcessing());
|
||||
} catch (SAXNotRecognizedException e) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ e.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(),
|
||||
XMLConstants.FEATURE_SECURE_PROCESSING, e);
|
||||
}
|
||||
} catch (Exception e ) {
|
||||
try {
|
||||
@ -149,25 +147,27 @@ public final class Util {
|
||||
reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
|
||||
} catch (SAXNotRecognizedException e) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ e.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(),
|
||||
XMLConstants.ACCESS_EXTERNAL_DTD, e);
|
||||
}
|
||||
|
||||
String lastProperty = "";
|
||||
try {
|
||||
XMLSecurityManager securityManager =
|
||||
(XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
|
||||
if (securityManager != null) {
|
||||
for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
|
||||
reader.setProperty(limit.apiProperty(),
|
||||
lastProperty = limit.apiProperty();
|
||||
reader.setProperty(lastProperty,
|
||||
securityManager.getLimitValueAsString(limit));
|
||||
}
|
||||
if (securityManager.printEntityCountInfo()) {
|
||||
lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
|
||||
reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
|
||||
}
|
||||
}
|
||||
} catch (SAXException se) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ se.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
|
||||
}
|
||||
xsltc.setXMLReader(reader);
|
||||
}catch (SAXNotRecognizedException snre ) {
|
||||
|
||||
@ -2249,8 +2249,8 @@ public class XSDHandler {
|
||||
try {
|
||||
parser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, fAccessExternalDTD);
|
||||
} catch (SAXNotRecognizedException exc) {
|
||||
System.err.println("Warning: " + parser.getClass().getName() + ": " +
|
||||
exc.getMessage());
|
||||
XMLSecurityManager.printWarning(parser.getClass().getName(),
|
||||
XMLConstants.ACCESS_EXTERNAL_DTD, exc);
|
||||
}
|
||||
}
|
||||
// If XML names and Namespace URIs are already internalized we
|
||||
|
||||
@ -697,8 +697,8 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements
|
||||
reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD));
|
||||
} catch (SAXException exc) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": " +
|
||||
exc.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(),
|
||||
XMLConstants.ACCESS_EXTERNAL_DTD, exc);
|
||||
}
|
||||
}
|
||||
} catch( Exception e ) {
|
||||
|
||||
@ -27,6 +27,8 @@ package com.sun.org.apache.xerces.internal.utils;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.util.SecurityManager;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* This class manages standard and implementation-specific limitations.
|
||||
@ -496,6 +498,23 @@ public final class XMLSecurityManager {
|
||||
|
||||
}
|
||||
|
||||
// Array list to store printed warnings for each SAX parser used
|
||||
private static final CopyOnWriteArrayList<String> printedWarnings = new CopyOnWriteArrayList<>();
|
||||
|
||||
/**
|
||||
* Prints out warnings if a parser does not support the specified feature/property.
|
||||
*
|
||||
* @param parserClassName the name of the parser class
|
||||
* @param propertyName the property name
|
||||
* @param exception the exception thrown by the parser
|
||||
*/
|
||||
public static void printWarning(String parserClassName, String propertyName, SAXException exception) {
|
||||
String key = parserClassName+":"+propertyName;
|
||||
if (printedWarnings.addIfAbsent(key)) {
|
||||
System.err.println( "Warning: "+parserClassName+": "+exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from system properties, or those in jaxp.properties
|
||||
*
|
||||
|
||||
@ -128,8 +128,8 @@ public class XMLReaderManager {
|
||||
try {
|
||||
reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _secureProcessing);
|
||||
} catch (SAXNotRecognizedException e) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ e.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(),
|
||||
XMLConstants.FEATURE_SECURE_PROCESSING, e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
@ -172,23 +172,25 @@ public class XMLReaderManager {
|
||||
//reader is cached, but this property might have been reset
|
||||
reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
|
||||
} catch (SAXException se) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ se.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(),
|
||||
XMLConstants.ACCESS_EXTERNAL_DTD, se);
|
||||
}
|
||||
|
||||
String lastProperty = "";
|
||||
try {
|
||||
if (_xmlSecurityManager != null) {
|
||||
for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
|
||||
reader.setProperty(limit.apiProperty(),
|
||||
lastProperty = limit.apiProperty();
|
||||
reader.setProperty(lastProperty,
|
||||
_xmlSecurityManager.getLimitValueAsString(limit));
|
||||
}
|
||||
if (_xmlSecurityManager.printEntityCountInfo()) {
|
||||
lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
|
||||
reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
|
||||
}
|
||||
}
|
||||
} catch (SAXException se) {
|
||||
System.err.println("Warning: " + reader.getClass().getName() + ": "
|
||||
+ se.getMessage());
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
|
||||
}
|
||||
|
||||
return reader;
|
||||
|
||||
58
jaxp/test/javax/xml/jaxp/unittest/common/TestSAXDriver.java
Normal file
58
jaxp/test/javax/xml/jaxp/unittest/common/TestSAXDriver.java
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
package common;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl;
|
||||
import javax.xml.XMLConstants;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
|
||||
/*
|
||||
* Test implementation of SAXParser. It is extended from JDK parser and two methods
|
||||
* are overriden to disable support of specific features and properties.
|
||||
* This class is used in ValidationWarningsTest and TransformationWarningsTest
|
||||
* to generate multiple warnings during xml validation and transformation processes.
|
||||
*/
|
||||
public class TestSAXDriver extends SAXParserImpl.JAXPSAXParser {
|
||||
|
||||
@Override
|
||||
public synchronized void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(name)) {
|
||||
throw new SAXNotRecognizedException(name+" feature is not recognised by test SAX parser intentionally.");
|
||||
} else {
|
||||
super.setFeature(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if (XMLConstants.ACCESS_EXTERNAL_DTD.equals(name) || ENT_EXP_LIMIT_PROP.equals(name)) {
|
||||
throw new SAXNotRecognizedException(name+" property is not recognised by test SAX parser intentionally.");
|
||||
} else {
|
||||
super.setProperty(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String ENT_EXP_LIMIT_PROP = "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit";
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
package common;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
|
||||
* @bug 8144593
|
||||
* @summary Check that warnings about unsupported properties from parsers
|
||||
* are suppressed during the transformation process.
|
||||
*/
|
||||
public class TransformationWarningsTest extends WarningsTestBase {
|
||||
|
||||
@BeforeClass
|
||||
public void setup() {
|
||||
//Set test SAX driver implementation.
|
||||
System.setProperty("org.xml.sax.driver", "common.TestSAXDriver");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransformation() throws Exception {
|
||||
startTest();
|
||||
}
|
||||
|
||||
//One iteration of xml transformation test case. It will be called from each
|
||||
//TestWorker task defined in WarningsTestBase class.
|
||||
void doOneTestIteration() throws Exception {
|
||||
// Prepare output stream
|
||||
StringWriter xmlResultString = new StringWriter();
|
||||
StreamResult xmlResultStream = new StreamResult(xmlResultString);
|
||||
// Prepare xml source stream
|
||||
Source src = new StreamSource(new StringReader(xml));
|
||||
Transformer t = createTransformer();
|
||||
//Transform the xml
|
||||
t.transform(src, xmlResultStream);
|
||||
}
|
||||
|
||||
//Create transformer from xsl test string
|
||||
Transformer createTransformer() throws Exception {
|
||||
// Prepare sources for transormation
|
||||
Source xslsrc = new StreamSource(new StringReader(xsl));
|
||||
|
||||
// Create factory and transformer
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer t = tf.newTransformer(xslsrc);
|
||||
|
||||
// Set URI Resolver to return the newly constructed xml
|
||||
// stream source object from xml test string
|
||||
t.setURIResolver((String href, String base) -> new StreamSource(new StringReader(xml)));
|
||||
return t;
|
||||
}
|
||||
|
||||
//Xsl and Xml contents used in the transformation test
|
||||
private static final String xsl = "<xsl:stylesheet version='2.0'"
|
||||
+ " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
|
||||
+ " <xsl:output method='xml' indent='yes' omit-xml-declaration='yes'/>"
|
||||
+ " <xsl:template match='/'>"
|
||||
+ " <test>Simple Transformation Result. No warnings should be printed to console</test>"
|
||||
+ " </xsl:template>"
|
||||
+ "</xsl:stylesheet>";
|
||||
private static final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>";
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
package common;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.StringReader;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
|
||||
* @bug 8144593
|
||||
* @summary Check that warnings about unsupported properties from SAX
|
||||
* parsers are suppressed during the xml validation process.
|
||||
*/
|
||||
public class ValidationWarningsTest extends WarningsTestBase {
|
||||
|
||||
@BeforeClass
|
||||
public void setup() {
|
||||
//Set test SAX driver implementation.
|
||||
System.setProperty("org.xml.sax.driver", "common.TestSAXDriver");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidation() throws Exception {
|
||||
startTest();
|
||||
}
|
||||
|
||||
//One iteration of xml validation test case. It will be called from each
|
||||
//TestWorker task defined in WarningsTestBase class.
|
||||
void doOneTestIteration() throws Exception {
|
||||
Source src = new StreamSource(new StringReader(xml));
|
||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
SAXSource xsdSource = new SAXSource(new InputSource(new ByteArrayInputStream(xsd.getBytes())));
|
||||
Schema schema = schemaFactory.newSchema(xsdSource);
|
||||
Validator v = schema.newValidator();
|
||||
v.validate(src);
|
||||
}
|
||||
|
||||
//Xsd and Xml contents used in the validation test
|
||||
private static final String xsd = "<?xml version='1.0'?>"
|
||||
+ " <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>"
|
||||
+ " <xs:element name='test' type='xs:string'/>\n"
|
||||
+ " </xs:schema>";
|
||||
private static final String xml = "<?xml version='1.0'?><test>Element</test>";
|
||||
|
||||
}
|
||||
136
jaxp/test/javax/xml/jaxp/unittest/common/WarningsTestBase.java
Normal file
136
jaxp/test/javax/xml/jaxp/unittest/common/WarningsTestBase.java
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
package common;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.xml.XMLConstants;
|
||||
import org.testng.Assert;
|
||||
|
||||
/*
|
||||
* This class helps to test suppression of unsupported parser properties
|
||||
* messages printed to standard error output.
|
||||
* It launches THREADS_COUNT tasks. Each task does ITERATIONS_PER_THREAD
|
||||
* sequential calls to doOneIteration method implemented by specific test class.
|
||||
*/
|
||||
public abstract class WarningsTestBase {
|
||||
|
||||
/*
|
||||
* Abstract method that should be implemented by test class.
|
||||
* It is repeatedly called by each TestWorker task.
|
||||
*/
|
||||
abstract void doOneTestIteration() throws Exception;
|
||||
|
||||
/*
|
||||
* Launches parallel test tasks and check the output for the number of
|
||||
* generated warning messages. There should be no more than one message of
|
||||
* each type.
|
||||
*/
|
||||
void startTest() throws Exception {
|
||||
//Save standard error stream
|
||||
PrintStream defStdErr = System.err;
|
||||
//Set new byte array stream as standard error stream
|
||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(5000);
|
||||
System.setErr(new PrintStream(byteStream));
|
||||
//Execute multiple TestWorker tasks
|
||||
for (int id = 0; id < THREADS_COUNT; id++) {
|
||||
EXECUTOR.execute(new TestWorker(id));
|
||||
}
|
||||
//Initiate shutdown of previously submitted task
|
||||
EXECUTOR.shutdown();
|
||||
//Wait for termination of submitted tasks
|
||||
if (!EXECUTOR.awaitTermination(THREADS_COUNT, TimeUnit.SECONDS)) {
|
||||
//If not all tasks terminates during the time out force them to shutdown
|
||||
EXECUTOR.shutdownNow();
|
||||
}
|
||||
//Restore default standard error stream
|
||||
System.setErr(defStdErr);
|
||||
//Print tasks stderr output
|
||||
String errContent = byteStream.toString();
|
||||
System.out.println("Standard error output content:");
|
||||
System.out.println(errContent);
|
||||
//Check tasks stderr output for quatity of warning messages
|
||||
Assert.assertTrue(warningPrintedOnce(XMLConstants.ACCESS_EXTERNAL_DTD, errContent));
|
||||
Assert.assertTrue(warningPrintedOnce(ENT_EXP_PROPERTY, errContent));
|
||||
Assert.assertTrue(warningPrintedOnce(XMLConstants.FEATURE_SECURE_PROCESSING, errContent));
|
||||
}
|
||||
|
||||
// Count occurences of warning messages in standard error and check if warning is printed
|
||||
// not more than once
|
||||
private boolean warningPrintedOnce(String propertyName, String testOutput) {
|
||||
//Count for property name in test output
|
||||
Pattern p = Pattern.compile(propertyName);
|
||||
Matcher m = p.matcher(testOutput);
|
||||
int count = 0;
|
||||
while (m.find()) {
|
||||
count += 1;
|
||||
}
|
||||
System.out.println("'" + propertyName + "' print count: " + count);
|
||||
//If count is more than 1 then consider test failed
|
||||
return count <= 1;
|
||||
}
|
||||
|
||||
//TestWorker task that sequentially calls test method
|
||||
private class TestWorker implements Runnable {
|
||||
// Task id
|
||||
private final int id;
|
||||
|
||||
TestWorker(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
System.out.printf("%d: waiting for barrier%n", id);
|
||||
//Synchronize startup of all tasks
|
||||
BARRIER.await();
|
||||
System.out.printf("%d: starting iterations%n", id);
|
||||
//Call test method multiple times
|
||||
for (int i = 0; i < ITERATIONS_PER_THREAD; i++) {
|
||||
doOneTestIteration();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("TestWorker id:" + id + " failed", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Entity expansion limit property name
|
||||
private static final String ENT_EXP_PROPERTY = "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit";
|
||||
//Number of simultaneous test threads
|
||||
private static final int THREADS_COUNT = 10;
|
||||
//Number of iterations per one thread
|
||||
private static final int ITERATIONS_PER_THREAD = 4;
|
||||
//Test thread pool
|
||||
private static final ExecutorService EXECUTOR = Executors.newCachedThreadPool();
|
||||
//Cyclic barrier for threads startup synchronisation
|
||||
private static final CyclicBarrier BARRIER = new CyclicBarrier(THREADS_COUNT);
|
||||
}
|
||||
@ -349,3 +349,4 @@ d0a97e57d2336238edf6a4cd60aafe67deb7258d jdk-9+100
|
||||
3e99318616da903e0dc8f07f9f9203dc1bd49921 jdk-9+101
|
||||
0868b93587cc99df3a4f4d3817a1aa756bea60ab jdk-9+102
|
||||
eb5e005a17e50d7d8340daaf21a5c3c5ae358d68 jdk-9+103
|
||||
0f557aa096e2a5c9733d406d8cf0c2e6b1f8ca60 jdk-9+104
|
||||
|
||||
@ -346,3 +346,4 @@ e1a789be1535741274c9779f4d4ca3495196b5c3 jdk-9+99
|
||||
5e8370fb3ed925335164afe340d1e54beab2d4d5 jdk-9+101
|
||||
6eb3c8132e489dab81adde4ce29844904ce15482 jdk-9+102
|
||||
eee1ced1d8e78293f2a004af818ca474387dbebf jdk-9+103
|
||||
8faf1aec77a9517c69d2f4d8dd146429852ace7f jdk-9+104
|
||||
|
||||
@ -235,6 +235,13 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
LIBAWT_MAPFILE :=
|
||||
endif
|
||||
|
||||
# Turn off all warnings for debug_mem.c This is needed because the specific warning
|
||||
# about initializing a declared 'extern' cannot be turned off individually. Only
|
||||
# applies to debug builds.
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
|
||||
endif
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
|
||||
LIBRARY := awt, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
@ -248,7 +255,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
|
||||
DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
|
||||
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
|
||||
DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
|
||||
WARNINGS_AS_ERRORS_gcc := false, \
|
||||
ASFLAGS := $(LIBAWT_ASFLAGS), \
|
||||
MAPFILE := $(LIBAWT_MAPFILE), \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
@ -343,6 +349,19 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
|
||||
LIBAWT_XAWT_LIBS += -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
# Turn off all warnings for the following files since they contain warnings
|
||||
# that cannot be turned of individually.
|
||||
# redefining a macro
|
||||
BUILD_LIBAWT_XAWT_gtk2_interface.c_CFLAGS := -w
|
||||
# comparison between pointer and integer
|
||||
BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
|
||||
# initializing a declared 'extern'
|
||||
BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
|
||||
# decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
|
||||
BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
|
||||
endif
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
|
||||
LIBRARY := awt_xawt, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
@ -356,7 +375,6 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
|
||||
format-security int-to-pointer-cast parentheses, \
|
||||
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
|
||||
E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
|
||||
WARNINGS_AS_ERRORS_gcc := false, \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN) \
|
||||
@ -658,8 +676,11 @@ endif
|
||||
|
||||
LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
|
||||
|
||||
# Turn off aliasing with GCC for ExtensionSubtables.cpp
|
||||
ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
# Turn off all warnings for sunFont.c. This is needed because the specific warning
|
||||
# about discarding 'const' qualifier cannot be turned off individually.
|
||||
BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
|
||||
# Turn off aliasing with GCC for ExtensionSubtables.cpp
|
||||
BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
|
||||
endif
|
||||
|
||||
@ -674,14 +695,20 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
|
||||
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
|
||||
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
|
||||
CFLAGS_windows = -DCC_NOEX, \
|
||||
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
|
||||
delete-non-virtual-dtor type-limits missing-field-initializers, \
|
||||
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
|
||||
type-limits missing-field-initializers, \
|
||||
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
|
||||
maybe-uninitialized, \
|
||||
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
|
||||
tautological-constant-out-of-range-compare int-to-pointer-cast, \
|
||||
DISABLED_WARNINGS_solstudio := truncwarn, \
|
||||
DISABLED_WARNINGS_C_solstudio = \
|
||||
E_INTEGER_OVERFLOW_DETECTED \
|
||||
E_ARG_INCOMPATIBLE_WITH_ARG_L \
|
||||
E_ENUM_VAL_OVERFLOWS_INT_MAX, \
|
||||
DISABLED_WARNINGS_CXX_solstudio := \
|
||||
truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
|
||||
hidevf w_novirtualdescr arrowrtn2, \
|
||||
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334, \
|
||||
WARNINGS_AS_ERRORS_gcc := false, \
|
||||
WARNINGS_AS_ERRORS_solstudio := false, \
|
||||
MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
|
||||
LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
|
||||
@ -247,6 +247,13 @@ ifeq ($(OPENJDK_TARGET_OS), aix)
|
||||
LIBJIMAGE_TOOLCHAIN := TOOLCHAIN_LINK_CXX
|
||||
endif # OPENJDK_TARGET_OS aix
|
||||
|
||||
JIMAGELIB_CPPFLAGS := \
|
||||
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
|
||||
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
|
||||
-I$(JDK_TOPDIR)/src/java.base/share/native/libjimage \
|
||||
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
|
||||
#
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
|
||||
LIBRARY := jimage, \
|
||||
TOOLCHAIN := $(LIBJIMAGE_TOOLCHAIN), \
|
||||
@ -255,12 +262,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
|
||||
SRC := $(JDK_TOPDIR)/src/java.base/share/native/libjimage \
|
||||
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \
|
||||
EXCLUDES := $(LIBJIMAGE_EXCLUDES), \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(JIMAGELIB_CPPFLAGS) \
|
||||
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
|
||||
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
|
||||
-I$(JDK_TOPDIR)/src/java.base/share/native/libjimage \
|
||||
-I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
|
||||
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
|
||||
CFLAGS_unix := -UDEBUG, \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjimage/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
|
||||
@ -250,6 +250,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_misc_Signal_raise0;
|
||||
Java_sun_reflect_ConstantPool_getClassAt0;
|
||||
Java_sun_reflect_ConstantPool_getClassAtIfLoaded0;
|
||||
Java_sun_reflect_ConstantPool_getClassRefIndexAt0;
|
||||
Java_sun_reflect_ConstantPool_getDoubleAt0;
|
||||
Java_sun_reflect_ConstantPool_getFieldAt0;
|
||||
Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0;
|
||||
@ -259,8 +260,11 @@ SUNWprivate_1.1 {
|
||||
Java_sun_reflect_ConstantPool_getMemberRefInfoAt0;
|
||||
Java_sun_reflect_ConstantPool_getMethodAt0;
|
||||
Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0;
|
||||
Java_sun_reflect_ConstantPool_getNameAndTypeRefIndexAt0;
|
||||
Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0;
|
||||
Java_sun_reflect_ConstantPool_getSize0;
|
||||
Java_sun_reflect_ConstantPool_getStringAt0;
|
||||
Java_sun_reflect_ConstantPool_getTagAt0;
|
||||
Java_sun_reflect_ConstantPool_getUTF8At0;
|
||||
Java_java_io_Console_istty;
|
||||
Java_java_io_Console_encoding;
|
||||
|
||||
@ -351,8 +351,8 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
*/
|
||||
void encryptBlock(byte[] in, int inOffset,
|
||||
byte[] out, int outOffset) {
|
||||
cryptBlockCheck(in, inOffset);
|
||||
cryptBlockCheck(out, outOffset);
|
||||
Objects.checkFromIndexSize(inOffset, AES_BLOCK_SIZE, in.length);
|
||||
Objects.checkFromIndexSize(outOffset, AES_BLOCK_SIZE, out.length);
|
||||
implEncryptBlock(in, inOffset, out, outOffset);
|
||||
}
|
||||
|
||||
@ -430,8 +430,8 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
*/
|
||||
void decryptBlock(byte[] in, int inOffset,
|
||||
byte[] out, int outOffset) {
|
||||
cryptBlockCheck(in, inOffset);
|
||||
cryptBlockCheck(out, outOffset);
|
||||
Objects.checkFromIndexSize(inOffset, AES_BLOCK_SIZE, in.length);
|
||||
Objects.checkFromIndexSize(outOffset, AES_BLOCK_SIZE, out.length);
|
||||
implDecryptBlock(in, inOffset, out, outOffset);
|
||||
}
|
||||
|
||||
@ -593,26 +593,6 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
out[outOffset ] = (byte)(Si[(a0 ) & 0xFF] ^ (t1 ));
|
||||
}
|
||||
|
||||
// Used to perform all checks required by the Java semantics
|
||||
// (i.e., null checks and bounds checks) on the input parameters
|
||||
// to encryptBlock and to decryptBlock.
|
||||
// Normally, the Java Runtime performs these checks, however, as
|
||||
// encryptBlock and decryptBlock are possibly replaced with
|
||||
// compiler intrinsics, the JDK performs the required checks instead.
|
||||
// Does not check accesses to class-internal (private) arrays.
|
||||
private static void cryptBlockCheck(byte[] array, int offset) {
|
||||
Objects.requireNonNull(array);
|
||||
|
||||
if (offset < 0 || offset >= array.length) {
|
||||
throw new ArrayIndexOutOfBoundsException(offset);
|
||||
}
|
||||
|
||||
int largestIndex = offset + AES_BLOCK_SIZE - 1;
|
||||
if (largestIndex < 0 || largestIndex >= array.length) {
|
||||
throw new ArrayIndexOutOfBoundsException(largestIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand a user-supplied key material into a session key.
|
||||
*
|
||||
|
||||
@ -173,9 +173,9 @@ final class CounterMode extends FeedbackCipher {
|
||||
*/
|
||||
private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
|
||||
|
||||
cryptBlockCheck(in, inOff, len);
|
||||
cryptBlockCheck(out, outOff, len);
|
||||
return implCrypt(in, inOff, len, out, outOff);
|
||||
Objects.checkFromIndexSize(inOff, len, in.length);
|
||||
Objects.checkFromIndexSize(outOff, len, out.length);
|
||||
return implCrypt(in, inOff, len, out, outOff);
|
||||
}
|
||||
|
||||
// Implementation of crpyt() method. Possibly replaced with a compiler intrinsic.
|
||||
@ -193,22 +193,4 @@ final class CounterMode extends FeedbackCipher {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Used to perform all checks required by the Java semantics
|
||||
// (i.e., null checks and bounds checks) on the input parameters to crypt().
|
||||
// Normally, the Java Runtime performs these checks, however, as crypt() is
|
||||
// possibly replaced with compiler intrinsic, the JDK performs the
|
||||
// required checks instead.
|
||||
// Does not check accesses to class-internal (private) arrays.
|
||||
private static void cryptBlockCheck(byte[] array, int offset, int len) {
|
||||
Objects.requireNonNull(array);
|
||||
|
||||
if (offset < 0 || len < 0 || offset >= array.length) {
|
||||
throw new ArrayIndexOutOfBoundsException(offset);
|
||||
}
|
||||
|
||||
int largestIndex = offset + len - 1;
|
||||
if (largestIndex < 0 || largestIndex >= array.length) {
|
||||
throw new ArrayIndexOutOfBoundsException(largestIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -401,18 +401,6 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
* @param offset the offset in the destination buffer to start at
|
||||
* @param len the number of characters to write
|
||||
*/
|
||||
static void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
|
||||
// assert shift > 0 && shift <=5 : "Illegal shift value";
|
||||
// assert offset >= 0 && offset < buf.length : "illegal offset";
|
||||
// assert len > 0 && (offset + len) <= buf.length : "illegal length";
|
||||
int charPos = offset + len;
|
||||
int radix = 1 << shift;
|
||||
int mask = radix - 1;
|
||||
do {
|
||||
buf[--charPos] = Integer.digits[((int) val) & mask];
|
||||
val >>>= shift;
|
||||
} while (charPos > offset);
|
||||
}
|
||||
|
||||
/** byte[]/LATIN1 version */
|
||||
static void formatUnsignedLong0(long val, int shift, byte[] buf, int offset, int len) {
|
||||
@ -436,6 +424,39 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
} while (charPos > offset);
|
||||
}
|
||||
|
||||
static String fastUUID(long lsb, long msb) {
|
||||
if (COMPACT_STRINGS) {
|
||||
byte[] buf = new byte[36];
|
||||
formatUnsignedLong0(lsb, 4, buf, 24, 12);
|
||||
formatUnsignedLong0(lsb >>> 48, 4, buf, 19, 4);
|
||||
formatUnsignedLong0(msb, 4, buf, 14, 4);
|
||||
formatUnsignedLong0(msb >>> 16, 4, buf, 9, 4);
|
||||
formatUnsignedLong0(msb >>> 32, 4, buf, 0, 8);
|
||||
|
||||
buf[23] = '-';
|
||||
buf[18] = '-';
|
||||
buf[13] = '-';
|
||||
buf[8] = '-';
|
||||
|
||||
return new String(buf, LATIN1);
|
||||
} else {
|
||||
byte[] buf = new byte[72];
|
||||
|
||||
formatUnsignedLong0UTF16(lsb, 4, buf, 24, 12);
|
||||
formatUnsignedLong0UTF16(lsb >>> 48, 4, buf, 19, 4);
|
||||
formatUnsignedLong0UTF16(msb, 4, buf, 14, 4);
|
||||
formatUnsignedLong0UTF16(msb >>> 16, 4, buf, 9, 4);
|
||||
formatUnsignedLong0UTF16(msb >>> 32, 4, buf, 0, 8);
|
||||
|
||||
StringUTF16.putChar(buf, 23, '-');
|
||||
StringUTF16.putChar(buf, 18, '-');
|
||||
StringUTF16.putChar(buf, 13, '-');
|
||||
StringUTF16.putChar(buf, 8, '-');
|
||||
|
||||
return new String(buf, UTF16);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code String} object representing the specified
|
||||
* {@code long}. The argument is converted to signed decimal
|
||||
|
||||
@ -342,4 +342,12 @@ final class StringConcatHelper {
|
||||
return new String(buf, coder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the initial coder for the String.
|
||||
* @return initial coder
|
||||
*/
|
||||
static byte initialCoder() {
|
||||
return String.COMPACT_STRINGS ? String.LATIN1 : String.UTF16;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1911,11 +1911,8 @@ public final class System {
|
||||
public void invokeFinalize(Object o) throws Throwable {
|
||||
o.finalize();
|
||||
}
|
||||
public void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
|
||||
Long.formatUnsignedLong(val, shift, buf, offset, len);
|
||||
}
|
||||
public void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) {
|
||||
Integer.formatUnsignedInt(val, shift, buf, offset, len);
|
||||
public String fastUUID(long lsb, long msb) {
|
||||
return Long.fastUUID(lsb, msb);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ import java.lang.reflect.Field;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.*;
|
||||
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
|
||||
/**
|
||||
* The JVM interface for the method handles package is all here.
|
||||
|
||||
@ -1043,7 +1043,8 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
|
||||
* @param specialCaller the proposed calling class to perform the {@code invokespecial}
|
||||
* @return the desired method handle
|
||||
* @throws NoSuchMethodException if the method does not exist
|
||||
* @throws IllegalAccessException if access checking fails
|
||||
* @throws IllegalAccessException if access checking fails,
|
||||
* or if the method is {@code static},
|
||||
* or if the method's variable arity modifier bit
|
||||
* is set and {@code asVarargsCollector} fails
|
||||
* @exception SecurityException if a security manager is present and it
|
||||
@ -1275,7 +1276,8 @@ return mh1;
|
||||
* @param m the reflected method
|
||||
* @param specialCaller the class nominally calling the method
|
||||
* @return a method handle which can invoke the reflected method
|
||||
* @throws IllegalAccessException if access checking fails
|
||||
* @throws IllegalAccessException if access checking fails,
|
||||
* or if the method is {@code static},
|
||||
* or if the method's variable arity modifier bit
|
||||
* is set and {@code asVarargsCollector} fails
|
||||
* @throws NullPointerException if any argument is null
|
||||
|
||||
@ -30,7 +30,7 @@ import jdk.internal.org.objectweb.asm.Label;
|
||||
import jdk.internal.org.objectweb.asm.MethodVisitor;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import java.lang.invoke.MethodHandles.Lookup;
|
||||
import java.security.AccessController;
|
||||
@ -957,6 +957,22 @@ public final class StringConcatFactory {
|
||||
storage trimming, which defeats the purpose of exact strategies.
|
||||
*/
|
||||
|
||||
/*
|
||||
The logic for this check is as follows:
|
||||
|
||||
Stack before: Op:
|
||||
(SB) dup, dup
|
||||
(SB, SB, SB) capacity()
|
||||
(int, SB, SB) swap
|
||||
(SB, int, SB) toString()
|
||||
(S, int, SB) length()
|
||||
(int, int, SB) if_icmpeq
|
||||
(SB) <end>
|
||||
|
||||
Note that it leaves the same StringBuilder on exit, like the one on enter.
|
||||
*/
|
||||
|
||||
mv.visitInsn(DUP);
|
||||
mv.visitInsn(DUP);
|
||||
|
||||
mv.visitMethodInsn(
|
||||
@ -967,7 +983,7 @@ public final class StringConcatFactory {
|
||||
false
|
||||
);
|
||||
|
||||
mv.visitIntInsn(ISTORE, 0);
|
||||
mv.visitInsn(SWAP);
|
||||
|
||||
mv.visitMethodInsn(
|
||||
INVOKEVIRTUAL,
|
||||
@ -977,8 +993,6 @@ public final class StringConcatFactory {
|
||||
false
|
||||
);
|
||||
|
||||
mv.visitInsn(DUP);
|
||||
|
||||
mv.visitMethodInsn(
|
||||
INVOKEVIRTUAL,
|
||||
"java/lang/String",
|
||||
@ -987,8 +1001,6 @@ public final class StringConcatFactory {
|
||||
false
|
||||
);
|
||||
|
||||
mv.visitIntInsn(ILOAD, 0);
|
||||
|
||||
Label l0 = new Label();
|
||||
mv.visitJumpInsn(IF_ICMPEQ, l0);
|
||||
|
||||
@ -1003,16 +1015,16 @@ public final class StringConcatFactory {
|
||||
mv.visitInsn(ATHROW);
|
||||
|
||||
mv.visitLabel(l0);
|
||||
} else {
|
||||
mv.visitMethodInsn(
|
||||
INVOKEVIRTUAL,
|
||||
"java/lang/StringBuilder",
|
||||
"toString",
|
||||
"()Ljava/lang/String;",
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
mv.visitMethodInsn(
|
||||
INVOKEVIRTUAL,
|
||||
"java/lang/StringBuilder",
|
||||
"toString",
|
||||
"()Ljava/lang/String;",
|
||||
false
|
||||
);
|
||||
|
||||
mv.visitInsn(ARETURN);
|
||||
|
||||
mv.visitMaxs(-1, -1);
|
||||
@ -1485,7 +1497,7 @@ public final class StringConcatFactory {
|
||||
//
|
||||
// The method handle shape after all length and coder mixers is:
|
||||
// (int, byte, <args>)String = ("index", "coder", <args>)
|
||||
byte initialCoder = 0; // initial coder
|
||||
byte initialCoder = INITIAL_CODER;
|
||||
int initialLen = 0; // initial length, in characters
|
||||
for (RecipeElement el : recipe.getElements()) {
|
||||
switch (el.getTag()) {
|
||||
@ -1618,11 +1630,14 @@ public final class StringConcatFactory {
|
||||
private static final ConcurrentMap<Class<?>, MethodHandle> LENGTH_MIXERS;
|
||||
private static final ConcurrentMap<Class<?>, MethodHandle> CODER_MIXERS;
|
||||
private static final Class<?> STRING_HELPER;
|
||||
private static final byte INITIAL_CODER;
|
||||
|
||||
static {
|
||||
try {
|
||||
STRING_HELPER = Class.forName("java.lang.StringConcatHelper");
|
||||
} catch (ClassNotFoundException e) {
|
||||
MethodHandle initCoder = lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "initialCoder", byte.class);
|
||||
INITIAL_CODER = (byte) initCoder.invoke();
|
||||
} catch (Throwable e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
package java.lang.ref;
|
||||
|
||||
import jdk.internal.vm.annotation.DontInline;
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import jdk.internal.misc.JavaLangRefAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
|
||||
/**
|
||||
* Abstract base class for reference objects. This class defines the
|
||||
|
||||
@ -28,9 +28,9 @@
|
||||
package java.nio;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.misc.VM;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
|
||||
|
||||
|
||||
@ -1898,7 +1898,7 @@ public final class Files {
|
||||
* many file systems.
|
||||
*
|
||||
* <p> The <i>attribute-list</i> component is a comma separated list of
|
||||
* zero or more names of attributes to read. If the list contains the value
|
||||
* one or more names of attributes to read. If the list contains the value
|
||||
* {@code "*"} then all attributes are read. Attributes that are not supported
|
||||
* are ignored and will not be present in the returned map. It is
|
||||
* implementation specific if all attributes are read as an atomic operation
|
||||
@ -1948,7 +1948,7 @@ public final class Files {
|
||||
* @throws UnsupportedOperationException
|
||||
* if the attribute view is not available
|
||||
* @throws IllegalArgumentException
|
||||
* if no attributes are specified or an unrecognized attributes is
|
||||
* if no attributes are specified or an unrecognized attribute is
|
||||
* specified
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
|
||||
@ -150,7 +150,7 @@ public interface Path
|
||||
* #normalize normalize} method, to eliminate redundant names, for cases where
|
||||
* <em>shell-like</em> navigation is required.
|
||||
*
|
||||
* <p> If this path has one or more elements, and no root component, then
|
||||
* <p> If this path has more than one element, and no root component, then
|
||||
* this method is equivalent to evaluating the expression:
|
||||
* <blockquote><pre>
|
||||
* subpath(0, getNameCount()-1);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2016, 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
|
||||
@ -472,7 +472,7 @@ public class SecureRandom extends java.util.Random {
|
||||
* @param bytes the array to be filled in with random bytes.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void nextBytes(byte[] bytes) {
|
||||
public void nextBytes(byte[] bytes) {
|
||||
secureRandomSpi.engineNextBytes(bytes);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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
|
||||
@ -62,6 +62,7 @@
|
||||
package java.time;
|
||||
|
||||
import static java.time.LocalTime.MINUTES_PER_HOUR;
|
||||
import static java.time.LocalTime.NANOS_PER_MILLI;
|
||||
import static java.time.LocalTime.NANOS_PER_SECOND;
|
||||
import static java.time.LocalTime.SECONDS_PER_DAY;
|
||||
import static java.time.LocalTime.SECONDS_PER_HOUR;
|
||||
@ -1214,8 +1215,16 @@ public final class Duration
|
||||
* @throws ArithmeticException if numeric overflow occurs
|
||||
*/
|
||||
public long toMillis() {
|
||||
long millis = Math.multiplyExact(seconds, 1000);
|
||||
millis = Math.addExact(millis, nanos / 1000_000);
|
||||
long tempSeconds = seconds;
|
||||
long tempNanos = nanos;
|
||||
if (tempSeconds < 0) {
|
||||
// change the seconds and nano value to
|
||||
// handle Long.MIN_VALUE case
|
||||
tempSeconds = tempSeconds + 1;
|
||||
tempNanos = tempNanos - NANOS_PER_SECOND;
|
||||
}
|
||||
long millis = Math.multiplyExact(tempSeconds, 1000);
|
||||
millis = Math.addExact(millis, tempNanos / NANOS_PER_MILLI);
|
||||
return millis;
|
||||
}
|
||||
|
||||
@ -1229,8 +1238,16 @@ public final class Duration
|
||||
* @throws ArithmeticException if numeric overflow occurs
|
||||
*/
|
||||
public long toNanos() {
|
||||
long totalNanos = Math.multiplyExact(seconds, NANOS_PER_SECOND);
|
||||
totalNanos = Math.addExact(totalNanos, nanos);
|
||||
long tempSeconds = seconds;
|
||||
long tempNanos = nanos;
|
||||
if (tempSeconds < 0) {
|
||||
// change the seconds and nano value to
|
||||
// handle Long.MIN_VALUE case
|
||||
tempSeconds = tempSeconds + 1;
|
||||
tempNanos = tempNanos - NANOS_PER_SECOND;
|
||||
}
|
||||
long totalNanos = Math.multiplyExact(tempSeconds, NANOS_PER_SECOND);
|
||||
totalNanos = Math.addExact(totalNanos, tempNanos);
|
||||
return totalNanos;
|
||||
}
|
||||
|
||||
|
||||
@ -100,6 +100,8 @@ import java.time.temporal.ValueRange;
|
||||
import java.time.zone.ZoneOffsetTransition;
|
||||
import java.time.zone.ZoneRules;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.LongStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* A date without a time-zone in the ISO-8601 calendar system,
|
||||
@ -1715,6 +1717,89 @@ public final class LocalDate
|
||||
return Period.of(Math.toIntExact(years), months, days);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequential ordered stream of dates. The returned stream starts from this date
|
||||
* (inclusive) and goes to {@code endExclusive} (exclusive) by an incremental step of 1 day.
|
||||
* <p>
|
||||
* This method is equivalent to {@code datesUntil(endExclusive, Period.ofDays(1))}.
|
||||
*
|
||||
* @param endExclusive the end date, exclusive, not null
|
||||
* @return a sequential {@code Stream} for the range of {@code LocalDate} values
|
||||
* @throws IllegalArgumentException if end date is before this date
|
||||
* @since 9
|
||||
*/
|
||||
public Stream<LocalDate> datesUntil(LocalDate endExclusive) {
|
||||
long end = endExclusive.toEpochDay();
|
||||
long start = toEpochDay();
|
||||
if (end < start) {
|
||||
throw new IllegalArgumentException(endExclusive + " < " + this);
|
||||
}
|
||||
return LongStream.range(start, end).mapToObj(LocalDate::ofEpochDay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequential ordered stream of dates by given incremental step. The returned stream
|
||||
* starts from this date (inclusive) and goes to {@code endExclusive} (exclusive).
|
||||
* <p>
|
||||
* The n-th date which appears in the stream is equal to {@code this.plus(step.multipliedBy(n))}
|
||||
* (but the result of step multiplication never overflows). For example, if this date is
|
||||
* {@code 2015-01-31}, the end date is {@code 2015-05-01} and the step is 1 month, then the
|
||||
* stream contains {@code 2015-01-31}, {@code 2015-02-28}, {@code 2015-03-31}, and
|
||||
* {@code 2015-04-30}.
|
||||
*
|
||||
* @param endExclusive the end date, exclusive, not null
|
||||
* @param step the non-zero, non-negative {@code Period} which represents the step.
|
||||
* @return a sequential {@code Stream} for the range of {@code LocalDate} values
|
||||
* @throws IllegalArgumentException if step is zero, or {@code step.getDays()} and
|
||||
* {@code step.toTotalMonths()} have opposite sign, or end date is before this date
|
||||
* and step is positive, or end date is after this date and step is negative
|
||||
* @since 9
|
||||
*/
|
||||
public Stream<LocalDate> datesUntil(LocalDate endExclusive, Period step) {
|
||||
if (step.isZero()) {
|
||||
throw new IllegalArgumentException("step is zero");
|
||||
}
|
||||
long end = endExclusive.toEpochDay();
|
||||
long start = toEpochDay();
|
||||
long until = end - start;
|
||||
long months = step.toTotalMonths();
|
||||
long days = step.getDays();
|
||||
if ((months < 0 && days > 0) || (months > 0 && days < 0)) {
|
||||
throw new IllegalArgumentException("period months and days are of opposite sign");
|
||||
}
|
||||
if (until == 0) {
|
||||
return Stream.empty();
|
||||
}
|
||||
int sign = months > 0 || days > 0 ? 1 : -1;
|
||||
if (sign < 0 ^ until < 0) {
|
||||
throw new IllegalArgumentException(endExclusive + (sign < 0 ? " > " : " < ") + this);
|
||||
}
|
||||
if (months == 0) {
|
||||
long steps = (until - sign) / days; // non-negative
|
||||
return LongStream.rangeClosed(0, steps).mapToObj(
|
||||
n -> LocalDate.ofEpochDay(start + n * days));
|
||||
}
|
||||
// 48699/1600 = 365.2425/12, no overflow, non-negative result
|
||||
long steps = until * 1600 / (months * 48699 + days * 1600) + 1;
|
||||
long addMonths = months * steps;
|
||||
long addDays = days * steps;
|
||||
long maxAddMonths = months > 0 ? MAX.getProlepticMonth() - getProlepticMonth()
|
||||
: getProlepticMonth() - MIN.getProlepticMonth();
|
||||
// adjust steps estimation
|
||||
if (addMonths * sign > maxAddMonths
|
||||
|| (plusMonths(addMonths).toEpochDay() + addDays) * sign >= end * sign) {
|
||||
steps--;
|
||||
addMonths -= months;
|
||||
addDays -= days;
|
||||
if (addMonths * sign > maxAddMonths
|
||||
|| (plusMonths(addMonths).toEpochDay() + addDays) * sign >= end * sign) {
|
||||
steps--;
|
||||
}
|
||||
}
|
||||
return LongStream.rangeClosed(0, steps).mapToObj(
|
||||
n -> this.plusMonths(months * n).plusDays(days * n));
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats this date using the specified formatter.
|
||||
* <p>
|
||||
|
||||
@ -392,17 +392,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||
* @return A string representation of this {@code UUID}
|
||||
*/
|
||||
public String toString() {
|
||||
char[] chars = new char[36];
|
||||
jla.formatUnsignedLong(mostSigBits >> 32, 4, chars, 0, 8);
|
||||
chars[8] = '-';
|
||||
jla.formatUnsignedLong(mostSigBits >> 16, 4, chars, 9, 4);
|
||||
chars[13] = '-';
|
||||
jla.formatUnsignedLong(mostSigBits, 4, chars, 14, 4);
|
||||
chars[18] = '-';
|
||||
jla.formatUnsignedLong(leastSigBits >> 48, 4, chars, 19, 4);
|
||||
chars[23] = '-';
|
||||
jla.formatUnsignedLong(leastSigBits, 4, chars, 24, 12);
|
||||
return jla.newStringUnsafe(chars);
|
||||
return jla.fastUUID(leastSigBits, mostSigBits);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -35,6 +35,9 @@
|
||||
|
||||
package java.util.concurrent;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A {@code TimeUnit} represents time durations at a given unit of
|
||||
* granularity and provides utility methods to convert across units,
|
||||
@ -390,4 +393,48 @@ public enum TimeUnit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this {@code TimeUnit} to the equivalent {@code ChronoUnit}.
|
||||
*
|
||||
* @return the converted equivalent ChronoUnit
|
||||
* @since 9
|
||||
*/
|
||||
public ChronoUnit toChronoUnit() {
|
||||
switch (this) {
|
||||
case NANOSECONDS: return ChronoUnit.NANOS;
|
||||
case MICROSECONDS: return ChronoUnit.MICROS;
|
||||
case MILLISECONDS: return ChronoUnit.MILLIS;
|
||||
case SECONDS: return ChronoUnit.SECONDS;
|
||||
case MINUTES: return ChronoUnit.MINUTES;
|
||||
case HOURS: return ChronoUnit.HOURS;
|
||||
case DAYS: return ChronoUnit.DAYS;
|
||||
default: throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@code ChronoUnit} to the equivalent {@code TimeUnit}.
|
||||
*
|
||||
* @param chronoUnit the ChronoUnit to convert
|
||||
* @return the converted equivalent TimeUnit
|
||||
* @throws IllegalArgumentException if {@code chronoUnit} has no
|
||||
* equivalent TimeUnit
|
||||
* @throws NullPointerException if {@code chronoUnit} is null
|
||||
* @since 9
|
||||
*/
|
||||
public static TimeUnit of(ChronoUnit chronoUnit) {
|
||||
switch (Objects.requireNonNull(chronoUnit, "chronoUnit")) {
|
||||
case NANOS: return TimeUnit.NANOSECONDS;
|
||||
case MICROS: return TimeUnit.MICROSECONDS;
|
||||
case MILLIS: return TimeUnit.MILLISECONDS;
|
||||
case SECONDS: return TimeUnit.SECONDS;
|
||||
case MINUTES: return TimeUnit.MINUTES;
|
||||
case HOURS: return TimeUnit.HOURS;
|
||||
case DAYS: return TimeUnit.DAYS;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"No TimeUnit equivalent for " + chronoUnit);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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
|
||||
@ -107,7 +107,7 @@ final class FindOps {
|
||||
*/
|
||||
private static final class FindOp<T, O> implements TerminalOp<T, O> {
|
||||
private final StreamShape shape;
|
||||
final boolean mustFindFirst;
|
||||
final int opFlags;
|
||||
final O emptyValue;
|
||||
final Predicate<O> presentPredicate;
|
||||
final Supplier<TerminalSink<T, O>> sinkSupplier;
|
||||
@ -129,7 +129,7 @@ final class FindOps {
|
||||
O emptyValue,
|
||||
Predicate<O> presentPredicate,
|
||||
Supplier<TerminalSink<T, O>> sinkSupplier) {
|
||||
this.mustFindFirst = mustFindFirst;
|
||||
this.opFlags = StreamOpFlag.IS_SHORT_CIRCUIT | (mustFindFirst ? 0 : StreamOpFlag.NOT_ORDERED);
|
||||
this.shape = shape;
|
||||
this.emptyValue = emptyValue;
|
||||
this.presentPredicate = presentPredicate;
|
||||
@ -138,7 +138,7 @@ final class FindOps {
|
||||
|
||||
@Override
|
||||
public int getOpFlags() {
|
||||
return StreamOpFlag.IS_SHORT_CIRCUIT | (mustFindFirst ? 0 : StreamOpFlag.NOT_ORDERED);
|
||||
return opFlags;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -156,7 +156,10 @@ final class FindOps {
|
||||
@Override
|
||||
public <P_IN> O evaluateParallel(PipelineHelper<T> helper,
|
||||
Spliterator<P_IN> spliterator) {
|
||||
return new FindTask<>(this, helper, spliterator).invoke();
|
||||
// This takes into account the upstream ops flags and the terminal
|
||||
// op flags and therefore takes into account findFirst or findAny
|
||||
boolean mustFindFirst = StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags());
|
||||
return new FindTask<>(this, mustFindFirst, helper, spliterator).invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,16 +253,20 @@ final class FindOps {
|
||||
private static final class FindTask<P_IN, P_OUT, O>
|
||||
extends AbstractShortCircuitTask<P_IN, P_OUT, O, FindTask<P_IN, P_OUT, O>> {
|
||||
private final FindOp<P_OUT, O> op;
|
||||
private final boolean mustFindFirst;
|
||||
|
||||
FindTask(FindOp<P_OUT, O> op,
|
||||
boolean mustFindFirst,
|
||||
PipelineHelper<P_OUT> helper,
|
||||
Spliterator<P_IN> spliterator) {
|
||||
super(helper, spliterator);
|
||||
this.mustFindFirst = mustFindFirst;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
FindTask(FindTask<P_IN, P_OUT, O> parent, Spliterator<P_IN> spliterator) {
|
||||
super(parent, spliterator);
|
||||
this.mustFindFirst = parent.mustFindFirst;
|
||||
this.op = parent.op;
|
||||
}
|
||||
|
||||
@ -283,7 +290,7 @@ final class FindOps {
|
||||
@Override
|
||||
protected O doLeaf() {
|
||||
O result = helper.wrapAndCopyInto(op.sinkSupplier.get(), spliterator).get();
|
||||
if (!op.mustFindFirst) {
|
||||
if (!mustFindFirst) {
|
||||
if (result != null)
|
||||
shortCircuit(result);
|
||||
return null;
|
||||
@ -300,7 +307,7 @@ final class FindOps {
|
||||
|
||||
@Override
|
||||
public void onCompletion(CountedCompleter<?> caller) {
|
||||
if (op.mustFindFirst) {
|
||||
if (mustFindFirst) {
|
||||
for (FindTask<P_IN, P_OUT, O> child = leftChild, p = null; child != p;
|
||||
p = child, child = rightChild) {
|
||||
O result = child.getLocalResult();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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
|
||||
@ -139,7 +139,7 @@ final class SliceOps {
|
||||
}
|
||||
else {
|
||||
// @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE).filter(i -> true).limit(n)
|
||||
// regardless of the value of n
|
||||
// when n * parallelismLevel is sufficiently large.
|
||||
// Need to adjust the target size of splitting for the
|
||||
// SliceTask from say (size / k) to say min(size / k, 1 << 14)
|
||||
// This will limit the size of the buffers created at the leaf nodes
|
||||
@ -604,8 +604,15 @@ final class SliceOps {
|
||||
return nb.build();
|
||||
}
|
||||
else {
|
||||
Node<P_OUT> node = helper.wrapAndCopyInto(helper.makeNodeBuilder(-1, generator),
|
||||
spliterator).build();
|
||||
final Node.Builder<P_OUT> nb = op.makeNodeBuilder(-1, generator);
|
||||
if (targetOffset == 0) { // limit only
|
||||
Sink<P_OUT> opSink = op.opWrapSink(helper.getStreamAndOpFlags(), nb);
|
||||
helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator);
|
||||
}
|
||||
else {
|
||||
helper.wrapAndCopyInto(nb, spliterator);
|
||||
}
|
||||
Node<P_OUT> node = nb.build();
|
||||
thisNodeSize = node.count();
|
||||
completed = true;
|
||||
spliterator = null;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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
|
||||
@ -186,7 +186,7 @@ class StreamSpliterators {
|
||||
|
||||
@Override
|
||||
public Spliterator<P_OUT> trySplit() {
|
||||
if (isParallel && !finished) {
|
||||
if (isParallel && buffer == null && !finished) {
|
||||
init();
|
||||
|
||||
Spliterator<P_IN> split = spliterator.trySplit();
|
||||
|
||||
609
jdk/src/java.base/share/classes/jdk/Version.java
Normal file
609
jdk/src/java.base/share/classes/jdk/Version.java
Normal file
@ -0,0 +1,609 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* A representation of the JDK version-string which contains a version
|
||||
* number optionally followed by pre-release and build information.
|
||||
*
|
||||
* <h2><a name="verNum">Version numbers</a></h2>
|
||||
*
|
||||
* A <em>version number</em>, {@code $VNUM}, is a non-empty sequence of
|
||||
* non-negative integer numerals, without leading or trailing zeroes,
|
||||
* separated by period characters (U+002E); i.e., it matches the regular
|
||||
* expression {@code ^[1-9][0-9]*(((\.0)*\.[1-9][0-9]*)*)*$}. The sequence may
|
||||
* be of arbitrary length but the first three elements are assigned specific
|
||||
* meanings, as follows:
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* $MAJOR.$MINOR.$SECURITY
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li><p> <a name="major">{@code $MAJOR}</a> --- The major version number,
|
||||
* incremented for a major release that contains significant new features as
|
||||
* specified in a new edition of the Java SE Platform Specification,
|
||||
* <em>e.g.</em>, <a href="https://jcp.org/en/jsr/detail?id=337">JSR 337</a>
|
||||
* for Java SE 8. Features may be removed in a major release, given
|
||||
* advance notice at least one major release ahead of time, and incompatible
|
||||
* changes may be made when justified. The {@code $MAJOR} version number of
|
||||
* JDK 8 was {@code 8}; the {@code $MAJOR} version number of JDK 9
|
||||
* is {@code 9}. </p></li>
|
||||
*
|
||||
* <li><p> <a name="minor">{@code $MINOR}</a> --- The minor version number,
|
||||
* incremented for a minor update release that may contain compatible bug
|
||||
* fixes, revisions to standard APIs mandated by a <a
|
||||
* href="https://jcp.org/en/procedures/jcp2#5.3">Maintenance Release</a> of
|
||||
* the relevant Platform Specification, and implementation features outside
|
||||
* the scope of that Specification such as new JDK-specific APIs, additional
|
||||
* service providers, new garbage collectors, and ports to new hardware
|
||||
* architectures. {@code $MINOR} is reset to zero when {@code $MAJOR} is
|
||||
* incremented. </p></li>
|
||||
*
|
||||
* <li><p> <a name="security">{@code $SECURITY}</a> --- The security level,
|
||||
* incremented for a security-update release that contains critical fixes
|
||||
* including those necessary to improve security. {@code $SECURITY} is reset
|
||||
* to zero <strong>only</strong> when {@code $MAJOR} is incremented. A higher
|
||||
* value of {@code $SECURITY} for a given {@code $MAJOR} value, therefore,
|
||||
* always indicates a more secure release, regardless of the value of {@code
|
||||
* $MINOR}. </p></li>
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
* <p> The fourth and later elements of a version number are free for use by
|
||||
* downstream consumers of the JDK code base. Such a consumer may,
|
||||
* <em>e.g.</em>, use the fourth element to identify patch releases which
|
||||
* contain a small number of critical non-security fixes in addition to the
|
||||
* security fixes in the corresponding security release. </p>
|
||||
*
|
||||
* <p> The version number does not include trailing zero elements;
|
||||
* <em>i.e.</em>, {@code $SECURITY} is omitted if it has the value zero, and
|
||||
* {@code $MINOR} is omitted if both {@code $MINOR} and {@code $SECURITY} have
|
||||
* the value zero. </p>
|
||||
*
|
||||
* <p> The sequence of numerals in a version number is compared to another
|
||||
* such sequence in numerical, pointwise fashion; <em>e.g.</em>, {@code 9.9.1}
|
||||
* is less than {@code 9.10.0}. If one sequence is shorter than another then
|
||||
* the missing elements of the shorter sequence are considered to be zero;
|
||||
* <em>e.g.</em>, {@code 9.1.2} is equal to {@code 9.1.2.0} but less than
|
||||
* {@code 9.1.2.1}. </p>
|
||||
*
|
||||
* <h2><a name="verStr">Version strings</a></h2>
|
||||
*
|
||||
* <p> A <em>version string</em> {@code $VSTR} consists of a version number
|
||||
* {@code $VNUM}, as described above, optionally followed by pre-release and
|
||||
* build information, in the format </p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* $VNUM(-$PRE)?(\+($BUILD)?(-$OPT)?)?
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <p> where: </p>
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li><p> <a name="pre">{@code $PRE}</a>, matching {@code ([a-zA-Z0-9]+)} ---
|
||||
* A pre-release identifier. Typically {@code ea}, for an early-access
|
||||
* release that's under active development and potentially unstable, or {@code
|
||||
* internal}, for an internal developer build.
|
||||
*
|
||||
* <li><p> <a name="build">{@code $BUILD}</a>, matching {@code
|
||||
* (0|[1-9][0-9]*)} --- The build number, incremented for each promoted build.
|
||||
* {@code $BUILD} is reset to {@code 1} when any portion of {@code $VNUM} is
|
||||
* incremented. </p>
|
||||
*
|
||||
* <li><p> <a name="opt">{@code $OPT}</a>, matching {@code ([-a-zA-Z0-9\.]+)}
|
||||
* --- Additional build information, if desired. In the case of an {@code
|
||||
* internal} build this will often contain the date and time of the
|
||||
* build. </p>
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
* <p> When comparing two version strings the value of {@code $OPT}, if
|
||||
* present, may or may not be significant depending on the chosen comparison
|
||||
* method. The comparison methods {@link #compareTo(Version) compareTo()} and
|
||||
* {@link #compareToIgnoreOpt(Version) compareToIgnoreOpt{}} should be used
|
||||
* consistently with the corresponding methods {@link #equals(Object) equals()}
|
||||
* and {@link #equalsIgnoreOpt(Object) equalsIgnoreOpt()}. </p>
|
||||
*
|
||||
* <p> A <em>short version string</em> ({@code $SVSTR}), often useful in less
|
||||
* formal contexts, is simply {@code $VNUM} optionally ended with {@code
|
||||
* -$PRE}. </p>
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
public final class Version
|
||||
implements Comparable<Version>
|
||||
{
|
||||
private final List<Integer> version;
|
||||
private final Optional<String> pre;
|
||||
private final Optional<Integer> build;
|
||||
private final Optional<String> optional;
|
||||
|
||||
private static Version current;
|
||||
|
||||
// $VNUM(-$PRE)?(\+($BUILD)?(\-$OPT)?)?
|
||||
// RE limits the format of version strings
|
||||
// ([1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:-([a-zA-Z0-9]+))?(?:(\+)(0|[1-9][0-9]*)?)?(?:-([-a-zA-Z0-9.]+))?
|
||||
|
||||
private static final String VNUM
|
||||
= "(?<VNUM>[1-9][0-9]*(?:(?:\\.0)*\\.[1-9][0-9]*)*)";
|
||||
private static final String VNUM_GROUP = "VNUM";
|
||||
|
||||
private static final String PRE = "(?:-(?<PRE>[a-zA-Z0-9]+))?";
|
||||
private static final String PRE_GROUP = "PRE";
|
||||
|
||||
private static final String BUILD
|
||||
= "(?:(?<PLUS>\\+)(?<BUILD>0|[1-9][0-9]*)?)?";
|
||||
private static final String PLUS_GROUP = "PLUS";
|
||||
private static final String BUILD_GROUP = "BUILD";
|
||||
|
||||
private static final String OPT = "(?:-(?<OPT>[-a-zA-Z0-9.]+))?";
|
||||
private static final String OPT_GROUP = "OPT";
|
||||
|
||||
private static final String VSTR_FORMAT
|
||||
= "^" + VNUM + PRE + BUILD + OPT + "$";
|
||||
private static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
|
||||
|
||||
/**
|
||||
* Constructs a valid JDK <a href="verStr">version string</a> containing a
|
||||
* <a href="#verNum">version number</a> followed by pre-release and build
|
||||
* information.
|
||||
*
|
||||
* @param s
|
||||
* A string to be interpreted as a version
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If the given string cannot be interpreted a valid version
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* If {@code s} is {@code null}
|
||||
*
|
||||
* @throws NumberFormatException
|
||||
* If an element of the version number or the build number cannot
|
||||
* be represented as an {@link Integer}
|
||||
*/
|
||||
private Version(String s) {
|
||||
if (s == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
Matcher m = VSTR_PATTERN.matcher(s);
|
||||
if (!m.matches())
|
||||
throw new IllegalArgumentException("Invalid version string: '"
|
||||
+ s + "'");
|
||||
|
||||
// $VNUM is a dot-separated list of integers of arbitrary length
|
||||
version
|
||||
= Collections.unmodifiableList(
|
||||
Arrays.stream(m.group(VNUM_GROUP).split("\\."))
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
pre = Optional.ofNullable(m.group(PRE_GROUP));
|
||||
|
||||
String b = m.group(BUILD_GROUP);
|
||||
// $BUILD is an integer
|
||||
build = (b == null)
|
||||
? Optional.<Integer>empty()
|
||||
: Optional.ofNullable(Integer.parseInt(b));
|
||||
|
||||
optional = Optional.ofNullable(m.group(OPT_GROUP));
|
||||
|
||||
// empty '+'
|
||||
if ((m.group(PLUS_GROUP) != null) && !build.isPresent()) {
|
||||
if (optional.isPresent()) {
|
||||
if (pre.isPresent())
|
||||
throw new IllegalArgumentException("'+' found with"
|
||||
+ " pre-release and optional components:'" + s + "'");
|
||||
} else {
|
||||
throw new IllegalArgumentException("'+' found with neither"
|
||||
+ " build or optional components: '" + s + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given string as a valid JDK <a
|
||||
* href="#verStr">version string</a> containing a <a
|
||||
* href="#verNum">version number</a> followed by pre-release and
|
||||
* build information.
|
||||
*
|
||||
* @param s
|
||||
* A string to interpret as a version
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* If the given string cannot be interpreted a valid version
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* If the given string is {@code null}
|
||||
*
|
||||
* @throws NumberFormatException
|
||||
* If an element of the version number or the build number cannot
|
||||
* be represented as an {@link Integer}
|
||||
*
|
||||
* @return This version
|
||||
*/
|
||||
public static Version parse(String s) {
|
||||
return new Version(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code System.getProperty("java.version")} as a Version.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* If a security manager exists and its {@link
|
||||
* SecurityManager#checkPropertyAccess(String)
|
||||
* checkPropertyAccess} method does not allow access to the
|
||||
* system property "java.version"
|
||||
*
|
||||
* @return {@code System.getProperty("java.version")} as a Version
|
||||
*/
|
||||
public static Version current() {
|
||||
if (current == null) {
|
||||
current = parse(AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
return System.getProperty("java.version");
|
||||
}
|
||||
}));
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <a href="#major">major</a> version number.
|
||||
*
|
||||
* @return The major version number
|
||||
*/
|
||||
public int major() {
|
||||
return version.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <a href="#minor">minor</a> version number or zero if it was
|
||||
* not set.
|
||||
*
|
||||
* @return The minor version number or zero if it was not set
|
||||
*/
|
||||
public int minor() {
|
||||
return (version.size() > 1 ? version.get(1) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <a href="#security">security</a> version number or zero if
|
||||
* it was not set.
|
||||
*
|
||||
* @return The security version number or zero if it was not set
|
||||
*/
|
||||
public int security() {
|
||||
return (version.size() > 2 ? version.get(2) : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable {@link java.util.List List} of the
|
||||
* integer numerals contained in the <a href="#verNum">version
|
||||
* number</a>. The {@code List} always contains at least one
|
||||
* element corresponding to the <a href="#major">major version
|
||||
* number</a>.
|
||||
*
|
||||
* @return An unmodifiable list of the integer numerals
|
||||
* contained in the version number
|
||||
*/
|
||||
public List<Integer> version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the optional <a href="#pre">pre-release</a> information.
|
||||
*
|
||||
* @return The optional pre-release information as a String
|
||||
*/
|
||||
public Optional<String> pre() {
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <a href="#build">build number</a>.
|
||||
*
|
||||
* @return The optional build number.
|
||||
*/
|
||||
public Optional<Integer> build() {
|
||||
return build;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <a href="#opt">optional</a> additional identifying build
|
||||
* information.
|
||||
*
|
||||
* @return Additional build information as a String
|
||||
*/
|
||||
public Optional<String> optional() {
|
||||
return optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this version to another.
|
||||
*
|
||||
* <p> Each of the components in the <a href="#verStr">version</a> is
|
||||
* compared in the follow order of precedence: version numbers,
|
||||
* pre-release identifiers, build numbers, optional build information. </p>
|
||||
*
|
||||
* <p> Comparison begins by examining the sequence of version numbers. If
|
||||
* one sequence is shorter than another, then the missing elements of the
|
||||
* shorter sequence are considered to be zero. </p>
|
||||
*
|
||||
* <p> A version with a pre-release identifier is always considered to be
|
||||
* less than a version without one. Pre-release identifiers are compared
|
||||
* numerically when they consist only of digits, and lexicographically
|
||||
* otherwise. Numeric identifiers are considered to be less than
|
||||
* non-numeric identifiers. </p>
|
||||
*
|
||||
* <p> A version without a build number is always less than one with a
|
||||
* build number; otherwise build numbers are compared numerically. </p>
|
||||
*
|
||||
* <p> The optional build information is compared lexicographically.
|
||||
* During this comparison, a version with optional build information is
|
||||
* considered to be greater than a version without one. </p>
|
||||
*
|
||||
* <p> A version is not comparable to any other type of object.
|
||||
*
|
||||
* @param ob
|
||||
* The object to be compared
|
||||
*
|
||||
* @return A negative integer, zero, or a positive integer if this
|
||||
* {@code Version} is less than, equal to, or greater than the
|
||||
* given {@code Version}
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* If the given object is {@code null}
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(Version ob) {
|
||||
return compare(ob, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this version to another disregarding optional build
|
||||
* information.
|
||||
*
|
||||
* <p> Two versions are compared by examining the version string as
|
||||
* described in {@link #compareTo(Version)} with the exception that the
|
||||
* optional build information is always ignored. </p>
|
||||
*
|
||||
* <p> A version is not comparable to any other type of object.
|
||||
*
|
||||
* @param ob
|
||||
* The object to be compared
|
||||
*
|
||||
* @return A negative integer, zero, or a positive integer if this
|
||||
* {@code Version} is less than, equal to, or greater than the
|
||||
* given {@code Version}
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* If the given object is {@code null}
|
||||
*/
|
||||
public int compareToIgnoreOpt(Version ob) {
|
||||
return compare(ob, true);
|
||||
}
|
||||
|
||||
private int compare(Version ob, boolean ignoreOpt) {
|
||||
if (ob == null)
|
||||
throw new NullPointerException("Invalid argument");
|
||||
|
||||
int ret = compareVersion(ob);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = comparePre(ob);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = compareBuild(ob);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (!ignoreOpt)
|
||||
return compareOpt(ob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int compareVersion(Version ob) {
|
||||
int size = version.size();
|
||||
int oSize = ob.version().size();
|
||||
int min = Math.min(size, oSize);
|
||||
for (int i = 0; i < min; i++) {
|
||||
Integer val = version.get(i);
|
||||
Integer oVal = ob.version().get(i);
|
||||
if (val != oVal)
|
||||
return val - oVal;
|
||||
}
|
||||
if (size != oSize)
|
||||
return size - oSize;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int comparePre(Version ob) {
|
||||
Optional<String> oPre = ob.pre();
|
||||
if (!pre.isPresent()) {
|
||||
if (oPre.isPresent())
|
||||
return 1;
|
||||
} else {
|
||||
if (!oPre.isPresent())
|
||||
return -1;
|
||||
String val = pre.get();
|
||||
String oVal = oPre.get();
|
||||
if (val.matches("\\d+")) {
|
||||
return (oVal.matches("\\d+")
|
||||
? (new BigInteger(val)).compareTo(new BigInteger(oVal))
|
||||
: -1);
|
||||
} else {
|
||||
return (oVal.matches("\\d+")
|
||||
? 1
|
||||
: val.compareTo(oVal));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int compareBuild(Version ob) {
|
||||
Optional<Integer> oBuild = ob.build();
|
||||
if (oBuild.isPresent()) {
|
||||
return (build.isPresent()
|
||||
? build.get().compareTo(oBuild.get())
|
||||
: 1);
|
||||
} else if (build.isPresent()) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int compareOpt(Version ob) {
|
||||
Optional<String> oOpt = ob.optional();
|
||||
if (!optional.isPresent()) {
|
||||
if (oOpt.isPresent())
|
||||
return -1;
|
||||
} else {
|
||||
if (!oOpt.isPresent())
|
||||
return 1;
|
||||
return optional.get().compareTo(oOpt.get());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this version.
|
||||
*
|
||||
* @return The version string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb
|
||||
= new StringBuilder(version.stream()
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.joining(".")));
|
||||
pre.ifPresent(v -> sb.append("-").append(v));
|
||||
|
||||
if (build.isPresent()) {
|
||||
sb.append("+").append(build.get());
|
||||
if (optional.isPresent())
|
||||
sb.append("-").append(optional.get());
|
||||
} else {
|
||||
if (optional.isPresent()) {
|
||||
sb.append(pre.isPresent() ? "-" : "+-");
|
||||
sb.append(optional.get());
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this {@code Version} is equal to another object.
|
||||
*
|
||||
* <p> Two {@code Version}s are equal if and only if they represent the
|
||||
* same version string.
|
||||
*
|
||||
* <p> This method satisfies the general contract of the {@link
|
||||
* Object#equals(Object) Object.equals} method. </p>
|
||||
*
|
||||
* @param ob
|
||||
* The object to which this {@code Version} is to be compared
|
||||
*
|
||||
* @return {@code true} if, and only if, the given object is a {@code
|
||||
* Version} that is identical to this {@code Version}
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object ob) {
|
||||
boolean ret = equalsIgnoreOpt(ob);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
Version that = (Version)ob;
|
||||
return (this.optional().equals(that.optional()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this {@code Version} is equal to another
|
||||
* disregarding optional build information.
|
||||
*
|
||||
* <p> Two {@code Version}s are equal if and only if they represent the
|
||||
* same version string disregarding the optional build information.
|
||||
*
|
||||
* @param ob
|
||||
* The object to which this {@code Version} is to be compared
|
||||
*
|
||||
* @return {@code true} if, and only if, the given object is a {@code
|
||||
* Version} that is identical to this {@code Version}
|
||||
* ignoring the optinal build information
|
||||
*
|
||||
*/
|
||||
public boolean equalsIgnoreOpt(Object ob) {
|
||||
if (this == ob)
|
||||
return true;
|
||||
if (!(ob instanceof Version))
|
||||
return false;
|
||||
|
||||
Version that = (Version)ob;
|
||||
return (this.version().equals(that.version())
|
||||
&& this.pre().equals(that.pre())
|
||||
&& this.build().equals(that.build()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hash code of this version.
|
||||
*
|
||||
* <p> This method satisfies the general contract of the {@link
|
||||
* Object#hashCode Object.hashCode} method.
|
||||
*
|
||||
* @return The hashcode of this version
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int h = 1;
|
||||
int p = 17;
|
||||
|
||||
h = p * h + version.hashCode();
|
||||
h = p * h + pre.hashCode();
|
||||
h = p * h + build.hashCode();
|
||||
h = p * h + optional.hashCode();
|
||||
|
||||
return h;
|
||||
}
|
||||
}
|
||||
@ -124,12 +124,7 @@ public interface JavaLangAccess {
|
||||
void invokeFinalize(Object o) throws Throwable;
|
||||
|
||||
/**
|
||||
* Invokes Long.formatUnsignedLong(long val, int shift, char[] buf, int offset, int len)
|
||||
* Invokes Long.fastUUID
|
||||
*/
|
||||
void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len);
|
||||
|
||||
/**
|
||||
* Invokes Integer.formatUnsignedInt(long val, int shift, char[] buf, int offset, int len)
|
||||
*/
|
||||
void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len);
|
||||
String fastUUID(long lsb, long msb);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.ref;
|
||||
|
||||
import java.lang.ref.*;
|
||||
import java.security.AccessController;
|
||||
@ -58,6 +58,7 @@ import java.security.PrivilegedAction;
|
||||
|
||||
public class Cleaner
|
||||
extends PhantomReference<Object>
|
||||
implements Runnable
|
||||
{
|
||||
|
||||
// Dummy reference queue, needed because the PhantomReference constructor
|
||||
@ -153,4 +154,11 @@ public class Cleaner
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void run() {
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null)
|
||||
security.checkPackageAccess("jdk.internal.ref");
|
||||
this.clean();
|
||||
}
|
||||
|
||||
}
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
package sun.nio.ch;
|
||||
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
|
||||
|
||||
public interface DirectBuffer {
|
||||
|
||||
@ -47,7 +47,7 @@ import java.util.List;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.JavaNioAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
public class FileChannelImpl
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
package sun.nio.ch;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import sun.misc.*;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -33,7 +33,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
package sun.nio.fs;
|
||||
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.misc.Cleaner;
|
||||
import jdk.internal.ref.Cleaner;
|
||||
|
||||
/**
|
||||
* A light-weight buffer in native memory.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, 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
|
||||
@ -36,6 +36,10 @@ public class ConstantPool {
|
||||
public int getSize() { return getSize0 (constantPoolOop); }
|
||||
public Class<?> getClassAt (int index) { return getClassAt0 (constantPoolOop, index); }
|
||||
public Class<?> getClassAtIfLoaded (int index) { return getClassAtIfLoaded0 (constantPoolOop, index); }
|
||||
// Returns a class reference index for a method or a field.
|
||||
public int getClassRefIndexAt(int index) {
|
||||
return getClassRefIndexAt0(constantPoolOop, index);
|
||||
}
|
||||
// Returns either a Method or Constructor.
|
||||
// Static initializers are returned as Method objects.
|
||||
public Member getMethodAt (int index) { return getMethodAt0 (constantPoolOop, index); }
|
||||
@ -45,13 +49,56 @@ public class ConstantPool {
|
||||
// Fetches the class name, member (field, method or interface
|
||||
// method) name, and type descriptor as an array of three Strings
|
||||
public String[] getMemberRefInfoAt (int index) { return getMemberRefInfoAt0 (constantPoolOop, index); }
|
||||
// Returns a name and type reference index for a method, a field or an invokedynamic.
|
||||
public int getNameAndTypeRefIndexAt(int index) {
|
||||
return getNameAndTypeRefIndexAt0(constantPoolOop, index);
|
||||
}
|
||||
// Fetches the name and type from name_and_type index as an array of two Strings
|
||||
public String[] getNameAndTypeRefInfoAt(int index) {
|
||||
return getNameAndTypeRefInfoAt0(constantPoolOop, index);
|
||||
}
|
||||
public int getIntAt (int index) { return getIntAt0 (constantPoolOop, index); }
|
||||
public long getLongAt (int index) { return getLongAt0 (constantPoolOop, index); }
|
||||
public float getFloatAt (int index) { return getFloatAt0 (constantPoolOop, index); }
|
||||
public double getDoubleAt (int index) { return getDoubleAt0 (constantPoolOop, index); }
|
||||
public String getStringAt (int index) { return getStringAt0 (constantPoolOop, index); }
|
||||
public String getUTF8At (int index) { return getUTF8At0 (constantPoolOop, index); }
|
||||
public Tag getTagAt(int index) {
|
||||
return Tag.valueOf(getTagAt0(constantPoolOop, index));
|
||||
}
|
||||
|
||||
public static enum Tag {
|
||||
UTF8(1),
|
||||
INTEGER(3),
|
||||
FLOAT(4),
|
||||
LONG(5),
|
||||
DOUBLE(6),
|
||||
CLASS(7),
|
||||
STRING(8),
|
||||
FIELDREF(9),
|
||||
METHODREF(10),
|
||||
INTERFACEMETHODREF(11),
|
||||
NAMEANDTYPE(12),
|
||||
METHODHANDLE(15),
|
||||
METHODTYPE(16),
|
||||
INVOKEDYNAMIC(18),
|
||||
INVALID(0);
|
||||
|
||||
private final int tagCode;
|
||||
|
||||
private Tag(int tagCode) {
|
||||
this.tagCode = tagCode;
|
||||
}
|
||||
|
||||
private static Tag valueOf(byte v) {
|
||||
for (Tag tag : Tag.values()) {
|
||||
if (tag.tagCode == v) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown constant pool tag code " + v);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// Internals only below this point
|
||||
//
|
||||
@ -66,15 +113,19 @@ public class ConstantPool {
|
||||
private native int getSize0 (Object constantPoolOop);
|
||||
private native Class<?> getClassAt0 (Object constantPoolOop, int index);
|
||||
private native Class<?> getClassAtIfLoaded0 (Object constantPoolOop, int index);
|
||||
private native int getClassRefIndexAt0 (Object constantPoolOop, int index);
|
||||
private native Member getMethodAt0 (Object constantPoolOop, int index);
|
||||
private native Member getMethodAtIfLoaded0(Object constantPoolOop, int index);
|
||||
private native Field getFieldAt0 (Object constantPoolOop, int index);
|
||||
private native Field getFieldAtIfLoaded0 (Object constantPoolOop, int index);
|
||||
private native String[] getMemberRefInfoAt0 (Object constantPoolOop, int index);
|
||||
private native int getNameAndTypeRefIndexAt0(Object constantPoolOop, int index);
|
||||
private native String[] getNameAndTypeRefInfoAt0(Object constantPoolOop, int index);
|
||||
private native int getIntAt0 (Object constantPoolOop, int index);
|
||||
private native long getLongAt0 (Object constantPoolOop, int index);
|
||||
private native float getFloatAt0 (Object constantPoolOop, int index);
|
||||
private native double getDoubleAt0 (Object constantPoolOop, int index);
|
||||
private native String getStringAt0 (Object constantPoolOop, int index);
|
||||
private native String getUTF8At0 (Object constantPoolOop, int index);
|
||||
private native byte getTagAt0 (Object constantPoolOop, int index);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2016, 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
|
||||
@ -653,6 +653,7 @@ public final class ProviderList {
|
||||
String type = null;
|
||||
String algorithm;
|
||||
String provider;
|
||||
String alternateName = null;
|
||||
|
||||
PreferredEntry(String t, String p) {
|
||||
int i = t.indexOf('.');
|
||||
@ -664,6 +665,11 @@ public final class ProviderList {
|
||||
}
|
||||
|
||||
provider = p;
|
||||
if (algorithm.compareToIgnoreCase("SHA1") == 0) {
|
||||
alternateName = "SHA-1";
|
||||
} else if (algorithm.compareToIgnoreCase("SHA-1") == 0) {
|
||||
alternateName = "SHA1";
|
||||
}
|
||||
}
|
||||
|
||||
boolean match(String t, String a) {
|
||||
@ -685,6 +691,15 @@ public final class ProviderList {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (alternateName != null &&
|
||||
a.compareToIgnoreCase(alternateName) == 0) {
|
||||
if (debug != null) {
|
||||
debug.println("Config entry found (alternateName): " +
|
||||
toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// No match
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -109,7 +109,8 @@ security.provider.tbd=sun.security.pkcs11.SunPKCS11
|
||||
# jdk.security.provider.preferred=AES/GCM/NoPadding:SunJCE, \
|
||||
# MessageDigest.SHA-256:SUN
|
||||
#ifdef solaris-sparc
|
||||
jdk.security.provider.preferred=AES:SunJCE, SHA-256:SUN, SHA-384:SUN, SHA-512:SUN
|
||||
jdk.security.provider.preferred=AES:SunJCE, SHA1:SUN, SHA-224:SUN, \
|
||||
SHA-256:SUN, SHA-384:SUN, SHA-512:SUN
|
||||
#endif
|
||||
#ifdef solaris-x86
|
||||
jdk.security.provider.preferred=AES:SunJCE, RSA:SunRsaSign
|
||||
|
||||
@ -63,7 +63,7 @@ extern "C" {
|
||||
* class.
|
||||
*/
|
||||
|
||||
#define JVM_INTERFACE_VERSION 4
|
||||
#define JVM_INTERFACE_VERSION 5
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
JVM_GetInterfaceVersion(void);
|
||||
@ -502,6 +502,9 @@ JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
|
||||
JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
||||
|
||||
JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt
|
||||
(JNIEnv *env, jobject obj, jobject unused, jint index);
|
||||
|
||||
JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
||||
|
||||
@ -517,6 +520,12 @@ JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
|
||||
JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
||||
|
||||
JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt
|
||||
(JNIEnv *env, jobject obj, jobject unused, jint index);
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt
|
||||
(JNIEnv *env, jobject obj, jobject unused, jint index);
|
||||
|
||||
JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
||||
|
||||
@ -535,6 +544,9 @@ JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
|
||||
JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
||||
|
||||
JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index);
|
||||
|
||||
/*
|
||||
* Parameter reflection
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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
|
||||
@ -44,6 +44,12 @@ JNIEXPORT jclass JNICALL Java_sun_reflect_ConstantPool_getClassAtIfLoaded0
|
||||
return JVM_ConstantPoolGetClassAtIfLoaded(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getClassRefIndexAt0
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index)
|
||||
{
|
||||
return JVM_ConstantPoolGetClassRefIndexAt(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getMethodAt0
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index)
|
||||
{
|
||||
@ -74,6 +80,18 @@ JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getMemberRefInfoAt0
|
||||
return JVM_ConstantPoolGetMemberRefInfoAt(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getNameAndTypeRefIndexAt0
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index)
|
||||
{
|
||||
return JVM_ConstantPoolGetNameAndTypeRefIndexAt(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index)
|
||||
{
|
||||
return JVM_ConstantPoolGetNameAndTypeRefInfoAt(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getIntAt0
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index)
|
||||
{
|
||||
@ -109,3 +127,10 @@ JNIEXPORT jstring JNICALL Java_sun_reflect_ConstantPool_getUTF8At0
|
||||
{
|
||||
return JVM_ConstantPoolGetUTF8At(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jbyte JNICALL Java_sun_reflect_ConstantPool_getTagAt0
|
||||
(JNIEnv *env, jobject unused, jobject jcpool, jint index)
|
||||
{
|
||||
return JVM_ConstantPoolGetTagAt(env, unused, jcpool, index);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
@ -210,7 +210,7 @@ static jlong* JIMAGE_FindAttributes(JNIEnv *env, jlong* rawAttributes, jbyte* ra
|
||||
// Locate resource location data.
|
||||
ImageLocation location;
|
||||
bool found = reader->find_location(path, location);
|
||||
delete path;
|
||||
delete[] path;
|
||||
// Resource not found.
|
||||
if (!found) return NULL;
|
||||
// Expand stream into array.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
@ -86,7 +86,7 @@ void ImageDecompressor::image_decompressor_init() {
|
||||
}
|
||||
|
||||
void ImageDecompressor::image_decompressor_close() {
|
||||
delete _decompressors;
|
||||
delete[] _decompressors;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -135,13 +135,13 @@ void ImageDecompressor::decompress_resource(u1* compressed, u1* uncompressed,
|
||||
decompressor->decompress_resource(compressed_resource, decompressed_resource,
|
||||
&_header, strings);
|
||||
if (compressed_resource_base != compressed) {
|
||||
delete compressed_resource_base;
|
||||
delete[] compressed_resource_base;
|
||||
}
|
||||
compressed_resource = decompressed_resource;
|
||||
}
|
||||
} while (has_header);
|
||||
memcpy(uncompressed, decompressed_resource, uncompressed_size);
|
||||
delete decompressed_resource;
|
||||
delete[] decompressed_resource;
|
||||
}
|
||||
|
||||
// Zip decompressor
|
||||
@ -190,8 +190,8 @@ void SharedStringDecompressor::decompress_resource(u1* data,
|
||||
{ // String in Strings table
|
||||
*uncompressed_resource = 1;
|
||||
uncompressed_resource += 1;
|
||||
int i = decompress_int(data);
|
||||
const char * string = strings->get(i);
|
||||
int k = decompress_int(data);
|
||||
const char * string = strings->get(k);
|
||||
int str_length = (int) strlen(string);
|
||||
Endian::set_java(uncompressed_resource, str_length);
|
||||
uncompressed_resource += 2;
|
||||
@ -241,7 +241,7 @@ void SharedStringDecompressor::decompress_resource(u1* data,
|
||||
*fullpkg = '/';
|
||||
memcpy(uncompressed_resource, pkg_base, len);
|
||||
uncompressed_resource += len;
|
||||
delete pkg_base;
|
||||
delete[] pkg_base;
|
||||
desc_length += len;
|
||||
} else { // Empty package
|
||||
// Nothing to do.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,6 +28,8 @@ package sun.security.provider;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
import sun.security.util.Debug;
|
||||
|
||||
/**
|
||||
@ -334,7 +336,9 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
private static final long MAX_BUFFER_TIME = 100;
|
||||
|
||||
// size of the "next" buffer
|
||||
private static final int BUFFER_SIZE = 32;
|
||||
private static final int MAX_BUFFER_SIZE = 65536;
|
||||
private static final int MIN_BUFFER_SIZE = 32;
|
||||
private int bufferSize = 256;
|
||||
|
||||
// Holder for the seedFile. Used if we ever add seed material.
|
||||
File seedFile;
|
||||
@ -351,7 +355,7 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
private volatile sun.security.provider.SecureRandom mixRandom;
|
||||
|
||||
// buffer for next bits
|
||||
private final byte[] nextBuffer;
|
||||
private byte[] nextBuffer;
|
||||
|
||||
// number of bytes left in nextBuffer
|
||||
private int buffered;
|
||||
@ -359,6 +363,16 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
// time we read the data into the nextBuffer
|
||||
private long lastRead;
|
||||
|
||||
// Count for the number of buffer size changes requests
|
||||
// Positive value in increase size, negative to lower it.
|
||||
private int change_buffer = 0;
|
||||
|
||||
// Request limit to trigger an increase in nextBuffer size
|
||||
private static final int REQ_LIMIT_INC = 1000;
|
||||
|
||||
// Request limit to trigger a decrease in nextBuffer size
|
||||
private static final int REQ_LIMIT_DEC = -100;
|
||||
|
||||
// mutex lock for nextBytes()
|
||||
private final Object LOCK_GET_BYTES = new Object();
|
||||
|
||||
@ -373,7 +387,7 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
this.seedFile = seedFile;
|
||||
seedIn = FileInputStreamPool.getInputStream(seedFile);
|
||||
nextIn = FileInputStreamPool.getInputStream(nextFile);
|
||||
nextBuffer = new byte[BUFFER_SIZE];
|
||||
nextBuffer = new byte[bufferSize];
|
||||
}
|
||||
|
||||
// get the SHA1PRNG for mixing
|
||||
@ -466,9 +480,47 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
// if not, read new bytes
|
||||
private void ensureBufferValid() throws IOException {
|
||||
long time = System.currentTimeMillis();
|
||||
if ((buffered > 0) && (time - lastRead < MAX_BUFFER_TIME)) {
|
||||
return;
|
||||
int new_buffer_size = 0;
|
||||
|
||||
// Check if buffer has bytes available that are not too old
|
||||
if (buffered > 0) {
|
||||
if (time - lastRead < MAX_BUFFER_TIME) {
|
||||
return;
|
||||
} else {
|
||||
// byte is old, so subtract from counter to shrink buffer
|
||||
change_buffer--;
|
||||
}
|
||||
} else {
|
||||
// No bytes available, so add to count to increase buffer
|
||||
change_buffer++;
|
||||
}
|
||||
|
||||
// If counter has it a limit, increase or decrease size
|
||||
if (change_buffer > REQ_LIMIT_INC) {
|
||||
new_buffer_size = nextBuffer.length * 2;
|
||||
} else if (change_buffer < REQ_LIMIT_DEC) {
|
||||
new_buffer_size = nextBuffer.length / 2;
|
||||
}
|
||||
|
||||
// If buffer size is to be changed, replace nextBuffer.
|
||||
if (new_buffer_size > 0) {
|
||||
if (new_buffer_size <= MAX_BUFFER_SIZE &&
|
||||
new_buffer_size >= MIN_BUFFER_SIZE) {
|
||||
nextBuffer = new byte[new_buffer_size];
|
||||
if (debug != null) {
|
||||
debug.println("Buffer size changed to " +
|
||||
new_buffer_size);
|
||||
}
|
||||
} else {
|
||||
if (debug != null) {
|
||||
debug.println("Buffer reached limit: " +
|
||||
nextBuffer.length);
|
||||
}
|
||||
}
|
||||
change_buffer = 0;
|
||||
}
|
||||
|
||||
// Load fresh random bytes into nextBuffer
|
||||
lastRead = time;
|
||||
readFully(nextIn, nextBuffer);
|
||||
buffered = nextBuffer.length;
|
||||
@ -478,24 +530,40 @@ public final class NativePRNG extends SecureRandomSpi {
|
||||
// read from "next" and XOR with bytes generated by the
|
||||
// mixing SHA1PRNG
|
||||
private void implNextBytes(byte[] data) {
|
||||
synchronized (LOCK_GET_BYTES) {
|
||||
try {
|
||||
getMixRandom().engineNextBytes(data);
|
||||
int len = data.length;
|
||||
int data_len = data.length;
|
||||
int ofs = 0;
|
||||
while (len > 0) {
|
||||
ensureBufferValid();
|
||||
int bufferOfs = nextBuffer.length - buffered;
|
||||
while ((len > 0) && (buffered > 0)) {
|
||||
data[ofs++] ^= nextBuffer[bufferOfs++];
|
||||
len--;
|
||||
buffered--;
|
||||
int len;
|
||||
int buf_pos;
|
||||
int localofs;
|
||||
byte[] localBuffer;
|
||||
|
||||
while (data_len > 0) {
|
||||
synchronized (LOCK_GET_BYTES) {
|
||||
ensureBufferValid();
|
||||
buf_pos = nextBuffer.length - buffered;
|
||||
if (data_len > buffered) {
|
||||
len = buffered;
|
||||
buffered = 0;
|
||||
} else {
|
||||
len = data_len;
|
||||
buffered -= len;
|
||||
}
|
||||
localBuffer = Arrays.copyOfRange(nextBuffer, buf_pos,
|
||||
buf_pos + len);
|
||||
}
|
||||
localofs = 0;
|
||||
while (len > localofs) {
|
||||
data[ofs] ^= localBuffer[localofs];
|
||||
ofs++;
|
||||
localofs++;
|
||||
}
|
||||
data_len -= len;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e){
|
||||
throw new ProviderException("nextBytes() failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ import sun.lwawt.LWWindowPeer;
|
||||
import sun.lwawt.macosx.CPlatformWindow;
|
||||
|
||||
/**
|
||||
* The <code>Application</code> class allows you to integrate your Java application with the native Mac OS X environment.
|
||||
* The {@code Application} class allows you to integrate your Java application with the native Mac OS X environment.
|
||||
* You can provide your Mac OS X users a greatly enhanced experience by implementing a few basic handlers for standard system events.
|
||||
*
|
||||
* For example:
|
||||
@ -142,7 +142,7 @@ public class Application {
|
||||
/**
|
||||
* Installs a handler to show a custom About window for your application.
|
||||
*
|
||||
* Setting the {@link AboutHandler} to <code>null</code> reverts it to the default Cocoa About window.
|
||||
* Setting the {@link AboutHandler} to {@code null} reverts it to the default Cocoa About window.
|
||||
*
|
||||
* @param aboutHandler the handler to respond to the {@link AboutHandler#handleAbout()} message
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -155,7 +155,7 @@ public class Application {
|
||||
/**
|
||||
* Installs a handler to create the Preferences menu item in your application's app menu.
|
||||
*
|
||||
* Setting the {@link PreferencesHandler} to <code>null</code> will remove the Preferences item from the app menu.
|
||||
* Setting the {@link PreferencesHandler} to {@code null} will remove the Preferences item from the app menu.
|
||||
*
|
||||
* @param preferencesHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -167,8 +167,8 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Installs the handler which is notified when the application is asked to open a list of files.
|
||||
* The {@link OpenFilesHandler#openFiles(AppEvent.OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a <code>CFBundleDocumentTypes</code> array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleDocumentTypes</code> key to your app's Info.plist.
|
||||
* The {@link OpenFilesHandler#openFiles(AppEvent.OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
|
||||
*
|
||||
* @param openFileHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -180,8 +180,8 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Installs the handler which is notified when the application is asked to print a list of files.
|
||||
* The {@link PrintFilesHandler#printFiles(AppEvent.PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a <code>CFBundleDocumentTypes</code> array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleDocumentTypes</code> key to your app's Info.plist.
|
||||
* The {@link PrintFilesHandler#printFiles(AppEvent.PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
|
||||
*
|
||||
* @param printFileHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -193,10 +193,10 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Installs the handler which is notified when the application is asked to open a URL.
|
||||
* The {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a <code>CFBundleURLTypes</code> array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleURLTypes</code> key to your app's Info.plist.
|
||||
* The {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleURLTypes} array present in it's Info.plist.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleURLTypes} key to your app's Info.plist.
|
||||
*
|
||||
* Setting the handler to <code>null</code> causes all {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be enqueued until another handler is set.
|
||||
* Setting the handler to {@code null} causes all {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be enqueued until another handler is set.
|
||||
*
|
||||
* @param openURIHandler
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -209,7 +209,7 @@ public class Application {
|
||||
/**
|
||||
* Installs the handler which determines if the application should quit.
|
||||
* The handler is passed a one-shot {@link QuitResponse} which can cancel or proceed with the quit.
|
||||
* Setting the handler to <code>null</code> causes all quit requests to directly perform the default {@link QuitStrategy}.
|
||||
* Setting the handler to {@code null} causes all quit requests to directly perform the default {@link QuitStrategy}.
|
||||
*
|
||||
* @param quitHandler the handler that is called when the application is asked to quit
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
@ -432,11 +432,11 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Enables the Preferences item in the application menu. The ApplicationListener receives a callback for
|
||||
* selection of the Preferences item in the application menu only if this is set to <code>true</code>.
|
||||
* selection of the Preferences item in the application menu only if this is set to {@code true}.
|
||||
*
|
||||
* If a Preferences item isn't present, this method adds and enables it.
|
||||
*
|
||||
* @param enable specifies whether the Preferences item in the application menu should be enabled (<code>true</code>) or not (<code>false</code>)
|
||||
* @param enable specifies whether the Preferences item in the application menu should be enabled ({@code true}) or not ({@code false})
|
||||
*
|
||||
* @deprecated no replacement
|
||||
* @since 1.4
|
||||
@ -449,12 +449,12 @@ public class Application {
|
||||
|
||||
/**
|
||||
* Enables the About item in the application menu. The ApplicationListener receives a callback for
|
||||
* selection of the About item in the application menu only if this is set to <code>true</code>. Because AWT supplies
|
||||
* a standard About window when an application may not, by default this is set to <code>true</code>.
|
||||
* selection of the About item in the application menu only if this is set to {@code true}. Because AWT supplies
|
||||
* a standard About window when an application may not, by default this is set to {@code true}.
|
||||
*
|
||||
* If the About item isn't present, this method adds and enables it.
|
||||
*
|
||||
* @param enable specifies whether the About item in the application menu should be enabled (<code>true</code>) or not (<code>false</code>)
|
||||
* @param enable specifies whether the About item in the application menu should be enabled ({@code true}) or not ({@code false})
|
||||
*
|
||||
* @deprecated no replacement
|
||||
* @since 1.4
|
||||
@ -553,7 +553,7 @@ public class Application {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use <code>java.awt.MouseInfo.getPointerInfo().getLocation()</code>.
|
||||
* @deprecated Use {@code java.awt.MouseInfo.getPointerInfo().getLocation()}.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
package com.apple.eawt;
|
||||
|
||||
/**
|
||||
* An abstract adapter class for receiving <code>ApplicationEvents</code>.
|
||||
* An abstract adapter class for receiving {@code ApplicationEvents}.
|
||||
*
|
||||
* ApplicationEvents are deprecated. Use individual app event listeners or handlers instead.
|
||||
*
|
||||
|
||||
@ -50,9 +50,9 @@ public class ApplicationEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* Determines whether an ApplicationListener has acted on a particular event.
|
||||
* An event is marked as having been handled with <code>setHandled(true)</code>.
|
||||
* An event is marked as having been handled with {@code setHandled(true)}.
|
||||
*
|
||||
* @return <code>true</code> if the event has been handled, otherwise <code>false</code>
|
||||
* @return {@code true} if the event has been handled, otherwise {@code false}
|
||||
*
|
||||
* @since 1.4
|
||||
* @deprecated
|
||||
@ -65,10 +65,10 @@ public class ApplicationEvent extends EventObject {
|
||||
/**
|
||||
* Marks the event as handled.
|
||||
* After this method handles an ApplicationEvent, it may be useful to specify that it has been handled.
|
||||
* This is usually used in conjunction with <code>getHandled()</code>.
|
||||
* Set to <code>true</code> to designate that this event has been handled. By default it is <code>false</code>.
|
||||
* This is usually used in conjunction with {@code getHandled()}.
|
||||
* Set to {@code true} to designate that this event has been handled. By default it is {@code false}.
|
||||
*
|
||||
* @param state <code>true</code> if the event has been handled, otherwise <code>false</code>.
|
||||
* @param state {@code true} if the event has been handled, otherwise {@code false}.
|
||||
*
|
||||
* @since 1.4
|
||||
* @deprecated
|
||||
@ -84,7 +84,7 @@ public class ApplicationEvent extends EventObject {
|
||||
* For example, the Print and Open events refer to specific files.
|
||||
* For these cases, this returns the appropriate file name.
|
||||
*
|
||||
* @return the full path to the file associated with the event, if applicable, otherwise <code>null</code>
|
||||
* @return the full path to the file associated with the event, if applicable, otherwise {@code null}
|
||||
*
|
||||
* @since 1.4
|
||||
* @deprecated use {@link OpenFilesHandler} or {@link PrintFilesHandler} instead
|
||||
|
||||
@ -53,9 +53,9 @@ import java.util.EventListener;
|
||||
@Deprecated
|
||||
public interface ApplicationListener extends EventListener {
|
||||
/**
|
||||
* Called when the user selects the About item in the application menu. If <code>event</code> is not handled by
|
||||
* setting <code>isHandled(true)</code>, a default About window consisting of the application's name and icon is
|
||||
* displayed. To display a custom About window, designate the <code>event</code> as being handled and display the
|
||||
* Called when the user selects the About item in the application menu. If {@code event} is not handled by
|
||||
* setting {@code isHandled(true)}, a default About window consisting of the application's name and icon is
|
||||
* displayed. To display a custom About window, designate the {@code event} as being handled and display the
|
||||
* appropriate About window.
|
||||
*
|
||||
* @param event an ApplicationEvent initiated by the user choosing About in the application menu
|
||||
@ -99,7 +99,7 @@ public interface ApplicationListener extends EventListener {
|
||||
* Called when the Preference item in the application menu is selected. Native Mac OS X applications make their
|
||||
* Preferences window available through the application menu. Java applications are automatically given an application
|
||||
* menu in Mac OS X. By default, the Preferences item is disabled in that menu. If you are deploying an application
|
||||
* on Mac OS X, you should enable the preferences item with <code>setEnabledPreferencesMenu(true)</code> in the
|
||||
* on Mac OS X, you should enable the preferences item with {@code setEnabledPreferencesMenu(true)} in the
|
||||
* Application object and then display your Preferences window in this handler.
|
||||
*
|
||||
* @param event triggered when the user selects Preferences from the application menu
|
||||
@ -130,8 +130,8 @@ public interface ApplicationListener extends EventListener {
|
||||
* application menu, when the user types Command-Q, or when the user control clicks on your application icon in the
|
||||
* Dock and chooses Quit. You can either accept or reject the request to quit. You might want to reject the request
|
||||
* to quit if the user has unsaved work. Reject the request, move into your code to save changes, then quit your
|
||||
* application. To accept the request to quit, and terminate the application, set <code>isHandled(true)</code> for the
|
||||
* <code>event</code>. To reject the quit, set <code>isHandled(false)</code>.
|
||||
* application. To accept the request to quit, and terminate the application, set {@code isHandled(true)} for the
|
||||
* {@code event}. To reject the quit, set {@code isHandled(false)}.
|
||||
*
|
||||
* @param event a Quit Application event
|
||||
* @deprecated use {@link QuitHandler} and {@link QuitResponse}
|
||||
|
||||
@ -29,8 +29,8 @@ import com.apple.eawt.AppEvent.OpenURIEvent;
|
||||
|
||||
/**
|
||||
* An implementor is notified when the application is asked to open a URI.
|
||||
* The application only sends {@link com.apple.eawt.EAWTEvent.OpenURIEvent}s when it has been launched as a bundled Mac application, and it's Info.plist claims URL schemes in it's <code>CFBundleURLTypes</code> entry.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a <code>CFBundleURLTypes</code> key to your app's Info.plist.
|
||||
* The application only sends {@link com.apple.eawt.EAWTEvent.OpenURIEvent}s when it has been launched as a bundled Mac application, and it's Info.plist claims URL schemes in it's {@code CFBundleURLTypes} entry.
|
||||
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleURLTypes} key to your app's Info.plist.
|
||||
*
|
||||
* @see Application#setOpenURIHandler(OpenURIHandler)
|
||||
*
|
||||
|
||||
@ -38,7 +38,7 @@ package com.apple.eawt;
|
||||
*/
|
||||
public enum QuitStrategy {
|
||||
/**
|
||||
* Shuts down the application by calling <code>System.exit(0)</code>. This is the default strategy.
|
||||
* Shuts down the application by calling {@code System.exit(0)}. This is the default strategy.
|
||||
*/
|
||||
SYSTEM_EXIT_0,
|
||||
|
||||
|
||||
@ -32,19 +32,19 @@ import java.io.*;
|
||||
* attributes. These attributes in turn are dependent on HFS and HFS+ file systems. As such, it is important to recognize
|
||||
* their limitation when writing code that must function well across multiple platforms.<p>
|
||||
*
|
||||
* In addition to file name suffixes, Mac OS X can use Finder attributes like file <code>type</code> and <code>creator</code> codes to
|
||||
* identify and handle files. These codes are unique 4-byte identifiers. The file <code>type</code> is a string that describes the
|
||||
* contents of a file. For example, the file type <code>APPL</code> identifies the file as an application and therefore
|
||||
* executable. A file type of <code>TEXT</code> means that the file contains raw text. Any application that can read raw
|
||||
* text can open a file of type <code>TEXT</code>. Applications that use proprietary file types might assign their files a proprietary
|
||||
* file <code>type</code> code.
|
||||
* In addition to file name suffixes, Mac OS X can use Finder attributes like file {@code type} and {@code creator} codes to
|
||||
* identify and handle files. These codes are unique 4-byte identifiers. The file {@code type} is a string that describes the
|
||||
* contents of a file. For example, the file type {@code APPL} identifies the file as an application and therefore
|
||||
* executable. A file type of {@code TEXT} means that the file contains raw text. Any application that can read raw
|
||||
* text can open a file of type {@code TEXT}. Applications that use proprietary file types might assign their files a proprietary
|
||||
* file {@code type} code.
|
||||
* <p>
|
||||
* To identify the application that can handle a document, the Finder can look at the <code>creator</code>. For example, if a user
|
||||
* double-clicks on a document with the <code>ttxt</code> <code>creator</code>, it opens up in Text Edit, the application registered
|
||||
* with the <code>ttxt</code> <code>creator</code> code. Note that the <code>creator</code>
|
||||
* To identify the application that can handle a document, the Finder can look at the {@code creator}. For example, if a user
|
||||
* double-clicks on a document with the {@code ttxt creator}, it opens up in Text Edit, the application registered
|
||||
* with the {@code ttxt creator} code. Note that the {@code creator}
|
||||
* code can be set to any application, not necessarily the application that created it. For example, if you
|
||||
* use an editor to create an HTML document, you might want to assign a browser's <code>creator</code> code for the file rather than
|
||||
* the HTML editor's <code>creator</code> code. Double-clicking on the document then opens the appropriate browser rather than the
|
||||
* use an editor to create an HTML document, you might want to assign a browser's {@code creator} code for the file rather than
|
||||
* the HTML editor's {@code creator} code. Double-clicking on the document then opens the appropriate browser rather than the
|
||||
*HTML editor.
|
||||
*<p>
|
||||
* If you plan to publicly distribute your application, you must register its creator and any proprietary file types with the Apple
|
||||
@ -126,7 +126,7 @@ public class FileManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file <code>type</code> and <code>creator</code> codes for a file or folder.
|
||||
* Sets the file {@code type} and {@code creator} codes for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -140,7 +140,7 @@ public class FileManager {
|
||||
private static native void _setFileTypeAndCreator(String filename, int type, int creator) throws IOException;
|
||||
|
||||
/**
|
||||
* Sets the file <code>type</code> code for a file or folder.
|
||||
* Sets the file {@code type} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -154,7 +154,7 @@ public class FileManager {
|
||||
private static native void _setFileType(String filename, int type) throws IOException;
|
||||
|
||||
/**
|
||||
* Sets the file <code>creator</code> code for a file or folder.
|
||||
* Sets the file {@code creator} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -168,7 +168,7 @@ public class FileManager {
|
||||
private static native void _setFileCreator(String filename, int creator) throws IOException;
|
||||
|
||||
/**
|
||||
* Obtains the file <code>type</code> code for a file or folder.
|
||||
* Obtains the file {@code type} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -182,7 +182,7 @@ public class FileManager {
|
||||
private static native int _getFileType(String filename) throws IOException;
|
||||
|
||||
/**
|
||||
* Obtains the file <code>creator</code> code for a file or folder.
|
||||
* Obtains the file {@code creator} code for a file or folder.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
@ -200,11 +200,11 @@ public class FileManager {
|
||||
* Locates a folder of a particular type. Mac OS X recognizes certain specific folders that have distinct purposes.
|
||||
* For example, the user's desktop or temporary folder. These folders have corresponding codes. Given one of these codes,
|
||||
* this method returns the path to that particular folder. Certain folders of a given type may appear in more than
|
||||
* one domain. For example, although there is only one <code>root</code> folder, there are multiple <code>pref</code>
|
||||
* folders. If this method is called to find the <code>pref</code> folder, it will return the first one it finds,
|
||||
* the user's preferences folder in <code>~/Library/Preferences</code>. To explicitly locate a folder in a certain
|
||||
* domain use <code>findFolder(short domain, int folderType)</code> or <code>findFolder(short domain, int folderType,
|
||||
* boolean createIfNeeded)</code>.
|
||||
* one domain. For example, although there is only one {@code root} folder, there are multiple {@code pref}
|
||||
* folders. If this method is called to find the {@code pref} folder, it will return the first one it finds,
|
||||
* the user's preferences folder in {@code ~/Library/Preferences}. To explicitly locate a folder in a certain
|
||||
* domain use {@code findFolder(short domain, int folderType)} or
|
||||
* {@code findFolder(short domain, int folderType, boolean createIfNeeded)}.
|
||||
*
|
||||
* @return the path to the folder searched for
|
||||
*
|
||||
@ -215,8 +215,8 @@ public class FileManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates a folder of a particular type, within a given domain. Similar to <code>findFolder(int folderType)</code>
|
||||
* except that the domain to look in can be specified. Valid values for <code>domain</code>include:
|
||||
* Locates a folder of a particular type, within a given domain. Similar to {@code findFolder(int folderType)}
|
||||
* except that the domain to look in can be specified. Valid values for {@code domain} include:
|
||||
* <dl>
|
||||
* <dt>user</dt>
|
||||
* <dd>The User domain contains resources specific to the user who is currently logged in</dd>
|
||||
@ -239,12 +239,12 @@ public class FileManager {
|
||||
|
||||
/**
|
||||
* Locates a folder of a particular type within a given domain and optionally creating the folder if it does
|
||||
* not exist. The behavior is similar to <code>findFolder(int folderType)</code> and
|
||||
* <code>findFolder(short domain, int folderType)</code> except that it can create the folder if it does not already exist.
|
||||
* not exist. The behavior is similar to {@code findFolder(int folderType)} and
|
||||
* {@code findFolder(short domain, int folderType)} except that it can create the folder if it does not already exist.
|
||||
*
|
||||
* @param createIfNeeded
|
||||
* set to <code>true</code>, by setting to <code>false</code> the behavior will be the
|
||||
* same as <code>findFolder(short domain, int folderType, boolean createIfNeeded)</code>
|
||||
* set to {@code true}, by setting to {@code false} the behavior will be the
|
||||
* same as {@code findFolder(short domain, int folderType, boolean createIfNeeded)}
|
||||
* @return the path to the folder searched for
|
||||
*
|
||||
* @since 1.4
|
||||
@ -263,9 +263,9 @@ public class FileManager {
|
||||
|
||||
|
||||
/**
|
||||
* Opens the path specified by a URL in the appropriate application for that URL. HTTP URL's (<code>http://</code>)
|
||||
* open in the default browser as set in the Internet pane of System Preferences. File (<code>file://</code>) and
|
||||
* FTP URL's (<code>ftp://</code>) open in the Finder. Note that opening an FTP URL will prompt the user for where
|
||||
* Opens the path specified by a URL in the appropriate application for that URL. HTTP URL's ({@code http://})
|
||||
* open in the default browser as set in the Internet pane of System Preferences. File ({@code file://}) and
|
||||
* FTP URL's ({@code ftp://}) open in the Finder. Note that opening an FTP URL will prompt the user for where
|
||||
* they want to save the downloaded file(s).
|
||||
*
|
||||
* @param url
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package com.apple.laf;
|
||||
|
||||
|
||||
import java.awt.ComponentOrientation;
|
||||
import java.beans.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@ -85,6 +86,15 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
} else if (prop == JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY) {
|
||||
invalidateFileCache();
|
||||
validateFileCache();
|
||||
} else if (prop.equals("componentOrientation")) {
|
||||
ComponentOrientation o = (ComponentOrientation) e.getNewValue();
|
||||
JFileChooser cc = (JFileChooser) e.getSource();
|
||||
if (o != e.getOldValue()) {
|
||||
cc.applyComponentOrientation(o);
|
||||
}
|
||||
fFileList.setComponentOrientation(o);
|
||||
fFileList.getParent().getParent().setComponentOrientation(o);
|
||||
|
||||
}
|
||||
if (prop == SORT_BY_CHANGED) {// $ Ought to just resort
|
||||
fSortNames = (((Integer)e.getNewValue()).intValue() == 0);
|
||||
|
||||
@ -105,7 +105,9 @@ public class AquaInternalFrameManager extends DefaultDesktopManager {
|
||||
// Position depends on *current* position of frame, unlike super which reuses the first position
|
||||
final Rectangle r = getBoundsForIconOf(f);
|
||||
desktopIcon.setBounds(r.x, r.y, r.width, r.height);
|
||||
|
||||
if (!wasIcon(f)) {
|
||||
setWasIcon(f, Boolean.TRUE);
|
||||
}
|
||||
c = f.getParent();
|
||||
if (c == null) return;
|
||||
|
||||
|
||||
@ -295,9 +295,9 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs necessary mouse handlers on <code>newPane</code>
|
||||
* Installs necessary mouse handlers on {@code newPane}
|
||||
* and adds it to the frame.
|
||||
* Reverse process for the <code>currentPane</code>.
|
||||
* Reverse process for the {@code currentPane}.
|
||||
*/
|
||||
@Override
|
||||
protected void replacePane(final JComponent currentPane, final JComponent newPane) {
|
||||
|
||||
@ -82,9 +82,9 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the <code>LookAndFeel</code> returned
|
||||
* <code>RootPaneUI</code> instances support providing Window decorations
|
||||
* in a <code>JRootPane</code>.
|
||||
* Returns true if the {@code LookAndFeel} returned
|
||||
* {@code RootPaneUI} instances support providing Window decorations
|
||||
* in a {@code JRootPane}.
|
||||
* <p>
|
||||
* The default implementation returns false, subclasses that support
|
||||
* Window decorations should override this and return true.
|
||||
@ -174,20 +174,20 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>ActionMap</code>.
|
||||
* Returns an {@code ActionMap}.
|
||||
* <P>
|
||||
* This <code>ActionMap</code> contains <code>Actions</code> that
|
||||
* This {@code ActionMap} contains {@code Actions} that
|
||||
* embody the ability to render an auditory cue. These auditory
|
||||
* cues map onto user and system activities that may be useful
|
||||
* for an end user to know about (such as a dialog box appearing).
|
||||
* <P>
|
||||
* At the appropriate time in a <code>JComponent</code> UI's lifecycle,
|
||||
* At the appropriate time in a {@code JComponent} UI's lifecycle,
|
||||
* the ComponentUI is responsible for getting the appropriate
|
||||
* <code>Action</code> out of the <code>ActionMap</code> and passing
|
||||
* it on to <code>playSound</code>.
|
||||
* {@code Action} out of the {@code ActionMap} and passing
|
||||
* it on to {@code playSound}.
|
||||
* <P>
|
||||
* The <code>Actions</code> in this <code>ActionMap</code> are
|
||||
* created by the <code>createAudioAction</code> method.
|
||||
* The {@code Actions} in this {@code ActionMap} are
|
||||
* created by the {@code createAudioAction} method.
|
||||
*
|
||||
* @return an ActionMap containing Actions
|
||||
* responsible for rendering auditory cues
|
||||
|
||||
@ -47,7 +47,7 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
|
||||
/**
|
||||
* Creates and returns a Container containin the buttons. The buttons
|
||||
* are created by calling <code>getButtons</code>.
|
||||
* are created by calling {@code getButtons}.
|
||||
*/
|
||||
protected Container createButtonArea() {
|
||||
final Container bottom = super.createButtonArea();
|
||||
@ -141,5 +141,27 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
xLocation += xOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container c) {
|
||||
if (c != null) {
|
||||
Component[] children = c.getComponents();
|
||||
if (children != null && children.length > 0) {
|
||||
int numChildren = children.length;
|
||||
Insets cInsets = c.getInsets();
|
||||
int extraHeight = cInsets.top + cInsets.bottom;
|
||||
int extraWidth = cInsets.left + cInsets.right;
|
||||
int okCancelButtonWidth = extraWidth
|
||||
+ (kOKCancelButtonWidth * numChildren)
|
||||
+ (numChildren - 1) * padding;
|
||||
int okbuttonHeight = extraHeight + kButtonHeight;
|
||||
Dimension minSize = super.minimumLayoutSize(c);
|
||||
return new Dimension(Math.max(minSize.width,
|
||||
okCancelButtonWidth),
|
||||
Math.max(minSize.height, okbuttonHeight));
|
||||
}
|
||||
}
|
||||
return new Dimension(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,10 +180,19 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
final int width = progressBar.getWidth() - (i.right + i.left);
|
||||
final int height = progressBar.getHeight() - (i.bottom + i.top);
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
final AffineTransform savedAT = g2.getTransform();
|
||||
if (!progressBar.getComponentOrientation().isLeftToRight()) {
|
||||
//Scale operation: Flips component about pivot
|
||||
//Translate operation: Moves component back into original position
|
||||
g2.scale(-1, 1);
|
||||
g2.translate(-progressBar.getWidth(), 0);
|
||||
}
|
||||
painter.paint(g, progressBar, i.left, i.top, width, height);
|
||||
|
||||
g2.setTransform(savedAT);
|
||||
if (progressBar.isStringPainted() && !progressBar.isIndeterminate()) {
|
||||
paintString(g, i.left, i.top, width, height);
|
||||
paintString(g, i.left, i.top, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +164,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
|
||||
/**
|
||||
* Invoked when a property changes on the root pane. If the event
|
||||
* indicates the <code>defaultButton</code> has changed, this will
|
||||
* indicates the {@code defaultButton} has changed, this will
|
||||
* update the animation.
|
||||
* If the enabled state changed, it will start or stop the animation
|
||||
*/
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.apple.laf;
|
||||
|
||||
import java.awt.*;
|
||||
@ -45,33 +44,37 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
/**
|
||||
* This is originally derived from BasicSpinnerUI, but they made everything private
|
||||
* so we can't subclass!
|
||||
* This is originally derived from BasicSpinnerUI, but they made everything
|
||||
* private so we can't subclass!
|
||||
*/
|
||||
public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
private static final RecyclableSingleton<? extends PropertyChangeListener> propertyChangeListener
|
||||
= new RecyclableSingletonFromDefaultConstructor<>(PropertyChangeHandler.class);
|
||||
|
||||
static PropertyChangeListener getPropertyChangeListener() {
|
||||
return propertyChangeListener.get();
|
||||
}
|
||||
|
||||
private static final RecyclableSingleton<ArrowButtonHandler> nextButtonHandler
|
||||
= new RecyclableSingleton<ArrowButtonHandler>() {
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("increment", true);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("increment", true);
|
||||
}
|
||||
};
|
||||
|
||||
static ArrowButtonHandler getNextButtonHandler() {
|
||||
return nextButtonHandler.get();
|
||||
}
|
||||
private static final RecyclableSingleton<ArrowButtonHandler> previousButtonHandler
|
||||
= new RecyclableSingleton<ArrowButtonHandler>() {
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("decrement", false);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected ArrowButtonHandler getInstance() {
|
||||
return new ArrowButtonHandler("decrement", false);
|
||||
}
|
||||
};
|
||||
|
||||
static ArrowButtonHandler getPreviousButtonHandler() {
|
||||
return previousButtonHandler.get();
|
||||
}
|
||||
@ -92,9 +95,10 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
boolean wasOpaque;
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
this.spinner = (JSpinner)c;
|
||||
this.spinner = (JSpinner) c;
|
||||
installDefaults();
|
||||
installListeners();
|
||||
next = createNextButton();
|
||||
@ -110,8 +114,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
installKeyboardActions();
|
||||
|
||||
// this doesn't work because JSpinner calls setOpaque(true) directly in it's constructor
|
||||
// LookAndFeel.installProperty(spinner, "opaque", Boolean.FALSE);
|
||||
|
||||
// LookAndFeel.installProperty(spinner, "opaque", Boolean.FALSE);
|
||||
// ...so we have to handle the is/was opaque ourselves
|
||||
wasOpaque = spinner.isOpaque();
|
||||
spinner.setOpaque(false);
|
||||
@ -208,6 +211,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class TransparentButton extends JButton implements SwingConstants {
|
||||
|
||||
boolean interceptRepaints = false;
|
||||
|
||||
public TransparentButton() {
|
||||
@ -219,14 +223,17 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g) {}
|
||||
public void paint(final Graphics g) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void repaint() {
|
||||
// only intercept repaints if we are after this has been initialized
|
||||
// otherwise we can't talk to our containing class
|
||||
if (interceptRepaints) {
|
||||
if (spinPainter == null) return;
|
||||
if (spinPainter == null) {
|
||||
return;
|
||||
}
|
||||
spinPainter.repaint();
|
||||
}
|
||||
super.repaint();
|
||||
@ -246,7 +253,9 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
protected void fixupEditor(final JComponent editor) {
|
||||
if (!(editor instanceof DefaultEditor)) return;
|
||||
if (!(editor instanceof DefaultEditor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.setOpaque(false);
|
||||
editor.setInheritsPopupMenu(true);
|
||||
@ -255,7 +264,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
editor.setFont(new FontUIResource(spinner.getFont()));
|
||||
}
|
||||
|
||||
final JFormattedTextField editorTextField = ((DefaultEditor)editor).getTextField();
|
||||
final JFormattedTextField editorTextField = ((DefaultEditor) editor).getTextField();
|
||||
if (editorTextField.getFont() instanceof UIResource) {
|
||||
editorTextField.setFont(new FontUIResource(spinner.getFont()));
|
||||
}
|
||||
@ -277,7 +286,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
child.setEnabled(enabled);
|
||||
if (child instanceof Container) {
|
||||
updateEnabledState((Container)child, enabled);
|
||||
updateEnabledState((Container) child, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -290,13 +299,13 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
private InputMap getInputMap(final int condition) {
|
||||
if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
|
||||
return (InputMap)UIManager.get("Spinner.ancestorInputMap");
|
||||
return (InputMap) UIManager.get("Spinner.ancestorInputMap");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ActionMap getActionMap() {
|
||||
ActionMap map = (ActionMap)UIManager.get("Spinner.actionMap");
|
||||
ActionMap map = (ActionMap) UIManager.get("Spinner.actionMap");
|
||||
|
||||
if (map == null) {
|
||||
map = createActionMap();
|
||||
@ -316,6 +325,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private static class ArrowButtonHandler extends AbstractAction implements MouseListener {
|
||||
|
||||
final javax.swing.Timer autoRepeatTimer;
|
||||
final boolean isNext;
|
||||
JSpinner spinner = null;
|
||||
@ -330,9 +340,9 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
private JSpinner eventToSpinner(final AWTEvent e) {
|
||||
Object src = e.getSource();
|
||||
while ((src instanceof Component) && !(src instanceof JSpinner)) {
|
||||
src = ((Component)src).getParent();
|
||||
src = ((Component) src).getParent();
|
||||
}
|
||||
return (src instanceof JSpinner) ? (JSpinner)src : null;
|
||||
return (src instanceof JSpinner) ? (JSpinner) src : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -342,13 +352,15 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
spinner = eventToSpinner(e);
|
||||
}
|
||||
|
||||
if (spinner == null) return;
|
||||
if (spinner == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final int calendarField = getCalendarField(spinner);
|
||||
spinner.commitEdit();
|
||||
if (calendarField != -1) {
|
||||
((SpinnerDateModel)spinner.getModel()).setCalendarField(calendarField);
|
||||
((SpinnerDateModel) spinner.getModel()).setCalendarField(calendarField);
|
||||
}
|
||||
final Object value = (isNext) ? spinner.getNextValue() : spinner.getPreviousValue();
|
||||
if (value != null) {
|
||||
@ -368,37 +380,46 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
*/
|
||||
private void select(final JSpinner spinnerComponent) {
|
||||
final JComponent editor = spinnerComponent.getEditor();
|
||||
if (!(editor instanceof JSpinner.DateEditor)) return;
|
||||
if (!(editor instanceof JSpinner.DateEditor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor) editor;
|
||||
final JFormattedTextField ftf = dateEditor.getTextField();
|
||||
final Format format = dateEditor.getFormat();
|
||||
Object value;
|
||||
if (format == null || (value = spinnerComponent.getValue()) == null) return;
|
||||
if (format == null || (value = spinnerComponent.getValue()) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SpinnerDateModel model = dateEditor.getModel();
|
||||
final DateFormat.Field field = DateFormat.Field.ofCalendarField(model.getCalendarField());
|
||||
if (field == null) return;
|
||||
if (field == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final AttributedCharacterIterator iterator = format.formatToCharacterIterator(value);
|
||||
if (!select(ftf, iterator, field) && field == DateFormat.Field.HOUR0) {
|
||||
select(ftf, iterator, DateFormat.Field.HOUR1);
|
||||
}
|
||||
} catch (final IllegalArgumentException iae) {}
|
||||
} catch (final IllegalArgumentException iae) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the passed in field, returning true if it is found,
|
||||
* false otherwise.
|
||||
* Selects the passed in field, returning true if it is found, false
|
||||
* otherwise.
|
||||
*/
|
||||
private boolean select(final JFormattedTextField ftf, final AttributedCharacterIterator iterator, final DateFormat.Field field) {
|
||||
final int max = ftf.getDocument().getLength();
|
||||
|
||||
iterator.first();
|
||||
do {
|
||||
final Map<Attribute,Object> attrs = iterator.getAttributes();
|
||||
if (attrs == null || !attrs.containsKey(field)) continue;
|
||||
final Map<Attribute, Object> attrs = iterator.getAttributes();
|
||||
if (attrs == null || !attrs.containsKey(field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final int start = iterator.getRunStart(field);
|
||||
final int end = iterator.getRunLimit(field);
|
||||
@ -412,29 +433,35 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the calendarField under the start of the selection, or
|
||||
* -1 if there is no valid calendar field under the selection (or
|
||||
* the spinner isn't editing dates.
|
||||
* Returns the calendarField under the start of the selection, or -1 if
|
||||
* there is no valid calendar field under the selection (or the spinner
|
||||
* isn't editing dates.
|
||||
*/
|
||||
private int getCalendarField(final JSpinner spinnerComponent) {
|
||||
final JComponent editor = spinnerComponent.getEditor();
|
||||
if (!(editor instanceof JSpinner.DateEditor)) return -1;
|
||||
if (!(editor instanceof JSpinner.DateEditor)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
|
||||
final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor) editor;
|
||||
final JFormattedTextField ftf = dateEditor.getTextField();
|
||||
final int start = ftf.getSelectionStart();
|
||||
final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
|
||||
if (!(formatter instanceof InternationalFormatter)) return -1;
|
||||
if (!(formatter instanceof InternationalFormatter)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
|
||||
final Format.Field[] fields = ((InternationalFormatter) formatter).getFields(start);
|
||||
for (final Field element : fields) {
|
||||
if (!(element instanceof DateFormat.Field)) continue;
|
||||
if (!(element instanceof DateFormat.Field)) {
|
||||
continue;
|
||||
}
|
||||
int calendarField;
|
||||
|
||||
if (element == DateFormat.Field.HOUR1) {
|
||||
calendarField = Calendar.HOUR;
|
||||
} else {
|
||||
calendarField = ((DateFormat.Field)element).getCalendarField();
|
||||
calendarField = ((DateFormat.Field) element).getCalendarField();
|
||||
}
|
||||
|
||||
if (calendarField != -1) {
|
||||
@ -446,7 +473,9 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (!SwingUtilities.isLeftMouseButton(e) || !e.getComponent().isEnabled()) return;
|
||||
if (!SwingUtilities.isLeftMouseButton(e) || !e.getComponent().isEnabled()) {
|
||||
return;
|
||||
}
|
||||
spinner = eventToSpinner(e);
|
||||
autoRepeatTimer.start();
|
||||
|
||||
@ -460,26 +489,35 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {}
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {}
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) {}
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests focus on a child of the spinner if the spinner doesn't
|
||||
* have focus.
|
||||
* Requests focus on a child of the spinner if the spinner doesn't have
|
||||
* focus.
|
||||
*/
|
||||
private void focusSpinnerIfNecessary() {
|
||||
final Component fo = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
if (!spinner.isRequestFocusEnabled() || (fo != null && (SwingUtilities.isDescendingFrom(fo, spinner)))) return;
|
||||
if (!spinner.isRequestFocusEnabled() || (fo != null && (SwingUtilities.isDescendingFrom(fo, spinner)))) {
|
||||
return;
|
||||
}
|
||||
Container root = spinner;
|
||||
|
||||
if (!root.isFocusCycleRoot()) {
|
||||
root = root.getFocusCycleRootAncestor();
|
||||
}
|
||||
|
||||
if (root == null) return;
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
final FocusTraversalPolicy ftp = root.getFocusTraversalPolicy();
|
||||
final Component child = ftp.getComponentAfter(root, spinner);
|
||||
|
||||
@ -491,6 +529,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class SpinPainter extends JComponent {
|
||||
|
||||
final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getSpinnerArrows());
|
||||
|
||||
ButtonModel fTopModel;
|
||||
@ -551,11 +590,12 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple layout manager for the editor and the next/previous buttons.
|
||||
* See the AquaSpinnerUI javadoc for more information about exactly
|
||||
* how the components are arranged.
|
||||
* A simple layout manager for the editor and the next/previous buttons. See
|
||||
* the AquaSpinnerUI javadoc for more information about exactly how the
|
||||
* components are arranged.
|
||||
*/
|
||||
static class SpinnerLayout implements LayoutManager {
|
||||
|
||||
private Component nextButton = null;
|
||||
private Component previousButton = null;
|
||||
private Component editor = null;
|
||||
@ -656,26 +696,38 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect JSpinner property changes we're interested in and delegate. Subclasses
|
||||
* shouldn't need to replace the default propertyChangeListener (although they
|
||||
* can by overriding createPropertyChangeListener) since all of the interesting
|
||||
* property changes are delegated to protected methods.
|
||||
* Detect JSpinner property changes we're interested in and delegate.
|
||||
* Subclasses shouldn't need to replace the default propertyChangeListener
|
||||
* (although they can by overriding createPropertyChangeListener) since all
|
||||
* of the interesting property changes are delegated to protected methods.
|
||||
*/
|
||||
static class PropertyChangeHandler implements PropertyChangeListener {
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String propertyName = e.getPropertyName();
|
||||
final JSpinner spinner = (JSpinner)(e.getSource());
|
||||
final JSpinner spinner = (JSpinner) (e.getSource());
|
||||
final SpinnerUI spinnerUI = spinner.getUI();
|
||||
|
||||
if (spinnerUI instanceof AquaSpinnerUI) {
|
||||
final AquaSpinnerUI ui = (AquaSpinnerUI)spinnerUI;
|
||||
final AquaSpinnerUI ui = (AquaSpinnerUI) spinnerUI;
|
||||
|
||||
if ("editor".equals(propertyName)) {
|
||||
final JComponent oldEditor = (JComponent)e.getOldValue();
|
||||
final JComponent newEditor = (JComponent)e.getNewValue();
|
||||
final JComponent oldEditor = (JComponent) e.getOldValue();
|
||||
final JComponent newEditor = (JComponent) e.getNewValue();
|
||||
ui.replaceEditor(oldEditor, newEditor);
|
||||
ui.updateEnabledState();
|
||||
} else if ("componentOrientation".equals(propertyName)) {
|
||||
ComponentOrientation o
|
||||
= (ComponentOrientation) e.getNewValue();
|
||||
if (o != e.getOldValue()) {
|
||||
JComponent editor = spinner.getEditor();
|
||||
if (editor != null) {
|
||||
editor.applyComponentOrientation(o);
|
||||
}
|
||||
spinner.revalidate();
|
||||
spinner.repaint();
|
||||
}
|
||||
} else if ("enabled".equals(propertyName)) {
|
||||
ui.updateEnabledState();
|
||||
} else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
|
||||
@ -683,8 +735,8 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
} else if ("font".equals(propertyName)) {
|
||||
JComponent editor = spinner.getEditor();
|
||||
if (editor instanceof JSpinner.DefaultEditor) {
|
||||
JTextField tf =
|
||||
((JSpinner.DefaultEditor) editor).getTextField();
|
||||
JTextField tf
|
||||
= ((JSpinner.DefaultEditor) editor).getTextField();
|
||||
if (tf != null) {
|
||||
if (tf.getFont() instanceof UIResource) {
|
||||
tf.setFont(new FontUIResource(spinner.getFont()));
|
||||
@ -703,12 +755,12 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
final Component[] children = spinnerComponent.getComponents();
|
||||
for (final Component element : children) {
|
||||
if (element instanceof JSpinner.DefaultEditor) {
|
||||
final JTextField tf = ((JSpinner.DefaultEditor)element).getTextField();
|
||||
final JTextField tf = ((JSpinner.DefaultEditor) element).getTextField();
|
||||
if (tf != null) {
|
||||
tf.setToolTipText(toolTipText);
|
||||
}
|
||||
} else if (element instanceof JComponent) {
|
||||
((JComponent)element).setToolTipText(toolTipText);
|
||||
((JComponent) element).setToolTipText(toolTipText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,9 +235,9 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked by <code>installUI</code> to create
|
||||
* Invoked by {@code installUI} to create
|
||||
* a layout manager object to manage
|
||||
* the <code>JTabbedPane</code>.
|
||||
* the {@code JTabbedPane}.
|
||||
*
|
||||
* @return a layout manager object
|
||||
*
|
||||
@ -536,7 +536,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* Sets the tab the mouse is over by location. This is a cover method
|
||||
* for <code>setRolloverTab(tabForCoordinate(x, y, false))</code>.
|
||||
* for {@code setRolloverTab(tabForCoordinate(x, y, false))}.
|
||||
*/
|
||||
private void setRolloverTab(final int x, final int y) {
|
||||
// NOTE:
|
||||
@ -547,8 +547,8 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tab the mouse is currently over to <code>index</code>.
|
||||
* <code>index</code> will be -1 if the mouse is no longer over any
|
||||
* Sets the tab the mouse is currently over to {@code index}.
|
||||
* {@code index} will be -1 if the mouse is no longer over any
|
||||
* tab. No checking is done to ensure the passed in index identifies a
|
||||
* valid tab.
|
||||
*
|
||||
@ -676,7 +676,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* Returns the amount the baseline is offset by. This is typically
|
||||
* the same as <code>getTabLabelShiftY</code>.
|
||||
* the same as {@code getTabLabelShiftY}.
|
||||
*
|
||||
* @return amount to offset the baseline by
|
||||
* @since 1.6
|
||||
@ -765,10 +765,10 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
/**
|
||||
* Paints the tabs in the tab area.
|
||||
* Invoked by paint().
|
||||
* The graphics parameter must be a valid <code>Graphics</code>
|
||||
* The graphics parameter must be a valid {@code Graphics}
|
||||
* object. Tab placement may be either:
|
||||
* <code>JTabbedPane.TOP</code>, <code>JTabbedPane.BOTTOM</code>,
|
||||
* <code>JTabbedPane.LEFT</code>, or <code>JTabbedPane.RIGHT</code>.
|
||||
* {@code JTabbedPane.TOP}, {@code JTabbedPane.BOTTOM},
|
||||
* {@code JTabbedPane.LEFT}, or {@code JTabbedPane.RIGHT}.
|
||||
* The selected index must be a valid tabbed pane tab index (0 to
|
||||
* tab count - 1, inclusive) or -1 if no tab is currently selected.
|
||||
* The handling of invalid parameters is unspecified.
|
||||
@ -1406,7 +1406,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* designated Rectangle object (rather than instantiating and returning
|
||||
* a new Rectangle each time). The tab index parameter must be a valid
|
||||
* tabbed pane tab index (0 to tab count - 1, inclusive). The destination
|
||||
* rectangle parameter must be a valid <code>Rectangle</code> instance.
|
||||
* rectangle parameter must be a valid {@code Rectangle} instance.
|
||||
* The handling of invalid parameters is unspecified.
|
||||
*
|
||||
* @param tabIndex the index of the tab
|
||||
@ -3717,7 +3717,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* An ActionMap that populates its contents as necessary. The
|
||||
* contents are populated by invoking the <code>loadActionMap</code>
|
||||
* contents are populated by invoking the {@code loadActionMap}
|
||||
* method on the passed in Object.
|
||||
*
|
||||
* @version 1.6, 11/17/05
|
||||
@ -3726,14 +3726,14 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class LazyActionMap extends ActionMapUIResource {
|
||||
/**
|
||||
* Object to invoke <code>loadActionMap</code> on. This may be
|
||||
* Object to invoke {@code loadActionMap} on. This may be
|
||||
* a Class object.
|
||||
*/
|
||||
private transient Object _loader;
|
||||
|
||||
/**
|
||||
* Installs an ActionMap that will be populated by invoking the
|
||||
* <code>loadActionMap</code> method on the specified Class
|
||||
* {@code loadActionMap} method on the specified Class
|
||||
* when necessary.
|
||||
* <p>
|
||||
* This should be used if the ActionMap can be shared.
|
||||
@ -3755,7 +3755,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
/**
|
||||
* Returns an ActionMap that will be populated by invoking the
|
||||
* <code>loadActionMap</code> method on the specified Class
|
||||
* {@code loadActionMap} method on the specified Class
|
||||
* when necessary.
|
||||
* <p>
|
||||
* This should be used if the ActionMap can be shared.
|
||||
|
||||
@ -179,8 +179,8 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the expand (toggle) part of a row. The receiver should NOT modify <code>clipBounds</code>, or
|
||||
* <code>insets</code>.
|
||||
* Paints the expand (toggle) part of a row. The receiver should NOT modify {@code clipBounds}, or
|
||||
* {@code insets}.
|
||||
*/
|
||||
protected void paintExpandControl(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) {
|
||||
final Object value = path.getLastPathComponent();
|
||||
|
||||
@ -41,7 +41,7 @@ public class NativeFont extends PhysicalFont {
|
||||
|
||||
/**
|
||||
* Verifies native font is accessible.
|
||||
* @throws FontFormatException - if the font can't be located.
|
||||
* @throws FontFormatException if the font can't be located.
|
||||
*/
|
||||
public NativeFont(String platName, boolean isBitmapDelegate)
|
||||
throws FontFormatException {
|
||||
|
||||
@ -37,10 +37,10 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
IntBuffer bankdata[];
|
||||
|
||||
/**
|
||||
* Constructs an integer-based <CODE>DataBuffer</CODE> with a single bank
|
||||
* Constructs an integer-based {@code DataBuffer} with a single bank
|
||||
* and the specified size.
|
||||
*
|
||||
* @param size The size of the <CODE>DataBuffer</CODE>.
|
||||
* @param size The size of the {@code DataBuffer}.
|
||||
*/
|
||||
public DataBufferNIOInt(int size) {
|
||||
super(TYPE_INT,size);
|
||||
@ -51,7 +51,7 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default (first) IntBuffer in <CODE>DataBuffer</CODE>.
|
||||
* Returns the default (first) IntBuffer in {@code DataBuffer}.
|
||||
*
|
||||
* @return The first IntBuffer.
|
||||
*/
|
||||
@ -70,7 +70,7 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default (first) int data array in <CODE>DataBuffer</CODE>.
|
||||
* Returns the default (first) int data array in {@code DataBuffer}.
|
||||
*
|
||||
* @return The first integer data array.
|
||||
*/
|
||||
@ -137,7 +137,7 @@ public final class DataBufferNIOInt extends DataBuffer {
|
||||
|
||||
/**
|
||||
* Sets the requested data array element in the specified bank
|
||||
* to the integer value <CODE>i</CODE>.
|
||||
* to the integer value {@code i}.
|
||||
* @param bank The bank in which you want to set the data array element.
|
||||
* @param i The data array element you want to set.
|
||||
* @param val The integer value to which you want to set the specified data array element.
|
||||
|
||||
@ -33,7 +33,7 @@ import java.net.URI;
|
||||
|
||||
|
||||
/**
|
||||
* Concrete implementation of the interface <code>DesktopPeer</code> for MacOS X
|
||||
* Concrete implementation of the interface {@code DesktopPeer} for MacOS X
|
||||
*
|
||||
* @see DesktopPeer
|
||||
*/
|
||||
|
||||
@ -101,7 +101,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* method.
|
||||
*
|
||||
* @param context the input method context for this input method
|
||||
* @exception NullPointerException if <code>context</code> is null
|
||||
* @exception NullPointerException if {@code context} is null
|
||||
*/
|
||||
public void setInputMethodContext(InputMethodContext context) {
|
||||
fIMContext = context;
|
||||
@ -124,7 +124,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
*
|
||||
* @param lang locale to input
|
||||
* @return whether the specified locale is supported
|
||||
* @exception NullPointerException if <code>locale</code> is null
|
||||
* @exception NullPointerException if {@code locale} is null
|
||||
*/
|
||||
public boolean setLocale(Locale lang) {
|
||||
return setLocale(lang, false);
|
||||
@ -205,7 +205,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* are dispatched to the current input method for this component before
|
||||
* they are dispatched to the component's methods or event listeners.
|
||||
* The input method decides whether it needs to handle the event. If it
|
||||
* does, it also calls the event's <code>consume</code> method; this
|
||||
* does, it also calls the event's {@code consume} method; this
|
||||
* causes the event to not get dispatched to the component's event
|
||||
* processing methods or event listeners.
|
||||
* <p>
|
||||
@ -216,7 +216,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* This method is called by {@link java.awt.im.InputContext#dispatchEvent InputContext.dispatchEvent}.
|
||||
*
|
||||
* @param event the event being dispatched to the input method
|
||||
* @exception NullPointerException if <code>event</code> is null
|
||||
* @exception NullPointerException if {@code event} is null
|
||||
*/
|
||||
public void dispatchEvent(final AWTEvent event) {
|
||||
// No-op for Mac OS X.
|
||||
|
||||
@ -75,8 +75,7 @@ final class CPlatformResponder {
|
||||
jclickCount = clickCount;
|
||||
}
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
|
||||
modifierFlags);
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
||||
|
||||
eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
|
||||
@ -90,9 +89,7 @@ final class CPlatformResponder {
|
||||
void handleScrollEvent(final int x, final int y, final int absX,
|
||||
final int absY, final int modifierFlags,
|
||||
final double deltaX, final double deltaY) {
|
||||
final int buttonNumber = CocoaConstants.kCGMouseButtonCenter;
|
||||
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
|
||||
modifierFlags);
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
final boolean isShift = (jmodifiers & InputEvent.SHIFT_DOWN_MASK) != 0;
|
||||
|
||||
// Vertical scroll.
|
||||
@ -187,8 +184,7 @@ final class CPlatformResponder {
|
||||
postsTyped = false;
|
||||
}
|
||||
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaKeyModifiers(modifierFlags);
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
long when = System.currentTimeMillis();
|
||||
|
||||
if (jeventType == KeyEvent.KEY_PRESSED) {
|
||||
|
||||
@ -35,8 +35,8 @@ public class CPrinterDevice extends GraphicsDevice {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this <code>GraphicsDevice</code>.
|
||||
* @return the type of this <code>GraphicsDevice</code>, which can
|
||||
* Returns the type of this {@code GraphicsDevice}.
|
||||
* @return the type of this {@code GraphicsDevice}, which can
|
||||
* either be TYPE_RASTER_SCREEN, TYPE_PRINTER or TYPE_IMAGE_BUFFER.
|
||||
* @see #TYPE_RASTER_SCREEN
|
||||
* @see #TYPE_PRINTER
|
||||
@ -48,30 +48,30 @@ public class CPrinterDevice extends GraphicsDevice {
|
||||
|
||||
/**
|
||||
* Returns the identification string associated with this
|
||||
* <code>GraphicsDevice</code>.
|
||||
* @return a <code>String</code> that is the identification
|
||||
* of this <code>GraphicsDevice</code>.
|
||||
* {@code GraphicsDevice}.
|
||||
* @return a {@code String} that is the identification
|
||||
* of this {@code GraphicsDevice}.
|
||||
*/
|
||||
public String getIDstring() {
|
||||
return ("Printer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of the <code>GraphicsConfiguration</code>
|
||||
* objects associated with this <code>GraphicsDevice</code>.
|
||||
* @return an array of <code>GraphicsConfiguration</code>
|
||||
* Returns all of the {@code GraphicsConfiguration}
|
||||
* objects associated with this {@code GraphicsDevice}.
|
||||
* @return an array of {@code GraphicsConfiguration}
|
||||
* objects that are associated with this
|
||||
* <code>GraphicsDevice</code>.
|
||||
* {@code GraphicsDevice}.
|
||||
*/
|
||||
public GraphicsConfiguration[] getConfigurations() {
|
||||
return new GraphicsConfiguration[] { gc };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default <code>GraphicsConfiguration</code>
|
||||
* associated with this <code>GraphicsDevice</code>.
|
||||
* @return the default <code>GraphicsConfiguration</code>
|
||||
* of this <code>GraphicsDevice</code>.
|
||||
* Returns the default {@code GraphicsConfiguration}
|
||||
* associated with this {@code GraphicsDevice}.
|
||||
* @return the default {@code GraphicsConfiguration}
|
||||
* of this {@code GraphicsDevice}.
|
||||
*/
|
||||
public GraphicsConfiguration getDefaultConfiguration() {
|
||||
return gc;
|
||||
|
||||
@ -49,9 +49,9 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the {@link GraphicsDevice} associated with this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* @return a <code>GraphicsDevice</code> object that is
|
||||
* associated with this <code>GraphicsConfiguration</code>.
|
||||
* {@code GraphicsConfiguration}.
|
||||
* @return a {@code GraphicsDevice} object that is
|
||||
* associated with this {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public GraphicsDevice getDevice() {
|
||||
return gd;
|
||||
@ -59,16 +59,16 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns a {@link BufferedImage} with a data layout and color model
|
||||
* compatible with this <code>GraphicsConfiguration</code>. This
|
||||
* compatible with this {@code GraphicsConfiguration}. This
|
||||
* method has nothing to do with memory-mapping
|
||||
* a device. The returned <code>BufferedImage</code> has
|
||||
* a device. The returned {@code BufferedImage} has
|
||||
* a layout and color model that is closest to this native device
|
||||
* configuration and can therefore be optimally blitted to this
|
||||
* device.
|
||||
* @param width the width of the returned <code>BufferedImage</code>
|
||||
* @param height the height of the returned <code>BufferedImage</code>
|
||||
* @return a <code>BufferedImage</code> whose data layout and color
|
||||
* model is compatible with this <code>GraphicsConfiguration</code>.
|
||||
* @param width the width of the returned {@code BufferedImage}
|
||||
* @param height the height of the returned {@code BufferedImage}
|
||||
* @return a {@code BufferedImage} whose data layout and color
|
||||
* model is compatible with this {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public BufferedImage createCompatibleImage(int width, int height) {
|
||||
return createCompatibleImage(width, height, Transparency.OPAQUE);
|
||||
@ -76,15 +76,15 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns a {@link VolatileImage} with a data layout and color model
|
||||
* compatible with this <code>GraphicsConfiguration</code>.
|
||||
* The returned <code>VolatileImage</code>
|
||||
* compatible with this {@code GraphicsConfiguration}.
|
||||
* The returned {@code VolatileImage}
|
||||
* may have data that is stored optimally for the underlying graphics
|
||||
* device and may therefore benefit from platform-specific rendering
|
||||
* acceleration.
|
||||
* @param width the width of the returned <code>VolatileImage</code>
|
||||
* @param height the height of the returned <code>VolatileImage</code>
|
||||
* @return a <code>VolatileImage</code> whose data layout and color
|
||||
* model is compatible with this <code>GraphicsConfiguration</code>.
|
||||
* @param width the width of the returned {@code VolatileImage}
|
||||
* @param height the height of the returned {@code VolatileImage}
|
||||
* @return a {@code VolatileImage} whose data layout and color
|
||||
* model is compatible with this {@code GraphicsConfiguration}.
|
||||
* @see Component#createVolatileImage(int, int)
|
||||
*/
|
||||
public VolatileImage createCompatibleVolatileImage(int width, int height) {
|
||||
@ -97,18 +97,18 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>BufferedImage</code> that supports the specified
|
||||
* Returns a {@code BufferedImage} that supports the specified
|
||||
* transparency and has a data layout and color model
|
||||
* compatible with this <code>GraphicsConfiguration</code>. This
|
||||
* compatible with this {@code GraphicsConfiguration}. This
|
||||
* method has nothing to do with memory-mapping
|
||||
* a device. The returned <code>BufferedImage</code> has a layout and
|
||||
* a device. The returned {@code BufferedImage} has a layout and
|
||||
* color model that can be optimally blitted to a device
|
||||
* with this <code>GraphicsConfiguration</code>.
|
||||
* @param width the width of the returned <code>BufferedImage</code>
|
||||
* @param height the height of the returned <code>BufferedImage</code>
|
||||
* with this {@code GraphicsConfiguration}.
|
||||
* @param width the width of the returned {@code BufferedImage}
|
||||
* @param height the height of the returned {@code BufferedImage}
|
||||
* @param transparency the specified transparency mode
|
||||
* @return a <code>BufferedImage</code> whose data layout and color
|
||||
* model is compatible with this <code>GraphicsConfiguration</code>
|
||||
* @return a {@code BufferedImage} whose data layout and color
|
||||
* model is compatible with this {@code GraphicsConfiguration}
|
||||
* and also supports the specified transparency.
|
||||
* @see Transparency#OPAQUE
|
||||
* @see Transparency#BITMASK
|
||||
@ -121,21 +121,21 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the {@link ColorModel} associated with this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* @return a <code>ColorModel</code> object that is associated with
|
||||
* this <code>GraphicsConfiguration</code>.
|
||||
* {@code GraphicsConfiguration}.
|
||||
* @return a {@code ColorModel} object that is associated with
|
||||
* this {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public ColorModel getColorModel() {
|
||||
return getColorModel(Transparency.OPAQUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>ColorModel</code> associated with this
|
||||
* <code>GraphicsConfiguration</code> that supports the specified
|
||||
* Returns the {@code ColorModel} associated with this
|
||||
* {@code GraphicsConfiguration} that supports the specified
|
||||
* transparency.
|
||||
* @param transparency the specified transparency mode
|
||||
* @return a <code>ColorModel</code> object that is associated with
|
||||
* this <code>GraphicsConfiguration</code> and supports the
|
||||
* @return a {@code ColorModel} object that is associated with
|
||||
* this {@code GraphicsConfiguration} and supports the
|
||||
* specified transparency.
|
||||
*/
|
||||
public ColorModel getColorModel(int transparency) {
|
||||
@ -144,22 +144,22 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the default {@link AffineTransform} for this
|
||||
* <code>GraphicsConfiguration</code>. This
|
||||
* <code>AffineTransform</code> is typically the Identity transform
|
||||
* for most normal screens. The default <code>AffineTransform</code>
|
||||
* {@code GraphicsConfiguration}. This
|
||||
* {@code AffineTransform} is typically the Identity transform
|
||||
* for most normal screens. The default {@code AffineTransform}
|
||||
* maps coordinates onto the device such that 72 user space
|
||||
* coordinate units measure approximately 1 inch in device
|
||||
* space. The normalizing transform can be used to make
|
||||
* this mapping more exact. Coordinates in the coordinate space
|
||||
* defined by the default <code>AffineTransform</code> for screen and
|
||||
* defined by the default {@code AffineTransform} for screen and
|
||||
* printer devices have the origin in the upper left-hand corner of
|
||||
* the target region of the device, with X coordinates
|
||||
* increasing to the right and Y coordinates increasing downwards.
|
||||
* For image buffers not associated with a device, such as those not
|
||||
* created by <code>createCompatibleImage</code>,
|
||||
* this <code>AffineTransform</code> is the Identity transform.
|
||||
* @return the default <code>AffineTransform</code> for this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* created by {@code createCompatibleImage},
|
||||
* this {@code AffineTransform} is the Identity transform.
|
||||
* @return the default {@code AffineTransform} for this
|
||||
* {@code GraphicsConfiguration}.
|
||||
*/
|
||||
public AffineTransform getDefaultTransform() {
|
||||
return new AffineTransform();
|
||||
@ -167,9 +167,9 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a <code>AffineTransform</code> that can be concatenated
|
||||
* with the default <code>AffineTransform</code>
|
||||
* of a <code>GraphicsConfiguration</code> so that 72 units in user
|
||||
* Returns a {@code AffineTransform} that can be concatenated
|
||||
* with the default {@code AffineTransform}
|
||||
* of a {@code GraphicsConfiguration} so that 72 units in user
|
||||
* space equals 1 inch in device space.
|
||||
* <p>
|
||||
* For a particular {@link Graphics2D}, g, one
|
||||
@ -181,16 +181,16 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
* g.setTransform(gc.getDefaultTransform());
|
||||
* g.transform(gc.getNormalizingTransform());
|
||||
* </pre>
|
||||
* Note that sometimes this <code>AffineTransform</code> is identity,
|
||||
* Note that sometimes this {@code AffineTransform} is identity,
|
||||
* such as for printers or metafile output, and that this
|
||||
* <code>AffineTransform</code> is only as accurate as the information
|
||||
* {@code AffineTransform} is only as accurate as the information
|
||||
* supplied by the underlying system. For image buffers not
|
||||
* associated with a device, such as those not created by
|
||||
* <code>createCompatibleImage</code>, this
|
||||
* <code>AffineTransform</code> is the Identity transform
|
||||
* {@code createCompatibleImage}, this
|
||||
* {@code AffineTransform} is the Identity transform
|
||||
* since there is no valid distance measurement.
|
||||
* @return an <code>AffineTransform</code> to concatenate to the
|
||||
* default <code>AffineTransform</code> so that 72 units in user
|
||||
* @return an {@code AffineTransform} to concatenate to the
|
||||
* default {@code AffineTransform} so that 72 units in user
|
||||
* space is mapped to 1 inch in device space.
|
||||
*/
|
||||
public AffineTransform getNormalizingTransform() {
|
||||
@ -198,12 +198,12 @@ public class CPrinterGraphicsConfig extends GraphicsConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of the <code>GraphicsConfiguration</code>
|
||||
* Returns the bounds of the {@code GraphicsConfiguration}
|
||||
* in the device coordinates. In a multi-screen environment
|
||||
* with a virtual device, the bounds can have negative X
|
||||
* or Y origins.
|
||||
* @return the bounds of the area covered by this
|
||||
* <code>GraphicsConfiguration</code>.
|
||||
* {@code GraphicsConfiguration}.
|
||||
* @since 1.3
|
||||
*/
|
||||
public Rectangle getBounds() {
|
||||
|
||||
@ -83,13 +83,13 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
* to these native print services.
|
||||
* To present the cross platform print dialog for all services,
|
||||
* including native ones instead use
|
||||
* <code>printDialog(PrintRequestAttributeSet)</code>.
|
||||
* {@code printDialog(PrintRequestAttributeSet)}.
|
||||
* <p>
|
||||
* PrinterJob implementations which can use PrintService's will update
|
||||
* the PrintService for this PrinterJob to reflect the new service
|
||||
* selected by the user.
|
||||
* @return <code>true</code> if the user does not cancel the dialog;
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if the user does not cancel the dialog;
|
||||
* {@code false} otherwise.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
@ -117,19 +117,19 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
|
||||
/**
|
||||
* Displays a dialog that allows modification of a
|
||||
* <code>PageFormat</code> instance.
|
||||
* The <code>page</code> argument is used to initialize controls
|
||||
* {@code PageFormat} instance.
|
||||
* The {@code page} argument is used to initialize controls
|
||||
* in the page setup dialog.
|
||||
* If the user cancels the dialog then this method returns the
|
||||
* original <code>page</code> object unmodified.
|
||||
* original {@code page} object unmodified.
|
||||
* If the user okays the dialog then this method returns a new
|
||||
* <code>PageFormat</code> object with the indicated changes.
|
||||
* In either case, the original <code>page</code> object is
|
||||
* {@code PageFormat} object with the indicated changes.
|
||||
* In either case, the original {@code page} object is
|
||||
* not modified.
|
||||
* @param page the default <code>PageFormat</code> presented to the
|
||||
* @param page the default {@code PageFormat} presented to the
|
||||
* user for modification
|
||||
* @return the original <code>page</code> object if the dialog
|
||||
* is cancelled; a new <code>PageFormat</code> object
|
||||
* @return the original {@code page} object if the dialog
|
||||
* is cancelled; a new {@code PageFormat} object
|
||||
* containing the format indicated by the user if the
|
||||
* dialog is acknowledged.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
@ -157,11 +157,11 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones the <code>PageFormat</code> argument and alters the
|
||||
* Clones the {@code PageFormat} argument and alters the
|
||||
* clone to describe a default page size and orientation.
|
||||
* @param page the <code>PageFormat</code> to be cloned and altered
|
||||
* @return clone of <code>page</code>, altered to describe a default
|
||||
* <code>PageFormat</code>.
|
||||
* @param page the {@code PageFormat} to be cloned and altered
|
||||
* @return clone of {@code page}, altered to describe a default
|
||||
* {@code PageFormat}.
|
||||
*/
|
||||
@Override
|
||||
public PageFormat defaultPage(PageFormat page) {
|
||||
|
||||
@ -73,7 +73,7 @@ class CRobot implements RobotPeer {
|
||||
* Presses one or more mouse buttons.
|
||||
*
|
||||
* @param buttons the button mask (combination of
|
||||
* <code>InputEvent.BUTTON1/2/3_MASK</code>)
|
||||
* {@code InputEvent.BUTTON1/2/3_MASK})
|
||||
*/
|
||||
@Override
|
||||
public void mousePress(int buttons) {
|
||||
@ -87,7 +87,7 @@ class CRobot implements RobotPeer {
|
||||
* Releases one or more mouse buttons.
|
||||
*
|
||||
* @param buttons the button mask (combination of
|
||||
* <code>InputEvent.BUTTON1/2/3_MASK</code>)
|
||||
* {@code InputEvent.BUTTON1/2/3_MASK})
|
||||
*/
|
||||
@Override
|
||||
public void mouseRelease(int buttons) {
|
||||
@ -133,14 +133,14 @@ class CRobot implements RobotPeer {
|
||||
* Presses a given key.
|
||||
* <p>
|
||||
* Key codes that have more than one physical key associated with them
|
||||
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
|
||||
* (e.g. {@code KeyEvent.VK_SHIFT} could mean either the
|
||||
* left or right shift key) will map to the left key.
|
||||
* <p>
|
||||
* Assumes that the
|
||||
* peer implementations will throw an exception for other bogus
|
||||
* values e.g. -1, 999999
|
||||
*
|
||||
* @param keycode the key to press (e.g. <code>KeyEvent.VK_A</code>)
|
||||
* @param keycode the key to press (e.g. {@code KeyEvent.VK_A})
|
||||
*/
|
||||
@Override
|
||||
public void keyPress(final int keycode) {
|
||||
@ -151,14 +151,14 @@ class CRobot implements RobotPeer {
|
||||
* Releases a given key.
|
||||
* <p>
|
||||
* Key codes that have more than one physical key associated with them
|
||||
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
|
||||
* (e.g. {@code KeyEvent.VK_SHIFT} could mean either the
|
||||
* left or right shift key) will map to the left key.
|
||||
* <p>
|
||||
* Assumes that the
|
||||
* peer implementations will throw an exception for other bogus
|
||||
* values e.g. -1, 999999
|
||||
*
|
||||
* @param keycode the key to release (e.g. <code>KeyEvent.VK_A</code>)
|
||||
* @param keycode the key to release (e.g. {@code KeyEvent.VK_A})
|
||||
*/
|
||||
@Override
|
||||
public void keyRelease(final int keycode) {
|
||||
|
||||
@ -214,7 +214,7 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
|
||||
jclickCount = nsEvent.getClickCount();
|
||||
}
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(
|
||||
nsEvent.getModifierFlags());
|
||||
boolean isPopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
||||
|
||||
|
||||
@ -515,13 +515,13 @@ public final class LWCToolkit extends LWToolkit {
|
||||
* key for menu shortcuts.
|
||||
* <p>
|
||||
* Menu shortcuts, which are embodied in the
|
||||
* <code>MenuShortcut</code> class, are handled by the
|
||||
* <code>MenuBar</code> class.
|
||||
* {@code MenuShortcut} class, are handled by the
|
||||
* {@code MenuBar} class.
|
||||
* <p>
|
||||
* By default, this method returns <code>Event.CTRL_MASK</code>.
|
||||
* By default, this method returns {@code Event.CTRL_MASK}.
|
||||
* Toolkit implementations should override this method if the
|
||||
* <b>Control</b> key isn't the correct key for accelerators.
|
||||
* @return the modifier mask on the <code>Event</code> class
|
||||
* @return the modifier mask on the {@code Event} class
|
||||
* that is used for menu shortcuts on this toolkit.
|
||||
* @see java.awt.MenuBar
|
||||
* @see java.awt.MenuShortcut
|
||||
|
||||
@ -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
|
||||
@ -231,16 +231,14 @@ final class NSEvent {
|
||||
return jeventType;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts NSEvent mouse modifiers to AWT mouse modifiers.
|
||||
/**
|
||||
* Converts NSEvent key modifiers to AWT key modifiers. Note that this
|
||||
* method adds the current mouse state as a mouse modifiers.
|
||||
*
|
||||
* @param modifierFlags the NSEvent key modifiers
|
||||
* @return the java key and mouse modifiers
|
||||
*/
|
||||
static native int nsToJavaMouseModifiers(int buttonNumber,
|
||||
int modifierFlags);
|
||||
|
||||
/*
|
||||
* Converts NSEvent key modifiers to AWT key modifiers.
|
||||
*/
|
||||
static native int nsToJavaKeyModifiers(int modifierFlags);
|
||||
static native int nsToJavaModifiers(int modifierFlags);
|
||||
|
||||
/*
|
||||
* Converts NSEvent key info to AWT key info.
|
||||
|
||||
@ -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
|
||||
@ -579,7 +579,7 @@ NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods)
|
||||
}
|
||||
|
||||
|
||||
jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags)
|
||||
jint GetJavaMouseModifiers(NSUInteger modifierFlags)
|
||||
{
|
||||
// Mousing needs the key modifiers
|
||||
jint modifiers = NsKeyModifiersToJavaModifiers(modifierFlags, YES);
|
||||
@ -632,38 +632,18 @@ Java_java_awt_AWTEvent_nativeSetSource
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_NSEvent
|
||||
* Method: nsToJavaMouseModifiers
|
||||
* Method: nsToJavaModifiers
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_lwawt_macosx_NSEvent_nsToJavaMouseModifiers
|
||||
(JNIEnv *env, jclass cls, jint buttonNumber, jint modifierFlags)
|
||||
{
|
||||
jint jmodifiers = 0;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
jmodifiers = GetJavaMouseModifiers(buttonNumber, modifierFlags);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
return jmodifiers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_NSEvent
|
||||
* Method: nsToJavaKeyModifiers
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyModifiers
|
||||
Java_sun_lwawt_macosx_NSEvent_nsToJavaModifiers
|
||||
(JNIEnv *env, jclass cls, jint modifierFlags)
|
||||
{
|
||||
jint jmodifiers = 0;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags, YES);
|
||||
jmodifiers = GetJavaMouseModifiers(modifierFlags);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
|
||||
@ -562,6 +562,17 @@ CGGI_CreateImageForGlyph
|
||||
(CGGI_GlyphCanvas *canvas, const CGGlyph glyph,
|
||||
GlyphInfo *info, const CGGI_RenderingMode *mode)
|
||||
{
|
||||
if (isnan(info->topLeftX) || isnan(info->topLeftY)) {
|
||||
// Explicitly set glyphInfo width/height to be 0 to ensure
|
||||
// zero length glyph image is copied into GlyphInfo from canvas
|
||||
info->width = 0;
|
||||
info->height = 0;
|
||||
|
||||
// copy the "empty" glyph from the canvas into the info
|
||||
(*mode->glyphDescriptor->copyFxnPtr)(canvas, info);
|
||||
return;
|
||||
}
|
||||
|
||||
// clean the canvas
|
||||
CGGI_ClearCanvas(canvas, info);
|
||||
|
||||
@ -570,7 +581,6 @@ CGGI_CreateImageForGlyph
|
||||
-info->topLeftX,
|
||||
canvas->image->height + info->topLeftY,
|
||||
&glyph, 1);
|
||||
|
||||
// copy the glyph from the canvas into the info
|
||||
(*mode->glyphDescriptor->copyFxnPtr)(canvas, info);
|
||||
}
|
||||
|
||||
@ -259,6 +259,10 @@ AWTGetGlyphOutline(CGGlyph *glyphs, NSFont *font,
|
||||
|
||||
OSStatus status = noErr;
|
||||
|
||||
if ( isnan(tx->a) || isnan(tx->b) || isnan(tx->c) ||
|
||||
isnan(tx->d) || isnan(tx->tx) || isnan(tx->ty)) {
|
||||
return status;
|
||||
}
|
||||
glyphs = glyphs + inStartIndex;
|
||||
// advanceArray = advanceArray + inStartIndex; // TODO(cpc): use advance
|
||||
|
||||
|
||||
@ -3,4 +3,5 @@ com.sun.media.sound.AuFileReader
|
||||
com.sun.media.sound.AiffFileReader
|
||||
com.sun.media.sound.WaveFileReader
|
||||
com.sun.media.sound.WaveFloatFileReader
|
||||
com.sun.media.sound.WaveExtensibleFileReader
|
||||
com.sun.media.sound.SoftMidiAudioFileReader
|
||||
|
||||
@ -2,3 +2,4 @@
|
||||
com.sun.media.sound.AuFileWriter
|
||||
com.sun.media.sound.AiffFileWriter
|
||||
com.sun.media.sound.WaveFileWriter
|
||||
com.sun.media.sound.WaveFloatFileWriter
|
||||
|
||||
@ -74,7 +74,7 @@ import com.sun.imageio.plugins.common.I18N;
|
||||
/** This class is the Java Image IO plugin reader for BMP images.
|
||||
* It may subsample the image, clip the image, select sub-bands,
|
||||
* and shift the decoded image origin if the proper decoding parameter
|
||||
* are set in the provided <code>ImageReadParam</code>.
|
||||
* are set in the provided {@code ImageReadParam}.
|
||||
*
|
||||
* This class supports Microsoft Windows Bitmap Version 3-5,
|
||||
* as well as OS/2 Bitmap Version 2.x (for single-image BMP file).
|
||||
@ -159,8 +159,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
||||
/** source and destination bands. */
|
||||
private int[] sourceBands, destBands;
|
||||
|
||||
/** Constructs <code>BMPImageReader</code> from the provided
|
||||
* <code>ImageReaderSpi</code>.
|
||||
/** Constructs {@code BMPImageReader} from the provided
|
||||
* {@code ImageReaderSpi}.
|
||||
*/
|
||||
public BMPImageReader(ImageReaderSpi originator) {
|
||||
super(originator);
|
||||
@ -1681,8 +1681,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
||||
/** Decodes the jpeg/png image embedded in the bitmap using any jpeg
|
||||
* ImageIO-style plugin.
|
||||
*
|
||||
* @param bi The destination <code>BufferedImage</code>.
|
||||
* @param bmpParam The <code>ImageReadParam</code> for decoding this
|
||||
* @param bi The destination {@code BufferedImage}.
|
||||
* @param bmpParam The {@code ImageReadParam} for decoding this
|
||||
* BMP image. The parameters for subregion, band selection and
|
||||
* subsampling are used in decoding the jpeg image.
|
||||
*/
|
||||
|
||||
@ -69,7 +69,7 @@ import com.sun.imageio.plugins.common.I18N;
|
||||
* a BMP format.
|
||||
*
|
||||
* The encoding process may clip, subsample using the parameters
|
||||
* specified in the <code>ImageWriteParam</code>.
|
||||
* specified in the {@code ImageWriteParam}.
|
||||
*
|
||||
* @see javax.imageio.plugins.bmp.BMPImageWriteParam
|
||||
*/
|
||||
@ -88,8 +88,8 @@ public class BMPImageWriter extends ImageWriter implements BMPConstants {
|
||||
private short[] spixels;
|
||||
private int[] ipixels;
|
||||
|
||||
/** Constructs <code>BMPImageWriter</code> based on the provided
|
||||
* <code>ImageWriterSpi</code>.
|
||||
/** Constructs {@code BMPImageWriter} based on the provided
|
||||
* {@code ImageWriterSpi}.
|
||||
*/
|
||||
public BMPImageWriter(ImageWriterSpi originator) {
|
||||
super(originator);
|
||||
|
||||
@ -28,7 +28,7 @@ package com.sun.imageio.plugins.common;
|
||||
import java.awt.color.ColorSpace;
|
||||
|
||||
/**
|
||||
* A dummy <code>ColorSpace</code> to enable <code>ColorModel</code>
|
||||
* A dummy {@code ColorSpace} to enable {@code ColorModel}
|
||||
* for image data which do not have an innate color representation.
|
||||
*/
|
||||
@SuppressWarnings("serial") // JDK-implementation class
|
||||
@ -37,8 +37,8 @@ public class BogusColorSpace extends ColorSpace {
|
||||
* Return the type given the number of components.
|
||||
*
|
||||
* @param numComponents The number of components in the
|
||||
* <code>ColorSpace</code>.
|
||||
* @exception IllegalArgumentException if <code>numComponents</code>
|
||||
* {@code ColorSpace}.
|
||||
* @exception IllegalArgumentException if {@code numComponents}
|
||||
* is less than 1.
|
||||
*/
|
||||
private static int getType(int numComponents) {
|
||||
@ -62,11 +62,11 @@ public class BogusColorSpace extends ColorSpace {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a bogus <code>ColorSpace</code>.
|
||||
* Constructs a bogus {@code ColorSpace}.
|
||||
*
|
||||
* @param numComponents The number of components in the
|
||||
* <code>ColorSpace</code>.
|
||||
* @exception IllegalArgumentException if <code>numComponents</code>
|
||||
* {@code ColorSpace}.
|
||||
* @exception IllegalArgumentException if {@code numComponents}
|
||||
* is less than 1.
|
||||
*/
|
||||
public BogusColorSpace(int numComponents) {
|
||||
|
||||
@ -37,9 +37,9 @@ import java.net.URL;
|
||||
* the file from the jar as the package name is included automatically.
|
||||
*
|
||||
* <p>Extenders need only provide a static method
|
||||
* <code>getString(String)</code> which calls the static method in this
|
||||
* {@code getString(String)} which calls the static method in this
|
||||
* class with the name of the invoking class and returns a
|
||||
* <code>String</code>.
|
||||
* {@code String}.
|
||||
*/
|
||||
public class I18NImpl {
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user