This commit is contained in:
J. Duke 2017-07-05 22:30:12 +02:00
commit bb3b1983d8
271 changed files with 8615 additions and 5267 deletions

View File

@ -388,3 +388,4 @@ f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141
1fc62b1c629fb80fdaa639d3b59452a184f0d705 jdk-9+143
8d337fd6333e28c48aa87880144b840aad82baaf jdk-9+144
ff98aa9ec9fae991e426ce5926fc9036d25f5562 jdk-9+145
a22e2671d88f6b22a4aa82e3966986542ed2a381 jdk-9+146

View File

@ -1048,7 +1048,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
# These tools might not be installed by default,
# need hint on how to install them.
BASIC_REQUIRE_PROGS(UNZIP, unzip)
BASIC_REQUIRE_PROGS(ZIP, zip)
# Since zip uses "ZIP" as a environment variable for passing options, we need
# to name our variable differently, hence ZIPEXE.
BASIC_REQUIRE_PROGS(ZIPEXE, zip)
# Non-required basic tools

View File

@ -311,7 +311,11 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
PICFLAG="-KPIC"
if test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
PICFLAG="-xcode=pic32"
else
PICFLAG="-KPIC"
fi
C_FLAG_REORDER='-xF'
CXX_FLAG_REORDER='-xF'
SHARED_LIBRARY_FLAGS="-G"
@ -838,7 +842,6 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
fastdebug | slowdebug )
$2CFLAGS_JDK="[$]$2CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
$2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
JAVAC_FLAGS="$JAVAC_FLAGS -g"
;;
release )
;;
@ -894,12 +897,12 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
# Set some additional per-OS defines.
if test "x$OPENJDK_$1_OS" = xlinux; then
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DLINUX"
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -pipe -fPIC -fno-rtti -fno-exceptions \
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -pipe $PICFLAG -fno-rtti -fno-exceptions \
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
elif test "x$OPENJDK_$1_OS" = xsolaris; then
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
-D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
elif test "x$OPENJDK_$1_OS" = xmacosx; then
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
@ -1310,7 +1313,7 @@ BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
supports=no
if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
AC_MSG_RESULT([$supports])
if test "x$supports" = "xyes" ; then
:

View File

@ -945,7 +945,7 @@ HG
READELF
OTOOL
LDD
ZIP
ZIPEXE
UNZIP
TAR_SUPPORTS_TRANSFORM
TAR_INCLUDE_PARAM
@ -1292,7 +1292,7 @@ CPIO
NICE
MAKE
UNZIP
ZIP
ZIPEXE
LDD
OTOOL
READELF
@ -2236,7 +2236,7 @@ Some influential environment variables:
NICE Override default value for NICE
MAKE Override default value for MAKE
UNZIP Override default value for UNZIP
ZIP Override default value for ZIP
ZIPEXE Override default value for ZIPEXE
LDD Override default value for LDD
OTOOL Override default value for OTOOL
READELF Override default value for READELF
@ -5093,7 +5093,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=1479120453
DATE_WHEN_GENERATED=1479997904
###############################################################################
#
@ -21373,13 +21373,15 @@ $as_echo "$tool_specified" >&6; }
fi
# Since zip uses "ZIP" as a environment variable for passing options, we need
# to name our variable differently, hence ZIPEXE.
# Publish this variable in the help.
if [ -z "${ZIP+x}" ]; then
if [ -z "${ZIPEXE+x}" ]; then
# The variable is not set by user, try to locate tool using the code snippet
for ac_prog in zip
do
@ -21387,12 +21389,12 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ZIP+:} false; then :
if ${ac_cv_path_ZIPEXE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ZIP in
case $ZIPEXE in
[\\/]* | ?:[\\/]*)
ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path.
ac_cv_path_ZIPEXE="$ZIPEXE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@ -21402,7 +21404,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
ac_cv_path_ZIPEXE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -21413,30 +21415,30 @@ IFS=$as_save_IFS
;;
esac
fi
ZIP=$ac_cv_path_ZIP
if test -n "$ZIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
$as_echo "$ZIP" >&6; }
ZIPEXE=$ac_cv_path_ZIPEXE
if test -n "$ZIPEXE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIPEXE" >&5
$as_echo "$ZIPEXE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ZIP" && break
test -n "$ZIPEXE" && break
done
else
# The variable is set, but is it from the command line or the environment?
# Try to remove the string !ZIP! from our list.
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!ZIP!/}
# Try to remove the string !ZIPEXE! from our list.
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!ZIPEXE!/}
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
# If it failed, the variable was not from the command line. Ignore it,
# but warn the user (except for BASH, which is always set by the calling BASH).
if test "xZIP" != xBASH; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of ZIP from the environment. Use command line variables instead." >&5
$as_echo "$as_me: WARNING: Ignoring value of ZIP from the environment. Use command line variables instead." >&2;}
if test "xZIPEXE" != xBASH; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of ZIPEXE from the environment. Use command line variables instead." >&5
$as_echo "$as_me: WARNING: Ignoring value of ZIPEXE from the environment. Use command line variables instead." >&2;}
fi
# Try to locate tool using the code snippet
for ac_prog in zip
@ -21445,12 +21447,12 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ZIP+:} false; then :
if ${ac_cv_path_ZIPEXE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ZIP in
case $ZIPEXE in
[\\/]* | ?:[\\/]*)
ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path.
ac_cv_path_ZIPEXE="$ZIPEXE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@ -21460,7 +21462,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
ac_cv_path_ZIPEXE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -21471,17 +21473,17 @@ IFS=$as_save_IFS
;;
esac
fi
ZIP=$ac_cv_path_ZIP
if test -n "$ZIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
$as_echo "$ZIP" >&6; }
ZIPEXE=$ac_cv_path_ZIPEXE
if test -n "$ZIPEXE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIPEXE" >&5
$as_echo "$ZIPEXE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ZIP" && break
test -n "$ZIPEXE" && break
done
else
@ -21493,31 +21495,31 @@ done
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
# Check if we try to supply an empty value
if test "x$ZIP" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool ZIP= (no value)" >&5
$as_echo "$as_me: Setting user supplied tool ZIP= (no value)" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIP" >&5
$as_echo_n "checking for ZIP... " >&6; }
if test "x$ZIPEXE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool ZIPEXE= (no value)" >&5
$as_echo "$as_me: Setting user supplied tool ZIPEXE= (no value)" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIPEXE" >&5
$as_echo_n "checking for ZIPEXE... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
$as_echo "disabled" >&6; }
else
# Check if the provided tool contains a complete path.
tool_specified="$ZIP"
tool_specified="$ZIPEXE"
tool_basename="${tool_specified##*/}"
if test "x$tool_basename" = "x$tool_specified"; then
# A command without a complete path is provided, search $PATH.
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool ZIP=$tool_basename" >&5
$as_echo "$as_me: Will search for user supplied tool ZIP=$tool_basename" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool ZIPEXE=$tool_basename" >&5
$as_echo "$as_me: Will search for user supplied tool ZIPEXE=$tool_basename" >&6;}
# Extract the first word of "$tool_basename", so it can be a program name with args.
set dummy $tool_basename; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ZIP+:} false; then :
if ${ac_cv_path_ZIPEXE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ZIP in
case $ZIPEXE in
[\\/]* | ?:[\\/]*)
ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path.
ac_cv_path_ZIPEXE="$ZIPEXE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@ -21527,7 +21529,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
ac_cv_path_ZIPEXE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -21538,29 +21540,29 @@ IFS=$as_save_IFS
;;
esac
fi
ZIP=$ac_cv_path_ZIP
if test -n "$ZIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
$as_echo "$ZIP" >&6; }
ZIPEXE=$ac_cv_path_ZIPEXE
if test -n "$ZIPEXE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIPEXE" >&5
$as_echo "$ZIPEXE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ZIP" = x; then
if test "x$ZIPEXE" = x; then
as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
fi
else
# Otherwise we believe it is a complete path. Use it as it is.
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool ZIP=$tool_specified" >&5
$as_echo "$as_me: Will use user supplied tool ZIP=$tool_specified" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIP" >&5
$as_echo_n "checking for ZIP... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool ZIPEXE=$tool_specified" >&5
$as_echo "$as_me: Will use user supplied tool ZIPEXE=$tool_specified" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIPEXE" >&5
$as_echo_n "checking for ZIPEXE... " >&6; }
if test ! -x "$tool_specified"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
as_fn_error $? "User supplied tool ZIP=$tool_specified does not exist or is not executable" "$LINENO" 5
as_fn_error $? "User supplied tool ZIPEXE=$tool_specified does not exist or is not executable" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
$as_echo "$tool_specified" >&6; }
@ -21572,8 +21574,8 @@ $as_echo "$tool_specified" >&6; }
if test "x$ZIP" = x; then
as_fn_error $? "Could not find required tool for ZIP" "$LINENO" 5
if test "x$ZIPEXE" = x; then
as_fn_error $? "Could not find required tool for ZIPEXE" "$LINENO" 5
fi
@ -49101,7 +49103,11 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
PICFLAG="-KPIC"
if test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
PICFLAG="-xcode=pic32"
else
PICFLAG="-KPIC"
fi
C_FLAG_REORDER='-xF'
CXX_FLAG_REORDER='-xF'
SHARED_LIBRARY_FLAGS="-G"
@ -50020,7 +50026,6 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
fastdebug | slowdebug )
CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
JAVAC_FLAGS="$JAVAC_FLAGS -g"
;;
release )
;;
@ -50076,12 +50081,12 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Set some additional per-OS defines.
if test "x$OPENJDK_TARGET_OS" = xlinux; then
JVM_CFLAGS="$JVM_CFLAGS -DLINUX"
JVM_CFLAGS="$JVM_CFLAGS -pipe -fPIC -fno-rtti -fno-exceptions \
JVM_CFLAGS="$JVM_CFLAGS -pipe $PICFLAG -fno-rtti -fno-exceptions \
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
JVM_CFLAGS="$JVM_CFLAGS -DSOLARIS"
JVM_CFLAGS="$JVM_CFLAGS -template=no%extdef -features=no%split_init \
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
-D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
JVM_CFLAGS="$JVM_CFLAGS -D_ALLBSD_SOURCE"
@ -50844,7 +50849,6 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
fastdebug | slowdebug )
OPENJDK_BUILD_CFLAGS_JDK="$OPENJDK_BUILD_CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
OPENJDK_BUILD_CXXFLAGS_JDK="$OPENJDK_BUILD_CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
JAVAC_FLAGS="$JAVAC_FLAGS -g"
;;
release )
;;
@ -50900,12 +50904,12 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Set some additional per-OS defines.
if test "x$OPENJDK_BUILD_OS" = xlinux; then
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DLINUX"
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -pipe -fPIC -fno-rtti -fno-exceptions \
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -pipe $PICFLAG -fno-rtti -fno-exceptions \
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
elif test "x$OPENJDK_BUILD_OS" = xsolaris; then
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DSOLARIS"
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -template=no%extdef -features=no%split_init \
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
-D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
elif test "x$OPENJDK_BUILD_OS" = xmacosx; then
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_ALLBSD_SOURCE"

View File

@ -657,8 +657,7 @@ TOUCH:=@TOUCH@
UNIQ:=@UNIQ@
WC:=@WC@
XARGS:=@XARGS@
ZIPEXE:=@ZIP@
ZIP:=@ZIP@
ZIPEXE:=@ZIPEXE@
UNZIP:=@UNZIP@
MT:=@FIXPATH@ @MT@
RC:=@FIXPATH@ @RC@

View File

@ -388,3 +388,4 @@ b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141
6211236ef15ec796806357608b1dd1b70c258ece jdk-9+143
d4f1dae174098e799c48948e866054c52e11a186 jdk-9+144
a44b156ae7f06bf41b9bece30df7775e482395dd jdk-9+145
ecd74b41ab65bf228837b5bdf99690638d55425c jdk-9+146

View File

@ -548,3 +548,4 @@ fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140
d87d5d430c42342f0320ca7f5cbe0cbd1f9d62ba jdk-9+143
6187b582d02aee38341dc8ce4011906e9b364e9f jdk-9+144
61e7ea56312351657e69198c503a6f7bf865af83 jdk-9+145
a82cb5350cad96a0b4de496afebe3ded89f27efa jdk-9+146

View File

@ -130,8 +130,6 @@ $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp: $(JVMTI_SRCDIR)/jvmtiEnv.cpp \
TARGETS += $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp
################################################################################
# Disable copy of jvmti.h from hotspot until this has been cleared up. The file
# is currently being copied from the jdk repository. See JDK-8167078.
# Copy jvmti.h to include dir
# The file is the same regardless of jvm variant. Only let one do the copy.

View File

@ -129,7 +129,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
$(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig.diz: \
$(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX)
$(CD) $$(@D) && $(ZIP) -q -y $$@ $$(basename $$(@F))$(DEBUG_INFO_SUFFIX)
$(CD) $$(@D) && $(ZIPEXE) -q -y $$@ $$(basename $$(@F))$(DEBUG_INFO_SUFFIX)
TARGETS += $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig.diz
endif

View File

@ -50,7 +50,7 @@ TEE = tee
UNAME = uname
UNIQ = uniq
WC = wc
ZIP = zip
ZIPEXE = zip
define NEWLINE
@ -213,7 +213,7 @@ endif
ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
&& $(CD) $(ABS_TEST_OUTPUT_DIR) \
&& $(CHMOD) -R a+r . \
&& $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
&& $(ZIPEXE) -q -r $(ARCHIVE_BUNDLE) . )
# important results files
SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
@ -327,7 +327,7 @@ ifdef NUM_CORES
else ifeq ($(shell expr $(CONCURRENCY) \> 12), 1)
CONCURRENCY := 12
endif
else
else
CONCURRENCY := 1
endif
JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)

View File

@ -388,3 +388,4 @@ e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140
8dbc8594f9d5149bf1c22221272284609408227a jdk-9+143
efa71dc820eb8bd5a6c9f2f66f39c383ac3ee99d jdk-9+144
99b7853cfbd8227c4441de4b6119c10742556840 jdk-9+145
6e4ff59afb5d0adf21a72c4ff534326594a99e5d jdk-9+146

