This commit is contained in:
J. Duke 2017-07-05 20:33:45 +02:00
commit c07a51a28d
499 changed files with 12121 additions and 8085 deletions

View File

@ -306,3 +306,4 @@ f25ee9f62427a9ba27418e5531a89754791a305b jdk9-b57
ea38728b4f4bdd8fd0d7a89b18069f521cf05013 jdk9-b61
105d045a69174d870b69bfe471b3f2d05a9f8ecc jdk9-b62
0b32ed628fa60e4ab99fb0b5866d648e16231f17 jdk9-b63
82cf9aab9a83e41c8194ba01af9666afdb856cbe jdk9-b64

View File

@ -705,9 +705,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
# is performed.
filtered_files=`$ECHO "$files_present" \
| $SED -e 's/config.log//g' \
-e 's/confdefs.h//g' \
-e 's/fixpath.exe//g' \
-e 's/ //g' \
-e 's/configure.log//g' \
-e 's/confdefs.h//g' \
-e 's/ //g' \
| $TR -d '\n'`
if test "x$filtered_files" != x; then
AC_MSG_NOTICE([Current directory is $CURDIR.])
@ -1054,3 +1054,29 @@ AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS],
AC_SUBST(BASH_ARGS)
])
# Code to run after AC_OUTPUT
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
[
# Try to move config.log (generated by autoconf) to the configure-support directory.
if test -e ./config.log; then
$MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
fi
# Rotate our log file (configure.log)
if test -e "$OUTPUT_ROOT/configure.log.old"; then
$RM -f "$OUTPUT_ROOT/configure.log.old"
fi
if test -e "$OUTPUT_ROOT/configure.log"; then
$MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
fi
# Move configure.log from current directory to the build output root
if test -e ./configure.log; then
echo found it
$MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
fi
# Make the compare script executable
$CHMOD +x $OUTPUT_ROOT/compare.sh
])

View File

@ -255,13 +255,10 @@ if test "x$conf_debug_configure" != x; then
set -x
fi
if test "x$conf_debug_configure" = xtrue; then
# Turn on logging, but don't turn on twice when called recursive
conf_debug_logfile=./debug-configure.log
(exec 3>&1 ; (. $conf_script_to_run "${conf_processed_arguments[@]}" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile
else
( . $conf_script_to_run "${conf_processed_arguments[@]}" )
fi
# Now transfer control to the script generated by autoconf. This is where the
# main work is done.
conf_logfile=./configure.log
(exec 3>&1 ; (. $conf_script_to_run "${conf_processed_arguments[@]}" 2>&1 1>&3 ) | tee -a $conf_logfile 1>&2 ; exec 3>&-) | tee -a $conf_logfile
conf_result_code=$?
###

View File

@ -265,15 +265,10 @@ CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
# Create the actual output files. Now the main work of configure is done.
AC_OUTPUT
# After AC_OUTPUT, we need to do final work
CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK
# Try to move the config.log file to the output directory.
if test -e ./config.log; then
$MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
fi
# Make the compare script executable
$CHMOD +x $OUTPUT_ROOT/compare.sh
BASIC_POST_CONFIG_OUTPUT
# Finally output some useful information to the user
HELP_PRINT_SUMMARY_AND_WARNINGS

View File

@ -231,7 +231,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
AC_SUBST(C_FLAG_REORDER)
AC_SUBST(CXX_FLAG_REORDER)
AC_SUBST(SHARED_LIBRARY_FLAGS)
AC_SUBST(SET_EXECUTABLE_ORIGIN)
AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
AC_SUBST(SET_SHARED_LIBRARY_NAME)
@ -524,6 +523,10 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
# CXXFLAGS_JDK - C++ Compiler flags
# COMMON_CCXXFLAGS_JDK - common to C and C++
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$OPENJDK_TARGET_CPU" = xx86; then
# Force compatibility with i586 on 32 bit intel platforms.
COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
fi
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
case $OPENJDK_TARGET_CPU_ARCH in
@ -900,6 +903,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
[COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
[do not consider native warnings to be an error @<:@enabled@:>@])])
AC_MSG_CHECKING([if native warnings are errors])
if test "x$enable_warnings_as_errors" = "xyes"; then
AC_MSG_RESULT([yes (explicitely set)])
WARNINGS_AS_ERRORS=true
elif test "x$enable_warnings_as_errors" = "xno"; then
AC_MSG_RESULT([no])
WARNINGS_AS_ERRORS=false
elif test "x$enable_warnings_as_errors" = "x"; then
AC_MSG_RESULT([yes (default)])
WARNINGS_AS_ERRORS=true
else
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
fi
AC_SUBST(WARNINGS_AS_ERRORS)
case "${TOOLCHAIN_TYPE}" in
microsoft)
DISABLE_WARNING_PREFIX="-wd"

View File

@ -684,6 +684,7 @@ ZIP_DEBUGINFO_FILES
ENABLE_DEBUG_SYMBOLS
CFLAGS_WARNINGS_ARE_ERRORS
DISABLE_WARNING_PREFIX
WARNINGS_AS_ERRORS
COMPILER_SUPPORTS_TARGET_BITS_FLAG
ZERO_ARCHFLAG
LDFLAGS_TESTEXE_SUFFIX
@ -727,7 +728,6 @@ SET_SHARED_LIBRARY_MAPFILE
SET_SHARED_LIBRARY_NAME
SET_SHARED_LIBRARY_ORIGIN
SET_EXECUTABLE_ORIGIN
SHARED_LIBRARY_FLAGS
CXX_FLAG_REORDER
C_FLAG_REORDER
SYSROOT_LDFLAGS
@ -1086,6 +1086,7 @@ with_jtreg
with_extra_cflags
with_extra_cxxflags
with_extra_ldflags
enable_warnings_as_errors
enable_debug_symbols
enable_zip_debug_info
enable_native_coverage
@ -1852,6 +1853,9 @@ Optional Features:
--enable-rmiconnector-iiop
enable the JMX RMIConnector iiop transport
[disabled]
--disable-warnings-as-errors
do not consider native warnings to be an error
[enabled]
--disable-debug-symbols disable generation of debug symbols [enabled]
--disable-zip-debug-info
disable zipping of debug-info files [enabled]
@ -3496,6 +3500,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Check for support for specific options in bash
# Code to run after AC_OUTPUT
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -4359,7 +4366,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=1430918902
DATE_WHEN_GENERATED=1431429776
###############################################################################
#
@ -15335,9 +15342,9 @@ $as_echo "in current directory" >&6; }
# is performed.
filtered_files=`$ECHO "$files_present" \
| $SED -e 's/config.log//g' \
-e 's/confdefs.h//g' \
-e 's/fixpath.exe//g' \
-e 's/ //g' \
-e 's/configure.log//g' \
-e 's/confdefs.h//g' \
-e 's/ //g' \
| $TR -d '\n'`
if test "x$filtered_files" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Current directory is $CURDIR." >&5
@ -41761,7 +41768,6 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
@ -42029,6 +42035,10 @@ fi
# CXXFLAGS_JDK - C++ Compiler flags
# COMMON_CCXXFLAGS_JDK - common to C and C++
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$OPENJDK_TARGET_CPU" = xx86; then
# Force compatibility with i586 on 32 bit intel platforms.
COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
fi
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
case $OPENJDK_TARGET_CPU_ARCH in
@ -42471,6 +42481,31 @@ $as_echo "$supports" >&6; }
# Check whether --enable-warnings-as-errors was given.
if test "${enable_warnings_as_errors+set}" = set; then :
enableval=$enable_warnings_as_errors;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if native warnings are errors" >&5
$as_echo_n "checking if native warnings are errors... " >&6; }
if test "x$enable_warnings_as_errors" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (explicitely set)" >&5
$as_echo "yes (explicitely set)" >&6; }
WARNINGS_AS_ERRORS=true
elif test "x$enable_warnings_as_errors" = "xno"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
WARNINGS_AS_ERRORS=false
elif test "x$enable_warnings_as_errors" = "x"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5
$as_echo "yes (default)" >&6; }
WARNINGS_AS_ERRORS=true
else
as_fn_error $? "--enable-warnings-as-errors accepts no argument" "$LINENO" 5
fi
case "${TOOLCHAIN_TYPE}" in
microsoft)
DISABLE_WARNING_PREFIX="-wd"
@ -54179,14 +54214,31 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
# After AC_OUTPUT, we need to do final work
# Try to move the config.log file to the output directory.
if test -e ./config.log; then
$MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
fi
# Make the compare script executable
$CHMOD +x $OUTPUT_ROOT/compare.sh
# Try to move config.log (generated by autoconf) to the configure-support directory.
if test -e ./config.log; then
$MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
fi
# Rotate our log file (configure.log)
if test -e "$OUTPUT_ROOT/configure.log.old"; then
$RM -f "$OUTPUT_ROOT/configure.log.old"
fi
if test -e "$OUTPUT_ROOT/configure.log"; then
$MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
fi
# Move configure.log from current directory to the build output root
if test -e ./configure.log; then
echo found it
$MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
fi
# Make the compare script executable
$CHMOD +x $OUTPUT_ROOT/compare.sh
# Finally output some useful information to the user
@ -54280,14 +54332,20 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh
if test -e "$OUTPUT_ROOT/config.log"; then
$GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1
if test $? -eq 0; then
printf "The following warnings were produced. Repeated here for convenience:\n"
# We must quote sed expression (using []) to stop m4 from eating the [].
$GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e 's/^configure:[0-9]*: //'
printf "\n"
# Locate config.log.
if test -e "$CONFIGURESUPPORT_OUTPUTDIR/config.log"; then
CONFIG_LOG_PATH="$CONFIGURESUPPORT_OUTPUTDIR"
elif test -e "./config.log"; then
CONFIG_LOG_PATH="."
fi
fi
if test -e "$CONFIG_LOG_PATH/config.log"; then
$GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" > /dev/null 2>&1
if test $? -eq 0; then
printf "The following warnings were produced. Repeated here for convenience:\n"
# We must quote sed expression (using []) to stop m4 from eating the [].
$GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" | $SED -e 's/^configure:[0-9]*: //'
printf "\n"
fi
fi

View File

@ -212,7 +212,7 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
if test "x$TOOLCHAIN_VERSION" != "x"; then
print_version=" $TOOLCHAIN_VERSION"
fi
printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
printf "* C Compiler: Version $CC_VERSION_NUMBER (at $CC)\n"
printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at $CXX)\n"
@ -263,14 +263,20 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS],
[
if test -e "$OUTPUT_ROOT/config.log"; then
$GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1
if test $? -eq 0; then
printf "The following warnings were produced. Repeated here for convenience:\n"
# We must quote sed expression (using []) to stop m4 from eating the [].
$GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
printf "\n"
# Locate config.log.
if test -e "$CONFIGURESUPPORT_OUTPUTDIR/config.log"; then
CONFIG_LOG_PATH="$CONFIGURESUPPORT_OUTPUTDIR"
elif test -e "./config.log"; then
CONFIG_LOG_PATH="."
fi
fi
if test -e "$CONFIG_LOG_PATH/config.log"; then
$GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" > /dev/null 2>&1
if test $? -eq 0; then
printf "The following warnings were produced. Repeated here for convenience:\n"
# We must quote sed expression (using []) to stop m4 from eating the [].
$GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
printf "\n"
fi
fi
])

View File

@ -321,6 +321,9 @@ CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
DISABLE_WARNING_PREFIX := @DISABLE_WARNING_PREFIX@
CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
# A global flag (true or false) determining if native warnings are considered errors.
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
# Tools that potentially need to be cross compilation aware.
@ -394,9 +397,6 @@ STRIP:=@STRIP@
LIPO:=@LIPO@
# Command to create a shared library
SHARED_LIBRARY_FLAGS:=@SHARED_LIBRARY_FLAGS@
# Options to linker to specify a mapfile.
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@

View File

@ -306,3 +306,4 @@ caa330b275f39282793466529f6864766b31d9fd jdk9-b60
d690f489ca0bb95a6157d996da2fa72bcbcf02ea jdk9-b61
d27f7e0a7aca129969de23e9934408a31b4abf4c jdk9-b62
0acac6937de7a0868f8c6f88b7d036d780abeee6 jdk9-b63
0a5e5a7c3539e8bde73d9fe55750e49a49cb8dac jdk9-b64

View File

@ -466,3 +466,4 @@ ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58
715d2da5801c410746e92f08066d53bde1496286 jdk9-b61
1eab877142cce6ca06e556e2ad0af688f993f00b jdk9-b62
2ac9b6b36689b50d1562627067c92d51781b5684 jdk9-b63
bf92b8db249cdfa5651ef954b6c0743a7e0ea4cd jdk9-b64

View File

@ -810,9 +810,6 @@ class HandlerImpl {
bool unnecessary_volatile(const Node *barrier);
bool needs_releasing_store(const Node *store);
// Use barrier instructions rather than load acquire / store
// release.
const bool UseBarriersForVolatile = false;
// Use barrier instructions for unsafe volatile gets rather than
// trying to identify an exact signature for them
const bool UseBarriersForUnsafeVolatileGet = false;

View File

@ -98,8 +98,8 @@ define_pd_global(intx, InlineSmallCode, 1000);
product(bool, NearCpool, true, \
"constant pool is close to instructions") \
\
notproduct(bool, UseAcqRelForVolatileFields, false, \
"Use acquire and release insns for volatile fields") \
product(bool, UseBarriersForVolatile, false, \
"Use memory barriers to implement volatile accesses") \
\
product(bool, UseCRC32, false, \
"Use CRC32 instructions for CRC32 computation") \
@ -117,8 +117,8 @@ define_pd_global(intx, InlineSmallCode, 1000);
product(bool, NearCpool, true, \
"constant pool is close to instructions") \
\
notproduct(bool, UseAcqRelForVolatileFields, false, \
"Use acquire and release insns for volatile fields") \
product(bool, UseBarriersForVolatile, false, \
"Use memory barriers to implement volatile accesses") \
product(bool, UseNeon, false, \
"Use Neon for CRC32 computation") \
product(bool, UseCRC32, false, \

View File

@ -1314,7 +1314,7 @@ void InterpreterMacroAssembler::profile_switch_case(Register index,
// case_array_offset_in_bytes()
movw(reg2, in_bytes(MultiBranchData::per_case_size()));
movw(rscratch1, in_bytes(MultiBranchData::case_array_offset()));
maddw(index, index, reg2, rscratch1);
Assembler::maddw(index, index, reg2, rscratch1);
// Update the case count
increment_mdp_data_at(mdp,

View File

@ -1625,7 +1625,7 @@ int MacroAssembler::corrected_idivl(Register result, Register ra, Register rb,
sdivw(result, ra, rb);
} else {
sdivw(scratch, ra, rb);
msubw(result, scratch, rb, ra);
Assembler::msubw(result, scratch, rb, ra);
}
return idivl_offset;
@ -1655,7 +1655,7 @@ int MacroAssembler::corrected_idivq(Register result, Register ra, Register rb,
sdiv(result, ra, rb);
} else {
sdiv(scratch, ra, rb);
msub(result, scratch, rb, ra);
Assembler::msub(result, scratch, rb, ra);
}
return idivq_offset;
@ -3787,14 +3787,6 @@ void MacroAssembler::adrp(Register reg1, const Address &dest, unsigned long &byt
}
}
bool MacroAssembler::use_acq_rel_for_volatile_fields() {
#ifdef PRODUCT
return false;
#else
return UseAcqRelForVolatileFields;
#endif
}
void MacroAssembler::build_frame(int framesize) {
if (framesize == 0) {
// Is this even possible?

View File

@ -405,6 +405,18 @@ class MacroAssembler: public Assembler {
umaddl(Rd, Rn, Rm, zr);
}
#define WRAP(INSN) \
void INSN(Register Rd, Register Rn, Register Rm, Register Ra) { \
if ((VM_Version::cpu_cpuFeatures() & VM_Version::CPU_A53MAC) && Ra != zr) \
nop(); \
Assembler::INSN(Rd, Rn, Rm, Ra); \
}
WRAP(madd) WRAP(msub) WRAP(maddw) WRAP(msubw)
WRAP(smaddl) WRAP(smsubl) WRAP(umaddl) WRAP(umsubl)
#undef WRAP
// macro assembly operations needed for aarch64
// first two private routines for loading 32 bit or 64 bit constants
@ -1094,9 +1106,6 @@ public:
address read_polling_page(Register r, address page, relocInfo::relocType rtype);
address read_polling_page(Register r, relocInfo::relocType rtype);
// Used by aarch64.ad to control code generation
static bool use_acq_rel_for_volatile_fields();
// CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic.
void update_byte_crc32(Register crc, Register val, Register table);
void update_word_crc32(Register crc, Register v, Register tmp,
@ -1150,10 +1159,6 @@ private:
int offset, int size);
};
// Used by aarch64.ad to control code generation
#define treat_as_volatile(MEM_NODE) \
(MacroAssembler::use_acq_rel_for_volatile_fields() ? (MEM_NODE)->is_volatile() : false)
#ifdef ASSERT
inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
#endif

View File

@ -59,6 +59,9 @@
int VM_Version::_cpu;
int VM_Version::_model;
int VM_Version::_model2;
int VM_Version::_variant;
int VM_Version::_revision;
int VM_Version::_stepping;
int VM_Version::_cpuFeatures;
const char* VM_Version::_features_str = "";
@ -122,13 +125,47 @@ void VM_Version::get_processor_features() {
char buf[512];
strcpy(buf, "simd");
_cpuFeatures = auxv;
int cpu_lines = 0;
if (FILE *f = fopen("/proc/cpuinfo", "r")) {
char buf[128], *p;
while (fgets(buf, sizeof (buf), f) != NULL) {
if (p = strchr(buf, ':')) {
long v = strtol(p+1, NULL, 0);
if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
_cpu = v;
cpu_lines++;
} else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
_variant = v;
} else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
if (_model != v) _model2 = _model;
_model = v;
} else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
_revision = v;
}
}
}
fclose(f);
}
// Enable vendor specific features
if (_cpu == CPU_CAVIUM && _variant == 0) _cpuFeatures |= CPU_DMB_ATOMICS;
if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _cpuFeatures |= CPU_A53MAC;
// If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07)
// we assume the worst and assume we could be on a big little system and have
// undisclosed A53 cores which we could be swapped to at any stage
if (_cpu == CPU_ARM && cpu_lines == 1 && _model == 0xd07) _cpuFeatures |= CPU_A53MAC;
sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision);
if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2);
if (auxv & HWCAP_ASIMD) strcat(buf, ", simd");
if (auxv & HWCAP_CRC32) strcat(buf, ", crc");
if (auxv & HWCAP_AES) strcat(buf, ", aes");
if (auxv & HWCAP_SHA1) strcat(buf, ", sha1");
if (auxv & HWCAP_SHA2) strcat(buf, ", sha256");
_features_str = strdup(buf);
_features_str = os::strdup(buf);
if (FLAG_IS_DEFAULT(UseCRC32)) {
UseCRC32 = (auxv & HWCAP_CRC32) != 0;
@ -202,6 +239,10 @@ void VM_Version::get_processor_features() {
UseMultiplyToLenIntrinsic = true;
}
if (FLAG_IS_DEFAULT(UseBarriersForVolatile)) {
UseBarriersForVolatile = (_cpuFeatures & CPU_DMB_ATOMICS) != 0;
}
#ifdef COMPILER2
if (FLAG_IS_DEFAULT(OptoScheduling)) {
OptoScheduling = true;

View File

@ -34,6 +34,9 @@ public:
protected:
static int _cpu;
static int _model;
static int _model2;
static int _variant;
static int _revision;
static int _stepping;
static int _cpuFeatures; // features returned by the "cpuid" instruction
// 0 if this instruction is not available
@ -49,7 +52,40 @@ public:
static void assert_is_initialized() {
}
enum {
CPU_ARM = 'A',
CPU_BROADCOM = 'B',
CPU_CAVIUM = 'C',
CPU_DEC = 'D',
CPU_INFINEON = 'I',
CPU_MOTOROLA = 'M',
CPU_NVIDIA = 'N',
CPU_AMCC = 'P',
CPU_QUALCOM = 'Q',
CPU_MARVELL = 'V',
CPU_INTEL = 'i',
} cpuFamily;
enum {
CPU_FP = (1<<0),
CPU_ASIMD = (1<<1),
CPU_EVTSTRM = (1<<2),
CPU_AES = (1<<3),
CPU_PMULL = (1<<4),
CPU_SHA1 = (1<<5),
CPU_SHA2 = (1<<6),
CPU_CRC32 = (1<<7),
CPU_A53MAC = (1 << 30),
CPU_DMB_ATOMICS = (1 << 31),
} cpuFeatureFlags;
static const char* cpu_features() { return _features_str; }
static int cpu_family() { return _cpu; }
static int cpu_model() { return _model; }
static int cpu_model2() { return _model2; }
static int cpu_variant() { return _variant; }
static int cpu_revision() { return _revision; }
static int cpu_cpuFeatures() { return _cpuFeatures; }
};

View File

@ -306,3 +306,4 @@ c12db18748dacfccd6581ead29228c2cb6e51b34 jdk9-b60
f4a4a54620370f077c2e830a5561c8cfa811712b jdk9-b61
3bcf83c1bbc1b7663e930d72c133a9bd86c7618d jdk9-b62
4a8f895f0317dcc90479cb7cc97014312e69edf7 jdk9-b63
6f91749b5aaef1a171ec2254163233438d1071d1 jdk9-b64

View File

@ -567,8 +567,12 @@ public final class MultiDOM implements DOM {
}
public NodeList makeNodeList(DTMAxisIterator iter) {
// TODO: gather nodes from all DOMs ?
return _main.makeNodeList(iter);
int index = iter.next();
if (index == DTM.NULL) {
return null;
}
iter.reset();
return _adapters[getDTMId(index)].makeNodeList(iter);
}
public String getLanguage(int node) {

View File

@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -21,8 +21,15 @@
* questions.
*/
public class X11CNS11643P2 extends X11CNS11643 {
public X11CNS11643P2() {
super(2, "X11CNS11643P2");
package javax.xml.transform;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class DocumentExtFunc {
public static String test(NodeList list) {
Node node = list.item(0);
return "["+node.getNodeName() + ":" + node.getNodeValue()+"]";
}
}

View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
/*
* @summary This class contains tests for XSLT functions.
*/
public class XSLTFunctionsTest {
/**
* @bug 8062518
* Verifies that a reference to the DTM created by XSLT document function is
* actually read from the DTM by an extension function.
* @param xml Content of xml file to process
* @param xsl stylesheet content that loads external document {@code externalDoc}
* with XSLT 'document' function and then reads it with
* DocumentExtFunc.test() function
* @param externalDoc Content of the external xml document
* @param expectedResult Expected transformation result
**/
@Test(dataProvider = "document")
public void testDocument(final String xml, final String xsl,
final String externalDoc, final String expectedResult) throws Exception {
// Prepare sources for transormation
Source src = new StreamSource(new StringReader(xml));
Source xslsrc = new StreamSource(new StringReader(xsl));
// Create factory and transformer
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer( xslsrc );
t.setErrorListener(tf.getErrorListener());
// Set URI Resolver to return the newly constructed xml
// stream source object from xml test string
t.setURIResolver(new URIResolver() {
@Override
public Source resolve(String href, String base)
throws TransformerException {
if (href.contains("externalDoc")) {
return new StreamSource(new StringReader(externalDoc));
} else {
return new StreamSource(new StringReader(xml));
}
}
});
// Prepare output stream
StringWriter xmlResultString = new StringWriter();
StreamResult xmlResultStream = new StreamResult(xmlResultString);
//Transform the xml
t.transform(src, xmlResultStream);
// If the document can't be accessed and the bug is in place then
// reported exception will be thrown during transformation
System.out.println("Transformation result:"+xmlResultString.toString().trim());
// Check the result - it should contain two (node name, node values) entries -
// one for original document, another for a document created with
// call to 'document' function
assertEquals(xmlResultString.toString().trim(), expectedResult);
}
@DataProvider(name = "document")
public static Object[][] documentTestData() {
return new Object[][] {
{documentTestXml, documentTestXsl, documentTestExternalDoc, documentTesteExpectedResult},
};
}
static final String documentTestXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Test>Doc</Test>";
static final String documentTestExternalDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Test>External Doc</Test>";
static final String documentTestXsl = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<xsl:transform version=\"1.0\""
+ " xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" "
+ " xmlns:cfunc=\"http://xml.apache.org/xalan/java/\">"
+ "<xsl:template match=\"/\">"
+ "<xsl:element name=\"root\">"
+ "<xsl:variable name=\"other_doc\" select=\"document(&#39;externalDoc&#39;)\"/>"
+ "<!-- Source -->"
+ "<xsl:value-of select=\"cfunc:javax.xml.transform.DocumentExtFunc.test(/Test)\"/>"
+ "<!-- document() -->"
+ "<xsl:value-of select=\"cfunc:javax.xml.transform.DocumentExtFunc.test($other_doc/Test)\"/>"
+ "</xsl:element></xsl:template></xsl:transform>";
static final String documentTesteExpectedResult = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<root>[Test:Doc][Test:External Doc]</root>";
}

View File

@ -306,3 +306,4 @@ c76339e86ea7da5d9ac7856f3fae9ef73eef04a2 jdk9-b57
da84dcac1b0b12c5b836b05ac75ecbfadee0cd32 jdk9-b61
49118e68fbd4cc0044e718c47db681946d5efd69 jdk9-b62
fd3281c400347088b36aeb16273aa679d53a81a4 jdk9-b63
7de8d036ad0980d988d1b9b4b4e6be555d9fbf98 jdk9-b64

View File

@ -396,7 +396,7 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
$(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER, \
SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
LDFLAGS := $(LDFLAGS_JDKLIB), \
LDFLAGS_SUFFIX_solaris := -lc, \

View File

@ -1833,10 +1833,3 @@ charset x-JIS0212_MS5022X JIS_X_0212_MS5022X
##
########################################################
charset x-COMPOUND_TEXT COMPOUND_TEXT
package sun.nio.cs.ext
type source
os unix
alias COMPOUND_TEXT # JDK historical
alias x11-compound_text
alias x-compound-text

View File

@ -39,7 +39,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
-analyze- -Od -Gd -D_WINDOWS \
-D_UNICODE -DUNICODE -RTC1 -EHsc, \
DISABLED_WARNINGS_microsoft := 4267, \
DISABLED_WARNINGS_microsoft := 4267 4996, \
LDFLAGS := $(LDFLAGS_JDKEXE) \
Advapi32.lib Version.lib User32.lib, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \

View File

@ -84,6 +84,7 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \
DISABLED_WARNINGS_gcc := unused-result, \
MAPFILE := $(UNPACK_MAPFILE),\
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \

View File

@ -246,9 +246,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
format-nonliteral parentheses, \
DISABLED_WARNINGS_clang := logical-op-parentheses, \
DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4297 4244 4267, \
DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
WARNINGS_AS_ERRORS_gcc := false, \
ASFLAGS := $(LIBAWT_ASFLAGS), \
MAPFILE := $(LIBAWT_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
@ -357,6 +358,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
format-security int-to-pointer-cast parentheses, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
WARNINGS_AS_ERRORS_gcc := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
@ -408,11 +410,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
$(SHARED_LIBRARY_FLAGS) $(LIBLCMS_CPPFLAGS) \
$(LIBLCMS_CPPFLAGS) \
$(LCMS_CFLAGS), \
CFLAGS_solaris := -xc99=no_lib, \
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
DISABLED_WARNINGS_gcc := format-nonliteral, \
DISABLED_WARNINGS_gcc := format-nonliteral type-limits, \
DISABLED_WARNINGS_clang := tautological-compare, \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
@ -647,10 +649,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
delete-non-virtual-dtor, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types, \
delete-non-virtual-dtor type-limits, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast, \
DISABLED_WARNINGS_solstudio := truncwarn, \
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090, \
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146, \
WARNINGS_AS_ERRORS_gcc := false, \
WARNINGS_AS_ERRORS_solstudio := false, \
MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@ -880,10 +885,10 @@ ifndef BUILD_HEADLESS_ONLY
OPTIMIZATION := LOW, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
DISABLED_WARNINGS_gcc := type-limits unused-result maybe-uninitialized, \
DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
DISABLED_WARNINGS_clang := incompatible-pointer-types, \
DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST, \
DISABLED_WARNINGS_microsoft := 4244 4267, \
DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@ -956,6 +961,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
DISABLED_WARNINGS_clang := incomplete-implementation \
deprecated-declarations objc-method-access bitwise-op-parentheses \
incompatible-pointer-types parentheses-equality extra-tokens, \
WARNINGS_AS_ERRORS_clang := false, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
-L$(INSTALL_LIBRARIES_HERE), \

View File

@ -149,7 +149,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
DISABLED_WARNINGS_clang := int-conversion, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4022 4267, \
DISABLED_WARNINGS_microsoft := 4022 4267 4996, \
WARNINGS_AS_ERRORS_solstudio := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

View File

@ -38,6 +38,7 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBJ2UCRYPTO_SRC)), \
DISABLED_WARNINGS_solstudio := E_MACRO_REDEFINED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2ucrypto/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB), \
LDFLAGS_SUFFIX := $(LIBDL), \

View File

@ -34,7 +34,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
$(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
DISABLED_WARNINGS_gcc := format-nonliteral, \
DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
DISABLED_WARNINGS_microsoft := 4244 4047 4133, \
DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

View File

@ -70,7 +70,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
$(BUILD_LIBNIO_CFLAGS), \
DISABLED_WARNINGS_gcc := type-limits, \
DISABLED_WARNINGS_clang := tautological-compare, \
DISABLED_WARNINGS_microsoft := 4244, \
DISABLED_WARNINGS_microsoft := 4244 4996, \
MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

View File

@ -111,10 +111,6 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
endif # OPENJDK_TARGET_OS solaris
ifeq ($(OPENJDK_TARGET_CPU), aarch64)
LIBJSOUND_CFLAGS += -DX_ARCH=X_AARCH64
endif
LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
@ -129,6 +125,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
DISABLED_WARNINGS_clang := implicit-function-declaration \
deprecated-writable-strings, \
WARNINGS_AS_ERRORS_clang := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

View File

@ -948,8 +948,15 @@ SetMainClassForAWT(JNIEnv *env, jclass mainClass) {
jmethodID getCanonicalNameMID = NULL;
NULL_CHECK(getCanonicalNameMID = (*env)->GetMethodID(env, classClass, "getCanonicalName", "()Ljava/lang/String;"));
jstring mainClassString = NULL;
NULL_CHECK(mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID));
jstring mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID);
if ((*env)->ExceptionCheck(env)) {
/*
* Clears all errors caused by getCanonicalName() on the mainclass and
* leaves the JAVA_MAIN_CLASS__<pid> empty.
*/
(*env)->ExceptionClear(env);
return;
}
const char *mainClassName = NULL;
NULL_CHECK(mainClassName = (*env)->GetStringUTFChars(env, mainClassString, NULL));
@ -1056,7 +1063,7 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
* Note the jvmInstance must be initialized first before entering into
* ShowSplashScreen, as there is a callback into the JLI_GetJavaVMInstance.
*/
void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm) {
void PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm) {
jvmInstance = vm;
SetMainClassForAWT(env, mainClass);
CHECK_EXCEPTION_RETURN();

View File

@ -272,6 +272,7 @@ public class BufferedReader extends Reader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {

View File

@ -116,6 +116,7 @@ public class CharArrayReader extends Reader {
* the end of the stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char b[], int off, int len) throws IOException {
synchronized (lock) {

View File

@ -69,6 +69,7 @@ public abstract class FilterReader extends Reader {
* Reads characters into a portion of an array.
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
return in.read(cbuf, off, len);

View File

@ -179,6 +179,7 @@ public class InputStreamReader extends Reader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int offset, int length) throws IOException {
return sd.read(cbuf, offset, length);

View File

@ -159,6 +159,8 @@ public class LineNumberReader extends BufferedReader {
*
* @throws IOException
* If an I/O error occurs
*
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
@SuppressWarnings("fallthrough")
public int read(char cbuf[], int off, int len) throws IOException {

View File

@ -286,6 +286,7 @@ public class PipedReader extends Reader {
* <a href=PipedInputStream.html#BROKEN> <code>broken</code></a>,
* {@link #connect(java.io.PipedWriter) unconnected}, closed,
* or an I/O error occurs.
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public synchronized int read(char cbuf[], int off, int len) throws IOException {
if (!connected) {

View File

@ -102,6 +102,7 @@ public class PushbackReader extends FilterReader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {

View File

@ -153,6 +153,9 @@ public abstract class Reader implements Readable, Closeable {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException
* If {@code off} is negative, or {@code len} is negative,
* or {@code len} is greater than {@code cbuf.length - off}
*/
abstract public int read(char cbuf[], int off, int len) throws IOException;

View File

@ -84,6 +84,7 @@ public class StringReader extends Reader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {

View File

@ -26,12 +26,24 @@
package java.lang.annotation;
/**
* Indicates that annotations with a type are to be documented by javadoc
* and similar tools by default. This type should be used to annotate the
* declarations of types whose annotations affect the use of annotated
* elements by their clients. If a type declaration is annotated with
* Documented, its annotations become part of the public API
* of the annotated elements.
* If the annotation {@code @Documented} is present on the declaration
* of an annotation type <i>A</i>, then any {@code @A} annotation on
* an element is considered part of the element's public contract.
*
* In more detail, when an annotation type <i>A</i> is annotated with
* {@code Documented}, the presence and value of annotations of type
* <i>A</i> are a part of the public contract of the elements <i>A</i>
* annotates.
*
* Conversely, if an annotation type <i>B</i> is <em>not</em>
* annotated with {@code Documented}, the presence and value of
* <i>B</i> annotations are <em>not</em> part of the public contract
* of the elements <i>B</i> annotates.
*
* Concretely, if an annotation type is annotated with {@code
* Documented}, by default a tool like javadoc will display
* annotations of that type in its output while annotations of
* annotation types without {@code Documented} will not be displayed.
*
* @author Joshua Bloch
* @since 1.5

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,8 @@ import sun.security.util.SecurityConstants;
* implementation (a default subclass implementation of this abstract class).
* The default Policy implementation can be changed by setting the value
* of the {@code policy.provider} security property to the fully qualified
* name of the desired Policy subclass implementation.
* name of the desired Policy subclass implementation. The system class loader
* is used to load this class.
*
* <p> Application code can directly subclass Policy to provide a custom
* implementation. In addition, an instance of a Policy object can be
@ -111,6 +112,10 @@ public abstract class Policy {
private static final Debug debug = Debug.getInstance("policy");
// Default policy provider
private static final String DEFAULT_POLICY =
"sun.security.provider.PolicyFile";
// Cache mapping ProtectionDomain.Key to PermissionCollection
private WeakHashMap<ProtectionDomain.Key, PermissionCollection> pdMapping;
@ -169,74 +174,7 @@ public abstract class Policy {
synchronized (Policy.class) {
PolicyInfo pinfo = policy.get();
if (pinfo.policy == null) {
String policy_class = AccessController.doPrivileged(
new PrivilegedAction<>() {
public String run() {
return Security.getProperty("policy.provider");
}
});
if (policy_class == null) {
policy_class = "sun.security.provider.PolicyFile";
}
try {
pinfo = new PolicyInfo(
(Policy) Class.forName(policy_class).newInstance(),
true);
} catch (Exception e) {
/*
* The policy_class seems to be an extension
* so we have to bootstrap loading it via a policy
* provider that is on the bootclasspath.
* If it loads then shift gears to using the configured
* provider.
*/
// install the bootstrap provider to avoid recursion
Policy polFile = new sun.security.provider.PolicyFile();
pinfo = new PolicyInfo(polFile, false);
policy.set(pinfo);
final String pc = policy_class;
Policy pol = AccessController.doPrivileged(
new PrivilegedAction<>() {
public Policy run() {
try {
ClassLoader cl =
ClassLoader.getSystemClassLoader();
// we want the extension loader
ClassLoader extcl = null;
while (cl != null) {
extcl = cl;
cl = cl.getParent();
}
return (extcl != null ? (Policy)Class.forName(
pc, true, extcl).newInstance() : null);
} catch (Exception e) {
if (debug != null) {
debug.println("policy provider " +
pc +
" not available");
e.printStackTrace();
}
return null;
}
}
});
/*
* if it loaded install it as the policy provider. Otherwise
* continue to use the system default implementation
*/
if (pol != null) {
pinfo = new PolicyInfo(pol, true);
} else {
if (debug != null) {
debug.println("using sun.security.provider.PolicyFile");
}
pinfo = new PolicyInfo(polFile, true);
}
}
policy.set(pinfo);
return loadPolicyProvider();
}
return pinfo.policy;
}
@ -244,6 +182,70 @@ public abstract class Policy {
return pi.policy;
}
/**
* Loads and instantiates a Policy implementation specified by the
* policy.provider security property. Note that this method should only
* be called by getPolicyNoCheck and from within a synchronized block with
* an intrinsic lock on the Policy.class.
*/
private static Policy loadPolicyProvider() {
String policyProvider =
AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public String run() {
return Security.getProperty("policy.provider");
}
});
/*
* If policy.provider is not set or is set to the default provider,
* simply instantiate it and return.
*/
if (policyProvider == null || policyProvider.isEmpty() ||
policyProvider.equals(DEFAULT_POLICY))
{
Policy polFile = new sun.security.provider.PolicyFile();
policy.set(new PolicyInfo(polFile, true));
return polFile;
}
/*
* Locate, load, and instantiate the policy.provider impl using
* the system class loader. While doing so, install the bootstrap
* provider to avoid potential recursion.
*/
Policy polFile = new sun.security.provider.PolicyFile();
policy.set(new PolicyInfo(polFile, false));
Policy pol = AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Policy run() {
try {
ClassLoader scl = ClassLoader.getSystemClassLoader();
Class<?> c = Class.forName(policyProvider, true, scl);
return (Policy)c.newInstance();
} catch (Exception e) {
if (debug != null) {
debug.println("policy provider " + policyProvider +
" not available");
e.printStackTrace();
}
return null;
}
}
});
if (pol == null) {
// Fallback and use the system default implementation
if (debug != null) {
debug.println("using " + DEFAULT_POLICY);
}
pol = polFile;
}
policy.set(new PolicyInfo(pol, true));
return pol;
}
/**
* Sets the system-wide Policy object. This method first calls
* {@code SecurityManager.checkPermission} with a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,12 @@ package java.security.cert;
* <p>
* This class is used to provide necessary configuration parameters (server
* name and port number) to implementations of the LDAP {@code CertStore}
* algorithm.
* algorithm. However, if you are retrieving certificates or CRLs from
* an ldap URI as specified by RFC 5280, use the
* {@link java.security.cert.URICertStoreParameters URICertStoreParameters}
* instead as the URI may contain additional information such as the
* distinguished name that will help the LDAP CertStore find the specific
* certificates and CRLs.
* <p>
* <b>Concurrent Access</b>
* <p>

View File

@ -0,0 +1,149 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.security.cert;
import java.net.URI;
/**
* Parameters used as input for {@code CertStore} algorithms which use
* information contained in a URI to retrieve certificates and CRLs.
* <p>
* This class is used to provide necessary configuration parameters
* through a URI as defined in RFC 5280 to implementations of
* {@code CertStore} algorithms.
* <p>
* <b>Concurrent Access</b>
* <p>
* Unless otherwise specified, the methods defined in this class are not
* thread-safe. Multiple threads that need to access a single
* object concurrently should synchronize amongst themselves and
* provide the necessary locking. Multiple threads each manipulating
* separate objects need not synchronize.
*
* @since 1.9
* @see CertStore
* @see java.net.URI
*/
public final class URICertStoreParameters implements CertStoreParameters {
/**
* The uri, cannot be null
*/
private final URI uri;
/*
* Hash code for this parameters.
*/
private int myhash = -1;
/**
* Creates an instance of {@code URICertStoreParameters} with the
* specified URI.
*
* @param uri the URI which contains configuration information.
* @throws NullPointerException if {@code uri} is null
*/
public URICertStoreParameters(URI uri) {
if (uri == null) {
throw new NullPointerException();
}
this.uri = uri;
}
/**
* Returns the URI used to construct this
* {@code URICertStoreParameters} object.
*
* @return the URI.
*/
public URI getURI() {
return uri;
}
/**
* Returns a copy of this object. Changes to the copy will not affect
* the original and vice versa.
*
* @return the copy
*/
@Override
public URICertStoreParameters clone() {
try {
return new URICertStoreParameters(uri);
} catch (NullPointerException e) {
/* Cannot happen */
throw new InternalError(e.toString(), e);
}
}
/**
* Returns a hash code value for this parameters object.
* The hash code is generated using the URI supplied at construction.
*
* @return a hash code value for this parameters.
*/
@Override
public int hashCode() {
if (myhash == -1) {
myhash = uri.hashCode()*7;
}
return myhash;
}
/**
* Compares the specified object with this parameters object for equality.
* Two URICertStoreParameters are considered equal if the URIs used
* to construct them are equal.
*
* @param p the object to test for equality with this parameters.
*
* @return true if the specified object is equal to this parameters object.
*/
@Override
public boolean equals(Object p) {
if (p == null || (!(p instanceof URICertStoreParameters))) {
return false;
}
if (p == this) {
return true;
}
URICertStoreParameters other = (URICertStoreParameters)p;
return uri.equals(other.getURI());
}
/**
* Returns a formatted string describing the parameters
* including the URI used to construct this object.
*
* @return a formatted string describing the parameters
*/
@Override
public String toString() {
return "URICertStoreParameters: " + uri.toString();
}
}

View File

@ -64,6 +64,7 @@ import java.util.function.DoubleBinaryOperator;
import java.util.function.Function;
import java.util.function.IntBinaryOperator;
import java.util.function.LongBinaryOperator;
import java.util.function.Predicate;
import java.util.function.ToDoubleBiFunction;
import java.util.function.ToDoubleFunction;
import java.util.function.ToIntBiFunction;
@ -1618,6 +1619,45 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
}
/**
* Helper method for EntrySet.removeIf
*/
boolean removeEntryIf(Predicate<? super Entry<K, V>> function) {
if (function == null) throw new NullPointerException();
Node<K,V>[] t;
boolean removed = false;
if ((t = table) != null) {
Traverser<K,V> it = new Traverser<K,V>(t, t.length, 0, t.length);
for (Node<K,V> p; (p = it.advance()) != null; ) {
K k = p.key;
V v = p.val;
Map.Entry<K,V> e = new AbstractMap.SimpleImmutableEntry<>(k, v);
if (function.test(e) && replaceNode(k, null, v) != null)
removed = true;
}
}
return removed;
}
/**
* Helper method for Values.removeIf
*/
boolean removeValueIf(Predicate<? super V> function) {
if (function == null) throw new NullPointerException();
Node<K,V>[] t;
boolean removed = false;
if ((t = table) != null) {
Traverser<K,V> it = new Traverser<K,V>(t, t.length, 0, t.length);
for (Node<K,V> p; (p = it.advance()) != null; ) {
K k = p.key;
V v = p.val;
if (function.test(v) && replaceNode(k, null, v) != null)
removed = true;
}
}
return removed;
}
/**
* If the specified key is not already associated with a value,
* attempts to compute its value using the given mapping function
@ -4690,6 +4730,10 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
throw new UnsupportedOperationException();
}
public boolean removeIf(Predicate<? super V> filter) {
return map.removeValueIf(filter);
}
public Spliterator<V> spliterator() {
Node<K,V>[] t;
ConcurrentHashMap<K,V> m = map;
@ -4759,6 +4803,10 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
return added;
}
public boolean removeIf(Predicate<? super Entry<K, V>> filter) {
return map.removeEntryIf(filter);
}
public final int hashCode() {
int h = 0;
Node<K,V>[] t;

View File

@ -34,6 +34,7 @@
*/
package java.util.concurrent;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
@ -44,6 +45,14 @@ import java.util.function.Function;
* A {@link java.util.Map} providing thread safety and atomicity
* guarantees.
*
* <p>To maintain the specified guarantees, default implementations of
* methods including {@link #putIfAbsent} inherited from {@link Map}
* must be overridden by implementations of this interface. Similarly,
* implementations of the collections returned by methods {@link
* #keySet}, {@link #values}, and {@link #entrySet} must override
* methods such as {@code removeIf} when necessary to
* preserve atomicity guarantees.
*
* <p>Memory consistency effects: As with other concurrent
* collections, actions in a thread prior to placing an object into a
* {@code ConcurrentMap} as a key or value
@ -60,7 +69,7 @@ import java.util.function.Function;
* @param <K> the type of keys maintained by this map
* @param <V> the type of mapped values
*/
public interface ConcurrentMap<K, V> extends Map<K, V> {
public interface ConcurrentMap<K,V> extends Map<K,V> {
/**
* {@inheritDoc}
@ -86,9 +95,9 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @implSpec The default implementation is equivalent to, for this
* {@code map}:
* <pre> {@code
* for ((Map.Entry<K, V> entry : map.entrySet())
* action.accept(entry.getKey(), entry.getValue());
* }</pre>
* for (Map.Entry<K,V> entry : map.entrySet()) {
* action.accept(entry.getKey(), entry.getValue());
* }}</pre>
*
* @implNote The default implementation assumes that
* {@code IllegalStateException} thrown by {@code getKey()} or
@ -101,13 +110,13 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
@Override
default void forEach(BiConsumer<? super K, ? super V> action) {
Objects.requireNonNull(action);
for (Map.Entry<K, V> entry : entrySet()) {
for (Map.Entry<K,V> entry : entrySet()) {
K k;
V v;
try {
k = entry.getKey();
v = entry.getValue();
} catch(IllegalStateException ise) {
} catch (IllegalStateException ise) {
// this usually means the entry is no longer in the map.
continue;
}
@ -117,14 +126,13 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
/**
* If the specified key is not already associated
* with a value, associate it with the given value.
* This is equivalent to
* <pre> {@code
* with a value, associates it with the given value.
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (!map.containsKey(key))
* return map.put(key, value);
* else
* return map.get(key);
* }</pre>
* return map.get(key);}</pre>
*
* except that the action is performed atomically.
*
@ -147,18 +155,19 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
*/
V putIfAbsent(K key, V value);
V putIfAbsent(K key, V value);
/**
* Removes the entry for a key only if currently mapped to a given value.
* This is equivalent to
* <pre> {@code
* if (map.containsKey(key) && Objects.equals(map.get(key), value)) {
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (map.containsKey(key)
* && Objects.equals(map.get(key), value)) {
* map.remove(key);
* return true;
* } else
* } else {
* return false;
* }</pre>
* }}</pre>
*
* except that the action is performed atomically.
*
@ -181,14 +190,15 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
/**
* Replaces the entry for a key only if currently mapped to a given value.
* This is equivalent to
* <pre> {@code
* if (map.containsKey(key) && Objects.equals(map.get(key), oldValue)) {
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (map.containsKey(key)
* && Objects.equals(map.get(key), oldValue)) {
* map.put(key, newValue);
* return true;
* } else
* } else {
* return false;
* }</pre>
* }}</pre>
*
* except that the action is performed atomically.
*
@ -212,13 +222,12 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
/**
* Replaces the entry for a key only if currently mapped to some value.
* This is equivalent to
* <pre> {@code
* if (map.containsKey(key)) {
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (map.containsKey(key))
* return map.put(key, value);
* } else
* return null;
* }</pre>
* else
* return null;}</pre>
*
* except that the action is performed atomically.
*
@ -249,12 +258,14 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @implSpec
* <p>The default implementation is equivalent to, for this {@code map}:
* <pre> {@code
* for ((Map.Entry<K, V> entry : map.entrySet())
* do {
* K k = entry.getKey();
* V v = entry.getValue();
* } while(!replace(k, v, function.apply(k, v)));
* }</pre>
* for (Map.Entry<K,V> entry : map.entrySet()) {
* K k;
* V v;
* do {
* k = entry.getKey();
* v = entry.getValue();
* } while (!map.replace(k, v, function.apply(k, v)));
* }}</pre>
*
* The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the function
@ -275,7 +286,7 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
default void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
Objects.requireNonNull(function);
forEach((k,v) -> {
while(!replace(k, v, function.apply(k, v))) {
while (!replace(k, v, function.apply(k, v))) {
// v changed or k is gone
if ( (v = get(k)) == null) {
// k is no longer in the map.
@ -295,11 +306,10 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
*
* <pre> {@code
* if (map.get(key) == null) {
* V newValue = mappingFunction.apply(key);
* if (newValue != null)
* return map.putIfAbsent(key, newValue);
* }
* }</pre>
* V newValue = mappingFunction.apply(key);
* if (newValue != null)
* return map.putIfAbsent(key, newValue);
* }}</pre>
*
* The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the mapping
@ -331,18 +341,17 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @implSpec
* The default implementation is equivalent to performing the following
* steps for this {@code map}, then returning the current value or
* {@code null} if now absent. :
* {@code null} if now absent:
*
* <pre> {@code
* if (map.get(key) != null) {
* V oldValue = map.get(key);
* V newValue = remappingFunction.apply(key, oldValue);
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* }
* }</pre>
* V oldValue = map.get(key);
* V newValue = remappingFunction.apply(key, oldValue);
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* }}</pre>
*
* The default implementation may retry these steps when multiple threads
* attempt updates including potentially calling the remapping function
@ -363,13 +372,13 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
V oldValue;
while((oldValue = get(key)) != null) {
while ((oldValue = get(key)) != null) {
V newValue = remappingFunction.apply(key, oldValue);
if (newValue != null) {
if (replace(key, oldValue, newValue))
return newValue;
} else if (remove(key, oldValue))
return null;
return null;
}
return oldValue;
}
@ -386,17 +395,16 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* V oldValue = map.get(key);
* V newValue = remappingFunction.apply(key, oldValue);
* if (oldValue != null ) {
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* } else {
* if (newValue != null)
* map.putIfAbsent(key, newValue);
* else
* return null;
* }
* }</pre>
* if (newValue != null)
* map.putIfAbsent(key, newValue);
* else
* return null;
* }}</pre>
*
* The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the remapping
@ -417,7 +425,7 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
V oldValue = get(key);
for(;;) {
for (;;) {
V newValue = remappingFunction.apply(key, oldValue);
if (newValue == null) {
// delete mapping
@ -458,7 +466,6 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
}
}
/**
* {@inheritDoc}
*
@ -470,12 +477,11 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* <pre> {@code
* V oldValue = map.get(key);
* V newValue = (oldValue == null) ? value :
* remappingFunction.apply(oldValue, value);
* remappingFunction.apply(oldValue, value);
* if (newValue == null)
* map.remove(key);
* map.remove(key);
* else
* map.put(key, newValue);
* }</pre>
* map.put(key, newValue);}</pre>
*
* <p>The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the remapping

View File

@ -58,6 +58,7 @@ import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* A scalable concurrent {@link ConcurrentNavigableMap} implementation.
@ -2492,6 +2493,22 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
else
return (Spliterator<E>)((SubMap<?,E>)m).valueIterator();
}
public boolean removeIf(Predicate<? super E> filter) {
if (filter == null) throw new NullPointerException();
if (m instanceof ConcurrentSkipListMap)
return ((ConcurrentSkipListMap<?,E>)m).removeValueIf(filter);
// else use iterator
@SuppressWarnings("unchecked") Iterator<Map.Entry<Object,E>> it =
((SubMap<Object,E>)m).entryIterator();
boolean removed = false;
while (it.hasNext()) {
Map.Entry<Object,E> e = it.next();
E v = e.getValue();
if (filter.test(v) && m.remove(e.getKey(), v))
removed = true;
}
return removed;
}
}
static final class EntrySet<K1,V1> extends AbstractSet<Map.Entry<K1,V1>> {
@ -2554,6 +2571,20 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
return (Spliterator<Map.Entry<K1,V1>>)
((SubMap<K1,V1>)m).entryIterator();
}
public boolean removeIf(Predicate<? super Entry<K1, V1>> filter) {
if (filter == null) throw new NullPointerException();
if (m instanceof ConcurrentSkipListMap)
return ((ConcurrentSkipListMap<K1,V1>)m).removeEntryIf(filter);
// else use iterator
Iterator<Map.Entry<K1,V1>> it = ((SubMap<K1,V1>)m).entryIterator();
boolean removed = false;
while (it.hasNext()) {
Map.Entry<K1,V1> e = it.next();
if (filter.test(e) && m.remove(e.getKey(), e.getValue()))
removed = true;
}
return removed;
}
}
/**
@ -3266,6 +3297,41 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
}
}
/**
* Helper method for EntrySet.removeIf
*/
boolean removeEntryIf(Predicate<? super Entry<K, V>> function) {
if (function == null) throw new NullPointerException();
boolean removed = false;
for (Node<K,V> n = findFirst(); n != null; n = n.next) {
V v;
if ((v = n.getValidValue()) != null) {
K k = n.key;
Map.Entry<K,V> e = new AbstractMap.SimpleImmutableEntry<>(k, v);
if (function.test(e) && remove(k, v))
removed = true;
}
}
return removed;
}
/**
* Helper method for Values.removeIf
*/
boolean removeValueIf(Predicate<? super V> function) {
if (function == null) throw new NullPointerException();
boolean removed = false;
for (Node<K,V> n = findFirst(); n != null; n = n.next) {
V v;
if ((v = n.getValidValue()) != null) {
K k = n.key;
if (function.test(v) && remove(k, v))
removed = true;
}
}
return removed;
}
/**
* Base class providing common structure for Spliterators.
* (Although not all that much common functionality; as usual for

View File

@ -1522,17 +1522,20 @@ public final class Subject implements java.io.Serializable {
}
}
@Override
public int size() {
return set.size();
}
@Override
public Iterator<T> iterator() {
return set.iterator();
}
@Override
public boolean add(T o) {
if (!o.getClass().isAssignableFrom(c)) {
if (!c.isAssignableFrom(o.getClass())) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("attempting.to.add.an.object.which.is.not.an.instance.of.class"));
Object[] source = {c.toString()};

View File

@ -67,10 +67,6 @@ import java.security.*;
* in RFC 5280. The ValidationAlgorithm attribute notes the
* specification that this provider implements.
*
* - LDAP is the CertStore type for LDAP repositories. The
* LDAPSchema attribute notes the specification defining the
* schema that this provider uses to find certificates and CRLs.
*
* - JavaPolicy is the default file-based Policy type.
*
* - JavaLoginConfig is the default file-based LoginModule Configuration type.
@ -275,9 +271,6 @@ final class SunEntries {
/*
* CertStores
*/
map.put("CertStore.LDAP",
"sun.security.provider.certpath.ldap.LDAPCertStore");
map.put("CertStore.LDAP LDAPSchema", "RFC2587");
map.put("CertStore.Collection",
"sun.security.provider.certpath.CollectionCertStore");
map.put("CertStore.com.sun.security.IndexedCollection",
@ -310,7 +303,6 @@ final class SunEntries {
map.put("KeyStore.JKS ImplementedIn", "Software");
map.put("CertPathValidator.PKIX ImplementedIn", "Software");
map.put("CertPathBuilder.PKIX ImplementedIn", "Software");
map.put("CertStore.LDAP ImplementedIn", "Software");
map.put("CertStore.Collection ImplementedIn", "Software");
map.put("CertStore.com.sun.security.IndexedCollection ImplementedIn",
"Software");

View File

@ -1,148 +0,0 @@
/*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.provider.certpath;
import java.net.URI;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.security.AccessController;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidAlgorithmParameterException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.X509CertSelector;
import java.security.cert.X509CRLSelector;
import javax.security.auth.x500.X500Principal;
import java.io.IOException;
import sun.security.util.Cache;
/**
* Helper used by URICertStore and others when delegating to another CertStore
* to fetch certs and CRLs.
*/
public abstract class CertStoreHelper {
private static final int NUM_TYPES = 2;
private final static Map<String,String> classMap = new HashMap<>(NUM_TYPES);
static {
classMap.put(
"LDAP",
"sun.security.provider.certpath.ldap.LDAPCertStoreHelper");
classMap.put(
"SSLServer",
"sun.security.provider.certpath.ssl.SSLServerCertStoreHelper");
};
private static Cache<String, CertStoreHelper> cache
= Cache.newSoftMemoryCache(NUM_TYPES);
public static CertStoreHelper getInstance(final String type)
throws NoSuchAlgorithmException
{
CertStoreHelper helper = cache.get(type);
if (helper != null) {
return helper;
}
final String cl = classMap.get(type);
if (cl == null) {
throw new NoSuchAlgorithmException(type + " not available");
}
try {
helper = AccessController.doPrivileged(
new PrivilegedExceptionAction<CertStoreHelper>() {
public CertStoreHelper run() throws ClassNotFoundException {
try {
Class<?> c = Class.forName(cl, true, null);
CertStoreHelper csh
= (CertStoreHelper)c.newInstance();
cache.put(type, csh);
return csh;
} catch (InstantiationException |
IllegalAccessException e) {
throw new AssertionError(e);
}
}
});
return helper;
} catch (PrivilegedActionException e) {
throw new NoSuchAlgorithmException(type + " not available",
e.getException());
}
}
static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
switch (type) {
case "LDAP":
case "SSLServer":
try {
CertStoreHelper csh = CertStoreHelper.getInstance(type);
return csh.isCausedByNetworkIssue(cse);
} catch (NoSuchAlgorithmException nsae) {
return false;
}
case "URI":
Throwable t = cse.getCause();
return (t != null && t instanceof IOException);
default:
// we don't know about any other remote CertStore types
return false;
}
}
/**
* Returns a CertStore using the given URI as parameters.
*/
public abstract CertStore getCertStore(URI uri)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException;
/**
* Wraps an existing X509CertSelector when needing to avoid DN matching
* issues.
*/
public abstract X509CertSelector wrap(X509CertSelector selector,
X500Principal certSubject,
String dn)
throws IOException;
/**
* Wraps an existing X509CRLSelector when needing to avoid DN matching
* issues.
*/
public abstract X509CRLSelector wrap(X509CRLSelector selector,
Collection<X500Principal> certIssuers,
String dn)
throws IOException;
/**
* Returns true if the cause of the CertStoreException is a network
* related issue.
*/
public abstract boolean isCausedByNetworkIssue(CertStoreException e);
}

View File

@ -466,6 +466,34 @@ class RevocationChecker extends PKIXRevocationChecker {
stackedCerts, params.trustAnchors());
}
static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
boolean result;
Throwable t = cse.getCause();
switch (type) {
case "LDAP":
if (t != null) {
// These two exception classes are inside java.naming module
String cn = t.getClass().getName();
result = (cn.equals("javax.naming.ServiceUnavailableException") ||
cn.equals("javax.naming.CommunicationException"));
} else {
result = false;
}
break;
case "SSLServer":
result = (t != null && t instanceof IOException);
break;
case "URI":
result = (t != null && t instanceof IOException);
break;
default:
// we don't know about any other remote CertStore types
return false;
}
return result;
}
private void checkCRLs(X509Certificate cert, PublicKey prevKey,
X509Certificate prevCert, boolean signFlag,
boolean allowSeparateKey,
@ -510,7 +538,7 @@ class RevocationChecker extends PKIXRevocationChecker {
"CertStoreException: " + e.getMessage());
}
if (networkFailureException == null &&
CertStoreHelper.isCausedByNetworkIssue(store.getType(),e)) {
isCausedByNetworkIssue(store.getType(),e)) {
// save this exception, we may need to throw it later
networkFailureException = new CertPathValidatorException(
"Unable to determine revocation status due to " +
@ -557,8 +585,7 @@ class RevocationChecker extends PKIXRevocationChecker {
} catch (CertStoreException e) {
if (e instanceof CertStoreTypeException) {
CertStoreTypeException cste = (CertStoreTypeException)e;
if (CertStoreHelper.isCausedByNetworkIssue(cste.getType(),
e)) {
if (isCausedByNetworkIssue(cste.getType(), e)) {
throw new CertPathValidatorException(
"Unable to determine revocation status due to " +
"network error", e, null, -1,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,6 +42,7 @@ import java.security.cert.CertStoreParameters;
import java.security.cert.CertStoreSpi;
import java.security.cert.CRLException;
import java.security.cert.CRLSelector;
import java.security.cert.URICertStoreParameters;
import java.security.cert.X509Certificate;
import java.security.cert.X509CertSelector;
import java.security.cert.X509CRL;
@ -118,9 +119,7 @@ class URICertStore extends CertStoreSpi {
// true if URI is ldap
private boolean ldap = false;
private CertStoreHelper ldapHelper;
private CertStore ldapCertStore;
private String ldapPath;
// Default maximum connect timeout in milliseconds (15 seconds)
// allowed when downloading CRLs
@ -165,13 +164,8 @@ class URICertStore extends CertStoreSpi {
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
ldap = true;
ldapHelper = CertStoreHelper.getInstance("LDAP");
ldapCertStore = ldapHelper.getCertStore(uri);
ldapPath = uri.getPath();
// strip off leading '/'
if (ldapPath.charAt(0) == '/') {
ldapPath = ldapPath.substring(1);
}
URICertStoreParameters lparams = new URICertStoreParameters(uri);
ldapCertStore = CertStore.getInstance("LDAP", lparams);
}
try {
factory = CertificateFactory.getInstance("X.509");
@ -246,20 +240,10 @@ class URICertStore extends CertStoreSpi {
public synchronized Collection<X509Certificate> engineGetCertificates
(CertSelector selector) throws CertStoreException {
// if ldap URI we wrap the CertSelector in an LDAPCertSelector to
// avoid LDAP DN matching issues (see LDAPCertSelector for more info)
if (ldap) {
X509CertSelector xsel = (X509CertSelector) selector;
try {
xsel = ldapHelper.wrap(xsel, xsel.getSubject(), ldapPath);
} catch (IOException ioe) {
throw new CertStoreException(ioe);
}
// Fetch the certificates via LDAP. LDAPCertStore has its own
// caching mechanism, see the class description for more info.
// Safe cast since xsel is an X509 certificate selector.
return (Collection<X509Certificate>)
ldapCertStore.getCertificates(xsel);
ldapCertStore.getCertificates(selector);
}
// Return the Certificates for this entry. It returns the cached value
@ -356,20 +340,11 @@ class URICertStore extends CertStoreSpi {
public synchronized Collection<X509CRL> engineGetCRLs(CRLSelector selector)
throws CertStoreException {
// if ldap URI we wrap the CRLSelector in an LDAPCRLSelector to
// avoid LDAP DN matching issues (see LDAPCRLSelector for more info)
if (ldap) {
X509CRLSelector xsel = (X509CRLSelector) selector;
try {
xsel = ldapHelper.wrap(xsel, null, ldapPath);
} catch (IOException ioe) {
throw new CertStoreException(ioe);
}
// Fetch the CRLs via LDAP. LDAPCertStore has its own
// caching mechanism, see the class description for more info.
// Safe cast since xsel is an X509 certificate selector.
try {
return (Collection<X509CRL>) ldapCertStore.getCRLs(xsel);
return (Collection<X509CRL>) ldapCertStore.getCRLs(selector);
} catch (CertStoreException cse) {
throw new PKIX.CertStoreTypeException("LDAP", cse);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -153,7 +153,7 @@ public final class SSLServerCertStore extends CertStoreSpi {
throw new UnsupportedOperationException();
}
static CertStore getInstance(URI uri)
public static CertStore getInstance(URI uri)
throws InvalidAlgorithmParameterException
{
return new CS(new SSLServerCertStore(uri), null, "SSLServer", null);

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.provider.certpath.ssl;
import java.io.IOException;
import java.net.URI;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidAlgorithmParameterException;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.X509CertSelector;
import java.security.cert.X509CRLSelector;
import java.util.Collection;
import javax.security.auth.x500.X500Principal;
import sun.security.provider.certpath.CertStoreHelper;
/**
* SSL implementation of CertStoreHelper.
*/
public final class SSLServerCertStoreHelper extends CertStoreHelper {
@Override
public CertStore getCertStore(URI uri)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
{
return SSLServerCertStore.getInstance(uri);
}
@Override
public X509CertSelector wrap(X509CertSelector selector,
X500Principal certSubject,
String ldapDN)
throws IOException
{
throw new UnsupportedOperationException();
}
@Override
public X509CRLSelector wrap(X509CRLSelector selector,
Collection<X500Principal> certIssuers,
String ldapDN)
throws IOException
{
throw new UnsupportedOperationException();
}
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
Throwable t = e.getCause();
return (t != null && t instanceof IOException);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,6 +46,9 @@ import java.security.cert.CertStoreException;
import java.security.cert.CRL;
import java.security.cert.X509Certificate;
import java.security.cert.CertificateException;
import java.security.cert.URICertStoreParameters;
import java.text.Collator;
import java.text.MessageFormat;
import java.util.*;
@ -69,7 +72,7 @@ import sun.security.util.ObjectIdentifier;
import sun.security.pkcs10.PKCS10;
import sun.security.pkcs10.PKCS10Attribute;
import sun.security.provider.X509Factory;
import sun.security.provider.certpath.CertStoreHelper;
import sun.security.provider.certpath.ssl.SSLServerCertStore;
import sun.security.util.Password;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
@ -2208,14 +2211,10 @@ public final class Main {
}
}
} else { // must be LDAP, and uri is not null
// Lazily load LDAPCertStoreHelper if present
CertStoreHelper helper = CertStoreHelper.getInstance("LDAP");
String path = uri.getPath();
if (path.charAt(0) == '/') path = path.substring(1);
CertStore s = helper.getCertStore(uri);
X509CRLSelector sel =
helper.wrap(new X509CRLSelector(), null, path);
return s.getCRLs(sel);
URICertStoreParameters params =
new URICertStoreParameters(uri);
CertStore s = CertStore.getInstance("LDAP", params);
return s.getCRLs(new X509CRLSelector());
}
}
@ -2463,9 +2462,7 @@ public final class Main {
out.println(rb.getString("Not.a.signed.jar.file"));
}
} else if (sslserver != null) {
// Lazily load SSLCertStoreHelper if present
CertStoreHelper helper = CertStoreHelper.getInstance("SSLServer");
CertStore cs = helper.getCertStore(new URI("https://" + sslserver));
CertStore cs = SSLServerCertStore.getInstance(new URI("https://" + sslserver));
Collection<? extends Certificate> chain;
try {
chain = cs.getCertificates(null);

View File

@ -78,6 +78,7 @@ security.provider.tbd=sun.security.jgss.SunProvider
security.provider.tbd=com.sun.security.sasl.Provider
security.provider.tbd=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.tbd=sun.security.smartcardio.SunPCSC
security.provider.tbd=sun.security.provider.certpath.ldap.JdkLDAP
#ifdef windows
security.provider.tbd=sun.security.mscapi.SunMSCAPI
#endif
@ -156,7 +157,8 @@ login.configuration.provider=sun.security.provider.ConfigFile
#
# Class to instantiate as the system Policy. This is the name of the class
# that will be used as the Policy object.
# that will be used as the Policy object. The system class loader is used to
# locate this class.
#
policy.provider=sun.security.provider.PolicyFile

View File

@ -194,7 +194,7 @@ void InitLauncher(jboolean javaw);
* For MacOSX and Windows/Unix compatibility we require these
* entry points, some of them may be stubbed out on Windows/Unixes.
*/
void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm);
void PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm);
void ShowSplashScreen();
void RegisterThread();
/*

View File

@ -1206,7 +1206,7 @@ ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash)
}
/* Slash is already there? */
if (name[ulen-1] == '/') {
if (ulen > 0 && name[ulen - 1] == '/') {
break;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, 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

View File

@ -938,7 +938,7 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
}
void
PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm)
PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm)
{
// stubbed out for windows and *nixes.
}

View File

@ -970,7 +970,7 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
}
void
PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm)
PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm)
{
// stubbed out for windows and *nixes.
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,14 +25,18 @@
package com.apple.eawt;
import java.awt.*;
import java.awt.peer.*;
import java.awt.Image;
import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.Toolkit;
import java.awt.Window;
import java.beans.Beans;
import javax.swing.JMenuBar;
import sun.lwawt.*;
import sun.lwawt.macosx.*;
import sun.awt.AWTAccessor;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CPlatformWindow;
/**
* The <code>Application</code> class allows you to integrate your Java application with the native Mac OS X environment.
@ -385,10 +389,8 @@ public class Application {
*
* @since Java for Mac OS X 10.7 Update 1
*/
@SuppressWarnings("deprecation")
public void requestToggleFullScreen(final Window window) {
final ComponentPeer peer = window.getPeer();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
if (!(peer instanceof LWWindowPeer)) return;
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
if (!(platformWindow instanceof CPlatformWindow)) return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package com.apple.eawt;
import java.awt.*;
import java.lang.reflect.*;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
import sun.lwawt.macosx.CImage.Creator;
@ -41,7 +42,6 @@ class _AppDockIconHandler {
_AppDockIconHandler() { }
@SuppressWarnings("deprecation")
public void setDockMenu(final PopupMenu menu) {
fDockMenu = menu;
@ -61,8 +61,8 @@ class _AppDockIconHandler {
// instantiate the menu peer and set the native fDockMenu ivar
menu.addNotify();
final long nsMenuPtr = ((CMenu)fDockMenu.getPeer()).getNativeMenu();
nativeSetDockMenu(nsMenuPtr);
CMenu peer = AWTAccessor.getMenuComponentAccessor().getPeer(fDockMenu);
nativeSetDockMenu(peer.getNativeMenu());
}
public PopupMenu getDockMenu() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import javax.swing.*;
import javax.swing.plaf.MenuBarUI;
import com.apple.laf.ScreenMenuBar;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI;
@ -49,7 +50,10 @@ class _AppMenuBarHandler {
}
// callback from the native delegate -init function
private static void initMenuStates(final boolean aboutMenuItemVisible, final boolean aboutMenuItemEnabled, final boolean prefsMenuItemVisible, final boolean prefsMenuItemEnabled) {
private static void initMenuStates(final boolean aboutMenuItemVisible,
final boolean aboutMenuItemEnabled,
final boolean prefsMenuItemVisible,
final boolean prefsMenuItemEnabled) {
synchronized (instance) {
instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
@ -92,7 +96,6 @@ class _AppMenuBarHandler {
return (frame.getExtendedState() & Frame.ICONIFIED) != 0;
}
@SuppressWarnings("deprecation")
static void installDefaultMenuBar(final JMenuBar menuBar) {
if (menuBar == null) {
// intentionally clearing the default menu
@ -114,7 +117,7 @@ class _AppMenuBarHandler {
}
screenMenuBar.addNotify();
final MenuComponentPeer peer = screenMenuBar.getPeer();
final Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar);
if (!(peer instanceof CMenuBar)) {
// such a thing should not be possible
throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar");

View File

@ -151,20 +151,6 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
editor.getDocument().addDocumentListener(this);
}
@Override
public void focusGained(final FocusEvent e) {
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void focusLost(final FocusEvent e) {
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void changedUpdate(final DocumentEvent e) {
editorTextChanged();
@ -252,6 +238,16 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
*/
protected FocusListener createFocusListener() {
return new BasicComboBoxUI.FocusHandler() {
@Override
public void focusGained(FocusEvent e) {
super.focusGained(e);
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void focusLost(final FocusEvent e) {
hasFocus = false;
if (!e.isTemporary()) {
@ -264,6 +260,10 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
if (ac != null) {
ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleState.FOCUSED, null);
}
if (arrowButton != null) {
arrowButton.repaint();
}
}
};
}
@ -438,6 +438,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
if (editor != null) {
final Rectangle editorRect = rectangleForCurrentValue();
editorRect.width += 4;
editorRect.height += 1;
editor.setBounds(editorRect);
}
}

View File

@ -124,7 +124,7 @@ public class AquaTextFieldBorder extends AquaBorder {
public Insets getBorderInsets(final Component c) {
if (!(c instanceof JTextComponent) || c.isOpaque()) return new InsetsUIResource(3, 7, 3, 7);
return new InsetsUIResource(6, 7, 6, 7);
return new InsetsUIResource(5, 5, 5, 5);
}
protected static State getStateFor(final JTextComponent jc) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,11 +27,11 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import java.util.Hashtable;
import javax.swing.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.lwawt.LWToolkit;
import sun.lwawt.macosx.*;
@ -212,24 +212,36 @@ final class ScreenMenu extends Menu
// Send a mouseExited to the previously hilited item, if it wasn't 0.
if (target != fLastMouseEventTarget) {
if (fLastMouseEventTarget != null) {
LWToolkit.postEvent(new MouseEvent(fLastMouseEventTarget, MouseEvent.MOUSE_EXITED, when, modifiers, x - fLastTargetRect.x, y - fLastTargetRect.y, 0, false));
LWToolkit.postEvent(
new MouseEvent(fLastMouseEventTarget,
MouseEvent.MOUSE_EXITED, when,
modifiers, x - fLastTargetRect.x,
y - fLastTargetRect.y, 0,
false));
}
// Send a mouseEntered to the current hilited item, if it wasn't 0.
// Send a mouseEntered to the current hilited item, if it
// wasn't 0.
if (target != null) {
LWToolkit.postEvent(new MouseEvent(target, MouseEvent.MOUSE_ENTERED, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false));
LWToolkit.postEvent(
new MouseEvent(target, MouseEvent.MOUSE_ENTERED,
when, modifiers,
x - targetRect.x,
y - targetRect.y, 0, false));
}
fLastMouseEventTarget = target;
fLastTargetRect = targetRect;
}
// Post a mouse event to the current item.
if (target == null) return;
LWToolkit.postEvent(new MouseEvent(target, kind, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false));
LWToolkit.postEvent(
new MouseEvent(target, kind, when, modifiers,
x - targetRect.x, y - targetRect.y, 0,
false));
}
});
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
super.addNotify();
@ -248,7 +260,8 @@ final class ScreenMenu extends Menu
if (tooltipText != null) {
setToolTipText(tooltipText);
}
final MenuComponentPeer peer = getPeer();
final Object peer = AWTAccessor.getMenuComponentAccessor()
.getPeer(this);
if (peer instanceof CMenu) {
final CMenu menu = (CMenu) peer;
final long nativeMenu = menu.getNativeMenu();
@ -355,9 +368,8 @@ final class ScreenMenu extends Menu
public void setIndeterminate(boolean indeterminate) { }
@Override
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@ -365,9 +377,8 @@ final class ScreenMenu extends Menu
}
@Override
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,19 +25,21 @@
package com.apple.laf;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.*;
import java.security.*;
import java.util.*;
import javax.swing.*;
import static sun.awt.AWTAccessor.*;
@SuppressWarnings("serial") // JDK implementation class
public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenMenuPropertyHandler, ComponentListener {
public class ScreenMenuBar extends MenuBar
implements ContainerListener, ScreenMenuPropertyHandler,
ComponentListener {
static boolean sJMenuBarHasHelpMenus = false; //$ could check by calling getHelpMenu in a try block
JMenuBar fSwingBar;
@ -246,22 +248,23 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM
fSubmenus.remove(menu);
}
@SuppressWarnings("deprecation")
public Menu add(final Menu m, final int index) {
synchronized (getTreeLock()) {
if (m.getParent() != null) {
m.getParent().remove(m);
}
final Vector<Menu> menus = AWTAccessor.getMenuBarAccessor().getMenus(this);
final Vector<Menu> menus = getMenuBarAccessor().getMenus(this);
menus.insertElementAt(m, index);
AWTAccessor.getMenuComponentAccessor().setParent(m, this);
final MenuComponentAccessor acc = getMenuComponentAccessor();
acc.setParent(m, this);
final CMenuBar peer = (CMenuBar)getPeer();
final CMenuBar peer = acc.getPeer(this);
if (peer == null) return m;
peer.setNextInsertionIndex(index);
if (m.getPeer() == null) {
final CMenuBar mPeer = acc.getPeer(m);
if (mPeer == null) {
m.addNotify();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,15 +27,18 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuItem;
@SuppressWarnings("serial") // JDK implementation class
final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
final class ScreenMenuItem extends MenuItem
implements ActionListener, ComponentListener,
ScreenMenuPropertyHandler {
ScreenMenuPropertyListener fListener;
JMenuItem fMenuItem;
@ -97,9 +100,8 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
fMenuItem.removeComponentListener(this);
}
@SuppressWarnings("deprecation")
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
final MenuComponentPeer peer = menuItem.getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
if (!(peer instanceof CMenuItem)) {
//Is it possible?
return;
@ -166,18 +168,16 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
}
}
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
cmi.setToolTipText(text);
}
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,17 +27,20 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
@SuppressWarnings("serial") // JDK implementation class
final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
final class ScreenMenuItemCheckbox extends CheckboxMenuItem
implements ActionListener, ComponentListener, ScreenMenuPropertyHandler,
ItemListener {
JMenuItem fMenuItem;
MenuContainer fParent;
@ -57,12 +60,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
}
ScreenMenuPropertyListener fPropertyListener;
@SuppressWarnings("deprecation")
public void addNotify() {
super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer();
CCheckboxMenuItem ccb = AWTAccessor.getMenuComponentAccessor().getPeer(this);
ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this);
@ -155,17 +158,15 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
setVisible(false);
}
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
((CMenuItem)peer).setToolTipText(text);
}
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@ -208,9 +209,8 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
}
}
@SuppressWarnings("deprecation")
public void setIndeterminate(final boolean indeterminate) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (peer instanceof CCheckboxMenuItem) {
((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
}

View File

@ -72,7 +72,8 @@ public abstract class CGraphicsConfig extends GraphicsConfiguration
@Override
public AffineTransform getDefaultTransform() {
return new AffineTransform();
double scaleFactor = device.getScaleFactor();
return AffineTransform.getScaleInstance(scaleFactor, scaleFactor);
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -206,17 +206,15 @@ public final class CGraphicsDevice extends GraphicsDevice
return true;
}
@SuppressWarnings("deprecation")
private static void enterFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer();
FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
peer.enterFullScreenMode();
}
}
@SuppressWarnings("deprecation")
private static void exitFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer();
FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
peer.exitFullScreenMode();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,13 +33,14 @@ import java.awt.Transparency;
import java.awt.image.ColorModel;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.BackBufferCapsProvider;
import sun.java2d.SurfaceData;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
@ -74,11 +75,11 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData = null;
Component comp = vImg.getComponent();
final ComponentPeer peer = (comp != null) ? comp.getPeer() : null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
final ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try {
boolean createVSynced = false;

View File

@ -930,8 +930,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
return false;
}
final LWWindowPeer parentPeer =
(LWWindowPeer) AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (parentPeer == null) {
focusLog.fine("request rejected, parentPeer is null");
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());

View File

@ -33,6 +33,7 @@ import java.util.List;
import javax.swing.*;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.*;
import sun.java2d.loops.Blit;
import sun.java2d.loops.CompositeType;
@ -505,7 +506,7 @@ public class LWWindowPeer
@Override
public void repositionSecurityWarning() {
if (warningWindow != null) {
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
Window target = getTarget();
int x = compAccessor.getX(target);
int y = compAccessor.getY(target);
@ -563,8 +564,7 @@ public class LWWindowPeer
public void blockWindows(List<Window> windows) {
//TODO: LWX will probably need some collectJavaToplevels to speed this up
for (Window w : windows) {
WindowPeer wp =
(WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) {
wp.setModalBlocked((Dialog)getTarget(), true);
}
@ -1247,7 +1247,8 @@ public class LWWindowPeer
private boolean isOneOfOwnersOf(LWWindowPeer peer) {
Window owner = (peer != null ? peer.getTarget().getOwner() : null);
while (owner != null) {
if ((LWWindowPeer)owner.getPeer() == this) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (acc.getPeer(owner) == this) {
return true;
}
owner = owner.getOwner();
@ -1321,8 +1322,8 @@ public class LWWindowPeer
while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
owner = owner.getOwner();
}
return owner == null ? null :
(LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
return owner == null ? null : AWTAccessor.getComponentAccessor()
.getPeer(owner);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,6 +39,7 @@ import javax.accessibility.*;
import java.util.Map;
import java.util.concurrent.Callable;
import sun.awt.AWTAccessor;
import sun.awt.dnd.*;
import sun.lwawt.LWComponentPeer;
import sun.lwawt.LWWindowPeer;
@ -88,7 +89,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
super.startDrag(dsc, cursor, dragImage, dragImageOffset);
}
@SuppressWarnings("deprecation")
protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
DragGestureEvent trigger = getTrigger();
InputEvent triggerEvent = trigger.getTriggerEvent();
@ -135,7 +135,9 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
try {
//It sure will be LWComponentPeer instance as rootComponent is a Window
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
LWComponentPeer<?, ?> peer = AWTAccessor.getComponentAccessor()
.getPeer(rootComponent);
PlatformWindow platformWindow = peer.getPlatformWindow();
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke;
import java.awt.Point;
import java.awt.Toolkit;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer;
@ -46,9 +47,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
show();
}
@SuppressWarnings("deprecation")
public void addNotify() {
if (getPeer() == null) {
if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
setPeer(peer);
@ -61,10 +61,9 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void unregisterAccelerator(AWTKeyStroke stroke) {}
@SuppressWarnings("deprecation")
protected long getLayerPtr() {
LWWindowPeer peer = (LWWindowPeer)getPeer();
return peer.getLayerPtr();
return AWTAccessor.getComponentAccessor().<LWWindowPeer>getPeer(this)
.getLayerPtr();
}
// -----------------------------------------------------------------------

View File

@ -138,17 +138,6 @@ public class CImage extends CFRetainedResource {
return ((DataBufferInt)bimg.getRaster().getDataBuffer()).getData();
}
public CImage createFromImageImmediately(final Image image) {
int[] buffer = imageToArray(image, false);
if (buffer == null) {
return null;
}
return new CImage(nativeCreateNSImageFromArray(buffer, image.getWidth(null),
image.getHeight(null)));
}
public byte[] getPlatformImageBytes(final Image image) {
int[] buffer = imageToArray(image, false);
@ -168,20 +157,33 @@ public class CImage extends CFRetainedResource {
// This is used to create a CImage from a Image
public CImage createFromImage(final Image image) {
return createFromImage(image, true);
}
public CImage createFromImageImmediately(final Image image) {
return createFromImage(image, false);
}
// This is used to create a CImage from a Image
private CImage createFromImage(final Image image, final boolean prepareImage) {
if (image instanceof MultiResolutionImage) {
List<Image> resolutionVariants
= ((MultiResolutionImage) image).getResolutionVariants();
return createFromImages(resolutionVariants);
return createFromImages(resolutionVariants, prepareImage);
}
int[] buffer = imageToArray(image, true);
int[] buffer = imageToArray(image, prepareImage);
if (buffer == null) {
return null;
}
return new CImage(nativeCreateNSImageFromArray(buffer, image.getWidth(null), image.getHeight(null)));
}
public CImage createFromImages(List<Image> images) {
public CImage createFromImages(final List<Image> images) {
return createFromImages(images, true);
}
private CImage createFromImages(final List<Image> images, final boolean prepareImage) {
if (images == null || images.isEmpty()) {
return null;
}
@ -194,8 +196,8 @@ public class CImage extends CFRetainedResource {
num = 0;
for (Image img : images) {
buffers[num] = imageToArray(img, true);
for (final Image img : images) {
buffers[num] = imageToArray(img, prepareImage);
if (buffers[num] == null) {
// Unable to process the image
continue;
@ -210,9 +212,9 @@ public class CImage extends CFRetainedResource {
}
return new CImage(nativeCreateNSImageFromArrays(
Arrays.copyOf(buffers, num),
Arrays.copyOf(w, num),
Arrays.copyOf(h, num)));
Arrays.copyOf(buffers, num),
Arrays.copyOf(w, num),
Arrays.copyOf(h, num)));
}
static int getSelectorAsInt(final String fromString) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,9 +38,12 @@ import java.text.AttributedCharacterIterator.Attribute;
import java.text.*;
import javax.swing.text.JTextComponent;
import sun.awt.AWTAccessor;
import sun.awt.im.InputMethodAdapter;
import sun.lwawt.*;
import static sun.awt.AWTAccessor.ComponentAccessor;
public class CInputMethod extends InputMethodAdapter {
private InputMethodContext fIMContext;
private Component fAwtFocussedComponent;
@ -385,12 +388,11 @@ public class CInputMethod extends InputMethodAdapter {
// java.awt.Toolkit#getNativeContainer() is not available
// from this package
@SuppressWarnings("deprecation")
private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
if (comp==null)
return null;
ComponentPeer peer = comp.getPeer();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(comp);
if (peer==null)
return null;
@ -398,7 +400,7 @@ public class CInputMethod extends InputMethodAdapter {
comp = comp.getParent();
if (comp==null)
return null;
peer = comp.getPeer();
peer = acc.getPeer(comp);
if (peer==null)
return null;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,8 @@ import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.peer.MenuBarPeer;
import sun.awt.AWTAccessor;
public class CMenuBar extends CMenuComponent implements MenuBarPeer {
private int nextInsertionIndex = -1;
@ -43,9 +45,8 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer {
}
@Override
@SuppressWarnings("deprecation")
public void addHelpMenu(Menu m) {
CMenu cMenu = (CMenu)m.getPeer();
CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m);
nativeSetHelpMenu(getModel(), cMenu.getModel());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,12 +31,11 @@ import java.awt.event.*;
import java.awt.peer.WindowPeer;
import java.beans.*;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Objects;
import javax.swing.*;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLSurfaceData;
import sun.lwawt.*;
@ -193,8 +192,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@SuppressWarnings("deprecation")
public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
Component root = SwingUtilities.getRoot(p);
if (root == null || (LWWindowPeer)root.getPeer() == null) return null;
return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (root == null || acc.getPeer(root) == null) return null;
return (CPlatformWindow)((LWWindowPeer)acc.getPeer(root)).getPlatformWindow();
}
};
@ -523,15 +523,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
@Override // PlatformWindow
@SuppressWarnings("deprecation")
public void setVisible(boolean visible) {
final long nsWindowPtr = getNSWindowPtr();
// Process parent-child relationship when hiding
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!visible) {
// Unparent my children
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
WindowPeer p = acc.getPeer(w);
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
@ -627,7 +627,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Add my own children to myself
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
final Object p = acc.getPeer(w);
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
@ -679,13 +679,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
@Override // PlatformWindow
@SuppressWarnings("deprecation")
public void toFront() {
final long nsWindowPtr = getNSWindowPtr();
LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if( w != null && w.getPeer() != null
&& ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if( w != null && acc.getPeer(w) != null
&& ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
&& !lwcToolkit.isApplicationActive()) {
lwcToolkit.activateApplicationIgnoringOtherApps();
}

View File

@ -36,6 +36,10 @@ import java.security.PrivilegedAction;
import javax.print.*;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.Media;
import javax.print.attribute.standard.MediaPrintableArea;
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.PageRanges;
import sun.java2d.*;
@ -745,4 +749,34 @@ public final class CPrinterJob extends RasterPrinterJob {
protected void startPage(PageFormat arg0, Printable arg1, int arg2, boolean arg3) throws PrinterException {
// TODO Auto-generated method stub
}
}
@Override
protected MediaSize getMediaSize(Media media, PrintService service,
PageFormat page) {
if (media == null || !(media instanceof MediaSizeName)) {
return getDefaultMediaSize(page);
}
MediaSize size = MediaSize.getMediaSizeForName((MediaSizeName) media);
return size != null ? size : getDefaultMediaSize(page);
}
private MediaSize getDefaultMediaSize(PageFormat page){
final int inch = 72;
Paper paper = page.getPaper();
float width = (float) (paper.getWidth() / inch);
float height = (float) (paper.getHeight() / inch);
return new MediaSize(width, height, MediaSize.INCH);
}
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
final float dpi = 72.0f;
Paper paper = page.getPaper();
return new MediaPrintableArea(
(float) (paper.getImageableX() / dpi),
(float) (paper.getImageableY() / dpi),
(float) (paper.getImageableWidth() / dpi),
(float) (paper.getImageableHeight() / dpi),
MediaPrintableArea.INCH);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,8 @@ import java.awt.peer.TrayIconPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import static sun.awt.AWTAccessor.*;
public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
private TrayIcon target;
private PopupMenu popup;
@ -68,15 +70,15 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
updateImage();
}
@SuppressWarnings("deprecation")
private CPopupMenu checkAndCreatePopupPeer() {
CPopupMenu menuPeer = null;
if (popup != null) {
try {
menuPeer = (CPopupMenu)popup.getPeer();
final MenuComponentAccessor acc = getMenuComponentAccessor();
menuPeer = acc.getPeer(popup);
if (menuPeer == null) {
popup.addNotify();
menuPeer = (CPopupMenu)popup.getPeer();
menuPeer = acc.getPeer(popup);
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke;
import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer;
@ -48,10 +49,9 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
this.nsViewPtr = nsViewPtr;
}
@SuppressWarnings("deprecation")
@Override
public void addNotify() {
if (getPeer() == null) {
if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this));
}
@ -78,11 +78,12 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Synthetic event delivery for focus management
*/
@Override
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(boolean activated) {
if (isActive != activated) {
isActive = activated;
((LWWindowPeer)getPeer()).notifyActivation(activated, null);
final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
peer.notifyActivation(activated, null);
}
}
@ -91,13 +92,14 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Designed to be called from the main thread
* This method should be called once from the initialization of the SWT_AWT Bridge
*/
@SuppressWarnings("deprecation")
public void validateWithBounds(final int x, final int y, final int width, final int height) {
try {
final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
LWCToolkit.invokeAndWait(new Runnable() {
@Override
public void run() {
((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height);
peer.setBoundsPrivate(0, 0, width, height);
validate();
setVisible(true);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -293,7 +293,7 @@ public final class LWCToolkit extends LWToolkit {
}
@Override
protected DesktopPeer createDesktopPeer(Desktop target) {
public DesktopPeer createDesktopPeer(Desktop target) {
return new CDesktopPeer();
}
@ -575,7 +575,8 @@ public final class LWCToolkit extends LWToolkit {
final boolean[] ret = new boolean[1];
try { invokeAndWait(new Runnable() { public void run() { synchronized(ret) {
try { invokeAndWait(new Runnable() { @Override
public void run() { synchronized(ret) {
ret[0] = a.equals(b);
}}}, c); } catch (Exception e) { e.printStackTrace(); }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -168,13 +168,12 @@ public class Button extends Component implements Accessible {
* application to change the look of the button without changing
* its functionality.
*
* @see java.awt.Toolkit#createButton(java.awt.Button)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized(getTreeLock()) {
if (peer == null)
peer = getToolkit().createButton(this);
peer = getComponentFactory().createButton(this);
super.addNotify();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -58,11 +58,13 @@ public class Canvas extends Component implements Accessible {
}
/**
* Constructs a new Canvas given a GraphicsConfiguration object.
* Constructs a new Canvas given a GraphicsConfiguration object. If null is
* passed, then the default GraphicsConfiguration will be used.
*
* @param config a reference to a GraphicsConfiguration object.
* @param config a reference to a GraphicsConfiguration object or null
*
* @see GraphicsConfiguration
* @see Component#getGraphicsConfiguration()
*/
public Canvas(GraphicsConfiguration config) {
this();
@ -70,10 +72,9 @@ public class Canvas extends Component implements Accessible {
}
@Override
@SuppressWarnings("deprecation")
void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized(getTreeLock()) {
CanvasPeer peer = (CanvasPeer)getPeer();
CanvasPeer peer = (CanvasPeer) this.peer;
if (peer != null) {
gc = peer.getAppropriateGraphicsConfiguration(gc);
}
@ -94,13 +95,12 @@ public class Canvas extends Component implements Accessible {
/**
* Creates the peer of the canvas. This peer allows you to change the
* user interface of the canvas without changing its functionality.
* @see java.awt.Toolkit#createCanvas(java.awt.Canvas)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createCanvas(this);
peer = getComponentFactory().createCanvas(this);
super.addNotify();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -239,13 +239,12 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
* Creates the peer of the Checkbox. The peer allows you to change the
* look of the Checkbox without changing its functionality.
*
* @see java.awt.Toolkit#createCheckbox(java.awt.Checkbox)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createCheckbox(this);
peer = getComponentFactory().createCheckbox(this);
super.addNotify();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -155,13 +155,12 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
* change the look of the checkbox item without changing its
* functionality.
* Most applications do not call this method directly.
* @see java.awt.Toolkit#createCheckboxMenuItem(java.awt.CheckboxMenuItem)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = Toolkit.getDefaultToolkit().createCheckboxMenuItem(this);
peer = getComponentFactory().createCheckboxMenuItem(this);
super.addNotify();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -143,13 +143,12 @@ public class Choice extends Component implements ItemSelectable, Accessible {
* Creates the <code>Choice</code>'s peer. This peer allows us
* to change the look
* of the <code>Choice</code> without changing its functionality.
* @see java.awt.Toolkit#createChoice(java.awt.Choice)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createChoice(this);
peer = getComponentFactory().createChoice(this);
super.addNotify();
}
}

View File

@ -61,6 +61,7 @@ import java.security.AccessControlContext;
import javax.accessibility.*;
import java.applet.Applet;
import sun.awt.ComponentFactory;
import sun.security.action.GetPropertyAction;
import sun.awt.AppContext;
import sun.awt.AWTAccessor;
@ -198,7 +199,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #addNotify
* @see #removeNotify
*/
transient ComponentPeer peer;
transient volatile ComponentPeer peer;
/**
* The parent of the object. It may be <code>null</code>
@ -924,8 +925,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
public Cursor getCursor(Component comp) {
return comp.getCursor_NoClientCode();
}
public ComponentPeer getPeer(Component comp) {
return comp.peer;
@SuppressWarnings("unchecked")
public <T extends ComponentPeer> T getPeer(Component comp) {
return (T) comp.peer;
}
public void setPeer(Component comp, ComponentPeer peer) {
comp.peer = peer;
@ -1068,17 +1070,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
return getParent_NoClientCode();
}
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers;
* replaced by <code>boolean isDisplayable()</code>.
* @return the peer for this component
*/
@Deprecated
public ComponentPeer getPeer() {
return peer;
}
/**
* Associate a <code>DropTarget</code> with this component.
* The <code>Component</code> will receive drops only if it
@ -1095,7 +1086,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
DropTarget old;
if ((old = dropTarget) != null) {
if (peer != null) dropTarget.removeNotify(peer);
dropTarget.removeNotify();
DropTarget t = dropTarget;
@ -1113,12 +1104,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
if ((dropTarget = dt) != null) {
try {
dropTarget.setComponent(this);
if (peer != null) dropTarget.addNotify(peer);
dropTarget.addNotify();
} catch (IllegalArgumentException iae) {
if (old != null) {
try {
old.setComponent(this);
if (peer != null) dropTarget.addNotify(peer);
dropTarget.addNotify();
} catch (IllegalArgumentException iae1) {
// ignore it!
}
@ -1179,7 +1170,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
graphicsConfig = gc;
ComponentPeer peer = getPeer();
ComponentPeer peer = this.peer;
if (peer != null) {
return peer.updateGraphicsData(gc);
}
@ -1239,6 +1230,14 @@ public abstract class Component implements ImageObserver, MenuContainer,
return Toolkit.getDefaultToolkit();
}
final ComponentFactory getComponentFactory() {
final Toolkit toolkit = getToolkit();
if (toolkit instanceof ComponentFactory) {
return (ComponentFactory) toolkit;
}
throw new AWTError("UI components are unsupported by: " + toolkit);
}
/**
* Determines whether this component is valid. A component is valid
* when it is correctly sized and positioned within its parent
@ -1281,7 +1280,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isDisplayable() {
return getPeer() != null;
return peer != null;
}
/**
@ -1336,7 +1335,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
Window win = getContainingWindow();
if (!Toolkit.getDefaultToolkit().getMouseInfoPeer().isWindowUnderMouse(win)) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (!(toolkit instanceof ComponentFactory)) {
return null;
}
if (!((ComponentFactory) toolkit).getMouseInfoPeer().isWindowUnderMouse(win)) {
return null;
}
final boolean INCLUDE_DISABLED = true;
@ -2582,7 +2585,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isOpaque() {
if (getPeer() == null) {
if (peer == null) {
return false;
}
else {
@ -2608,7 +2611,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isLightweight() {
return getPeer() instanceof LightweightPeer;
return peer instanceof LightweightPeer;
}
@ -3126,7 +3129,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
* obtained
* @return the font metrics for <code>font</code>
* @see #getFont
* @see #getPeer
* @see java.awt.peer.ComponentPeer#getFontMetrics(Font)
* @see Toolkit#getFontMetrics(Font)
* @since 1.0
@ -3186,7 +3188,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (nativeContainer == null) return;
ComponentPeer cPeer = nativeContainer.getPeer();
ComponentPeer cPeer = nativeContainer.peer;
if (cPeer != null) {
cPeer.updateCursorImmediately();
@ -5019,7 +5021,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (source != null) {
Container target = source.getNativeContainer();
if (target != null) {
tpeer = target.getPeer();
tpeer = target.peer;
}
}
}
@ -6972,7 +6974,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (peer == null) {
// Update both the Component's peer variable and the local
// variable we use for thread safety.
this.peer = peer = getToolkit().createComponent(this);
this.peer = peer = getComponentFactory().createComponent(this);
}
// This is a lightweight component which means it won't be
@ -7022,7 +7024,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
popup.addNotify();
}
if (dropTarget != null) dropTarget.addNotify(peer);
if (dropTarget != null) dropTarget.addNotify();
peerFont = getFont();
@ -7109,7 +7111,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
((FlipBufferStrategy)bufferStrategy).destroyBuffers();
}
if (dropTarget != null) dropTarget.removeNotify(peer);
if (dropTarget != null) dropTarget.removeNotify();
// Hide peer first to stop system events such as cursor moves.
if (visible) {
@ -9851,7 +9853,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
if (!isLightweight()) {
ComponentPeer peer = getPeer();
ComponentPeer peer = this.peer;
if (peer != null) {
// The Region class has some optimizations. That's why
// we should manually check whether it's empty and
@ -9975,7 +9977,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
for (int i = indexAbove; i > -1; i--) {
Component comp = cont.getComponent(i);
if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
return comp.getPeer();
return comp.peer;
}
}
// traversing the hierarchy up to the closest HW container;

View File

@ -820,7 +820,7 @@ public class Container extends Component {
}
} else {
// Q: Need to update NativeInLightFixer?
comp.getPeer().reparent(parentPeer);
comp.peer.reparent(parentPeer);
}
}
}
@ -840,10 +840,10 @@ public class Container extends Component {
// If component is lightweight container we need to reparent all its explicit heavyweight children
if (comp instanceof Container) {
// Traverse component's tree till depth-first until encountering heavyweight component
reparentTraverse((ContainerPeer)getPeer(), (Container)comp);
reparentTraverse((ContainerPeer)peer, (Container)comp);
}
} else {
comp.getPeer().reparent((ContainerPeer)getPeer());
comp.peer.reparent((ContainerPeer) peer);
}
}
@ -4195,7 +4195,7 @@ public class Container extends Component {
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setVisible(true);
}
@ -4217,7 +4217,7 @@ public class Container extends Component {
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setVisible(false);
}
@ -4239,7 +4239,7 @@ public class Container extends Component {
((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin);
}
} else {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(),
comp.getWidth(), comp.getHeight(),

View File

@ -504,7 +504,10 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
} else if (comp instanceof Container && comp != aContainer) {
Container cont = (Container)comp;
if (cont.isFocusTraversalPolicyProvider()) {
return cont.getFocusTraversalPolicy().getLastComponent(cont);
Component retComp = cont.getFocusTraversalPolicy().getLastComponent(cont);
if (retComp != null) {
return retComp;
}
}
}
}

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