View File

@ -181,6 +181,7 @@ DEF_POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/lib/security/default.policy
DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy
DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
DEF_POLICY_SRC_LIST += $(CUSTOM_POLICY_SRC_LIST)
ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), )
DEF_POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2104, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2104, 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
@ -30,8 +30,7 @@ include CopyCommon.gmk
ifeq ($(OPENJDK_TARGET_OS), windows)
TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h \
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h
$(INCLUDE_DST_OS_DIR)/bridge/%: \
$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 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
@ -71,7 +71,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
$$(eval $$(call SetupNativeCompilation, BUILD_JACCESSINSPECTOR$1, \
SRC := $(TOPDIR)/jaccessinspector $(TOPDIR)/common \
$(TOPDIR)/toolscommon $(TOPDIR)/include/bridge, \
$(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
LIBS := advapi32.lib user32.lib, \
@ -98,7 +98,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
$$(eval $$(call SetupNativeCompilation,BUILD_JACCESSWALKER$1, \
SRC := $(TOPDIR)/jaccesswalker $(TOPDIR)/common \
$(TOPDIR)/toolscommon $(TOPDIR)/include/bridge, \
$(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
LIBS := advapi32.lib comctl32.lib gdi32.lib user32.lib, \

View File

@ -356,7 +356,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
$(X_CFLAGS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
deprecated-declarations unused-result maybe-uninitialized format \
unused-result maybe-uninitialized format \
format-security int-to-pointer-cast parentheses, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 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
@ -48,7 +48,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS) \
$(addprefix -I,$(JAVA_AB_SRCDIR)) \
-I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
-I$(ROOT_SRCDIR)/include/bridge \
-DACCESSBRIDGE_ARCH_$2, \
LDFLAGS := $(LDFLAGS_JDKLIB) -subsystem:windows, \
LIBS := kernel32.lib user32.lib gdi32.lib \
@ -78,7 +78,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
OPTIMIZATION := LOW, \
CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT $(ACCESSBRIDGE_CFLAGS) \
$(addprefix -I,$(WIN_AB_SRCDIR)) \
-I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
-I$(ROOT_SRCDIR)/include/bridge \
-DACCESSBRIDGE_ARCH_$2, \
LDFLAGS := $(LDFLAGS_JDKLIB) -subsystem:windows \
-def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \

View File

@ -194,11 +194,17 @@ public interface ObjectInputFilter {
* When setting the filter, it should be stateless and idempotent,
* reporting the same result when passed the same arguments.
* <p>
* The filter is configured using the {@link java.security.Security}
* property {@code jdk.serialFilter} and can be overridden by
* the System property {@code jdk.serialFilter}.
*
* The syntax is the same as for the {@link #createFilter(String) createFilter} method.
* The filter is configured during the initialization of the {@code ObjectInputFilter.Config}
* class. For example, by calling {@link #getSerialFilter() Config.getSerialFilter}.
* If the system property {@code jdk.serialFilter} is defined, it is used
* to configure the filter.
* If the system property is not defined, and the {@link java.security.Security}
* property {@code jdk.serialFilter} is defined then it is used to configure the filter.
* Otherwise, the filter is not configured during initialization.
* The syntax for each property is the same as for the
* {@link #createFilter(String) createFilter} method.
* If a filter is not configured, it can be set with
* {@link #setSerialFilter(ObjectInputFilter) Config.setSerialFilter}.
*
* @since 9
*/

View File

@ -121,8 +121,11 @@ public interface CharSequence {
* href="{@docRoot}/java/lang/Character.html#unicode">surrogate code
* point</a> is passed through uninterpreted.
*
* <p>If the sequence is mutated while the stream is being read, the
* result is undefined.
* <p>The stream binds to this sequence when the terminal stream operation
* commences (specifically, for mutable sequences the spliterator for the
* stream is <a href="../Spliterator.html#binding"><em>late-binding</em></a>).
* If the sequence is modified during that operation then the result is
* undefined.
*
* @return an IntStream of char values from this sequence
* @since 1.8
@ -168,8 +171,11 @@ public interface CharSequence {
* unpaired surrogates, and undefined code units, are zero-extended to
* {@code int} values which are then passed to the stream.
*
* <p>If the sequence is mutated while the stream is being read, the result
* is undefined.
* <p>The stream binds to this sequence when the terminal stream operation
* commences (specifically, for mutable sequences the spliterator for the
* stream is <a href="../Spliterator.html#binding"><em>late-binding</em></a>).
* If the sequence is modified during that operation then the result is
* undefined.
*
* @return an IntStream of Unicode code points from this sequence
* @since 1.8

View File

@ -2704,9 +2704,6 @@ public final class Class<T> implements java.io.Serializable,
* Reflection support.
*/
// Caches for certain reflective results
private static boolean useCaches = true;
// reflection data that might get invalidated when JVM TI RedefineClasses() is called
private static class ReflectionData<T> {
volatile Field[] declaredFields;
@ -2739,8 +2736,7 @@ public final class Class<T> implements java.io.Serializable,
SoftReference<ReflectionData<T>> reflectionData = this.reflectionData;
int classRedefinedCount = this.classRedefinedCount;
ReflectionData<T> rd;
if (useCaches &&
reflectionData != null &&
if (reflectionData != null &&
(rd = reflectionData.get()) != null &&
rd.redefinedCount == classRedefinedCount) {
return rd;
@ -2752,8 +2748,6 @@ public final class Class<T> implements java.io.Serializable,
private ReflectionData<T> newReflectionData(SoftReference<ReflectionData<T>> oldReflectionData,
int classRedefinedCount) {
if (!useCaches) return null;
while (true) {
ReflectionData<T> rd = new ReflectionData<>(classRedefinedCount);
// try to CAS it...
@ -2819,7 +2813,6 @@ public final class Class<T> implements java.io.Serializable,
// be propagated to the outside world, but must instead be copied
// via ReflectionFactory.copyField.
private Field[] privateGetDeclaredFields(boolean publicOnly) {
checkInitted();
Field[] res;
ReflectionData<T> rd = reflectionData();
if (rd != null) {
@ -2842,7 +2835,6 @@ public final class Class<T> implements java.io.Serializable,
// be propagated to the outside world, but must instead be copied
// via ReflectionFactory.copyField.
private Field[] privateGetPublicFields(Set<Class<?>> traversedInterfaces) {
checkInitted();
Field[] res;
ReflectionData<T> rd = reflectionData();
if (rd != null) {
@ -2902,7 +2894,6 @@ public final class Class<T> implements java.io.Serializable,
// objects must NOT be propagated to the outside world, but must
// instead be copied via ReflectionFactory.copyConstructor.
private Constructor<T>[] privateGetDeclaredConstructors(boolean publicOnly) {
checkInitted();
Constructor<T>[] res;
ReflectionData<T> rd = reflectionData();
if (rd != null) {
@ -2937,7 +2928,6 @@ public final class Class<T> implements java.io.Serializable,
// be propagated to the outside world, but must instead be copied
// via ReflectionFactory.copyMethod.
private Method[] privateGetDeclaredMethods(boolean publicOnly) {
checkInitted();
Method[] res;
ReflectionData<T> rd = reflectionData();
if (rd != null) {
@ -3134,7 +3124,6 @@ public final class Class<T> implements java.io.Serializable,
// be propagated to the outside world, but must instead be copied
// via ReflectionFactory.copyMethod.
private Method[] privateGetPublicMethods() {
checkInitted();
Method[] res;
ReflectionData<T> rd = reflectionData();
if (rd != null) {
@ -3445,7 +3434,7 @@ public final class Class<T> implements java.io.Serializable,
* @since 1.4
*/
public boolean desiredAssertionStatus() {
ClassLoader loader = getClassLoader();
ClassLoader loader = getClassLoader0();
// If the loader is null this is a system class, so ask the VM
if (loader == null)
return desiredAssertionStatus0(this);
@ -3490,39 +3479,6 @@ public final class Class<T> implements java.io.Serializable,
}
private static ReflectionFactory reflectionFactory;
// To be able to query system properties as soon as they're available
private static boolean initted = false;
private static void checkInitted() {
if (initted) return;
AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() {
// Tests to ensure the system properties table is fully
// initialized. This is needed because reflection code is
// called very early in the initialization process (before
// command-line arguments have been parsed and therefore
// these user-settable properties installed.) We assume that
// if System.out is non-null then the System class has been
// fully initialized and that the bulk of the startup code
// has been run.
if (System.out == null) {
// java.lang.System not yet fully initialized
return null;
}
// Doesn't use Boolean.getBoolean to avoid class init.
String val =
System.getProperty("sun.reflect.noCaches");
if (val != null && val.equals("true")) {
useCaches = false;
}
initted = true;
return null;
}
});
}
/**
* Returns the elements of this enum class or null if this
* Class object does not represent an enum type.

View File

@ -104,9 +104,9 @@ import sun.security.util.SecurityConstants;
* class or resource itself.
*
* <p> Class loaders that support concurrent loading of classes are known as
* <em>{@linkplain #isParallelCapable() parallel capable}</em> class loaders and
* are required to register themselves at their class initialization time by
* invoking the {@link
* <em>{@linkplain #isRegisteredAsParallelCapable() parallel capable}</em> class
* loaders and are required to register themselves at their class initialization
* time by invoking the {@link
* #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
* method. Note that the <tt>ClassLoader</tt> class is registered as parallel
* capable by default. However, its subclasses still need to register themselves
@ -1335,10 +1335,12 @@ public abstract class ClassLoader {
* @return A <tt>URL</tt> object for reading the resource, or
* <tt>null</tt> if the resource could not be found or the invoker
* doesn't have adequate privileges to get the resource.
* @throws NullPointerException If {@code name} is {@code null}
*
* @since 1.1
*/
public URL getResource(String name) {
Objects.requireNonNull(name);
URL url;
if (parent != null) {
url = parent.getResource(name);
@ -1382,12 +1384,14 @@ public abstract class ClassLoader {
*
* @throws IOException
* If I/O errors occur
* @throws NullPointerException If {@code name} is {@code null}
*
* @see #findResources(String)
*
* @since 1.2
*/
public Enumeration<URL> getResources(String name) throws IOException {
Objects.requireNonNull(name);
@SuppressWarnings("unchecked")
Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
if (parent != null) {
@ -1434,11 +1438,14 @@ public abstract class ClassLoader {
* that the class loader doesn't have access to will not be in the
* stream.
*
* @throws NullPointerException If {@code name} is {@code null}
*
* @see #findResources(String)
*
* @since 9
*/
public Stream<URL> resources(String name) {
Objects.requireNonNull(name);
int characteristics = Spliterator.NONNULL | Spliterator.IMMUTABLE;
Supplier<Spliterator<URL>> si = () -> {
try {
@ -1495,7 +1502,8 @@ public abstract class ClassLoader {
}
/**
* Registers the caller as {@linkplain #isParallelCapable() parallel capable}.
* Registers the caller as
* {@linkplain #isRegisteredAsParallelCapable() parallel capable}.
* The registration succeeds if and only if all of the following
* conditions are met:
* <ol>
@ -1509,7 +1517,7 @@ public abstract class ClassLoader {
* @return {@code true} if the caller is successfully registered as
* parallel capable and {@code false} if otherwise.
*
* @see #isParallelCapable()
* @see #isRegisteredAsParallelCapable()
*
* @since 1.7
*/
@ -1521,7 +1529,7 @@ public abstract class ClassLoader {
}
/**
* Returns {@code true} if this class loader is
* Returns {@code true} if this class loader is registered as
* {@linkplain #registerAsParallelCapable parallel capable}, otherwise
* {@code false}.
*
@ -1532,7 +1540,7 @@ public abstract class ClassLoader {
*
* @since 9
*/
public final boolean isParallelCapable() {
public final boolean isRegisteredAsParallelCapable() {
return ParallelLoaders.isRegistered(this.getClass());
}
@ -1599,10 +1607,12 @@ public abstract class ClassLoader {
*
* @return An input stream for reading the resource, or <tt>null</tt>
* if the resource could not be found
* @throws NullPointerException If {@code name} is {@code null}
*
* @since 1.1
*/
public InputStream getResourceAsStream(String name) {
Objects.requireNonNull(name);
URL url = getResource(name);
try {
return url != null ? url.openStream() : null;

View File

@ -200,7 +200,8 @@ public final class Constructor<T> extends Executable {
}
/**
* {@inheritDoc}
* Returns the {@code Class} object representing the class that
* declares the constructor represented by this object.
*/
@Override
public Class<T> getDeclaringClass() {
@ -321,6 +322,11 @@ public final class Constructor<T> extends Executable {
* public java.util.Hashtable(int,float)
* }</pre>
*
* <p>If the constructor is declared to throw exceptions, the
* parameter list is followed by a space, followed by the word
* "{@code throws}" followed by a comma-separated list of the
* thrown exception types.
*
* <p>The only possible modifiers for constructors are the access
* modifiers {@code public}, {@code protected} or
* {@code private}. Only one of these may appear, or none if the
@ -357,13 +363,13 @@ public final class Constructor<T> extends Executable {
* "<code><i>Type</i>...</code>".
*
* A space is used to separate access modifiers from one another
* and from the type parameters or return type. If there are no
* and from the type parameters or class name. If there are no
* type parameters, the type parameter list is elided; if the type
* parameter list is present, a space separates the list from the
* class name. If the constructor is declared to throw
* exceptions, the parameter list is followed by a space, followed
* by the word "{@code throws}" followed by a
* comma-separated list of the thrown exception types.
* comma-separated list of the generic thrown exception types.
*
* <p>The only possible modifiers for constructors are the access
* modifiers {@code public}, {@code protected} or

View File

@ -211,7 +211,8 @@ public final class Method extends Executable {
}
/**
* {@inheritDoc}
* Returns the {@code Class} object representing the class or interface
* that declares the method represented by this object.
*/
@Override
public Class<?> getDeclaringClass() {
@ -372,7 +373,7 @@ public final class Method extends Executable {
* the method name, followed by a parenthesized, comma-separated
* list of the method's formal parameter types. If the method
* throws checked exceptions, the parameter list is followed by a
* space, followed by the word throws followed by a
* space, followed by the word "{@code throws}" followed by a
* comma-separated list of the thrown exception types.
* For example:
* <pre>
@ -428,8 +429,8 @@ public final class Method extends Executable {
* parameter list is present, a space separates the list from the
* class name. If the method is declared to throw exceptions, the
* parameter list is followed by a space, followed by the word
* throws followed by a comma-separated list of the generic thrown
* exception types.
* "{@code throws}" followed by a comma-separated list of the generic
* thrown exception types.
*
* <p>The access modifiers are placed in canonical order as
* specified by "The Java Language Specification". This is

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -130,6 +130,35 @@ class Authenticator {
theAuthenticator = a;
}
/**
* Gets the default authenticator.
* First, if there is a security manager, its {@code checkPermission}
* method is called with a
* {@code NetPermission("requestPasswordAuthentication")} permission.
* This may result in a java.lang.SecurityException.
* Then the default authenticator, if set, is returned.
* Otherwise, {@code null} is returned.
*
* @return The default authenticator, if set, {@code null} otherwise.
*
* @throws SecurityException
* if a security manager exists and its
* {@code checkPermission} method doesn't allow
* requesting password authentication.
* @since 9
* @see SecurityManager#checkPermission
* @see java.net.NetPermission
*/
public static Authenticator getDefault() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
NetPermission requestPermission
= new NetPermission("requestPasswordAuthentication");
sm.checkPermission(requestPermission);
}
return theAuthenticator;
}
/**
* Ask the authenticator that has been registered with the system
* for a password.

View File

@ -42,6 +42,7 @@ import java.security.SecureClassLoader;
import java.util.Enumeration;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.jar.Attributes;
@ -301,9 +302,12 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @return An input stream for reading the resource, or {@code null}
* if the resource could not be found
*
* @throws NullPointerException If {@code name} is {@code null}
*
* @since 1.7
*/
public InputStream getResourceAsStream(String name) {
Objects.requireNonNull(name);
URL url = getResource(name);
try {
if (url == null) {

View File

@ -32,6 +32,7 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import jdk.internal.misc.JavaSecurityAccess;
import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
@ -524,7 +525,7 @@ public class ProtectionDomain {
// have some side effects so this manual
// comparison is sufficient.
if (pdpName.equals(pp.getName()) &&
pdpActions.equals(pp.getActions())) {
Objects.equals(pdpActions, pp.getActions())) {
plVector.remove(i);
break;
}

View File

@ -120,6 +120,24 @@ import sun.security.util.Debug;
* gathered, for example, if the entropy source is /dev/random on various
* Unix-like operating systems.
*
* <h2> Thread safety </h2>
* {@code SecureRandom} objects are safe for use by multiple concurrent threads.
*
* @implSpec
* A {@code SecureRandom} service provider can advertise that it is thread-safe
* by setting the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Service">service
* provider attribute</a> "ThreadSafe" to "true" when registering the provider.
* Otherwise, this class will instead synchronize access to the following
* methods of the {@code SecureRandomSpi} implementation:
* <ul>
* <li>{@link SecureRandomSpi#engineSetSeed(byte[])}
* <li>{@link SecureRandomSpi#engineNextBytes(byte[])}
* <li>{@link SecureRandomSpi#engineNextBytes(byte[], SecureRandomParameters)}
* <li>{@link SecureRandomSpi#engineGenerateSeed(int)}
* <li>{@link SecureRandomSpi#engineReseed(SecureRandomParameters)}
* </ul>
*
* @see java.security.SecureRandomSpi
* @see java.util.Random
*
@ -150,6 +168,14 @@ public class SecureRandom extends java.util.Random {
*/
private SecureRandomSpi secureRandomSpi = null;
/**
* Thread safety.
*
* @serial
* @since 9
*/
private final boolean threadSafe;
/*
* The algorithm name of null if unknown.
*
@ -189,6 +215,16 @@ public class SecureRandom extends java.util.Random {
*/
super(0);
getDefaultPRNG(false, null);
this.threadSafe = getThreadSafe();
}
private boolean getThreadSafe() {
if (provider == null || algorithm == null) {
return false;
} else {
return Boolean.parseBoolean(provider.getProperty(
"SecureRandom." + algorithm + " ThreadSafe", "false"));
}
}
/**
@ -217,6 +253,7 @@ public class SecureRandom extends java.util.Random {
public SecureRandom(byte[] seed) {
super(0);
getDefaultPRNG(true, seed);
this.threadSafe = getThreadSafe();
}
private void getDefaultPRNG(boolean setSeed, byte[] seed) {
@ -269,6 +306,7 @@ public class SecureRandom extends java.util.Random {
this.secureRandomSpi = secureRandomSpi;
this.provider = provider;
this.algorithm = algorithm;
this.threadSafe = getThreadSafe();
if (!skipDebug && pdebug != null) {
pdebug.println("SecureRandom." + algorithm +
@ -653,8 +691,14 @@ public class SecureRandom extends java.util.Random {
*
* @see #getSeed
*/
public synchronized void setSeed(byte[] seed) {
secureRandomSpi.engineSetSeed(seed);
public void setSeed(byte[] seed) {
if (threadSafe) {
secureRandomSpi.engineSetSeed(seed);
} else {
synchronized (this) {
secureRandomSpi.engineSetSeed(seed);
}
}
}
/**
@ -679,7 +723,7 @@ public class SecureRandom extends java.util.Random {
* yet been initialized at that point.
*/
if (seed != 0) {
this.secureRandomSpi.engineSetSeed(longToByteArray(seed));
setSeed(longToByteArray(seed));
}
}
@ -690,7 +734,13 @@ public class SecureRandom extends java.util.Random {
*/
@Override
public void nextBytes(byte[] bytes) {
secureRandomSpi.engineNextBytes(bytes);
if (threadSafe) {
secureRandomSpi.engineNextBytes(bytes);
} else {
synchronized (this) {
secureRandomSpi.engineNextBytes(bytes);
}
}
}
/**
@ -707,12 +757,19 @@ public class SecureRandom extends java.util.Random {
*
* @since 9
*/
public synchronized void nextBytes(
byte[] bytes, SecureRandomParameters params) {
public void nextBytes(byte[] bytes, SecureRandomParameters params) {
if (params == null) {
throw new IllegalArgumentException("params cannot be null");
}
secureRandomSpi.engineNextBytes(Objects.requireNonNull(bytes), params);
if (threadSafe) {
secureRandomSpi.engineNextBytes(
Objects.requireNonNull(bytes), params);
} else {
synchronized (this) {
secureRandomSpi.engineNextBytes(
Objects.requireNonNull(bytes), params);
}
}
}
/**
@ -756,6 +813,7 @@ public class SecureRandom extends java.util.Random {
*
* @param numBytes the number of seed bytes to generate.
*
* @throws IllegalArgumentException if {@code numBytes} is negative
* @return the seed bytes.
*
* @see #setSeed
@ -782,7 +840,13 @@ public class SecureRandom extends java.util.Random {
if (numBytes < 0) {
throw new IllegalArgumentException("numBytes cannot be negative");
}
return secureRandomSpi.engineGenerateSeed(numBytes);
if (threadSafe) {
return secureRandomSpi.engineGenerateSeed(numBytes);
} else {
synchronized (this) {
return secureRandomSpi.engineGenerateSeed(numBytes);
}
}
}
/**
@ -917,8 +981,14 @@ public class SecureRandom extends java.util.Random {
*
* @since 9
*/
public synchronized void reseed() {
secureRandomSpi.engineReseed(null);
public void reseed() {
if (threadSafe) {
secureRandomSpi.engineReseed(null);
} else {
synchronized (this) {
secureRandomSpi.engineReseed(null);
}
}
}
/**
@ -937,11 +1007,17 @@ public class SecureRandom extends java.util.Random {
*
* @since 9
*/
public synchronized void reseed(SecureRandomParameters params) {
public void reseed(SecureRandomParameters params) {
if (params == null) {
throw new IllegalArgumentException("params cannot be null");
}
secureRandomSpi.engineReseed(params);
if (threadSafe) {
secureRandomSpi.engineReseed(params);
} else {
synchronized (this) {
secureRandomSpi.engineReseed(params);
}
}
}
// Declare serialVersionUID to be compatible with JDK1.1

View File

@ -58,6 +58,26 @@ package java.security;
* a {@code SecureRandomParameters} argument will never
* return an instance of this implementation. The
* {@link #engineGetParameters()} method must return {@code null}.
* <p>
* See {@link SecureRandom} for additional details on thread safety. By
* default, a {@code SecureRandomSpi} implementation is considered to be
* not safe for use by multiple concurrent threads and {@code SecureRandom}
* will synchronize access to each of the applicable engine methods
* (see {@link SecureRandom} for the list of methods). However, if a
* {@code SecureRandomSpi} implementation is thread-safe, the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#Service">
* service provider attribute</a> "ThreadSafe" should be set to "true" during
* its registration, as follows:
* <blockquote><pre>
* put("SecureRandom.AlgName ThreadSafe", "true");</pre>
* </blockquote>
* or
* <blockquote><pre>
* putService(new Service(this, "SecureRandom", "AlgName", className,
* null, Map.of("ThreadSafe", "true")));</pre>
* </blockquote>
* {@code SecureRandom} will call the applicable engine methods
* without any synchronization.
*
* @since 1.2
*/

View File

@ -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
@ -76,6 +76,7 @@ import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.zone.ZoneRules;
import java.time.zone.ZoneRulesException;
import java.time.zone.ZoneRulesProvider;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
@ -284,7 +285,7 @@ public abstract class ZoneId implements Serializable {
* @return a modifiable copy of the set of zone IDs, not null
*/
public static Set<String> getAvailableZoneIds() {
return ZoneRulesProvider.getAvailableZoneIds();
return new HashSet<String>(ZoneRulesProvider.getAvailableZoneIds());
}
//-----------------------------------------------------------------------

View File

@ -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
@ -302,14 +302,10 @@ final class DateTimePrintContext {
* @throws DateTimeException if the field is not available and the section is not optional
*/
Long getValue(TemporalField field) {
try {
return temporal.getLong(field);
} catch (DateTimeException ex) {
if (optional > 0) {
return null;
}
throw ex;
if (optional > 0 && !temporal.isSupported(field)) {
return null;
}
return temporal.getLong(field);
}
//-----------------------------------------------------------------------

View File

@ -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
@ -77,6 +77,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.Collections;
/**
* Provider of time-zone rules to the system.
@ -137,6 +138,11 @@ public abstract class ZoneRulesProvider {
*/
private static final ConcurrentMap<String, ZoneRulesProvider> ZONES = new ConcurrentHashMap<>(512, 0.75f, 2);
/**
* The zone ID data
*/
private static volatile Set<String> ZONE_IDS;
static {
// if the property java.time.zone.DefaultZoneRulesProvider is
// set then its value is the class name of the default provider
@ -194,10 +200,10 @@ public abstract class ZoneRulesProvider {
* <p>
* These IDs are the string form of a {@link ZoneId}.
*
* @return a modifiable copy of the set of zone IDs, not null
* @return the unmodifiable set of zone IDs, not null
*/
public static Set<String> getAvailableZoneIds() {
return new HashSet<>(ZONES.keySet());
return ZONE_IDS;
}
/**
@ -303,7 +309,7 @@ public abstract class ZoneRulesProvider {
* @param provider the provider to register, not null
* @throws ZoneRulesException if unable to complete the registration
*/
private static void registerProvider0(ZoneRulesProvider provider) {
private static synchronized void registerProvider0(ZoneRulesProvider provider) {
for (String zoneId : provider.provideZoneIds()) {
Objects.requireNonNull(zoneId, "zoneId");
ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider);
@ -313,6 +319,8 @@ public abstract class ZoneRulesProvider {
", currently loading from provider: " + provider);
}
}
Set<String> combinedSet = new HashSet<String>(ZONES.keySet());
ZONE_IDS = Collections.unmodifiableSet(combinedSet);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
@ -29,6 +29,7 @@ import java.io.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.LongBuffer;
import java.util.function.IntConsumer;
import java.util.stream.IntStream;
import java.util.stream.StreamSupport;
@ -1209,40 +1210,165 @@ public class BitSet implements Cloneable, java.io.Serializable {
* is the number of bits in the set state, equal to the value
* returned by the {@link #cardinality()} method.
*
* <p>The bit set must remain constant during the execution of the
* terminal stream operation. Otherwise, the result of the terminal
* stream operation is undefined.
* <p>The stream binds to this bit set when the terminal stream operation
* commences (specifically, the spliterator for the stream is
* <a href="../Spliterator.html#binding"><em>late-binding</em></a>). If the
* bit set is modified during that operation then the result is undefined.
*
* @return a stream of integers representing set indices
* @since 1.8
*/
public IntStream stream() {
class BitSetIterator implements PrimitiveIterator.OfInt {
int next = nextSetBit(0);
class BitSetSpliterator implements Spliterator.OfInt {
private int index; // current bit index for a set bit
private int fence; // -1 until used; then one past last bit index
private int est; // size estimate
private boolean root; // true if root and not split
// root == true then size estimate is accurate
// index == -1 or index >= fence if fully traversed
// Special case when the max bit set is Integer.MAX_VALUE
@Override
public boolean hasNext() {
return next != -1;
BitSetSpliterator(int origin, int fence, int est, boolean root) {
this.index = origin;
this.fence = fence;
this.est = est;
this.root = root;
}
private int getFence() {
int hi;
if ((hi = fence) < 0) {
// Round up fence to maximum cardinality for allocated words
// This is sufficient and cheap for sequential access
// When splitting this value is lowered
hi = fence = (wordsInUse >= wordIndex(Integer.MAX_VALUE))
? Integer.MAX_VALUE
: wordsInUse << ADDRESS_BITS_PER_WORD;
est = cardinality();
index = nextSetBit(0);
}
return hi;
}
@Override
public int nextInt() {
if (next != -1) {
int ret = next;
next = (next == Integer.MAX_VALUE) ? -1 : nextSetBit(next+1);
return ret;
} else {
throw new NoSuchElementException();
public boolean tryAdvance(IntConsumer action) {
Objects.requireNonNull(action);
int hi = getFence();
int i = index;
if (i < 0 || i >= hi) {
// Check if there is a final bit set for Integer.MAX_VALUE
if (i == Integer.MAX_VALUE && hi == Integer.MAX_VALUE) {
index = -1;
action.accept(Integer.MAX_VALUE);
return true;
}
return false;
}
index = nextSetBit(i + 1, wordIndex(hi - 1));
action.accept(i);
return true;
}
@Override
public void forEachRemaining(IntConsumer action) {
Objects.requireNonNull(action);
int hi = getFence();
int i = index;
int v = wordIndex(hi - 1);
index = -1;
while (i >= 0 && i < hi) {
action.accept(i);
i = nextSetBit(i + 1, v);
}
// Check if there is a final bit set for Integer.MAX_VALUE
if (i == Integer.MAX_VALUE && hi == Integer.MAX_VALUE) {
action.accept(Integer.MAX_VALUE);
}
}
}
return StreamSupport.intStream(
() -> Spliterators.spliterator(
new BitSetIterator(), cardinality(),
Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SORTED),
Spliterator.SIZED | Spliterator.SUBSIZED |
Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SORTED,
false);
@Override
public OfInt trySplit() {
int hi = getFence();
int lo = index;
if (lo < 0) {
return null;
}
// Lower the fence to be the upper bound of last bit set
// The index is the first bit set, thus this spliterator
// covers one bit and cannot be split, or two or more
// bits
hi = fence = (hi < Integer.MAX_VALUE || !get(Integer.MAX_VALUE))
? previousSetBit(hi - 1) + 1
: Integer.MAX_VALUE;
// Find the mid point
int mid = (lo + hi) >>> 1;
if (lo >= mid) {
return null;
}
// Raise the index of this spliterator to be the next set bit
// from the mid point
index = nextSetBit(mid, wordIndex(hi - 1));
root = false;
// Don't lower the fence (mid point) of the returned spliterator,
// traversal or further splitting will do that work
return new BitSetSpliterator(lo, mid, est >>>= 1, false);
}
@Override
public long estimateSize() {
getFence(); // force init
return est;
}
@Override
public int characteristics() {
// Only sized when root and not split
return (root ? Spliterator.SIZED : 0) |
Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SORTED;
}
@Override
public Comparator<? super Integer> getComparator() {
return null;
}
}
return StreamSupport.intStream(new BitSetSpliterator(0, -1, 0, true), false);
}
/**
* Returns the index of the first bit that is set to {@code true}
* that occurs on or after the specified starting index and up to and
* including the specified word index
* If no such bit exists then {@code -1} is returned.
*
* @param fromIndex the index to start checking from (inclusive)
* @param toWordIndex the last word index to check (inclusive)
* @return the index of the next set bit, or {@code -1} if there
* is no such bit
*/
private int nextSetBit(int fromIndex, int toWordIndex) {
int u = wordIndex(fromIndex);
// Check if out of bounds
if (u > toWordIndex)
return -1;
long word = words[u] & (WORD_MASK << fromIndex);
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + Long.numberOfTrailingZeros(word);
// Check if out of bounds
if (++u > toWordIndex)
return -1;
word = words[u];
}
}
}

View File

@ -54,7 +54,8 @@ import java.util.function.Consumer;
* <p>This class and its iterator implement all of the
* <em>optional</em> methods of the {@link Collection} and {@link
* Iterator} interfaces. The Iterator provided in method {@link
* #iterator()} is <em>not</em> guaranteed to traverse the elements of
* #iterator()} and the Spliterator provided in method {@link #spliterator()}
* are <em>not</em> guaranteed to traverse the elements of
* the priority queue in any particular order. If you need ordered
* traversal, consider using {@code Arrays.sort(pq.toArray())}.
*
@ -799,7 +800,8 @@ public class PriorityQueue<E> extends AbstractQueue<E>
/**
* Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
* and <em>fail-fast</em> {@link Spliterator} over the elements in this
* queue.
* queue. The spliterator does not traverse elements in any particular order
* (the {@link Spliterator#ORDERED ORDERED} characteristic is not reported).
*
* <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
* {@link Spliterator#SUBSIZED}, and {@link Spliterator#NONNULL}.

View File

@ -65,7 +65,8 @@ import java.util.function.Consumer;
* <p>This class and its iterator implement all of the
* <em>optional</em> methods of the {@link Collection} and {@link
* Iterator} interfaces. The Iterator provided in method {@link
* #iterator()} is <em>not</em> guaranteed to traverse the elements of
* #iterator()} and the Spliterator provided in method {@link #spliterator()}
* are <em>not</em> guaranteed to traverse the elements of
* the PriorityBlockingQueue in any particular order. If you need
* ordered traversal, consider using
* {@code Arrays.sort(pq.toArray())}. Also, method {@code drainTo}
@ -994,6 +995,8 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
/**
* Returns a {@link Spliterator} over the elements in this queue.
* The spliterator does not traverse elements in any particular order
* (the {@link Spliterator#ORDERED ORDERED} characteristic is not reported).
*
* <p>The returned spliterator is
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.

View File

@ -1327,7 +1327,7 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
* @param s the {@code Supplier} of generated elements
* @return a new infinite sequential unordered {@code Stream}
*/
public static<T> Stream<T> generate(Supplier<T> s) {
public static<T> Stream<T> generate(Supplier<? extends T> s) {
Objects.requireNonNull(s);
return StreamSupport.stream(
new StreamSpliterators.InfiniteSupplyingSpliterator.OfRef<>(Long.MAX_VALUE, s), false);

View File

@ -1346,9 +1346,9 @@ class StreamSpliterators {
}
static final class OfRef<T> extends InfiniteSupplyingSpliterator<T> {
final Supplier<T> s;
final Supplier<? extends T> s;
OfRef(long size, Supplier<T> s) {
OfRef(long size, Supplier<? extends T> s) {
super(size);
this.s = s;
}

View File

@ -72,13 +72,13 @@ public class ClassLoaders {
// If neither is specified then default to -cp <working directory>
// If -cp is not specified and -m is specified, the value of
// java.class.path is an empty string, then no class path.
URLClassPath ucp = null;
URLClassPath ucp = new URLClassPath(new URL[0]);
String mainMid = System.getProperty("jdk.module.main");
String cp = System.getProperty("java.class.path");
if (cp == null)
cp = "";
if (mainMid == null || cp.length() > 0)
ucp = toURLClassPath(cp);
addClassPathToUCP(cp, ucp);
// create the class loaders
BOOT_LOADER = new BootClassLoader(bcp);

View File

@ -462,6 +462,8 @@ public final class LauncherHelper {
* This method:
* 1. Loads the main class from the module or class path
* 2. Checks the public static void main method.
* 3. If the main class extends FX Application then call on FXHelper to
* perform the launch.
*
* @param printToStderr if set, all output will be routed to stderr
* @param mode LaunchMode as determined by the arguments passed on the
@ -479,11 +481,23 @@ public final class LauncherHelper {
Class<?> mainClass = (mode == LM_MODULE) ? loadModuleMainClass(what)
: loadMainClass(mode, what);
validateMainClass(mainClass);
// record the real main class for UI purposes
// neither method above can return null, they will abort()
appClass = mainClass;
// record main class if not already set
if (appClass == null)
appClass = mainClass;
/*
* Check if FXHelper can launch it using the FX launcher. In an FX app,
* the main class may or may not have a main method, so do this before
* validating the main class.
*/
if (JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
doesExtendFXApplication(mainClass)) {
// Will abort() if there are problems with FX runtime
FXHelper.setFXLaunchParameters(what, mode);
mainClass = FXHelper.class;
}
validateMainClass(mainClass);
return mainClass;
}
@ -530,7 +544,6 @@ public final class LauncherHelper {
String cn = Normalizer.normalize(mainClass, Normalizer.Form.NFC);
c = Class.forName(m, cn);
}
if (c == null) {
abort(null, "java.launcher.module.error2", mainClass, mainModule);
@ -542,8 +555,6 @@ public final class LauncherHelper {
/**
* Loads the main class from the class path (LM_CLASS or LM_JAR).
* If the main class extends FX Application then call on FXHelper to
* determine the main class to launch.
*/
private static Class<?> loadMainClass(int mode, String what) {
// get the class name
@ -570,7 +581,7 @@ public final class LauncherHelper {
if (System.getProperty("os.name", "").contains("OS X")
&& Normalizer.isNormalized(cn, Normalizer.Form.NFD)) {
try {
// On Mac OS X since all names with diacretic symbols are
// On Mac OS X since all names with diacritical marks are
// given as decomposed it is possible that main class name
// comes incorrectly from the command line and we have
// to re-compose it
@ -583,21 +594,6 @@ public final class LauncherHelper {
abort(cnfe, "java.launcher.cls.error1", cn);
}
}
// record the main class
appClass = mainClass;
/*
* Check if FXHelper can launch it using the FX launcher. In an FX app,
* the main class may or may not have a main method, so do this before
* validating the main class.
*/
if (JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
doesExtendFXApplication(mainClass)) {
// Will abort() if there are problems with FX runtime
FXHelper.setFXLaunchParameters(what, mode);
return FXHelper.class;
}
return mainClass;
}
@ -773,9 +769,15 @@ public final class LauncherHelper {
* java -cp somedir FXClass N/A LM_CLASS "LM_CLASS"
* java -jar fxapp.jar Present LM_JAR "LM_JAR"
* java -jar fxapp.jar Not Present LM_JAR "LM_JAR"
* java -m module/class [1] N/A LM_MODULE "LM_MODULE"
* java -m module N/A LM_MODULE "LM_MODULE"
*
* [1] - JavaFX-Application-Class is ignored when modular args are used, even
* if present in a modular jar
*/
private static final String JAVAFX_LAUNCH_MODE_CLASS = "LM_CLASS";
private static final String JAVAFX_LAUNCH_MODE_JAR = "LM_JAR";
private static final String JAVAFX_LAUNCH_MODE_MODULE = "LM_MODULE";
/*
* FX application launcher and launch method, so we can launch
@ -835,6 +837,9 @@ public final class LauncherHelper {
case LM_JAR:
fxLaunchMode = JAVAFX_LAUNCH_MODE_JAR;
break;
case LM_MODULE:
fxLaunchMode = JAVAFX_LAUNCH_MODE_MODULE;
break;
default:
// should not have gotten this far...
throw new InternalError(mode + ": Unknown launch mode");

View File

@ -96,25 +96,32 @@ final class SunEntries {
if (nativeAvailable && useNativePRNG) {
map.put("SecureRandom.NativePRNG",
"sun.security.provider.NativePRNG");
map.put("SecureRandom.NativePRNG ThreadSafe", "true");
}
map.put("SecureRandom.DRBG", "sun.security.provider.DRBG");
map.put("SecureRandom.DRBG ThreadSafe", "true");
map.put("SecureRandom.SHA1PRNG",
"sun.security.provider.SecureRandom");
map.put("SecureRandom.SHA1PRNG ThreadSafe", "true");
if (nativeAvailable && !useNativePRNG) {
map.put("SecureRandom.NativePRNG",
"sun.security.provider.NativePRNG");
map.put("SecureRandom.NativePRNG ThreadSafe", "true");
}
if (NativePRNG.Blocking.isAvailable()) {
map.put("SecureRandom.NativePRNGBlocking",
"sun.security.provider.NativePRNG$Blocking");
map.put("SecureRandom.NativePRNGBlocking ThreadSafe", "true");
}
if (NativePRNG.NonBlocking.isAvailable()) {
map.put("SecureRandom.NativePRNGNonBlocking",
"sun.security.provider.NativePRNG$NonBlocking");
map.put("SecureRandom.NativePRNGNonBlocking ThreadSafe", "true");
}
/*
@ -329,6 +336,7 @@ final class SunEntries {
map.put("AlgorithmParameters.DSA ImplementedIn", "Software");
map.put("KeyFactory.DSA ImplementedIn", "Software");
map.put("SecureRandom.SHA1PRNG ImplementedIn", "Software");
map.put("SecureRandom.DRBG ImplementedIn", "Software");
map.put("CertificateFactory.X.509 ImplementedIn", "Software");
map.put("KeyStore.JKS ImplementedIn", "Software");
map.put("CertPathValidator.PKIX ImplementedIn", "Software");

View File

@ -403,6 +403,13 @@ public abstract class SSLContextImpl extends SSLContextSpi {
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
suite.name, null)) {
suites.add(suite);
} else {
if (debug != null && Debug.isOn("sslctx") &&
Debug.isOn("verbose")) {
System.out.println(
"Ignoring disabled cipher suite: " +
suite.name);
}
}
} else if (debug != null &&
Debug.isOn("sslctx") && Debug.isOn("verbose")) {

View File

@ -960,17 +960,6 @@ final class SSLSessionImpl extends ExtendedSSLSession {
+ "]";
}
/**
* When SSL sessions are finalized, all values bound to
* them are removed.
*/
@Override
protected void finalize() throws Throwable {
String[] names = getValueNames();
for (int i = 0; i < names.length; i++) {
removeValue(names[i]);
}
}
}

View File

@ -155,7 +155,6 @@ grant codeBase "jrt:/jdk.jsobject" {
grant codeBase "jrt:/jdk.localedata" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
permission java.util.PropertyPermission "*", "read";
};
grant codeBase "jrt:/jdk.naming.dns" {

View File

@ -431,6 +431,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
}
@Override
@SuppressWarnings("deprecation")
public void mouseReleased(final MouseEvent e) {
if (didForwardEvent(e)) return;

View File

@ -55,6 +55,7 @@ public class AquaTextFieldFormattedUI extends AquaTextFieldUI implements MouseLi
super.uninstallListeners();
}
@SuppressWarnings("deprecation")
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() != 1) return;

View File

@ -176,11 +176,12 @@ final class AquaUtils {
}
@Override
@SuppressWarnings("deprecation")
T getInstance() {
try {
ReflectUtil.checkPackageAccess(clazz);
return clazz.newInstance();
} catch (InstantiationException | IllegalAccessException ignored) {
} catch (ReflectiveOperationException ignored) {
}
return null;
}

View File

@ -672,7 +672,7 @@ public abstract class OSXSurfaceData extends BufImgSurfaceData {
TexturePaint color = (TexturePaint) sg2d.paint;
this.fGraphicsStatesInt.put(kColorStateIndex, kColorTexture);
texturePaintImage = color.getImage();
SurfaceData textureSurfaceData = BufImgSurfaceData.createData(texturePaintImage);
SurfaceData textureSurfaceData = OSXOffScreenSurfaceData.createNewSurface(texturePaintImage);
this.fGraphicsStatesInt.put(kColorWidthIndex, texturePaintImage.getWidth());
this.fGraphicsStatesInt.put(kColorHeightIndex, texturePaintImage.getHeight());
Rectangle2D anchor = color.getAnchorRect();

View File

@ -293,6 +293,7 @@ class CAccessibleText {
}, c);
}
@SuppressWarnings("deprecation")
static int[] getVisibleCharacterRange(final Accessible a) {
final Accessible sa = CAccessible.getSwingAccessible(a);
if (!(sa instanceof JTextComponent)) return null;

View File

@ -38,6 +38,7 @@ import java.text.Normalizer.Form;
import java.util.*;
import java.util.regex.*;
import java.awt.datatransfer.*;
import java.nio.charset.StandardCharsets;
import sun.awt.datatransfer.*;
public class CDataTransferer extends DataTransferer {
@ -132,7 +133,7 @@ public class CDataTransferer extends DataTransferer {
String charset = Charset.defaultCharset().name();
if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
try {
charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), StandardCharsets.UTF_8);
} catch (UnsupportedFlavorException cannotHappen) {
}
}

View File

@ -214,6 +214,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
this.setDefaultDragImage();
}
@SuppressWarnings("deprecation")
private void setDefaultDragImage(JTextComponent component) {
DragGestureEvent trigger = getTrigger();
int selectionStart = component.getSelectionStart();

View File

@ -196,7 +196,8 @@ public class CPlatformLWWindow extends CPlatformWindow {
getLocalGraphicsEnvironment();
LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();
int scale =(int) Math.round(((LightweightFrame)peer.getTarget())
.getScaleFactorX());
Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
for (GraphicsDevice d : ge.getScreenDevices()) {

View File

@ -25,10 +25,12 @@
package sun.lwawt.macosx;
import com.apple.eawt.FullScreenAdapter;
import com.apple.eawt.FullScreenUtilities;
import com.apple.eawt.event.FullScreenEvent;
import java.awt.*;
import java.awt.Dialog.ModalityType;
import java.awt.event.*;
import java.awt.peer.WindowPeer;
import java.beans.*;
import java.lang.reflect.InvocationTargetException;
@ -44,6 +46,7 @@ import sun.util.logging.PlatformLogger;
import com.apple.laf.*;
import com.apple.laf.ClientPropertyApplicator.Property;
import com.sun.awt.AWTUtilities;
import sun.lwawt.LWWindowPeer.PeerType;
public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
@ -175,10 +178,24 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
c.setStyleBits(CLOSEABLE, Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_ZOOMABLE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(ZOOMABLE, Boolean.parseBoolean(value.toString()));
boolean zoomable = Boolean.parseBoolean(value.toString());
if (c.target instanceof RootPaneContainer
&& c.getPeer().getPeerType() == PeerType.FRAME) {
if (c.isInFullScreen && !zoomable) {
c.toggleFullScreen();
}
}
c.setStyleBits(ZOOMABLE, zoomable);
}},
new Property<CPlatformWindow>(WINDOW_FULLSCREENABLE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(FULLSCREENABLE, Boolean.parseBoolean(value.toString()));
boolean fullscrenable = Boolean.parseBoolean(value.toString());
if (c.target instanceof RootPaneContainer
&& c.getPeer().getPeerType() == PeerType.FRAME) {
if (c.isInFullScreen && !fullscrenable) {
c.toggleFullScreen();
}
}
c.setStyleBits(FULLSCREENABLE, fullscrenable);
}},
new Property<CPlatformWindow>(WINDOW_SHADOW_REVALIDATE_NOW) { public void applyProperty(final CPlatformWindow c, final Object value) {
nativeRevalidateNSWindowShadow(c.getNSWindowPtr());
@ -210,6 +227,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private volatile boolean isFullScreenMode;
private boolean isFullScreenAnimationOn;
private volatile boolean isInFullScreen;
private Window target;
private LWWindowPeer peer;
protected CPlatformView contentView;
@ -308,6 +327,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
styleBits = SET(styleBits, RESIZABLE, resizable);
if (!resizable) {
styleBits = SET(styleBits, ZOOMABLE, false);
} else {
setCanFullscreen(true);
}
}
@ -680,9 +701,25 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
updateFocusabilityForAutoRequestFocus(true);
}
private void setCanFullscreen(final boolean canFullScreen) {
if (target instanceof RootPaneContainer
&& getPeer().getPeerType() == PeerType.FRAME) {
if (isInFullScreen && !canFullScreen) {
toggleFullScreen();
}
final RootPaneContainer rpc = (RootPaneContainer) target;
rpc.getRootPane().putClientProperty(
CPlatformWindow.WINDOW_FULLSCREENABLE, canFullScreen);
}
}
@Override
public void setResizable(final boolean resizable) {
setCanFullscreen(resizable);
setStyleBits(RESIZABLE, resizable);
setStyleBits(ZOOMABLE, resizable);
}
@Override
@ -1074,6 +1111,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
private void windowDidEnterFullScreen() {
isInFullScreen = true;
isFullScreenAnimationOn = false;
}
@ -1082,6 +1120,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
private void windowDidExitFullScreen() {
isInFullScreen = false;
isFullScreenAnimationOn = false;
}
}

View File

@ -26,6 +26,7 @@
#include <jni.h>
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <AppKit/NSTrackingArea.h>
#import "CPopupMenu.h"
@ -64,12 +65,14 @@ extern "C" {
@public
AWTTrayIcon *trayIcon;
NSImage* image;
NSTrackingArea *trackingArea;
BOOL isHighlighted;
}
-(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon;
-(void)setHighlighted:(BOOL)aFlag;
-(void)setImage:(NSImage*)anImage;
-(void)setTrayIcon:(AWTTrayIcon*)theTrayIcon;
-(void)addTrackingArea;
@end //AWTTrayIconView

View File

@ -171,12 +171,27 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) {
[self setTrayIcon: theTrayIcon];
isHighlighted = NO;
image = nil;
trackingArea = nil;
[self addTrackingArea];
return self;
}
- (void)addTrackingArea {
NSTrackingAreaOptions options = NSTrackingMouseMoved |
NSTrackingInVisibleRect |
NSTrackingActiveAlways;
trackingArea = [[NSTrackingArea alloc] initWithRect: CGRectZero
options: options
owner: self
userInfo: nil];
[self addTrackingArea:trackingArea];
}
-(void) dealloc {
[image release];
[trackingArea release];
[super dealloc];
}
@ -269,6 +284,10 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) {
[trayIcon deliverJavaMouseEvent: event];
}
- (void) mouseMoved: (NSEvent *)event {
[trayIcon deliverJavaMouseEvent: event];
}
- (void) rightMouseDown:(NSEvent *)event {
[trayIcon deliverJavaMouseEvent: event];
}

View File

@ -277,10 +277,12 @@ public final class DocumentHandler extends DefaultHandler {
* @param attributes the attributes attached to the element
*/
@Override
@SuppressWarnings("deprecation")
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
ElementHandler parent = this.handler;
try {
this.handler = getElementHandler(qName).newInstance();
this.handler =
getElementHandler(qName).newInstance();
this.handler.setOwner(this);
this.handler.setParent(parent);
}

View File

@ -86,6 +86,7 @@ class InstanceFinder<T> {
return null;
}
@SuppressWarnings("deprecation")
protected T instantiate(Class<?> type, String name) {
if (type != null) {
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -101,7 +101,8 @@ class TIFFFaxDecompressor extends TIFFDecompressor {
0xff // 8
};
// Table to be used when fillOrder = 2, for flipping bytes.
// Table to be used for flipping bytes when fillOrder is
// BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT (2).
static byte flipTable[] = {
0, -128, 64, -64, 32, -96, 96, -32,
16, -112, 80, -48, 48, -80, 112, -16,
@ -597,7 +598,8 @@ class TIFFFaxDecompressor extends TIFFDecompressor {
TIFFField f;
f = tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_FILL_ORDER);
this.fillOrder = f == null ? 1 : f.getAsInt(0);
this.fillOrder = f == null ?
BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT : f.getAsInt(0);
f = tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
this.compression = f == null ?
@ -612,7 +614,7 @@ class TIFFFaxDecompressor extends TIFFDecompressor {
f = tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_T6_OPTIONS);
this.t6Options = f == null ? 0 : f.getAsInt(0);
} else {
this.fillOrder = 1; // MSB-to-LSB
this.fillOrder = BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT;
this.compression = BaselineTIFFTagSet.COMPRESSION_CCITT_RLE; // RLE
@ -1458,7 +1460,7 @@ class TIFFFaxDecompressor extends TIFFDecompressor {
int l = data.length - 1;
int bp = this.bytePointer;
if (fillOrder == 1) {
if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT) {
b = data[bp];
if (bp == l) {
@ -1471,7 +1473,7 @@ class TIFFFaxDecompressor extends TIFFDecompressor {
next = data[bp + 1];
next2next = data[bp + 2];
}
} else if (fillOrder == 2) {
} else if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT) {
b = flipTable[data[bp] & 0xff];
if (bp == l) {
@ -1527,14 +1529,14 @@ class TIFFFaxDecompressor extends TIFFDecompressor {
int l = data.length - 1;
int bp = this.bytePointer;
if (fillOrder == 1) {
if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT) {
b = data[bp];
if (bp == l) {
next = 0x00;
} else {
next = data[bp + 1];
}
} else if (fillOrder == 2) {
} else if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT) {
b = flipTable[data[bp] & 0xff];
if (bp == l) {
next = 0x00;

View File

@ -49,6 +49,52 @@ public class TIFFIFD extends TIFFDirectory {
private long stripOrTileOffsetsPosition = -1;
private long lastPosition = -1;
//
// A set of tag numbers corresponding to tags essential to decoding
// the image and metadata required to interpret its samples.
//
private static volatile Set<Integer> essentialTags = null;
private static void initializeEssentialTags() {
Set<Integer> tags = essentialTags;
if (tags == null) {
essentialTags = tags = Set.of(
BaselineTIFFTagSet.TAG_BITS_PER_SAMPLE,
BaselineTIFFTagSet.TAG_COLOR_MAP,
BaselineTIFFTagSet.TAG_COMPRESSION,
BaselineTIFFTagSet.TAG_EXTRA_SAMPLES,
BaselineTIFFTagSet.TAG_FILL_ORDER,
BaselineTIFFTagSet.TAG_ICC_PROFILE,
BaselineTIFFTagSet.TAG_IMAGE_LENGTH,
BaselineTIFFTagSet.TAG_IMAGE_WIDTH,
BaselineTIFFTagSet.TAG_JPEG_AC_TABLES,
BaselineTIFFTagSet.TAG_JPEG_DC_TABLES,
BaselineTIFFTagSet.TAG_JPEG_INTERCHANGE_FORMAT,
BaselineTIFFTagSet.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
BaselineTIFFTagSet.TAG_JPEG_PROC,
BaselineTIFFTagSet.TAG_JPEG_Q_TABLES,
BaselineTIFFTagSet.TAG_JPEG_RESTART_INTERVAL,
BaselineTIFFTagSet.TAG_JPEG_TABLES,
BaselineTIFFTagSet.TAG_PHOTOMETRIC_INTERPRETATION,
BaselineTIFFTagSet.TAG_PLANAR_CONFIGURATION,
BaselineTIFFTagSet.TAG_PREDICTOR,
BaselineTIFFTagSet.TAG_REFERENCE_BLACK_WHITE,
BaselineTIFFTagSet.TAG_ROWS_PER_STRIP,
BaselineTIFFTagSet.TAG_SAMPLES_PER_PIXEL,
BaselineTIFFTagSet.TAG_SAMPLE_FORMAT,
BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS,
BaselineTIFFTagSet.TAG_STRIP_OFFSETS,
BaselineTIFFTagSet.TAG_T4_OPTIONS,
BaselineTIFFTagSet.TAG_T6_OPTIONS,
BaselineTIFFTagSet.TAG_TILE_BYTE_COUNTS,
BaselineTIFFTagSet.TAG_TILE_LENGTH,
BaselineTIFFTagSet.TAG_TILE_OFFSETS,
BaselineTIFFTagSet.TAG_TILE_WIDTH,
BaselineTIFFTagSet.TAG_Y_CB_CR_COEFFICIENTS,
BaselineTIFFTagSet.TAG_Y_CB_CR_SUBSAMPLING
);
}
}
/**
* Converts a {@code TIFFDirectory} to a {@code TIFFIFD}.
@ -507,6 +553,15 @@ public class TIFFIFD extends TIFFDirectory {
List<TIFFTagSet> tagSetList = getTagSetList();
boolean ensureEssentialTags = false;
TIFFTagSet baselineTagSet = null;
if (isPrimaryIFD && ignoreUnknownFields
&& !tagSetList.contains(BaselineTIFFTagSet.getInstance())) {
ensureEssentialTags = true;
initializeEssentialTags();
baselineTagSet = BaselineTIFFTagSet.getInstance();
}
List<Object> entries = new ArrayList<>();
Object[] entryData = new Object[1]; // allocate once for later reuse.
@ -530,6 +585,11 @@ public class TIFFIFD extends TIFFDirectory {
// Get the associated TIFFTag.
TIFFTag tag = getTag(tagNumber, tagSetList);
if (tag == null && ensureEssentialTags
&& essentialTags.contains(tagNumber)) {
tag = baselineTagSet.getTag(tagNumber);
}
// Ignore unknown fields, fields with unknown type, and fields
// with count out of int range.
if((tag == null && ignoreUnknownFields)

View File

@ -1174,7 +1174,14 @@ public class TIFFImageReader extends ImageReader {
int predictor = ((predictorField == null)
? BaselineTIFFTagSet.PREDICTOR_NONE
: predictorField.getAsInt(0));
this.decompressor = new TIFFLZWDecompressor(predictor);
TIFFField fillOrderField
= imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_FILL_ORDER);
int fillOrder = ((fillOrderField == null)
? BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT
: fillOrderField.getAsInt(0));
this.decompressor = new TIFFLZWDecompressor(predictor, fillOrder);
} else if (compression
== BaselineTIFFTagSet.COMPRESSION_JPEG) {
this.decompressor = new TIFFJPEGDecompressor();

View File

@ -30,6 +30,10 @@ import javax.imageio.plugins.tiff.BaselineTIFFTagSet;
class TIFFLZWDecompressor extends TIFFDecompressor {
private static final int CLEAR_CODE = 256;
private static final int EOI_CODE = 257;
private static final int FIRST_CODE = 258;
private static final int andTable[] = {
511,
1023,
@ -39,6 +43,10 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
private int predictor;
// whether to reverse the bits in each byte of the input data, i.e.,
// convert right-to-left fill order (lsb) to left-to-right (msb).
private boolean flipBits;
private byte[] srcData;
private byte[] dstData;
@ -51,7 +59,8 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
private int nextData = 0;
private int nextBits = 0;
public TIFFLZWDecompressor(int predictor) throws IIOException {
public TIFFLZWDecompressor(int predictor, int fillOrder)
throws IIOException {
super();
if (predictor != BaselineTIFFTagSet.PREDICTOR_NONE &&
@ -62,6 +71,8 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
}
this.predictor = predictor;
flipBits = fillOrder == BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT;
}
public void decodeRaw(byte[] b,
@ -88,6 +99,12 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
byte[] sdata = new byte[byteCount];
stream.readFully(sdata);
if (flipBits) {
for (int i = 0; i < byteCount; i++) {
sdata[i] = TIFFFaxDecompressor.flipTable[sdata[i] & 0xff];
}
}
int bytesPerRow = (srcWidth*bitsPerPixel + 7)/8;
byte[] buf;
int bufOffset;
@ -133,11 +150,11 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
int code, oldCode = 0;
byte[] string;
while ((code = getNextCode()) != 257) {
if (code == 256) {
while ((code = getNextCode()) != EOI_CODE) {
if (code == CLEAR_CODE) {
initializeStringTable();
code = getNextCode();
if (code == 257) {
if (code == EOI_CODE) {
break;
}
@ -186,12 +203,12 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
public void initializeStringTable() {
stringTable = new byte[4096][];
for (int i = 0; i < 256; i++) {
for (int i = 0; i < CLEAR_CODE; i++) {
stringTable[i] = new byte[1];
stringTable[i][0] = (byte)i;
}
tableIndex = 258;
tableIndex = FIRST_CODE;
bitsToGet = 9;
}
@ -281,7 +298,7 @@ class TIFFLZWDecompressor extends TIFFDecompressor {
return code;
} catch (ArrayIndexOutOfBoundsException e) {
// Strip not terminated as expected: return EndOfInformation code.
return 257;
return EOI_CODE;
}
}
}

View File

@ -88,6 +88,7 @@ public class SwingUtilities3 {
* or {@code Applet}
* @param isRequested the value to set vsyncRequested state to
*/
@SuppressWarnings("deprecation")
public static void setVsyncRequested(Container rootContainer,
boolean isRequested) {
assert (rootContainer instanceof Applet) || (rootContainer instanceof Window);
@ -104,6 +105,7 @@ public class SwingUtilities3 {
* @param rootContainer topmost container. Should be either Window or Applet
* @return {@code true} if vsync painting is requested for {@code rootContainer}
*/
@SuppressWarnings("deprecation")
public static boolean isVsyncRequested(Container rootContainer) {
assert (rootContainer instanceof Applet) || (rootContainer instanceof Window);
return Boolean.TRUE == vsyncedMap.get(rootContainer);

View File

@ -1125,6 +1125,7 @@ class GTKStyle extends SynthStyle implements GTKConstants {
this.methodName = methodName;
}
@SuppressWarnings("deprecation")
public Object createValue(UIDefaults table) {
try {
Class<?> c = Class.forName(className, true,Thread.currentThread().
@ -1136,11 +1137,7 @@ class GTKStyle extends SynthStyle implements GTKConstants {
Method m = c.getMethod(methodName, (Class<?>[])null);
return m.invoke(c, (Object[])null);
} catch (ClassNotFoundException cnfe) {
} catch (IllegalAccessException iae) {
} catch (InvocationTargetException ite) {
} catch (NoSuchMethodException nsme) {
} catch (InstantiationException ie) {
} catch (ReflectiveOperationException e) {
}
return null;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -29,6 +29,7 @@ import com.sun.java.swing.plaf.gtk.GTKConstants.ArrowType;
import com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import javax.swing.plaf.synth.*;
import java.awt.*;
@ -40,7 +41,6 @@ import java.security.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.xml.parsers.*;
import org.xml.sax.SAXException;
@ -226,12 +226,8 @@ class Metacity implements SynthConstants {
JComponent titlePane = (JComponent)button.getParent();
Container titlePaneParent = titlePane.getParent();
JInternalFrame jif;
if (titlePaneParent instanceof JInternalFrame) {
jif = (JInternalFrame)titlePaneParent;
} else if (titlePaneParent instanceof JInternalFrame.JDesktopIcon) {
jif = ((JInternalFrame.JDesktopIcon)titlePaneParent).getInternalFrame();
} else {
JInternalFrame jif = findInternalFrame(titlePaneParent);
if (jif == null) {
return;
}
@ -332,6 +328,19 @@ class Metacity implements SynthConstants {
}
}
JInternalFrame findInternalFrame(Component comp) {
if (comp.getParent() instanceof BasicInternalFrameTitlePane) {
comp = comp.getParent();
}
if (comp instanceof JInternalFrame) {
return (JInternalFrame)comp;
} else if (comp instanceof JInternalFrame.JDesktopIcon) {
return ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
}
assert false : "cannot find the internal frame";
return null;
}
void paintFrameBorder(SynthContext context, Graphics g, int x0, int y0, int width, int height) {
updateFrameGeometry(context);
@ -343,13 +352,8 @@ class Metacity implements SynthConstants {
return;
}
JInternalFrame jif = null;
if (comp instanceof JInternalFrame) {
jif = (JInternalFrame)comp;
} else if (comp instanceof JInternalFrame.JDesktopIcon) {
jif = ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
} else {
assert false : "component is not JInternalFrame or JInternalFrame.JDesktopIcon";
JInternalFrame jif = findInternalFrame(comp);
if (jif == null) {
return;
}
@ -1467,13 +1471,8 @@ class Metacity implements SynthConstants {
JComponent comp = context.getComponent();
JComponent titlePane = findChild(comp, "InternalFrame.northPane");
JInternalFrame jif = null;
if (comp instanceof JInternalFrame) {
jif = (JInternalFrame)comp;
} else if (comp instanceof JInternalFrame.JDesktopIcon) {
jif = ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
} else {
assert false : "component is not JInternalFrame or JInternalFrame.JDesktopIcon";
JInternalFrame jif = findInternalFrame(comp);
if (jif == null) {
return;
}

View File

@ -124,6 +124,7 @@ public class MotifTextUI {
* @param g the graphics context
* @see #damage
*/
@SuppressWarnings("deprecation")
public void paint(Graphics g) {
if(isVisible()) {
try {

View File

@ -132,6 +132,7 @@ public class WindowsTextFieldUI extends BasicTextFieldUI
this.r = r;
}
@SuppressWarnings("deprecation")
public void run() {
JTextField field = (JTextField) getComponent();
if (field != null) {

View File

@ -93,6 +93,7 @@ public abstract class WindowsTextUI extends BasicTextUI {
* @param bounds the bounding box for the highlight
* @param c the editor
*/
@SuppressWarnings("deprecation")
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
Rectangle alloc = bounds.getBounds();
try {

View File

@ -70,6 +70,7 @@ public final class JARSoundbankReader extends SoundbankReader {
}
@Override
@SuppressWarnings("deprecation")
public Soundbank getSoundbank(URL url)
throws InvalidMidiDataException, IOException {
if (!isZIP(url))
@ -93,9 +94,7 @@ public final class JARSoundbankReader extends SoundbankReader {
Object o = c.newInstance();
soundbanks.add((Soundbank) o);
}
} catch (ClassNotFoundException ignored) {
} catch (InstantiationException ignored) {
} catch (IllegalAccessException ignored) {
} catch (ReflectiveOperationException ignored) {
}
}
line = r.readLine();

View File

@ -55,6 +55,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
* @author Arthur van Hoff, Kara Kytle, Jan Borgersen
* @author Florian Bomers
*/
@SuppressWarnings("deprecation")
public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
private static final boolean DEBUG = false;

View File

@ -134,13 +134,12 @@ public abstract class ModelAbstractOscillator
}
@Override
@SuppressWarnings("deprecation")
public ModelOscillatorStream open(float samplerate) {
ModelAbstractOscillator oscs;
try {
oscs = this.getClass().newInstance();
} catch (InstantiationException e) {
throw new IllegalArgumentException(e);
} catch (IllegalAccessException e) {
} catch (ReflectiveOperationException e) {
throw new IllegalArgumentException(e);
}
oscs.setSampleRate(samplerate);

View File

@ -4016,6 +4016,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* {@code true}.
* @see #createBuffers(int, BufferCapabilities)
*/
@SuppressWarnings("deprecation")
protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
throws AWTException
{
@ -8133,6 +8134,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
return res;
}
@SuppressWarnings("deprecation")
final Component getNextFocusCandidate() {
Container rootAncestor = getTraversalRoot();
Component comp = this;

View File

@ -75,6 +75,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
private LinkedList<KeyEvent> enqueuedKeyEvents = new LinkedList<KeyEvent>();
private LinkedList<TypeAheadMarker> typeAheadMarkers = new LinkedList<TypeAheadMarker>();
private boolean consumeNextKeyTyped;
private Component restoreFocusTo;
static {
AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
@ -145,19 +146,24 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
}
private boolean restoreFocus(Window aWindow, Component vetoedComponent,
boolean clearOnFailure) {
restoreFocusTo = null;
Component toFocus =
KeyboardFocusManager.getMostRecentFocusOwner(aWindow);
if (toFocus != null && toFocus != vetoedComponent) {
Component heavyweight = getHeavyweight(aWindow);
if (heavyweight != null) {
setNativeFocusOwner(heavyweight);
Toolkit.getEventQueue().createSecondaryLoop(
() -> getGlobalFocusedWindow() != aWindow, null, 50)
.enter();
}
if (getGlobalFocusedWindow() == aWindow &&
doRestoreFocus(toFocus, vetoedComponent, false)) {
if (getHeavyweight(aWindow) != getNativeFocusOwner()) {
// cannot restore focus synchronously
if (!toFocus.isShowing() || !toFocus.canBeFocusOwner()) {
toFocus = toFocus.getNextFocusCandidate();
}
if (toFocus != null && toFocus != vetoedComponent) {
if (!toFocus.requestFocus(false,
FocusEvent.Cause.ROLLBACK)) {
restoreFocusTo = toFocus;
}
return true;
}
} else if (doRestoreFocus(toFocus, vetoedComponent, false)) {
return true;
}
}
@ -423,6 +429,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// may cause deadlock, thus we don't synchronize this block.
Component toFocus = KeyboardFocusManager.
getMostRecentFocusOwner(newFocusedWindow);
boolean isFocusRestore = restoreFocusTo != null &&
toFocus == restoreFocusTo;
if ((toFocus == null) &&
newFocusedWindow.isFocusableWindow())
{
@ -441,7 +449,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
tempLost, toFocus);
}
if (tempLost != null) {
tempLost.requestFocusInWindow(FocusEvent.Cause.ACTIVATION);
tempLost.requestFocusInWindow(
isFocusRestore && tempLost == toFocus ?
FocusEvent.Cause.ROLLBACK :
FocusEvent.Cause.ACTIVATION);
}
if (toFocus != null && toFocus != tempLost) {
@ -450,6 +461,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
toFocus.requestFocusInWindow(FocusEvent.Cause.ACTIVATION);
}
}
restoreFocusTo = null;
Window realOppositeWindow = this.realOppositeWindowWR.get();
if (realOppositeWindow != we.getOppositeWindow()) {
@ -499,6 +511,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
}
case FocusEvent.FOCUS_GAINED: {
restoreFocusTo = null;
FocusEvent fe = (FocusEvent)e;
Component oldFocusOwner = getGlobalFocusOwner();
Component newFocusOwner = fe.getComponent();

View File

@ -108,7 +108,7 @@ public abstract class GraphicsEnvironment {
ClassLoader cl = ClassLoader.getSystemClassLoader();
geCls = Class.forName(nm, true, cl);
}
ge = (GraphicsEnvironment)geCls.newInstance();
ge = (GraphicsEnvironment)geCls.getConstructor().newInstance();
// long t1 = System.currentTimeMillis();
// System.out.println("GE creation took " + (t1-t0)+ "ms.");
if (isHeadless()) {
@ -116,12 +116,9 @@ public abstract class GraphicsEnvironment {
}
} catch (ClassNotFoundException e) {
throw new Error("Could not find class: "+nm);
} catch (InstantiationException e) {
} catch (ReflectiveOperationException | IllegalArgumentException e) {
throw new Error("Could not instantiate Graphics Environment: "
+ nm);
} catch (IllegalAccessException e) {
throw new Error ("Could not access Graphics Environment: "
+ nm);
}
return ge;
}

View File

@ -407,10 +407,21 @@ public class Taskbar {
}
/**
* Displays progress for specified window.
* Displays a determinate progress bar in the task area for the specified
* window.
* <br>
* The visual behavior is platform and {@link State} dependent.
* <br>
* This call cancels the {@link State#INDETERMINATE INDETERMINATE} state
* of the window.
* <br>
* Note that when multiple windows is grouped in the task area
* the behavior is platform specific.
*
* @param w window to update
* @param value from 0 to 100, other to disable progress indication
* @param value from 0 to 100, other to switch to {@link State#OFF} state
* and disable progress indication
* @see #setWindowProgressState(java.awt.Window, State)
* @throws SecurityException if a security manager exists and it denies the
* {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
@ -426,14 +437,21 @@ public class Taskbar {
/**
* Sets a progress state for a specified window.
* <br>
* Each state displays a progress in a platform-dependent way.
* <br>
* Note than switching from {@link State#INDETERMINATE INDETERMINATE} state
* to any of determinate states may reset value set by
* {@link #setWindowProgressValue(java.awt.Window, int) setWindowProgressValue}
*
* @param w window
* @param state to change to
* @see State#OFF
* @see State#NORMAL
* @see State#PAUSED
* @see State#INDETERMINATE
* @see State#ERROR
* @see State#INDETERMINATE
* @see #setWindowProgressValue(java.awt.Window, int)
* @throws SecurityException if a security manager exists and it denies the
* {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform

View File

@ -468,7 +468,7 @@ public abstract class Toolkit {
private static void fallbackToLoadClassForAT(String atName) {
try {
Class<?> c = Class.forName(atName, false, ClassLoader.getSystemClassLoader());
c.newInstance();
c.getConstructor().newInstance();
} catch (ClassNotFoundException e) {
newAWTError(e, "Assistive Technology not found: " + atName);
} catch (InstantiationException e) {
@ -583,15 +583,13 @@ public abstract class Toolkit {
}
try {
if (cls != null) {
toolkit = (Toolkit)cls.newInstance();
toolkit = (Toolkit)cls.getConstructor().newInstance();
if (GraphicsEnvironment.isHeadless()) {
toolkit = new HeadlessToolkit(toolkit);
}
}
} catch (final InstantiationException ignored) {
throw new AWTError("Could not instantiate Toolkit: " + nm);
} catch (final IllegalAccessException ignored) {
throw new AWTError("Could not access Toolkit: " + nm);
} catch (final ReflectiveOperationException ignored) {
throw new AWTError("Could not create Toolkit: " + nm);
}
return null;
}

View File

@ -79,13 +79,12 @@ public abstract class PrinterJob {
public PrinterJob run() {
String nm = System.getProperty("java.awt.printerjob", null);
try {
return (PrinterJob)Class.forName(nm).newInstance();
return (PrinterJob)Class.forName(nm).
getConstructor().newInstance();
} catch (ClassNotFoundException e) {
throw new AWTError("PrinterJob not found: " + nm);
} catch (InstantiationException e) {
} catch (ReflectiveOperationException e) {
throw new AWTError("Could not instantiate PrinterJob: " + nm);
} catch (IllegalAccessException e) {
throw new AWTError("Could not access PrinterJob: " + nm);
}
}
});

View File

@ -44,6 +44,7 @@ import java.beans.beancontext.BeanContext;
*/
@SuppressWarnings("deprecation")
public interface AppletInitializer {
/**

View File

@ -154,7 +154,7 @@ public class Beans {
* @exception IOException if an I/O error occurs.
* @since 1.2
*/
@SuppressWarnings("deprecation")
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
throws IOException, ClassNotFoundException {
@ -501,7 +501,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream
* Package private support class. This provides a default AppletContext
* for beans which are applets.
*/
@SuppressWarnings("deprecation")
class BeansAppletContext implements AppletContext {
Applet target;
Hashtable<URL,Object> imageCache = new Hashtable<>();
@ -586,6 +586,7 @@ class BeansAppletContext implements AppletContext {
* Package private support class. This provides an AppletStub
* for beans which are applets.
*/
@SuppressWarnings("deprecation")
class BeansAppletStub implements AppletStub {
transient boolean active;
transient Applet target;

View File

@ -36,6 +36,7 @@ import java.awt.Component;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
@ -1278,8 +1279,10 @@ public class Introspector {
* First try the classloader of "sibling", then try the system
* classloader then the class loader of the current Thread.
*/
@SuppressWarnings("deprecation")
static Object instantiate(Class<?> sibling, String className)
throws InstantiationException, IllegalAccessException,
NoSuchMethodException, InvocationTargetException,
ClassNotFoundException {
// First check with sibling's classloader (if any).
ClassLoader cl = sibling.getClassLoader();

View File

@ -1219,7 +1219,7 @@ static final class sun_swing_PrintColorUIResource_PersistenceDelegate extends Pe
internalPersistenceDelegates.put("java.sql.Time", new java_util_Date_PersistenceDelegate());
}
@SuppressWarnings("rawtypes")
@SuppressWarnings({"rawtypes", "deprecation"})
public static synchronized PersistenceDelegate getPersistenceDelegate(Class type) {
if (type == null) {
return nullPersistenceDelegate;
@ -1261,7 +1261,7 @@ static final class sun_swing_PrintColorUIResource_PersistenceDelegate extends Pe
internalPersistenceDelegates.put(typeName, defaultPersistenceDelegate);
try {
String name = type.getName();
Class c = Class.forName("java.beans.MetaData$" + name.replace('.', '_')
Class<?> c = Class.forName("java.beans.MetaData$" + name.replace('.', '_')
+ "_PersistenceDelegate");
pd = (PersistenceDelegate)c.newInstance();
internalPersistenceDelegates.put(typeName, pd);

View File

@ -461,6 +461,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
* not been defined or cannot be created
* @since 1.5
*/
@SuppressWarnings("deprecation")
public PropertyEditor createPropertyEditor(Object bean) {
Object editor = null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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,7 @@ package javax.sound.sampled;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* An instance of the {@code AudioFileFormat} class describes an audio file,
@ -344,7 +345,7 @@ public class AudioFileFormat {
* @param extension the string that commonly marks the file type
* without leading dot
*/
public Type(String name, String extension) {
public Type(final String name, final String extension) {
this.name = name;
this.extension = extension;
}
@ -353,14 +354,14 @@ public class AudioFileFormat {
* Finalizes the equals method.
*/
@Override
public final boolean equals(Object obj) {
if (toString() == null) {
return (obj != null) && (obj.toString() == null);
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Type) {
return toString().equals(obj.toString());
if (!(obj instanceof Type)) {
return false;
}
return false;
return Objects.equals(name, ((Type) obj).name);
}
/**
@ -368,10 +369,7 @@ public class AudioFileFormat {
*/
@Override
public final int hashCode() {
if (toString() == null) {
return 0;
}
return toString().hashCode();
return name != null ? name.hashCode() : 0;
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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,7 @@ package javax.sound.sampled;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* {@code AudioFormat} is the class that specifies a particular arrangement of
@ -599,7 +600,7 @@ public class AudioFormat {
*
* @param name the name of the new type of encoding
*/
public Encoding(String name) {
public Encoding(final String name) {
this.name = name;
}
@ -607,14 +608,14 @@ public class AudioFormat {
* Finalizes the equals method.
*/
@Override
public final boolean equals(Object obj) {
if (toString() == null) {
return (obj != null) && (obj.toString() == null);
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Encoding) {
return toString().equals(obj.toString());
if (!(obj instanceof Encoding)) {
return false;
}
return false;
return Objects.equals(name, ((Encoding) obj).name);
}
/**
@ -622,10 +623,7 @@ public class AudioFormat {
*/
@Override
public final int hashCode() {
if (toString() == null) {
return 0;
}
return toString().hashCode();
return name != null ? name.hashCode() : 0;
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -129,7 +129,7 @@ public abstract class AudioFileWriter {
* system
* @throws NullPointerException if {@code stream} or {@code fileType} or
* {@code out} are {@code null}
* @see #isFileTypeSupported(AudioFileFormat.Type, AudioInputStream)
* @see #isFileTypeSupported(Type, AudioInputStream)
* @see #getAudioFileTypes
*/
public abstract int write(AudioInputStream stream, Type fileType,
@ -149,7 +149,7 @@ public abstract class AudioFileWriter {
* the system
* @throws NullPointerException if {@code stream} or {@code fileType} or
* {@code out} are {@code null}
* @see #isFileTypeSupported
* @see #isFileTypeSupported(Type, AudioInputStream)
* @see #getAudioFileTypes
*/
public abstract int write(AudioInputStream stream, Type fileType, File out)

View File

@ -555,6 +555,7 @@ public abstract class JComponent extends Container implements Serializable,
* @see #setComponentPopupMenu
* @since 1.5
*/
@SuppressWarnings("deprecation")
public JPopupMenu getComponentPopupMenu() {
if(!getInheritsPopupMenu()) {
@ -2913,6 +2914,7 @@ public abstract class JComponent extends Container implements Serializable,
* @param pressed true if the key is pressed
* @return true if there is a key binding for <code>e</code>
*/
@SuppressWarnings("deprecation")
boolean processKeyBindings(KeyEvent e, boolean pressed) {
if (!SwingUtilities.isValidKeyEventForKeyBindings(e)) {
return false;
@ -4457,6 +4459,7 @@ public abstract class JComponent extends Container implements Serializable,
* return value for this method
* @see #getVisibleRect
*/
@SuppressWarnings("deprecation")
static final void computeVisibleRect(Component c, Rectangle visibleRect) {
Container p = c.getParent();
Rectangle bounds = c.getBounds();
@ -4625,6 +4628,7 @@ public abstract class JComponent extends Container implements Serializable,
* or <code>null</code> if not in any container
*/
@BeanProperty(bound = false)
@SuppressWarnings("deprecation")
public Container getTopLevelAncestor() {
for(Container p = this; p != null; p = p.getParent()) {
if(p instanceof Window || p instanceof Applet) {
@ -5032,6 +5036,7 @@ public abstract class JComponent extends Container implements Serializable,
this.paintingChild = paintingChild;
}
@SuppressWarnings("deprecation")
void _paintImmediately(int x, int y, int w, int h) {
Graphics g;
Container c;

View File

@ -825,6 +825,7 @@ public class JEditorPane extends JTextComponent {
*
* @param reference the named location to scroll to
*/
@SuppressWarnings("deprecation")
public void scrollToReference(String reference) {
Document d = getDocument();
if (d instanceof HTMLDocument) {
@ -1179,6 +1180,7 @@ public class JEditorPane extends JTextComponent {
* @return the editor kit, or <code>null</code> if there is nothing
* registered for the given type
*/
@SuppressWarnings("deprecation")
public static EditorKit createEditorKitForContentType(String type) {
Hashtable<String, EditorKit> kitRegistry = getKitRegisty();
EditorKit k = kitRegistry.get(type);

View File

@ -6043,6 +6043,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
this.focusManager = fm;
}
@SuppressWarnings("deprecation")
public void propertyChange(PropertyChangeEvent ev) {
if (!isEditing() || getClientProperty("terminateEditOnFocusLost") != Boolean.TRUE) {
return;

View File

@ -27,6 +27,12 @@ package javax.swing;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.AffineTransform;
import static java.awt.geom.AffineTransform.TYPE_FLIP;
import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE;
import static java.awt.geom.AffineTransform.TYPE_TRANSLATION;
import java.awt.image.AbstractMultiResolutionImage;
import java.awt.image.ImageObserver;
import java.awt.peer.ComponentPeer;
import java.beans.BeanProperty;
import java.beans.Transient;
@ -37,6 +43,8 @@ import javax.swing.border.*;
import javax.accessibility.*;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import sun.awt.AWTAccessor;
@ -739,7 +747,43 @@ public class JViewport extends JComponent implements Accessible
g.clipRect(0, 0, viewBounds.width, viewBounds.height);
}
if (backingStoreImage == null) {
boolean recreateBackingStoreImage = (backingStoreImage == null);
int scaledWidth = width;
int scaledHeight = height;
if (g instanceof Graphics2D) {
double sw = width;
double sh = height;
Graphics2D g2d = (Graphics2D) g;
AffineTransform tx = g2d.getTransform();
int type = tx.getType();
if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) {
// skip
} else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) {
sw = Math.abs(width * tx.getScaleX());
sh = Math.abs(height * tx.getScaleY());
} else {
sw = Math.abs(width * Math.hypot(tx.getScaleX(), tx.getShearY()));
sh = Math.abs(height * Math.hypot(tx.getShearX(), tx.getScaleY()));
}
scaledWidth = (int) Math.ceil(sw);
scaledHeight = (int) Math.ceil(sh);
if (!recreateBackingStoreImage) {
if (backingStoreImage instanceof BackingStoreMultiResolutionImage) {
BackingStoreMultiResolutionImage mrImage
= (BackingStoreMultiResolutionImage) backingStoreImage;
recreateBackingStoreImage = (mrImage.scaledWidth != scaledWidth
|| mrImage.scaledHeight != scaledHeight);
} else {
recreateBackingStoreImage = (width != scaledWidth
|| height != scaledHeight);
}
}
}
if (recreateBackingStoreImage) {
// Backing store is enabled but this is the first call to paint.
// Create the backing store, paint it and then copy to g.
// The backing store image will be created with the size of
@ -747,7 +791,8 @@ public class JViewport extends JComponent implements Accessible
// same size, otherwise when scrolling the backing image
// the region outside of the clipped region will not be painted,
// and result in empty areas.
backingStoreImage = createImage(width, height);
backingStoreImage = createScaledImage(width, height,
scaledWidth, scaledHeight);
Rectangle clip = g.getClipBounds();
if (clip.width != width || clip.height != height) {
if (!isOpaque()) {
@ -815,6 +860,74 @@ public class JViewport extends JComponent implements Accessible
scrollUnderway = false;
}
private Image createScaledImage(final int width, final int height,
int scaledWidth, int scaledHeight)
{
if (scaledWidth == width && scaledHeight == height) {
return createImage(width, height);
}
Image rvImage = createImage(scaledWidth, scaledHeight);
return new BackingStoreMultiResolutionImage(width, height,
scaledWidth, scaledHeight, rvImage);
}
static class BackingStoreMultiResolutionImage
extends AbstractMultiResolutionImage {
private final int width;
private final int height;
private final int scaledWidth;
private final int scaledHeight;
private final Image rvImage;
public BackingStoreMultiResolutionImage(int width, int height,
int scaledWidth, int scaledHeight, Image rvImage) {
this.width = width;
this.height = height;
this.scaledWidth = scaledWidth;
this.scaledHeight = scaledHeight;
this.rvImage = rvImage;
}
@Override
public int getWidth(ImageObserver observer) {
return width;
}
@Override
public int getHeight(ImageObserver observer) {
return height;
}
@Override
protected Image getBaseImage() {
return rvImage;
}
@Override
public Graphics getGraphics() {
Graphics graphics = rvImage.getGraphics();
if (graphics instanceof Graphics2D) {
double sx = (double) scaledWidth / width;
double sy = (double) scaledHeight / height;
((Graphics2D) graphics).scale(sx, sy);
}
return graphics;
}
@Override
public Image getResolutionVariant(double w, double h) {
return rvImage;
}
@Override
public java.util.List<Image> getResolutionVariants() {
return Collections.unmodifiableList(Arrays.asList(rvImage));
}
}
/**
* Sets the bounds of this viewport. If the viewport's width

View File

@ -137,6 +137,7 @@ class KeyboardManager {
/**
* Find the top focusable Window, Applet, or InternalFrame
*/
@SuppressWarnings("deprecation")
private static Container getTopAncestor(JComponent c) {
for(Container p = c.getParent(); p != null; p = p.getParent()) {
if (p instanceof Window && ((Window)p).isFocusableWindow() ||

View File

@ -614,6 +614,7 @@ public class PopupFactory {
* Returns true if popup can fit the screen and the owner's top parent.
* It determines can popup be lightweight or mediumweight.
*/
@SuppressWarnings("deprecation")
boolean fitsOnScreen() {
boolean result = false;
Component component = getComponent();
@ -783,6 +784,8 @@ public class PopupFactory {
component.removeAll();
recycleLightWeightPopup(this);
}
@SuppressWarnings("deprecation")
public void show() {
Container parent = null;
@ -938,6 +941,8 @@ public class PopupFactory {
rootPane.getContentPane().removeAll();
recycleMediumWeightPopup(this);
}
@SuppressWarnings("deprecation")
public void show() {
Component component = getComponent();
Container parent = null;

View File

@ -408,6 +408,7 @@ public class RepaintManager
*
* @see JComponent#repaint
*/
@SuppressWarnings("deprecation")
private void addDirtyRegion0(Container c, int x, int y, int w, int h) {
/* Special cases we don't have to bother with.
*/
@ -521,10 +522,12 @@ public class RepaintManager
* @see JApplet#repaint
* @since 1.6
*/
@SuppressWarnings("deprecation")
public void addDirtyRegion(Applet applet, int x, int y, int w, int h) {
addDirtyRegion0(applet, x, y, w, h);
}
@SuppressWarnings("deprecation")
void scheduleHeavyWeightPaints() {
Map<Container,Rectangle> hws;

View File

@ -416,6 +416,7 @@ public class SwingUtilities implements SwingConstants
* @param p a Point object (converted to the new coordinate system)
* @param c a Component object
*/
@SuppressWarnings("deprecation")
public static void convertPointToScreen(Point p,Component c) {
Rectangle b;
int x,y;
@ -455,6 +456,7 @@ public class SwingUtilities implements SwingConstants
* @param p a Point object (converted to the new coordinate system)
* @param c a Component object
*/
@SuppressWarnings("deprecation")
public static void convertPointFromScreen(Point p,Component c) {
Rectangle b;
int x,y;
@ -1655,6 +1657,7 @@ public class SwingUtilities implements SwingConstants
* @param c the component
* @return the first ancestor of c that's a Window or the last Applet ancestor
*/
@SuppressWarnings("deprecation")
public static Component getRoot(Component c) {
Component applet = null;
for(Component p = c; p != null; p = p.getParent()) {
@ -1695,6 +1698,7 @@ public class SwingUtilities implements SwingConstants
* @return true if a binding has found and processed
* @since 1.4
*/
@SuppressWarnings("deprecation")
public static boolean processKeyBindings(KeyEvent event) {
if (event != null) {
if (event.isConsumed()) {
@ -2209,6 +2213,7 @@ public class SwingUtilities implements SwingConstants
* @see java.awt.Component#isVisible()
* @since 1.7
*/
@SuppressWarnings("deprecation")
static Container getValidateRoot(Container c, boolean visibleOnly) {
Container root = null;

View File

@ -753,6 +753,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
// Returns: 0 no adjust
// -1 can't fit
// >0 adjust value by amount returned
@SuppressWarnings("deprecation")
private int getPopupFitWidth(Rectangle popupRectInScreen, Component invoker){
if (invoker != null){
Container parent;
@ -778,6 +779,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
// Returns: 0 no adjust
// >0 adjust by value return
@SuppressWarnings("deprecation")
private int getPopupFitHeight(Rectangle popupRectInScreen, Component invoker){
if (invoker != null){
Container parent;

View File

@ -513,6 +513,7 @@ public class UIManager implements Serializable
*
* @since 9
*/
@SuppressWarnings("deprecation")
public static LookAndFeel createLookAndFeel(String name)
throws UnsupportedLookAndFeelException {
Objects.requireNonNull(name);
@ -526,14 +527,16 @@ public class UIManager implements Serializable
if (info.getName().equals(name)) {
Class<?> cls = Class.forName(UIManager.class.getModule(),
info.getClassName());
LookAndFeel laf = (LookAndFeel) cls.newInstance();
LookAndFeel laf =
(LookAndFeel) cls.newInstance();
if (!laf.isSupportedLookAndFeel()) {
break;
}
return laf;
}
}
} catch (InstantiationException | IllegalAccessException ignore) {
} catch (ReflectiveOperationException |
IllegalArgumentException ignore) {
}
throw new UnsupportedLookAndFeelException(name);
@ -613,6 +616,7 @@ public class UIManager implements Serializable
* @throws ClassCastException if {@code className} does not identify
* a class that extends {@code LookAndFeel}
*/
@SuppressWarnings("deprecation")
public static void setLookAndFeel(String className)
throws ClassNotFoundException,
InstantiationException,
@ -625,7 +629,16 @@ public class UIManager implements Serializable
}
else {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
try {
LookAndFeel laf =
(LookAndFeel)lnfClass.newInstance();
setLookAndFeel(laf);
} catch (ReflectiveOperationException | IllegalArgumentException e) {
InstantiationException ex =
new InstantiationException("Wrapped Exception");
ex.initCause(e);
throw ex;
}
}
}
@ -1086,6 +1099,7 @@ public class UIManager implements Serializable
/**
* Finds the Multiplexing <code>LookAndFeel</code>.
*/
@SuppressWarnings("deprecation")
private static LookAndFeel getMultiLookAndFeel() {
LookAndFeel multiLookAndFeel = getLAFState().multiLookAndFeel;
if (multiLookAndFeel == null) {
@ -1093,7 +1107,8 @@ public class UIManager implements Serializable
String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
multiLookAndFeel = (LookAndFeel)lnfClass.newInstance();
multiLookAndFeel =
(LookAndFeel)lnfClass.newInstance();
} catch (Exception exc) {
System.err.println("UIManager: failed loading " + className);
}
@ -1408,6 +1423,7 @@ public class UIManager implements Serializable
}
@SuppressWarnings("deprecation")
private static void initializeAuxiliaryLAFs(Properties swingProps)
{
String auxLookAndFeelNames = swingProps.getProperty(auxiliaryLAFsKey);
@ -1427,7 +1443,8 @@ public class UIManager implements Serializable
String className = p.nextToken();
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
LookAndFeel newLAF = (LookAndFeel)lnfClass.newInstance();
LookAndFeel newLAF =
(LookAndFeel)lnfClass.newInstance();
newLAF.initialize();
auxLookAndFeels.addElement(newLAF);
}

View File

@ -403,7 +403,7 @@ public class BasicGraphicsUtils
*/
public static void drawString(JComponent c, Graphics2D g, String string,
float x, float y) {
SwingUtilities2.drawString(c, g, string, (int) x, (int) y);
SwingUtilities2.drawString(c, g, string, x, y, true);
}
/**
@ -439,7 +439,7 @@ public class BasicGraphicsUtils
public static void drawStringUnderlineCharAt(JComponent c, Graphics2D g,
String string, int underlinedIndex, float x, float y) {
SwingUtilities2.drawStringUnderlineCharAt(c, g, string, underlinedIndex,
(int) x, (int) y);
x, y, true);
}
/**
@ -482,6 +482,6 @@ public class BasicGraphicsUtils
* @since 9
*/
public static float getStringWidth(JComponent c, FontMetrics fm, String string) {
return SwingUtilities2.stringWidth(c, fm, string);
return SwingUtilities2.stringWidth(c, fm, string, true);
}
}

View File

@ -926,6 +926,7 @@ public class BasicPopupMenuUI extends PopupMenuUI {
}
}
@SuppressWarnings("deprecation")
boolean isInPopup(Component src) {
for (Component c=src; c!=null; c=c.getParent()) {
if (c instanceof Applet || c instanceof Window) {
@ -1143,6 +1144,7 @@ public class BasicPopupMenuUI extends PopupMenuUI {
}
}
@SuppressWarnings("deprecation")
public void stateChanged(ChangeEvent ev) {
if (!(UIManager.getLookAndFeel() instanceof BasicLookAndFeel)) {
uninstall();

View File

@ -1309,6 +1309,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see javax.swing.text.View#getToolTipText
* @since 1.4
*/
@SuppressWarnings("deprecation")
public String getToolTipText(JTextComponent t, Point pt) {
if (!painted) {
return null;
@ -2264,6 +2265,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* <li>the press event is located over a selection
* </ul>
*/
@SuppressWarnings("deprecation")
protected boolean isDragPossible(MouseEvent e) {
JTextComponent c = (JTextComponent)e.getSource();
if (c.isEnabled()) {

View File

@ -85,6 +85,7 @@ public class MultiTextUI extends TextUI {
* the UI obtained from the default <code>LookAndFeel</code>
* @since 1.4
*/
@SuppressWarnings("deprecation")
public String getToolTipText(JTextComponent a, Point b) {
String returnValue =
((TextUI) (uis.elementAt(0))).getToolTipText(a,b);

View File

@ -304,6 +304,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
*
* @param e the mouse event
*/
@SuppressWarnings("deprecation")
protected void positionCaret(MouseEvent e) {
Point pt = new Point(e.getX(), e.getY());
Position.Bias[] biasRet = new Position.Bias[1];
@ -323,6 +324,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
*
* @param e the mouse event
*/
@SuppressWarnings("deprecation")
protected void moveCaret(MouseEvent e) {
Point pt = new Point(e.getX(), e.getY());
Position.Bias[] biasRet = new Position.Bias[1];
@ -615,6 +617,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
* @param g the graphics context
* @see #damage
*/
@SuppressWarnings("deprecation")
public void paint(Graphics g) {
if(isVisible()) {
try {
@ -959,6 +962,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
* @see #isActive
* @see Caret#setVisible
*/
@SuppressWarnings("deprecation")
public void setVisible(boolean e) {
// focus lost notification can come in later after the
// caret has been deinstalled, in which case the component
@ -1301,6 +1305,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
* event thread so that calling <code>modelToView</code>
* is safe.
*/
@SuppressWarnings("deprecation")
void repaintNewCaret() {
if (component != null) {
TextUI mapper = component.getUI();
@ -1664,6 +1669,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
*
* @param e the action event
*/
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
if (width == 0 || height == 0) {
// setVisible(true) will cause a scroll, only do this if the

View File

@ -1429,6 +1429,7 @@ public class DefaultEditorKit extends EditorKit {
}
/** The operation to perform when this action is triggered. */
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
@ -1542,6 +1543,7 @@ public class DefaultEditorKit extends EditorKit {
* Returns adjustsed {@code y} position that indicates the location to scroll to
* after selecting <code>index</code>.
*/
@SuppressWarnings("deprecation")
private int getAdjustedY(JTextComponent text, Rectangle visible, int index) {
int result = visible.y;
@ -1589,6 +1591,7 @@ public class DefaultEditorKit extends EditorKit {
}
/** The operation to perform when this action is triggered. */
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
@ -1672,6 +1675,7 @@ public class DefaultEditorKit extends EditorKit {
}
/** The operation to perform when this action is triggered. */
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {

View File

@ -405,6 +405,7 @@ public class DefaultHighlighter extends LayeredHighlighter {
* @param bounds the bounding box for the highlight
* @param c the editor
*/
@SuppressWarnings("deprecation")
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
Rectangle alloc = bounds.getBounds();
try {

View File

@ -205,6 +205,7 @@ public class FieldView extends PlainView {
* that is returned, although there is no guarantee.
* The parent may choose to resize or break the view.
*/
@SuppressWarnings("deprecation")
public float getPreferredSpan(int axis) {
switch (axis) {
case View.X_AXIS:

View File

@ -785,6 +785,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* @param p the point to calculate a drop location for
* @return the drop location, or <code>null</code>
*/
@SuppressWarnings("deprecation")
DropLocation dropLocationForPoint(Point p) {
Position.Bias[] bias = new Position.Bias[1];
int index = getUI().viewToModel(this, p, bias);
@ -1959,6 +1960,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* @see javax.swing.plaf.TextUI#getToolTipText
* @see javax.swing.ToolTipManager#registerComponent
*/
@SuppressWarnings("deprecation")
public String getToolTipText(MouseEvent event) {
String retValue = super.getToolTipText(event);

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