diff --git a/.hgtags-top-repo b/.hgtags-top-repo index ef0f8b30804..bc18620853e 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -235,3 +235,4 @@ b7e64be81c8a7690703df5711f4fc2375da8a9cb jdk8-b103 d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111 547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112 6ba4c7cb623ec612031e05cf8bf279d8f407bd1e jdk8-b113 +4f2011496393a26dcfd7b1f7787a3673ddd32599 jdk8-b114 diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index 1d51a304503..92d755af35f 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -514,7 +514,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION], if test "x$IS_GNU_MAKE" = x; then AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.]) else - IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[[12]]\)\|\(4\.\)'` + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[[12]]' -e '4\.'` if test "x$IS_MODERN_MAKE" = x; then AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.]) else diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 8476ff7e448..edac17dcbc6 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -3865,7 +3865,7 @@ fi #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1382702260 +DATE_WHEN_GENERATED=1383151988 ############################################################################### # @@ -8323,7 +8323,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} else - IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'` if test "x$IS_MODERN_MAKE" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} @@ -8680,7 +8680,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} else - IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'` if test "x$IS_MODERN_MAKE" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} @@ -9034,7 +9034,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} else - IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'` if test "x$IS_MODERN_MAKE" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} @@ -9393,7 +9393,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} else - IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'` if test "x$IS_MODERN_MAKE" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} @@ -9746,7 +9746,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} else - IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` + IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'` if test "x$IS_MODERN_MAKE" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} diff --git a/corba/.hgtags b/corba/.hgtags index 6be005665d2..132a2d9acf4 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -235,3 +235,4 @@ a4bb3b4500164748a9c33b2283cfda76d89f25ab jdk8-b108 85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111 43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112 a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113 +0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114 diff --git a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java index 3018cdef99e..1b03be02dd1 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java @@ -580,7 +580,7 @@ public class AnyImpl extends Any java.lang.Object[] objholder = new java.lang.Object[1]; objholder[0] = object; long[] longholder = new long[1]; - TCUtility.unmarshalIn(in, typeCode, longholder, objholder); + TCUtility.unmarshalIn(in, realType(), longholder, objholder); value = longholder[0]; object = objholder[0]; stream = null; diff --git a/corba/src/share/classes/javax/rmi/CORBA/Stub.java b/corba/src/share/classes/javax/rmi/CORBA/Stub.java index 72f9434c99f..227e28992b6 100644 --- a/corba/src/share/classes/javax/rmi/CORBA/Stub.java +++ b/corba/src/share/classes/javax/rmi/CORBA/Stub.java @@ -61,13 +61,11 @@ public abstract class Stub extends ObjectImpl private transient StubDelegate stubDelegate = null; private static Class stubDelegateClass = null; private static final String StubClassKey = "javax.rmi.CORBA.StubClass"; - private static final String defaultStubImplName = "com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl"; static { - Object stubDelegateInstance = (Object) createDelegateIfSpecified(StubClassKey, defaultStubImplName); + Object stubDelegateInstance = createDelegate(StubClassKey); if (stubDelegateInstance != null) stubDelegateClass = stubDelegateInstance.getClass(); - } @@ -207,7 +205,7 @@ public abstract class Stub extends ObjectImpl // are in different packages and the visibility needs to be package for // security reasons. If you know a better solution how to share this code // then remove it from PortableRemoteObject. Also in Util.java - private static Object createDelegateIfSpecified(String classKey, String defaultClassName) { + private static Object createDelegate(String classKey) { String className = (String) AccessController.doPrivileged(new GetPropertyAction(classKey)); if (className == null) { @@ -218,7 +216,7 @@ public abstract class Stub extends ObjectImpl } if (className == null) { - className = defaultClassName; + return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl(); } try { diff --git a/corba/src/share/classes/javax/rmi/CORBA/Util.java b/corba/src/share/classes/javax/rmi/CORBA/Util.java index 449788afa62..65df15f1a27 100644 --- a/corba/src/share/classes/javax/rmi/CORBA/Util.java +++ b/corba/src/share/classes/javax/rmi/CORBA/Util.java @@ -60,14 +60,11 @@ import com.sun.corba.se.impl.orbutil.GetPropertyAction; public class Util { // This can only be set at static initialization time (no sync necessary). - private static javax.rmi.CORBA.UtilDelegate utilDelegate = null; + private static final javax.rmi.CORBA.UtilDelegate utilDelegate; private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass"; - private static final String defaultUtilImplName = -"com.sun.corba.se.impl.javax.rmi.CORBA.Util"; static { - utilDelegate = (javax.rmi.CORBA.UtilDelegate) - createDelegateIfSpecified(UtilClassKey, defaultUtilImplName); + utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey); } private Util(){} @@ -338,9 +335,7 @@ Tie#deactivate} // are in different packages and the visibility needs to be package for // security reasons. If you know a better solution how to share this code // then remove it from PortableRemoteObject. Also in Stub.java - private static Object createDelegateIfSpecified(String classKey, - String defaultClassName) - { + private static Object createDelegate(String classKey) { String className = (String) AccessController.doPrivileged(new GetPropertyAction(classKey)); if (className == null) { @@ -351,7 +346,7 @@ Tie#deactivate} } if (className == null) { - className = defaultClassName; + return new com.sun.corba.se.impl.javax.rmi.CORBA.Util(); } try { diff --git a/corba/src/share/classes/javax/rmi/PortableRemoteObject.java b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java index cbd6df25510..951f06cb477 100644 --- a/corba/src/share/classes/javax/rmi/PortableRemoteObject.java +++ b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java @@ -65,17 +65,14 @@ import com.sun.corba.se.impl.orbutil.GetPropertyAction; */ public class PortableRemoteObject { - private static javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate = null; + private static final javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate; private static final String PortableRemoteObjectClassKey = "javax.rmi.CORBA.PortableRemoteObjectClass"; - private static final String defaultPortableRemoteObjectImplName = - "com.sun.corba.se.impl.javax.rmi.PortableRemoteObject"; - static { proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate) - createDelegateIfSpecified(PortableRemoteObjectClassKey); + createDelegate(PortableRemoteObjectClassKey); } /** @@ -181,7 +178,7 @@ public class PortableRemoteObject { // are in different packages and the visibility needs to be package for // security reasons. If you know a better solution how to share this code // then remove it from here. - private static Object createDelegateIfSpecified(String classKey) { + private static Object createDelegate(String classKey) { String className = (String) AccessController.doPrivileged(new GetPropertyAction(classKey)); if (className == null) { @@ -191,7 +188,7 @@ public class PortableRemoteObject { } } if (className == null) { - className = defaultPortableRemoteObjectImplName; + return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject(); } try { diff --git a/corba/src/share/classes/org/omg/CORBA/ORB.java b/corba/src/share/classes/org/omg/CORBA/ORB.java index 42fe7bc0090..5b434097c65 100644 --- a/corba/src/share/classes/org/omg/CORBA/ORB.java +++ b/corba/src/share/classes/org/omg/CORBA/ORB.java @@ -173,15 +173,6 @@ abstract public class ORB { private static final String ORBClassKey = "org.omg.CORBA.ORBClass"; private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass"; - // - // The last resort fallback ORB implementation classes in case - // no ORB implementation class is dynamically configured through - // properties or applet parameters. Change these values to - // vendor-specific class names. - // - private static final String defaultORB = "com.sun.corba.se.impl.orb.ORBImpl"; - private static final String defaultORBSingleton = "com.sun.corba.se.impl.orb.ORBSingleton"; - // // The global instance of the singleton ORB implementation which // acts as a factory for typecodes for generated Helper classes. @@ -294,10 +285,11 @@ abstract public class ORB { String className = getSystemProperty(ORBSingletonClassKey); if (className == null) className = getPropertyFromFile(ORBSingletonClassKey); - if (className == null) - className = defaultORBSingleton; - - singleton = create_impl(className); + if (className == null) { + singleton = new com.sun.corba.se.impl.orb.ORBSingleton(); + } else { + singleton = create_impl(className); + } } return singleton; } @@ -347,10 +339,12 @@ abstract public class ORB { className = getSystemProperty(ORBClassKey); if (className == null) className = getPropertyFromFile(ORBClassKey); - if (className == null) - className = defaultORB; + if (className == null) { + orb = new com.sun.corba.se.impl.orb.ORBImpl(); + } else { + orb = create_impl(className); + } - orb = create_impl(className); orb.set_parameters(args, props); return orb; } @@ -375,10 +369,12 @@ abstract public class ORB { className = getSystemProperty(ORBClassKey); if (className == null) className = getPropertyFromFile(ORBClassKey); - if (className == null) - className = defaultORB; + if (className == null) { + orb = new com.sun.corba.se.impl.orb.ORBImpl(); + } else { + orb = create_impl(className); + } - orb = create_impl(className); orb.set_parameters(app, props); return orb; } diff --git a/hotspot/.hgtags b/hotspot/.hgtags index f794add23e0..22734a967f6 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -389,3 +389,5 @@ f6962730bbde82f279a0ae3a1c14bc5e58096c6e jdk8-b111 23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55 4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113 82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56 +7fd913010dbbf75260688fd2fa8964763fa49a09 jdk8-b114 +3b32d287da89a47a45d16f6d9ba5bd3cd9bf4b3e hs25-b57 diff --git a/hotspot/agent/src/os/bsd/ps_proc.c b/hotspot/agent/src/os/bsd/ps_proc.c index cf4a5d71d75..53cafe1f44e 100644 --- a/hotspot/agent/src/os/bsd/ps_proc.c +++ b/hotspot/agent/src/os/bsd/ps_proc.c @@ -131,7 +131,7 @@ static bool process_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void static bool ptrace_continue(pid_t pid, int signal) { // pass the signal to the process so we don't swallow it - if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) { + if (ptrace(PT_CONTINUE, pid, NULL, signal) < 0) { print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid); return false; } @@ -434,7 +434,6 @@ static ps_prochandle_ops process_ops = { // attach to the process. One and only one exposed stuff struct ps_prochandle* Pgrab(pid_t pid) { struct ps_prochandle* ph = NULL; - thread_info* thr = NULL; if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) { print_debug("can't allocate memory for ps_prochandle\n"); diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 95f420164ac..69d9e8e9e59 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013 HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=56 +HS_BUILD_NUMBER=57 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff --git a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp index 5750e5f587f..371b6aa7f71 100644 --- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp @@ -365,7 +365,7 @@ address CppInterpreterGenerator::generate_stack_to_native_abi_converter(BasicTyp return entry; } -address CppInterpreter::return_entry(TosState state, int length) { +address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { // make it look good in the debugger return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation) + frame::pc_return_offset; } diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index b229eb34105..af142976b35 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -4099,15 +4099,19 @@ void MacroAssembler::decode_heap_oop_not_null(Register src, Register dst) { void MacroAssembler::encode_klass_not_null(Register r) { assert (UseCompressedClassPointers, "must be compressed"); - assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); - assert(r != G6_heapbase, "bad register choice"); - set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); - sub(r, G6_heapbase, r); - if (Universe::narrow_klass_shift() != 0) { - assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); - srlx(r, LogKlassAlignmentInBytes, r); + if (Universe::narrow_klass_base() != NULL) { + assert(r != G6_heapbase, "bad register choice"); + set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); + sub(r, G6_heapbase, r); + if (Universe::narrow_klass_shift() != 0) { + assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); + srlx(r, LogKlassAlignmentInBytes, r); + } + reinit_heapbase(); + } else { + assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong"); + srlx(r, Universe::narrow_klass_shift(), r); } - reinit_heapbase(); } void MacroAssembler::encode_klass_not_null(Register src, Register dst) { @@ -4115,11 +4119,16 @@ void MacroAssembler::encode_klass_not_null(Register src, Register dst) { encode_klass_not_null(src); } else { assert (UseCompressedClassPointers, "must be compressed"); - assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); - set((intptr_t)Universe::narrow_klass_base(), dst); - sub(src, dst, dst); - if (Universe::narrow_klass_shift() != 0) { - srlx(dst, LogKlassAlignmentInBytes, dst); + if (Universe::narrow_klass_base() != NULL) { + set((intptr_t)Universe::narrow_klass_base(), dst); + sub(src, dst, dst); + if (Universe::narrow_klass_shift() != 0) { + srlx(dst, LogKlassAlignmentInBytes, dst); + } + } else { + // shift src into dst + assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong"); + srlx(src, Universe::narrow_klass_shift(), dst); } } } @@ -4129,14 +4138,16 @@ void MacroAssembler::encode_klass_not_null(Register src, Register dst) { // the instructions they generate change, then this method needs to be updated. int MacroAssembler::instr_size_for_decode_klass_not_null() { assert (UseCompressedClassPointers, "only for compressed klass ptrs"); - // set + add + set - int num_instrs = insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) + 1 + - insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base()); - if (Universe::narrow_klass_shift() == 0) { - return num_instrs * BytesPerInstWord; - } else { // sllx - return (num_instrs + 1) * BytesPerInstWord; + int num_instrs = 1; // shift src,dst or add + if (Universe::narrow_klass_base() != NULL) { + // set + add + set + num_instrs += insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) + + insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base()); + if (Universe::narrow_klass_shift() != 0) { + num_instrs += 1; // sllx + } } + return num_instrs * BytesPerInstWord; } // !!! If the instructions that get generated here change then function @@ -4145,13 +4156,17 @@ void MacroAssembler::decode_klass_not_null(Register r) { // Do not add assert code to this unless you change vtableStubs_sparc.cpp // pd_code_size_limit. assert (UseCompressedClassPointers, "must be compressed"); - assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); - assert(r != G6_heapbase, "bad register choice"); - set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); - if (Universe::narrow_klass_shift() != 0) - sllx(r, LogKlassAlignmentInBytes, r); - add(r, G6_heapbase, r); - reinit_heapbase(); + if (Universe::narrow_klass_base() != NULL) { + assert(r != G6_heapbase, "bad register choice"); + set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); + if (Universe::narrow_klass_shift() != 0) + sllx(r, LogKlassAlignmentInBytes, r); + add(r, G6_heapbase, r); + reinit_heapbase(); + } else { + assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong"); + sllx(r, Universe::narrow_klass_shift(), r); + } } void MacroAssembler::decode_klass_not_null(Register src, Register dst) { @@ -4161,16 +4176,21 @@ void MacroAssembler::decode_klass_not_null(Register src, Register dst) { // Do not add assert code to this unless you change vtableStubs_sparc.cpp // pd_code_size_limit. assert (UseCompressedClassPointers, "must be compressed"); - assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); - if (Universe::narrow_klass_shift() != 0) { - assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice"); - set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); - sllx(src, LogKlassAlignmentInBytes, dst); - add(dst, G6_heapbase, dst); - reinit_heapbase(); + if (Universe::narrow_klass_base() != NULL) { + if (Universe::narrow_klass_shift() != 0) { + assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice"); + set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); + sllx(src, LogKlassAlignmentInBytes, dst); + add(dst, G6_heapbase, dst); + reinit_heapbase(); + } else { + set((intptr_t)Universe::narrow_klass_base(), dst); + add(src, dst, dst); + } } else { - set((intptr_t)Universe::narrow_klass_base(), dst); - add(src, dst, dst); + // shift/mov src into dst. + assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong"); + sllx(src, Universe::narrow_klass_shift(), dst); } } } diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index eea306b4130..eadb0a8b60f 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -1660,12 +1660,16 @@ void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { if (UseCompressedClassPointers) { assert(Universe::heap() != NULL, "java heap should be initialized"); st->print_cr("\tLDUW [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass"); - st->print_cr("\tSET Universe::narrow_klass_base,R_G6_heap_base"); - if (Universe::narrow_klass_shift() != 0) { - st->print_cr("\tSLL R_G5,3,R_G5"); + if (Universe::narrow_klass_base() != 0) { + st->print_cr("\tSET Universe::narrow_klass_base,R_G6_heap_base"); + if (Universe::narrow_klass_shift() != 0) { + st->print_cr("\tSLL R_G5,Universe::narrow_klass_shift,R_G5"); + } + st->print_cr("\tADD R_G5,R_G6_heap_base,R_G5"); + st->print_cr("\tSET Universe::narrow_ptrs_base,R_G6_heap_base"); + } else { + st->print_cr("\tSLL R_G5,Universe::narrow_klass_shift,R_G5"); } - st->print_cr("\tADD R_G5,R_G6_heap_base,R_G5"); - st->print_cr("\tSET Universe::narrow_ptrs_base,R_G6_heap_base"); } else { st->print_cr("\tLDX [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check"); } diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp index b6f8a5a5d1a..40847f8c2df 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp @@ -153,13 +153,9 @@ address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { } -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { - TosState incoming_state = state; - - Label cont; - address compiled_entry = __ pc(); - +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { address entry = __ pc(); + #if !defined(_LP64) && defined(COMPILER2) // All return values are where we want them, except for Longs. C2 returns // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1. @@ -170,14 +166,12 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, // do this here. Unfortunately if we did a rethrow we'd see an machepilog node // first which would move g1 -> O0/O1 and destroy the exception we were throwing. - if (incoming_state == ltos) { + if (state == ltos) { __ srl (G1, 0, O1); __ srlx(G1, 32, O0); } #endif // !_LP64 && COMPILER2 - __ bind(cont); - // The callee returns with the stack possibly adjusted by adapter transition // We remove that possible adjustment here. // All interpreter local registers are untouched. Any result is passed back @@ -186,28 +180,17 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, __ mov(Llast_SP, SP); // Remove any adapter added stack space. - Label L_got_cache, L_giant_index; const Register cache = G3_scratch; - const Register size = G1_scratch; - if (EnableInvokeDynamic) { - __ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode. - __ cmp_and_br_short(G1_scratch, Bytecodes::_invokedynamic, Assembler::equal, Assembler::pn, L_giant_index); - } - __ get_cache_and_index_at_bcp(cache, G1_scratch, 1); - __ bind(L_got_cache); - __ ld_ptr(cache, ConstantPoolCache::base_offset() + - ConstantPoolCacheEntry::flags_offset(), size); - __ and3(size, 0xFF, size); // argument size in words - __ sll(size, Interpreter::logStackElementSize, size); // each argument size in bytes - __ add(Lesp, size, Lesp); // pop arguments - __ dispatch_next(state, step); + const Register index = G1_scratch; + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); - // out of the main line of code... - if (EnableInvokeDynamic) { - __ bind(L_giant_index); - __ get_cache_and_index_at_bcp(cache, G1_scratch, 1, sizeof(u4)); - __ ba_short(L_got_cache); - } + const Register flags = cache; + __ ld_ptr(cache, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset(), flags); + const Register parameter_size = flags; + __ and3(flags, ConstantPoolCacheEntry::parameter_size_mask, parameter_size); // argument size in words + __ sll(parameter_size, Interpreter::logStackElementSize, parameter_size); // each argument size in bytes + __ add(Lesp, parameter_size, Lesp); // pop arguments + __ dispatch_next(state, step); return entry; } diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index c3e8b298d6e..92098113cca 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -2932,9 +2932,7 @@ void TemplateTable::prepare_invoke(int byte_no, ConstantPoolCacheEntry::verify_tos_state_shift(); // load return address { - const address table_addr = (is_invokeinterface || is_invokedynamic) ? - (address)Interpreter::return_5_addrs_by_index_table() : - (address)Interpreter::return_3_addrs_by_index_table(); + const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code); AddressLiteral table(table_addr); __ set(table, temp); __ sll(ra, LogBytesPerWord, ra); @@ -2984,7 +2982,7 @@ void TemplateTable::invokevirtual(int byte_no) { __ verify_oop(O0_recv); // get return address - AddressLiteral table(Interpreter::return_3_addrs_by_index_table()); + AddressLiteral table(Interpreter::invoke_return_entry_table()); __ set(table, Rtemp); __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type // Make sure we don't need to mask Rret after the above shift @@ -3026,7 +3024,7 @@ void TemplateTable::invokevfinal_helper(Register Rscratch, Register Rret) { __ profile_final_call(O4); // get return address - AddressLiteral table(Interpreter::return_3_addrs_by_index_table()); + AddressLiteral table(Interpreter::invoke_return_entry_table()); __ set(table, Rtemp); __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type // Make sure we don't need to mask Rret after the above shift diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp index 308befddc77..4a30d597b3e 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -1468,19 +1468,18 @@ void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) { addr = new LIR_Address(src.result(), offset, type); } - if (data != dst) { - __ move(data, dst); - data = dst; - } + // Because we want a 2-arg form of xchg and xadd + __ move(data, dst); + if (x->is_add()) { - __ xadd(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr); + __ xadd(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr); } else { if (is_obj) { // Do the pre-write barrier, if any. pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */, true /* do_load */, false /* patch */, NULL); } - __ xchg(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr); + __ xchg(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr); if (is_obj) { // Seems to be a precise address post_barrier(LIR_OprFact::address(addr), data); diff --git a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp index 1eef095b9a5..e669f5b6638 100644 --- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp +++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp @@ -367,7 +367,7 @@ address CppInterpreterGenerator::generate_stack_to_native_abi_converter(BasicTyp return entry; } -address CppInterpreter::return_entry(TosState state, int length) { +address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { // make it look good in the debugger return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation); } diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index c39c50082aa..cc4fe6869dc 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -5049,25 +5049,32 @@ void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) { } void MacroAssembler::encode_klass_not_null(Register r) { - assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); - // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. - assert(r != r12_heapbase, "Encoding a klass in r12"); - mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); - subq(r, r12_heapbase); + if (Universe::narrow_klass_base() != NULL) { + // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. + assert(r != r12_heapbase, "Encoding a klass in r12"); + mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); + subq(r, r12_heapbase); + } if (Universe::narrow_klass_shift() != 0) { assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); shrq(r, LogKlassAlignmentInBytes); } - reinit_heapbase(); + if (Universe::narrow_klass_base() != NULL) { + reinit_heapbase(); + } } void MacroAssembler::encode_klass_not_null(Register dst, Register src) { if (dst == src) { encode_klass_not_null(src); } else { - mov64(dst, (int64_t)Universe::narrow_klass_base()); - negq(dst); - addq(dst, src); + if (Universe::narrow_klass_base() != NULL) { + mov64(dst, (int64_t)Universe::narrow_klass_base()); + negq(dst); + addq(dst, src); + } else { + movptr(dst, src); + } if (Universe::narrow_klass_shift() != 0) { assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); shrq(dst, LogKlassAlignmentInBytes); @@ -5081,15 +5088,19 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src) { // generate change, then this method needs to be updated. int MacroAssembler::instr_size_for_decode_klass_not_null() { assert (UseCompressedClassPointers, "only for compressed klass ptrs"); - // mov64 + addq + shlq? + mov64 (for reinit_heapbase()). - return (Universe::narrow_klass_shift() == 0 ? 20 : 24); + if (Universe::narrow_klass_base() != NULL) { + // mov64 + addq + shlq? + mov64 (for reinit_heapbase()). + return (Universe::narrow_klass_shift() == 0 ? 20 : 24); + } else { + // longest load decode klass function, mov64, leaq + return 16; + } } // !!! If the instructions that get generated here change then function // instr_size_for_decode_klass_not_null() needs to get updated. void MacroAssembler::decode_klass_not_null(Register r) { // Note: it will change flags - assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); assert (UseCompressedClassPointers, "should only be used for compressed headers"); assert(r != r12_heapbase, "Decoding a klass in r12"); // Cannot assert, unverified entry point counts instructions (see .ad file) @@ -5100,14 +5111,15 @@ void MacroAssembler::decode_klass_not_null(Register r) { shlq(r, LogKlassAlignmentInBytes); } // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. - mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); - addq(r, r12_heapbase); - reinit_heapbase(); + if (Universe::narrow_klass_base() != NULL) { + mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); + addq(r, r12_heapbase); + reinit_heapbase(); + } } void MacroAssembler::decode_klass_not_null(Register dst, Register src) { // Note: it will change flags - assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); assert (UseCompressedClassPointers, "should only be used for compressed headers"); if (dst == src) { decode_klass_not_null(dst); @@ -5115,7 +5127,6 @@ void MacroAssembler::decode_klass_not_null(Register dst, Register src) { // Cannot assert, unverified entry point counts instructions (see .ad file) // vtableStubs also counts instructions in pd_code_size_limit. // Also do not verify_oop as this is called by verify_oop. - mov64(dst, (int64_t)Universe::narrow_klass_base()); if (Universe::narrow_klass_shift() != 0) { assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp index 880b7732a0b..c7fc0472677 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp @@ -150,13 +150,12 @@ address TemplateInterpreterGenerator::generate_continuation_for(TosState state) } -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { - TosState incoming_state = state; +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { address entry = __ pc(); #ifdef COMPILER2 // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases - if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) { + if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) { for (int i = 1; i < 8; i++) { __ ffree(i); } @@ -164,7 +163,7 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, __ empty_FPU_stack(); } #endif - if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) { + if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) { __ MacroAssembler::verify_FPU(1, "generate_return_entry_for compiled"); } else { __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled"); @@ -172,12 +171,12 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, // In SSE mode, interpreter returns FP results in xmm0 but they need // to end up back on the FPU so it can operate on them. - if (incoming_state == ftos && UseSSE >= 1) { + if (state == ftos && UseSSE >= 1) { __ subptr(rsp, wordSize); __ movflt(Address(rsp, 0), xmm0); __ fld_s(Address(rsp, 0)); __ addptr(rsp, wordSize); - } else if (incoming_state == dtos && UseSSE >= 2) { + } else if (state == dtos && UseSSE >= 2) { __ subptr(rsp, 2*wordSize); __ movdbl(Address(rsp, 0), xmm0); __ fld_d(Address(rsp, 0)); @@ -194,32 +193,21 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, __ restore_bcp(); __ restore_locals(); - if (incoming_state == atos) { + if (state == atos) { Register mdp = rbx; Register tmp = rcx; __ profile_return_type(mdp, rax, tmp); } - Label L_got_cache, L_giant_index; - if (EnableInvokeDynamic) { - __ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic); - __ jcc(Assembler::equal, L_giant_index); - } - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2)); - __ bind(L_got_cache); - __ movl(rbx, Address(rbx, rcx, - Address::times_ptr, ConstantPoolCache::base_offset() + - ConstantPoolCacheEntry::flags_offset())); - __ andptr(rbx, 0xFF); - __ lea(rsp, Address(rsp, rbx, Interpreter::stackElementScale())); - __ dispatch_next(state, step); + const Register cache = rbx; + const Register index = rcx; + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); - // out of the main line of code... - if (EnableInvokeDynamic) { - __ bind(L_giant_index); - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4)); - __ jmp(L_got_cache); - } + const Register flags = cache; + __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); + __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask); + __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale())); + __ dispatch_next(state, step); return entry; } diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp index 39c49cc4346..ef1aa8409b9 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp @@ -166,7 +166,7 @@ address TemplateInterpreterGenerator::generate_continuation_for(TosState state) } -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) { address entry = __ pc(); // Restore stack bottom in case i2c adjusted stack @@ -183,27 +183,15 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, __ profile_return_type(mdp, rax, tmp); } - Label L_got_cache, L_giant_index; - if (EnableInvokeDynamic) { - __ cmpb(Address(r13, 0), Bytecodes::_invokedynamic); - __ jcc(Assembler::equal, L_giant_index); - } - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2)); - __ bind(L_got_cache); - __ movl(rbx, Address(rbx, rcx, - Address::times_ptr, - in_bytes(ConstantPoolCache::base_offset()) + - 3 * wordSize)); - __ andl(rbx, 0xFF); - __ lea(rsp, Address(rsp, rbx, Address::times_8)); - __ dispatch_next(state, step); + const Register cache = rbx; + const Register index = rcx; + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); - // out of the main line of code... - if (EnableInvokeDynamic) { - __ bind(L_giant_index); - __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4)); - __ jmp(L_got_cache); - } + const Register flags = cache; + __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); + __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask); + __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale())); + __ dispatch_next(state, step); return entry; } diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index 6e6033b02b6..3d07cb0ee32 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -2925,9 +2925,7 @@ void TemplateTable::prepare_invoke(int byte_no, ConstantPoolCacheEntry::verify_tos_state_shift(); // load return address { - const address table_addr = (is_invokeinterface || is_invokedynamic) ? - (address)Interpreter::return_5_addrs_by_index_table() : - (address)Interpreter::return_3_addrs_by_index_table(); + const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code); ExternalAddress table(table_addr); __ movptr(flags, ArrayAddress(table, Address(noreg, flags, Address::times_ptr))); } diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index 8c49726e5ff..1da6efa85e0 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -2980,9 +2980,7 @@ void TemplateTable::prepare_invoke(int byte_no, ConstantPoolCacheEntry::verify_tos_state_shift(); // load return address { - const address table_addr = (is_invokeinterface || is_invokedynamic) ? - (address)Interpreter::return_5_addrs_by_index_table() : - (address)Interpreter::return_3_addrs_by_index_table(); + const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code); ExternalAddress table(table_addr); __ lea(rscratch1, table); __ movptr(flags, Address(rscratch1, flags, Address::times_ptr)); diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp index 42e88a7374b..27c9af71f17 100644 --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp @@ -1006,7 +1006,7 @@ void BytecodeInterpreter::layout_interpreterState(interpreterState istate, istate->set_stack_limit(stack_base - method->max_stack() - 1); } -address CppInterpreter::return_entry(TosState state, int length) { +address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotCallThis(); return NULL; } diff --git a/hotspot/src/cpu/zero/vm/globals_zero.hpp b/hotspot/src/cpu/zero/vm/globals_zero.hpp index 71b566fceb0..9a304c7f3fb 100644 --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp @@ -57,6 +57,8 @@ define_pd_global(bool, UseMembar, true); // GC Ergo Flags define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread +define_pd_global(uintx, TypeProfileLevel, 0); + #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) #endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index d1afaabf74d..1bea78444a8 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -945,17 +945,15 @@ extern "C" Thread* get_thread() { // Used by VMSelfDestructTimer and the MemProfiler. double os::elapsedTime() { - return (double)(os::elapsed_counter()) * 0.000001; + return ((double)os::elapsed_counter()) / os::elapsed_frequency(); } jlong os::elapsed_counter() { - timeval time; - int status = gettimeofday(&time, NULL); - return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count; + return javaTimeNanos() - initial_time_count; } jlong os::elapsed_frequency() { - return (1000 * 1000); + return NANOSECS_PER_SEC; // nanosecond resolution } bool os::supports_vtime() { return true; } @@ -3582,7 +3580,7 @@ void os::init(void) { Bsd::_main_thread = pthread_self(); Bsd::clock_init(); - initial_time_count = os::elapsed_counter(); + initial_time_count = javaTimeNanos(); #ifdef __APPLE__ // XXXDARWIN diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 3aeb1b70484..1bb32901540 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -1333,17 +1333,15 @@ void os::Linux::capture_initial_stack(size_t max_size) { // Used by VMSelfDestructTimer and the MemProfiler. double os::elapsedTime() { - return (double)(os::elapsed_counter()) * 0.000001; + return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution } jlong os::elapsed_counter() { - timeval time; - int status = gettimeofday(&time, NULL); - return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count; + return javaTimeNanos() - initial_time_count; } jlong os::elapsed_frequency() { - return (1000 * 1000); + return NANOSECS_PER_SEC; // nanosecond resolution } bool os::supports_vtime() { return true; } @@ -4750,7 +4748,7 @@ void os::init(void) { Linux::_main_thread = pthread_self(); Linux::clock_init(); - initial_time_count = os::elapsed_counter(); + initial_time_count = javaTimeNanos(); // pthread_condattr initialization for monotonic clock int status; diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp index ad3ebb2ead9..a1d7075af55 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -79,6 +79,15 @@ # include #endif +// needed by current_stack_region() workaround for Mavericks +#if defined(__APPLE__) +# include +# include +# include +# define DEFAULT_MAIN_THREAD_STACK_PAGES 2048 +# define OS_X_10_9_0_KERNEL_MAJOR_VERSION 13 +#endif + #ifdef AMD64 #define SPELL_REG_SP "rsp" #define SPELL_REG_FP "rbp" @@ -828,6 +837,21 @@ static void current_stack_region(address * bottom, size_t * size) { pthread_t self = pthread_self(); void *stacktop = pthread_get_stackaddr_np(self); *size = pthread_get_stacksize_np(self); + // workaround for OS X 10.9.0 (Mavericks) + // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages + if (pthread_main_np() == 1) { + if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) { + char kern_osrelease[256]; + size_t kern_osrelease_size = sizeof(kern_osrelease); + int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0); + if (ret == 0) { + // get the major number, atoi will ignore the minor amd micro portions of the version string + if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) { + *size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize()); + } + } + } + } *bottom = (address) stacktop - *size; #elif defined(__OpenBSD__) stack_t ss; diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 75e827b3b43..26bb8d0227e 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1873,7 +1873,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) { // number of implementors for decl_interface is 0 or 1. If // it's 0 then no class implements decl_interface and there's // no point in inlining. - if (!holder->is_loaded() || decl_interface->nof_implementors() != 1) { + if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_default_methods()) { singleton = NULL; } } diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp index d40e460dcf3..f4389da46a6 100644 --- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp @@ -57,6 +57,7 @@ ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) : _init_state = ik->init_state(); _nonstatic_field_size = ik->nonstatic_field_size(); _has_nonstatic_fields = ik->has_nonstatic_fields(); + _has_default_methods = ik->has_default_methods(); _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields: _implementor = NULL; // we will fill these lazily diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp index fdd93ddc58c..34eb84ccfeb 100644 --- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp @@ -52,6 +52,7 @@ private: bool _has_finalizer; bool _has_subklass; bool _has_nonstatic_fields; + bool _has_default_methods; ciFlags _flags; jint _nonstatic_field_size; @@ -171,6 +172,11 @@ public: } } + bool has_default_methods() { + assert(is_loaded(), "must be loaded"); + return _has_default_methods; + } + ciInstanceKlass* get_canonical_holder(int offset); ciField* get_field_by_offset(int field_offset, bool is_static); ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index 84c191e33bd..e3209ae1868 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -131,6 +131,17 @@ void ClassLoaderData::classes_do(void f(Klass * const)) { } } +void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) { + // Lock to avoid classes being modified/added/removed during iteration + MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag); + for (Klass* k = _klasses; k != NULL; k = k->next_link()) { + // Do not filter ArrayKlass oops here... + if (k->oop_is_array() || (k->oop_is_instance() && InstanceKlass::cast(k)->is_loaded())) { + klass_closure->do_klass(k); + } + } +} + void ClassLoaderData::classes_do(void f(InstanceKlass*)) { for (Klass* k = _klasses; k != NULL; k = k->next_link()) { if (k->oop_is_instance()) { @@ -600,6 +611,12 @@ void ClassLoaderDataGraph::classes_do(void f(Klass* const)) { } } +void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) { + for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) { + cld->loaded_classes_do(klass_closure); + } +} + void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!"); for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) { diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp index 6d5747483d4..cee114c75e0 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp @@ -78,6 +78,7 @@ class ClassLoaderDataGraph : public AllStatic { static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); static void classes_do(KlassClosure* klass_closure); static void classes_do(void f(Klass* const)); + static void loaded_classes_do(KlassClosure* klass_closure); static void classes_unloading_do(void f(Klass* const)); static bool do_unloading(BoolObjectClosure* is_alive); @@ -186,6 +187,7 @@ class ClassLoaderData : public CHeapObj { bool keep_alive() const { return _keep_alive; } bool is_alive(BoolObjectClosure* is_alive_closure) const; void classes_do(void f(Klass*)); + void loaded_classes_do(KlassClosure* klass_closure); void classes_do(void f(InstanceKlass*)); // Deallocate free list during class unloading. diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp index 85735a732fa..c6436364533 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp @@ -173,8 +173,6 @@ class SymbolPropertyTable; /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ do_klass(nio_Buffer_klass, java_nio_Buffer, Opt ) \ \ - do_klass(PostVMInitHook_klass, sun_misc_PostVMInitHook, Opt ) \ - \ /* Preload boxing klasses */ \ do_klass(Boolean_klass, java_lang_Boolean, Pre ) \ do_klass(Character_klass, java_lang_Character, Pre ) \ diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index bdfe2abd315..fb47df28267 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -780,6 +780,10 @@ CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS) void CompileBroker::compilation_init() { _last_method_compiled[0] = '\0'; + // No need to initialize compilation system if we do not use it. + if (!UseCompiler) { + return; + } #ifndef SHARK // Set the interface to the current compiler(s). int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); diff --git a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp index 4d7647ce05a..0ebfd1cdf13 100644 --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp @@ -158,8 +158,8 @@ class AbstractInterpreter: AllStatic { // Runtime support // length = invoke bytecode length (to advance to next bytecode) - static address deopt_entry (TosState state, int length) { ShouldNotReachHere(); return NULL; } - static address return_entry (TosState state, int length) { ShouldNotReachHere(); return NULL; } + static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return NULL; } + static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return NULL; } static address rethrow_exception_entry() { return _rethrow_exception_entry; } diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp index 4997a443257..71f78840b95 100644 --- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp @@ -78,7 +78,7 @@ class CppInterpreter: public AbstractInterpreter { static address stack_result_to_stack(int index) { return _stack_to_stack[index]; } static address stack_result_to_native(int index) { return _stack_to_native_abi[index]; } - static address return_entry (TosState state, int length); + static address return_entry (TosState state, int length, Bytecodes::Code code); static address deopt_entry (TosState state, int length); #ifdef TARGET_ARCH_x86 diff --git a/hotspot/src/share/vm/interpreter/interpreter.cpp b/hotspot/src/share/vm/interpreter/interpreter.cpp index dfd8b5b145a..60246e9013d 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.cpp +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp @@ -329,15 +329,21 @@ void AbstractInterpreter::print_method_kind(MethodKind kind) { //------------------------------------------------------------------------------------------------------------------------ // Deoptimization support -// If deoptimization happens, this function returns the point of next bytecode to continue execution +/** + * If a deoptimization happens, this function returns the point of next bytecode to continue execution. + */ address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) { assert(method->contains(bcp), "just checkin'"); - Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); + + // Get the original and rewritten bytecode. + Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute"); - int bci = method->bci_from(bcp); - int length = -1; // initial value for debugging + + const int bci = method->bci_from(bcp); + // compute continuation length - length = Bytecodes::length_at(method, bcp); + const int length = Bytecodes::length_at(method, bcp); + // compute result type BasicType type = T_ILLEGAL; @@ -393,7 +399,7 @@ address AbstractInterpreter::deopt_continue_after_entry(Method* method, address return is_top_frame ? Interpreter::deopt_entry (as_TosState(type), length) - : Interpreter::return_entry(as_TosState(type), length); + : Interpreter::return_entry(as_TosState(type), length, code); } // If deoptimization happens, this function returns the point where the interpreter reexecutes diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp index 9f7ed4c7e97..e3e89e8eed9 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp @@ -184,8 +184,9 @@ EntryPoint TemplateInterpreter::_deopt_entry [TemplateInterpreter::number_of_deo EntryPoint TemplateInterpreter::_continuation_entry; EntryPoint TemplateInterpreter::_safept_entry; -address TemplateInterpreter::_return_3_addrs_by_index[TemplateInterpreter::number_of_return_addrs]; -address TemplateInterpreter::_return_5_addrs_by_index[TemplateInterpreter::number_of_return_addrs]; +address TemplateInterpreter::_invoke_return_entry[TemplateInterpreter::number_of_return_addrs]; +address TemplateInterpreter::_invokeinterface_return_entry[TemplateInterpreter::number_of_return_addrs]; +address TemplateInterpreter::_invokedynamic_return_entry[TemplateInterpreter::number_of_return_addrs]; DispatchTable TemplateInterpreter::_active_table; DispatchTable TemplateInterpreter::_normal_table; @@ -237,22 +238,37 @@ void TemplateInterpreterGenerator::generate_all() { #endif // !PRODUCT { CodeletMark cm(_masm, "return entry points"); + const int index_size = sizeof(u2); for (int i = 0; i < Interpreter::number_of_return_entries; i++) { Interpreter::_return_entry[i] = EntryPoint( - generate_return_entry_for(itos, i), - generate_return_entry_for(itos, i), - generate_return_entry_for(itos, i), - generate_return_entry_for(atos, i), - generate_return_entry_for(itos, i), - generate_return_entry_for(ltos, i), - generate_return_entry_for(ftos, i), - generate_return_entry_for(dtos, i), - generate_return_entry_for(vtos, i) + generate_return_entry_for(itos, i, index_size), + generate_return_entry_for(itos, i, index_size), + generate_return_entry_for(itos, i, index_size), + generate_return_entry_for(atos, i, index_size), + generate_return_entry_for(itos, i, index_size), + generate_return_entry_for(ltos, i, index_size), + generate_return_entry_for(ftos, i, index_size), + generate_return_entry_for(dtos, i, index_size), + generate_return_entry_for(vtos, i, index_size) ); } } + { CodeletMark cm(_masm, "invoke return entry points"); + const TosState states[] = {itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos}; + const int invoke_length = Bytecodes::length_for(Bytecodes::_invokestatic); + const int invokeinterface_length = Bytecodes::length_for(Bytecodes::_invokeinterface); + const int invokedynamic_length = Bytecodes::length_for(Bytecodes::_invokedynamic); + + for (int i = 0; i < Interpreter::number_of_return_addrs; i++) { + TosState state = states[i]; + Interpreter::_invoke_return_entry[i] = generate_return_entry_for(state, invoke_length, sizeof(u2)); + Interpreter::_invokeinterface_return_entry[i] = generate_return_entry_for(state, invokeinterface_length, sizeof(u2)); + Interpreter::_invokedynamic_return_entry[i] = generate_return_entry_for(state, invokedynamic_length, sizeof(u4)); + } + } + { CodeletMark cm(_masm, "earlyret entry points"); Interpreter::_earlyret_entry = EntryPoint( @@ -298,13 +314,6 @@ void TemplateInterpreterGenerator::generate_all() { } } - for (int j = 0; j < number_of_states; j++) { - const TosState states[] = {btos, ctos, stos, itos, ltos, ftos, dtos, atos, vtos}; - int index = Interpreter::TosState_as_index(states[j]); - Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3); - Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5); - } - { CodeletMark cm(_masm, "continuation entry points"); Interpreter::_continuation_entry = EntryPoint( @@ -534,9 +543,46 @@ void TemplateInterpreterGenerator::generate_and_dispatch(Template* t, TosState t //------------------------------------------------------------------------------------------------------------------------ // Entry points -address TemplateInterpreter::return_entry(TosState state, int length) { +/** + * Returns the return entry table for the given invoke bytecode. + */ +address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code) { + switch (code) { + case Bytecodes::_invokestatic: + case Bytecodes::_invokespecial: + case Bytecodes::_invokevirtual: + case Bytecodes::_invokehandle: + return Interpreter::invoke_return_entry_table(); + case Bytecodes::_invokeinterface: + return Interpreter::invokeinterface_return_entry_table(); + case Bytecodes::_invokedynamic: + return Interpreter::invokedynamic_return_entry_table(); + default: + fatal(err_msg("invalid bytecode: %s", Bytecodes::name(code))); + return NULL; + } +} + +/** + * Returns the return entry address for the given top-of-stack state and bytecode. + */ +address TemplateInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length"); - return _return_entry[length].entry(state); + const int index = TosState_as_index(state); + switch (code) { + case Bytecodes::_invokestatic: + case Bytecodes::_invokespecial: + case Bytecodes::_invokevirtual: + case Bytecodes::_invokehandle: + return _invoke_return_entry[index]; + case Bytecodes::_invokeinterface: + return _invokeinterface_return_entry[index]; + case Bytecodes::_invokedynamic: + return _invokedynamic_return_entry[index]; + default: + assert(!Bytecodes::is_invoke(code), err_msg("invoke instructions should be handled separately: %s", Bytecodes::name(code))); + return _return_entry[length].entry(state); + } } diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp index 43fe4bdb1c0..838e2e08473 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp @@ -120,8 +120,9 @@ class TemplateInterpreter: public AbstractInterpreter { static EntryPoint _continuation_entry; static EntryPoint _safept_entry; - static address _return_3_addrs_by_index[number_of_return_addrs]; // for invokevirtual return entries - static address _return_5_addrs_by_index[number_of_return_addrs]; // for invokeinterface return entries + static address _invoke_return_entry[number_of_return_addrs]; // for invokestatic, invokespecial, invokevirtual return entries + static address _invokeinterface_return_entry[number_of_return_addrs]; // for invokeinterface return entries + static address _invokedynamic_return_entry[number_of_return_addrs]; // for invokedynamic return entries static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch) static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode) @@ -161,12 +162,15 @@ class TemplateInterpreter: public AbstractInterpreter { static address* normal_table() { return _normal_table.table_for(); } // Support for invokes - static address* return_3_addrs_by_index_table() { return _return_3_addrs_by_index; } - static address* return_5_addrs_by_index_table() { return _return_5_addrs_by_index; } - static int TosState_as_index(TosState state); // computes index into return_3_entry_by_index table + static address* invoke_return_entry_table() { return _invoke_return_entry; } + static address* invokeinterface_return_entry_table() { return _invokeinterface_return_entry; } + static address* invokedynamic_return_entry_table() { return _invokedynamic_return_entry; } + static int TosState_as_index(TosState state); - static address return_entry (TosState state, int length); - static address deopt_entry (TosState state, int length); + static address* invoke_return_entry_table_for(Bytecodes::Code code); + + static address deopt_entry(TosState state, int length); + static address return_entry(TosState state, int length, Bytecodes::Code code); // Safepoint support static void notice_safepoints(); // stops the thread when reaching a safepoint diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp index fb7bdc5b6c2..a80caa96409 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp @@ -53,7 +53,7 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator { address generate_ClassCastException_handler(); address generate_ArrayIndexOutOfBounds_handler(const char* name); address generate_continuation_for(TosState state); - address generate_return_entry_for(TosState state, int step); + address generate_return_entry_for(TosState state, int step, size_t index_size); address generate_earlyret_entry_for(TosState state); address generate_deopt_entry_for(TosState state, int step); address generate_safept_entry_for(TosState state, address runtime_entry); diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 1877967408d..8df4e32c355 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -56,7 +56,7 @@ size_t const allocation_from_dictionary_limit = 4 * K; MetaWord* last_allocated = 0; -size_t Metaspace::_class_metaspace_size; +size_t Metaspace::_compressed_class_space_size; // Used in declarations in SpaceManager and ChunkManager enum ChunkIndex { @@ -2843,6 +2843,8 @@ ChunkManager* Metaspace::_chunk_manager_class = NULL; #define VIRTUALSPACEMULTIPLIER 2 #ifdef _LP64 +static const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1); + void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address cds_base) { // Figure out the narrow_klass_base and the narrow_klass_shift. The // narrow_klass_base is the lower of the metaspace base and the cds base @@ -2852,14 +2854,22 @@ void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address address higher_address; if (UseSharedSpaces) { higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()), - (address)(metaspace_base + class_metaspace_size())); + (address)(metaspace_base + compressed_class_space_size())); lower_base = MIN2(metaspace_base, cds_base); } else { - higher_address = metaspace_base + class_metaspace_size(); + higher_address = metaspace_base + compressed_class_space_size(); lower_base = metaspace_base; + + uint64_t klass_encoding_max = UnscaledClassSpaceMax << LogKlassAlignmentInBytes; + // If compressed class space fits in lower 32G, we don't need a base. + if (higher_address <= (address)klass_encoding_max) { + lower_base = 0; // effectively lower base is zero. + } } + Universe::set_narrow_klass_base(lower_base); - if ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint) { + + if ((uint64_t)(higher_address - lower_base) < UnscaledClassSpaceMax) { Universe::set_narrow_klass_shift(0); } else { assert(!UseSharedSpaces, "Cannot shift with UseSharedSpaces"); @@ -2874,24 +2884,24 @@ bool Metaspace::can_use_cds_with_metaspace_addr(char* metaspace_base, address cd assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs"); address lower_base = MIN2((address)metaspace_base, cds_base); address higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()), - (address)(metaspace_base + class_metaspace_size())); - return ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint); + (address)(metaspace_base + compressed_class_space_size())); + return ((uint64_t)(higher_address - lower_base) < UnscaledClassSpaceMax); } // Try to allocate the metaspace at the requested addr. void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base) { assert(using_class_space(), "called improperly"); assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs"); - assert(class_metaspace_size() < KlassEncodingMetaspaceMax, + assert(compressed_class_space_size() < KlassEncodingMetaspaceMax, "Metaspace size is too big"); - assert_is_ptr_aligned(requested_addr, _reserve_alignment); - assert_is_ptr_aligned(cds_base, _reserve_alignment); - assert_is_size_aligned(class_metaspace_size(), _reserve_alignment); + assert_is_ptr_aligned(requested_addr, _reserve_alignment); + assert_is_ptr_aligned(cds_base, _reserve_alignment); + assert_is_size_aligned(compressed_class_space_size(), _reserve_alignment); // Don't use large pages for the class space. bool large_pages = false; - ReservedSpace metaspace_rs = ReservedSpace(class_metaspace_size(), + ReservedSpace metaspace_rs = ReservedSpace(compressed_class_space_size(), _reserve_alignment, large_pages, requested_addr, 0); @@ -2906,7 +2916,7 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a while (!metaspace_rs.is_reserved() && (addr + increment > addr) && can_use_cds_with_metaspace_addr(addr + increment, cds_base)) { addr = addr + increment; - metaspace_rs = ReservedSpace(class_metaspace_size(), + metaspace_rs = ReservedSpace(compressed_class_space_size(), _reserve_alignment, large_pages, addr, 0); } } @@ -2917,11 +2927,11 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a // initialization has happened that depends on UseCompressedClassPointers. // So, UseCompressedClassPointers cannot be turned off at this point. if (!metaspace_rs.is_reserved()) { - metaspace_rs = ReservedSpace(class_metaspace_size(), + metaspace_rs = ReservedSpace(compressed_class_space_size(), _reserve_alignment, large_pages); if (!metaspace_rs.is_reserved()) { vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes", - class_metaspace_size())); + compressed_class_space_size())); } } } @@ -2943,8 +2953,8 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT, Universe::narrow_klass_base(), Universe::narrow_klass_shift()); - gclog_or_tty->print_cr("Metaspace Size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT, - class_metaspace_size(), metaspace_rs.base(), requested_addr); + gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT, + compressed_class_space_size(), metaspace_rs.base(), requested_addr); } } @@ -3010,7 +3020,7 @@ void Metaspace::ergo_initialize() { MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment); CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment); - set_class_metaspace_size(CompressedClassSpaceSize); + set_compressed_class_space_size(CompressedClassSpaceSize); } void Metaspace::global_initialize() { @@ -3039,12 +3049,12 @@ void Metaspace::global_initialize() { } #ifdef _LP64 - if (cds_total + class_metaspace_size() > (uint64_t)max_juint) { + if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) { vm_exit_during_initialization("Unable to dump shared archive.", err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space (" SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed " - "klass limit: " SIZE_FORMAT, cds_total, class_metaspace_size(), - cds_total + class_metaspace_size(), (size_t)max_juint)); + "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(), + cds_total + compressed_class_space_size(), UnscaledClassSpaceMax)); } // Set the compressed klass pointer base so that decoding of these pointers works @@ -3092,7 +3102,8 @@ void Metaspace::global_initialize() { cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment); allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address); } else { - allocate_metaspace_compressed_klass_ptrs((char *)CompressedKlassPointersBase, 0); + char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment); + allocate_metaspace_compressed_klass_ptrs(base, 0); } } #endif @@ -3354,6 +3365,11 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size, return result; } +size_t Metaspace::class_chunk_size(size_t word_size) { + assert(using_class_space(), "Has to use class space"); + return class_vsm()->calc_chunk_size(word_size); +} + void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) { // If result is still null, we are out of memory. if (Verbose && TraceMetadataChunkAllocation) { @@ -3365,9 +3381,19 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s MetaspaceAux::dump(gclog_or_tty); } + bool out_of_compressed_class_space = false; + if (is_class_space_allocation(mdtype)) { + Metaspace* metaspace = loader_data->metaspace_non_null(); + out_of_compressed_class_space = + MetaspaceAux::committed_bytes(Metaspace::ClassType) + + (metaspace->class_chunk_size(word_size) * BytesPerWord) > + CompressedClassSpaceSize; + } + // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support - const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" : - "Metadata space"; + const char* space_string = out_of_compressed_class_space ? + "Compressed class space" : "Metaspace"; + report_java_out_of_memory(space_string); if (JvmtiExport::should_post_resource_exhausted()) { @@ -3380,7 +3406,7 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s vm_exit_during_initialization("OutOfMemoryError", space_string); } - if (is_class_space_allocation(mdtype)) { + if (out_of_compressed_class_space) { THROW_OOP(Universe::out_of_memory_error_class_metaspace()); } else { THROW_OOP(Universe::out_of_memory_error_metaspace()); diff --git a/hotspot/src/share/vm/memory/metaspace.hpp b/hotspot/src/share/vm/memory/metaspace.hpp index 974a1aac62d..c22d2170761 100644 --- a/hotspot/src/share/vm/memory/metaspace.hpp +++ b/hotspot/src/share/vm/memory/metaspace.hpp @@ -115,13 +115,13 @@ class Metaspace : public CHeapObj { static size_t align_word_size_up(size_t); // Aligned size of the metaspace. - static size_t _class_metaspace_size; + static size_t _compressed_class_space_size; - static size_t class_metaspace_size() { - return _class_metaspace_size; + static size_t compressed_class_space_size() { + return _compressed_class_space_size; } - static void set_class_metaspace_size(size_t metaspace_size) { - _class_metaspace_size = metaspace_size; + static void set_compressed_class_space_size(size_t size) { + _compressed_class_space_size = size; } static size_t _first_chunk_word_size; @@ -192,6 +192,8 @@ class Metaspace : public CHeapObj { AllocRecord * _alloc_record_head; AllocRecord * _alloc_record_tail; + size_t class_chunk_size(size_t word_size); + public: Metaspace(Mutex* lock, MetaspaceType type); @@ -252,6 +254,7 @@ class Metaspace : public CHeapObj { static bool is_class_space_allocation(MetadataType mdType) { return mdType == ClassType && using_class_space(); } + }; class MetaspaceAux : AllStatic { diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 1f632ae478f..043962c6304 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -677,13 +677,13 @@ jint universe_init() { // HeapBased - Use compressed oops with heap base + encoding. // 4Gb -static const uint64_t NarrowOopHeapMax = (uint64_t(max_juint) + 1); +static const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1); // 32Gb -// OopEncodingHeapMax == NarrowOopHeapMax << LogMinObjAlignmentInBytes; +// OopEncodingHeapMax == UnscaledOopHeapMax << LogMinObjAlignmentInBytes; char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode) { assert(is_size_aligned((size_t)OopEncodingHeapMax, alignment), "Must be"); - assert(is_size_aligned((size_t)NarrowOopHeapMax, alignment), "Must be"); + assert(is_size_aligned((size_t)UnscaledOopHeapMax, alignment), "Must be"); assert(is_size_aligned(heap_size, alignment), "Must be"); uintx heap_base_min_address_aligned = align_size_up(HeapBaseMinAddress, alignment); @@ -702,20 +702,40 @@ char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_O // If the total size is small enough to allow UnscaledNarrowOop then // just use UnscaledNarrowOop. } else if ((total_size <= OopEncodingHeapMax) && (mode != HeapBasedNarrowOop)) { - if ((total_size <= NarrowOopHeapMax) && (mode == UnscaledNarrowOop) && + if ((total_size <= UnscaledOopHeapMax) && (mode == UnscaledNarrowOop) && (Universe::narrow_oop_shift() == 0)) { // Use 32-bits oops without encoding and // place heap's top on the 4Gb boundary - base = (NarrowOopHeapMax - heap_size); + base = (UnscaledOopHeapMax - heap_size); } else { // Can't reserve with NarrowOopShift == 0 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); + if (mode == UnscaledNarrowOop || - mode == ZeroBasedNarrowOop && total_size <= NarrowOopHeapMax) { + mode == ZeroBasedNarrowOop && total_size <= UnscaledOopHeapMax) { + // Use zero based compressed oops with encoding and // place heap's top on the 32Gb boundary in case // total_size > 4Gb or failed to reserve below 4Gb. - base = (OopEncodingHeapMax - heap_size); + uint64_t heap_top = OopEncodingHeapMax; + + // For small heaps, save some space for compressed class pointer + // space so it can be decoded with no base. + if (UseCompressedClassPointers && !UseSharedSpaces && + OopEncodingHeapMax <= 32*G) { + + uint64_t class_space = align_size_up(CompressedClassSpaceSize, alignment); + assert(is_size_aligned((size_t)OopEncodingHeapMax-class_space, + alignment), "difference must be aligned too"); + uint64_t new_top = OopEncodingHeapMax-class_space; + + if (total_size <= new_top) { + heap_top = new_top; + } + } + + // Align base to the adjusted top of the heap + base = heap_top - heap_size; } } } else { @@ -737,7 +757,7 @@ char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_O // Set to a non-NULL value so the ReservedSpace ctor computes // the correct no-access prefix. // The final value will be set in initialize_heap() below. - Universe::set_narrow_oop_base((address)NarrowOopHeapMax); + Universe::set_narrow_oop_base((address)UnscaledOopHeapMax); #ifdef _WIN64 if (UseLargePages) { // Cannot allocate guard pages for implicit checks in indexed @@ -833,7 +853,7 @@ jint Universe::initialize_heap() { Universe::set_narrow_oop_use_implicit_null_checks(true); } #endif // _WIN64 - if((uint64_t)Universe::heap()->reserved_region().end() > NarrowOopHeapMax) { + if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) { // Can't reserve heap below 4Gb. Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); } else { @@ -1029,7 +1049,7 @@ bool universe_post_init() { Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false); java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg()); - msg = java_lang_String::create_from_str("Metadata space", CHECK_false); + msg = java_lang_String::create_from_str("Metaspace", CHECK_false); java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg()); msg = java_lang_String::create_from_str("Compressed class space", CHECK_false); java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg()); diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index a8fa7b3ee0e..510102d4e35 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2393,15 +2393,38 @@ address InstanceKlass::static_field_addr(int offset) { const char* InstanceKlass::signature_name() const { + int hash_len = 0; + char hash_buf[40]; + + // If this is an anonymous class, append a hash to make the name unique + if (is_anonymous()) { + assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set."); + intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0; + sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash); + hash_len = (int)strlen(hash_buf); + } + + // Get the internal name as a c string const char* src = (const char*) (name()->as_C_string()); const int src_length = (int)strlen(src); - char* dest = NEW_RESOURCE_ARRAY(char, src_length + 3); - int src_index = 0; + + char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3); + + // Add L as type indicator int dest_index = 0; dest[dest_index++] = 'L'; - while (src_index < src_length) { + + // Add the actual class name + for (int src_index = 0; src_index < src_length; ) { dest[dest_index++] = src[src_index++]; } + + // If we have a hash, append it + for (int hash_index = 0; hash_index < hash_len; ) { + dest[dest_index++] = hash_buf[hash_index++]; + } + + // Add the semicolon and the NULL dest[dest_index++] = ';'; dest[dest_index] = '\0'; return dest; diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index c0b4a97fca0..7c292c3ffe5 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -1515,7 +1515,10 @@ Bytecodes::Code Method::orig_bytecode_at(int bci) const { return bp->orig_bytecode(); } } - ShouldNotReachHere(); + { + ResourceMark rm; + fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci)); + } return Bytecodes::_shouldnotreachhere; } diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 6a7ee628844..df6c29f5766 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -2006,9 +2006,9 @@ bool LibraryCallKit::inline_math_addExactI(bool is_increment) { Node* arg2 = NULL; if (is_increment) { - arg2 = intcon(1); + arg2 = intcon(1); } else { - arg2 = argument(1); + arg2 = argument(1); } Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) ); @@ -2056,7 +2056,7 @@ bool LibraryCallKit::inline_math_subtractExactL(bool is_decrement) { if (is_decrement) { arg2 = longcon(1); } else { - Node* arg2 = argument(2); // type long + arg2 = argument(2); // type long // argument(3) == TOP } diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 41c0a9d416d..55a533bc38a 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -713,6 +713,10 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { case Op_ModL: body_size += 30; break; case Op_DivL: body_size += 30; break; case Op_MulL: body_size += 10; break; + case Op_FlagsProj: + // Can't handle unrolling of loops containing + // nodes that generate a FlagsProj at the moment + return false; case Op_StrComp: case Op_StrEquals: case Op_StrIndexOf: diff --git a/hotspot/src/share/vm/opto/postaloc.cpp b/hotspot/src/share/vm/opto/postaloc.cpp index 76de2ed16a1..2ad809d1a58 100644 --- a/hotspot/src/share/vm/opto/postaloc.cpp +++ b/hotspot/src/share/vm/opto/postaloc.cpp @@ -97,7 +97,8 @@ int PhaseChaitin::yank( Node *old, Block *current_block, Node_List *value, Node_ static bool expected_yanked_node(Node *old, Node *orig_old) { // This code is expected only next original nodes: // - load from constant table node which may have next data input nodes: - // MachConstantBase, Phi, MachTemp, MachSpillCopy + // MachConstantBase, MachTemp, MachSpillCopy + // - Phi nodes that are considered Junk // - load constant node which may have next data input nodes: // MachTemp, MachSpillCopy // - MachSpillCopy @@ -112,7 +113,9 @@ static bool expected_yanked_node(Node *old, Node *orig_old) { return (old == orig_old); } else if (old->is_MachTemp()) { return orig_old->is_Con(); - } else if (old->is_Phi() || old->is_MachConstantBase()) { + } else if (old->is_Phi()) { // Junk phi's + return true; + } else if (old->is_MachConstantBase()) { return (orig_old->is_Con() && orig_old->is_MachConstant()); } return false; @@ -522,11 +525,9 @@ void PhaseChaitin::post_allocate_copy_removal() { u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input } if (u != NodeSentinel) { // Junk Phi. Remove - block->remove_node(j--); - phi_dex--; - _cfg.unmap_node_from_block(phi); phi->replace_by(u); - phi->disconnect_inputs(NULL, C); + j -= yank_if_dead(phi, block, &value, ®nd); + phi_dex--; continue; } // Note that if value[pidx] exists, then we merged no new values here diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index faf1555161f..3f628195f78 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -2787,13 +2787,11 @@ intptr_t TypeOopPtr::get_con() const { //-----------------------------filter------------------------------------------ // Do not allow interface-vs.-noninterface joins to collapse to top. -const Type *TypeOopPtr::filter( const Type *kills ) const { +const Type *TypeOopPtr::filter(const Type *kills) const { const Type* ft = join(kills); const TypeInstPtr* ftip = ft->isa_instptr(); const TypeInstPtr* ktip = kills->isa_instptr(); - const TypeKlassPtr* ftkp = ft->isa_klassptr(); - const TypeKlassPtr* ktkp = kills->isa_klassptr(); if (ft->empty()) { // Check for evil case of 'this' being a class and 'kills' expecting an @@ -2807,8 +2805,6 @@ const Type *TypeOopPtr::filter( const Type *kills ) const { // uplift the type. if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) return kills; // Uplift to interface - if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) - return kills; // Uplift to interface return Type::TOP; // Canonical empty value } @@ -2825,14 +2821,6 @@ const Type *TypeOopPtr::filter( const Type *kills ) const { assert(!ftip->klass_is_exact(), "interface could not be exact"); return ktip->cast_to_ptr_type(ftip->ptr()); } - // Interface klass type could be exact in opposite to interface type, - // return it here instead of incorrect Constant ptr J/L/Object (6894807). - if (ftkp != NULL && ktkp != NULL && - ftkp->is_loaded() && ftkp->klass()->is_interface() && - !ftkp->klass_is_exact() && // Keep exact interface klass - ktkp->is_loaded() && !ktkp->klass()->is_interface()) { - return ktkp->cast_to_ptr_type(ftkp->ptr()); - } return ft; } @@ -4385,6 +4373,33 @@ bool TypeKlassPtr::singleton(void) const { return (_offset == 0) && !below_centerline(_ptr); } +// Do not allow interface-vs.-noninterface joins to collapse to top. +const Type *TypeKlassPtr::filter(const Type *kills) const { + // logic here mirrors the one from TypeOopPtr::filter. See comments + // there. + const Type* ft = join(kills); + const TypeKlassPtr* ftkp = ft->isa_klassptr(); + const TypeKlassPtr* ktkp = kills->isa_klassptr(); + + if (ft->empty()) { + if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) + return kills; // Uplift to interface + + return Type::TOP; // Canonical empty value + } + + // Interface klass type could be exact in opposite to interface type, + // return it here instead of incorrect Constant ptr J/L/Object (6894807). + if (ftkp != NULL && ktkp != NULL && + ftkp->is_loaded() && ftkp->klass()->is_interface() && + !ftkp->klass_is_exact() && // Keep exact interface klass + ktkp->is_loaded() && !ktkp->klass()->is_interface()) { + return ktkp->cast_to_ptr_type(ftkp->ptr()); + } + + return ft; +} + //----------------------compute_klass------------------------------------------ // Compute the defining klass for this class ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const { diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index e72baa96b1d..9810edfe724 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -63,7 +63,7 @@ class TypeRawPtr; class TypeOopPtr; class TypeInstPtr; class TypeAryPtr; -class TypeKlassPtr; +class TypeKlassPtr; class TypeMetadataPtr; //------------------------------Type------------------------------------------- @@ -1202,6 +1202,9 @@ public: virtual intptr_t get_con() const; + // Do not allow interface-vs.-noninterface joins to collapse to top. + virtual const Type *filter( const Type *kills ) const; + // Convenience common pre-built types. static const TypeKlassPtr* OBJECT; // Not-null object klass or below static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same diff --git a/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp b/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp index 51cfb384ac9..f58a5a3d532 100644 --- a/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp +++ b/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp @@ -29,8 +29,43 @@ #include "runtime/thread.hpp" +// The closure for GetLoadedClasses +class LoadedClassesClosure : public KlassClosure { +private: + Stack _classStack; + JvmtiEnv* _env; -// The closure for GetLoadedClasses and GetClassLoaderClasses +public: + LoadedClassesClosure(JvmtiEnv* env) { + _env = env; + } + + void do_klass(Klass* k) { + // Collect all jclasses + _classStack.push((jclass) _env->jni_reference(k->java_mirror())); + } + + int extract(jclass* result_list) { + // The size of the Stack will be 0 after extract, so get it here + int count = (int)_classStack.size(); + int i = count; + + // Pop all jclasses, fill backwards + while (!_classStack.is_empty()) { + result_list[--i] = _classStack.pop(); + } + + // Return the number of elements written + return count; + } + + // Return current size of the Stack + int get_count() { + return (int)_classStack.size(); + } +}; + +// The closure for GetClassLoaderClasses class JvmtiGetLoadedClassesClosure : public StackObj { // Since the SystemDictionary::classes_do callback // doesn't pass a closureData pointer, @@ -165,19 +200,6 @@ class JvmtiGetLoadedClassesClosure : public StackObj { } } - // Finally, the static methods that are the callbacks - static void increment(Klass* k) { - JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); - if (that->get_initiatingLoader() == NULL) { - for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { - that->set_count(that->get_count() + 1); - } - } else if (k != NULL) { - // if initiating loader not null, just include the instance with 1 dimension - that->set_count(that->get_count() + 1); - } - } - static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); oop class_loader = loader_data->class_loader(); @@ -196,24 +218,6 @@ class JvmtiGetLoadedClassesClosure : public StackObj { } } - static void add(Klass* k) { - JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); - if (that->available()) { - if (that->get_initiatingLoader() == NULL) { - for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) { - oop mirror = l->java_mirror(); - that->set_element(that->get_index(), mirror); - that->set_index(that->get_index() + 1); - } - } else if (k != NULL) { - // if initiating loader not null, just include the instance with 1 dimension - oop mirror = k->java_mirror(); - that->set_element(that->get_index(), mirror); - that->set_index(that->get_index() + 1); - } - } - } - static void add_with_loader(Klass* k, ClassLoaderData* loader_data) { JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); if (that->available()) { @@ -255,39 +259,30 @@ class JvmtiGetLoadedClassesClosure : public StackObj { jvmtiError JvmtiGetLoadedClasses::getLoadedClasses(JvmtiEnv *env, jint* classCountPtr, jclass** classesPtr) { - // Since SystemDictionary::classes_do only takes a function pointer - // and doesn't call back with a closure data pointer, - // we can only pass static methods. - JvmtiGetLoadedClassesClosure closure; + LoadedClassesClosure closure(env); { // To get a consistent list of classes we need MultiArray_lock to ensure - // array classes aren't created, and SystemDictionary_lock to ensure that - // classes aren't added to the system dictionary, + // array classes aren't created. MutexLocker ma(MultiArray_lock); - MutexLocker sd(SystemDictionary_lock); - // First, count the classes - SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::increment); - Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::increment); - // Next, fill in the classes - closure.allocate(); - SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::add); - Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::add); - // Drop the SystemDictionary_lock, so the results could be wrong from here, - // but we still have a snapshot. + // Iterate through all classes in ClassLoaderDataGraph + // and collect them using the LoadedClassesClosure + ClassLoaderDataGraph::loaded_classes_do(&closure); } - // Post results + + // Return results by extracting the collected contents into a list + // allocated via JvmtiEnv jclass* result_list; - jvmtiError err = env->Allocate(closure.get_count() * sizeof(jclass), - (unsigned char**)&result_list); - if (err != JVMTI_ERROR_NONE) { - return err; + jvmtiError error = env->Allocate(closure.get_count() * sizeof(jclass), + (unsigned char**)&result_list); + + if (error == JVMTI_ERROR_NONE) { + int count = closure.extract(result_list); + *classCountPtr = count; + *classesPtr = result_list; } - closure.extract(env, result_list); - *classCountPtr = closure.get_count(); - *classesPtr = result_list; - return JVMTI_ERROR_NONE; + return error; } jvmtiError diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index fce983f8cff..8060dae0377 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1988,6 +1988,15 @@ void Arguments::check_deprecated_gc_flags() { warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " "Use MaxRAMFraction instead."); } + if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) { + warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release."); + } + if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) { + warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release."); + } + if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) { + warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release."); + } } // Check stack pages settings diff --git a/hotspot/src/share/vm/runtime/handles.cpp b/hotspot/src/share/vm/runtime/handles.cpp index 1b4e9faecf9..ca73f86ba7f 100644 --- a/hotspot/src/share/vm/runtime/handles.cpp +++ b/hotspot/src/share/vm/runtime/handles.cpp @@ -45,7 +45,7 @@ oop* HandleArea::allocate_handle(oop obj) { assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark"); - assert(obj->is_oop(), "sanity check"); + assert(obj->is_oop(), err_msg("not an oop: " INTPTR_FORMAT, (intptr_t*) obj)); return real_allocate_handle(obj); } diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index f645be31d80..9f31c25b7c6 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -1097,7 +1097,7 @@ static const char* get_java_runtime_version(TRAPS) { // General purpose hook into Java code, run once when the VM is initialized. // The Java library method itself may be changed independently from the VM. static void call_postVMInitHook(TRAPS) { - Klass* k = SystemDictionary::PostVMInitHook_klass(); + Klass* k = SystemDictionary::resolve_or_null(vmSymbols::sun_misc_PostVMInitHook(), THREAD); instanceKlassHandle klass (THREAD, k); if (klass.not_null()) { JavaValue result(T_VOID); diff --git a/hotspot/src/share/vm/services/jmm.h b/hotspot/src/share/vm/services/jmm.h index 9f46499b4e8..e0a748a41d5 100644 --- a/hotspot/src/share/vm/services/jmm.h +++ b/hotspot/src/share/vm/services/jmm.h @@ -78,6 +78,7 @@ typedef enum { JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */ JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */ JMM_GC_COUNT = 10, /* Total number of collections */ + JMM_JVM_UPTIME_MS = 11, /* The JVM uptime in milliseconds */ JMM_INTERNAL_ATTRIBUTE_INDEX = 100, JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp index 9c87989601b..9585960daa2 100644 --- a/hotspot/src/share/vm/services/management.cpp +++ b/hotspot/src/share/vm/services/management.cpp @@ -1032,6 +1032,9 @@ static jlong get_long_attribute(jmmLongAttribute att) { case JMM_JVM_INIT_DONE_TIME_MS: return Management::vm_init_done_time(); + case JMM_JVM_UPTIME_MS: + return Management::ticks_to_ms(os::elapsed_counter()); + case JMM_COMPILE_TOTAL_TIME_MS: return Management::ticks_to_ms(CompileBroker::total_compilation_ticks()); diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 06a32dc9037..7806cdc0811 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -368,8 +368,6 @@ const int KlassAlignment = KlassAlignmentInBytes / HeapWordSize; // Klass encoding metaspace max size const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes; -const jlong CompressedKlassPointersBase = NOT_LP64(0) LP64_ONLY(CONST64(0x800000000)); // 32*G - // Machine dependent stuff #ifdef TARGET_ARCH_x86 diff --git a/hotspot/test/compiler/inlining/InlineDefaultMethod.java b/hotspot/test/compiler/inlining/InlineDefaultMethod.java new file mode 100644 index 00000000000..609eaf217d5 --- /dev/null +++ b/hotspot/test/compiler/inlining/InlineDefaultMethod.java @@ -0,0 +1,64 @@ +/* + * 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 + * 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. + */ + +/* + * @test + * @bug 8026735 + * @summary CHA in C1 should make correct decisions about default methods + * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod::test -XX:TieredStopAtLevel=1 InlineDefaultMethod + */ + + +interface InterfaceWithDefaultMethod0 { + default public int defaultMethod() { + return 1; + } +} + +interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { } + +abstract class Subtype implements InterfaceWithDefaultMethod1 { } + +class Decoy extends Subtype { + public int defaultMethod() { + return 2; + } +} + +class Instance extends Subtype { } + +public class InlineDefaultMethod { + public static int test(InterfaceWithDefaultMethod1 x) { + return x.defaultMethod(); + } + public static void main(String[] args) { + InterfaceWithDefaultMethod1 a = new Decoy(); + InterfaceWithDefaultMethod1 b = new Instance(); + if (test(a) != 2 || + test(b) != 1) { + System.err.println("FAILED"); + System.exit(97); + } + System.err.println("PASSED"); + } +} diff --git a/jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java similarity index 52% rename from jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java rename to hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java index b78588bf8fa..211dc8baff1 100644 --- a/jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2012, 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 * 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. + * 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 @@ -22,18 +20,35 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package java.lang.invoke; -/**

MagicLambdaImpl (named for similarity to MagicAccessorImpl and - others, not because it actually implements an interface) is a - marker class in the hierarchy. All subclasses of this class are - "magically" granted access by the VM to otherwise inaccessible - fields and methods of other classes. It is distinct from MagicAccessorImpl - because, while we want to bypass accessibility checks, we do not want to - bypass verification.

+/* + * @test + * @bug 8027444 + * @summary Test nested loops + * @compile NestedMathExactTest.java + * @run main NestedMathExactTest + * + */ -

Do not change the name of this class without also changing the - VM's code.

*/ +public class NestedMathExactTest { + public static final int LIMIT = 100; + public static int[] result = new int[LIMIT]; + public static int value = 17; -class MagicLambdaImpl { + public static void main(String[] args) { + for (int i = 0; i < 100; ++i) { + result[i] = runTest(); + } + } + + public static int runTest() { + int sum = 0; + for (int j = 0; j < 100000; j = Math.addExact(j, 1)) { + sum = 1; + for (int i = 0; i < 5; ++i) { + sum *= value; + } + } + return sum; + } } diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java index 46eefcd194a..ec554d7662b 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 8026844 + * @bug 8027353 * @summary Test constant subtractExact * @compile SubExactLConstantTest.java Verify.java * @run main SubExactLConstantTest diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java index 2bd67bb0f9b..86ecf20f366 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 8026844 + * @bug 8027353 * @summary Test non constant subtractExact * @compile SubExactLNonConstantTest.java Verify.java * @run main SubExactLNonConstantTest diff --git a/hotspot/test/compiler/startup/StartupOutput.java b/hotspot/test/compiler/startup/StartupOutput.java new file mode 100644 index 00000000000..f677853d51c --- /dev/null +++ b/hotspot/test/compiler/startup/StartupOutput.java @@ -0,0 +1,44 @@ +/* + * 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 + * 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. + */ + +/* + * @test + * @bug 8026949 + * @summary Test ensures correct VM output during startup + * @library ../../testlibrary + * + */ +import com.oracle.java.testlibrary.*; + +public class StartupOutput { + public static void main(String[] args) throws Exception { + ProcessBuilder pb; + OutputAnalyzer out; + + pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); + out = new OutputAnalyzer(pb.start()); + out.shouldNotContain("no space to run compilers"); + + out.shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java new file mode 100644 index 00000000000..ead8788524a --- /dev/null +++ b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java @@ -0,0 +1,52 @@ +/* +* 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 +* 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. +*/ + +/* +* @test TestCMSForegroundFlags +* @key gc +* @bug 8027132 +* @summary Test that the deprecated CMS foreground collector flags print warning messages +* @library /testlibrary +* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection +* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction +* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing +*/ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.ProcessTools; + +public class TestCMSForegroundFlags { + public static void main(String[] args) throws Exception { + if (args.length != 2) { + throw new Exception("Expected two arguments,flagValue and flagName"); + } + String flagValue = args[0]; + String flagName = args[1]; + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release."); + output.shouldNotContain("error"); + output.shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java new file mode 100644 index 00000000000..c3de30edf86 --- /dev/null +++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java @@ -0,0 +1,91 @@ +/* + * 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 + * 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. + */ + +/* + * @test + * @bug 8026365 + * @summary Test invokespecial of host class method from an anonymous class + * @author Robert Field + * @library /testlibrary + * @compile -XDignore.symbol.file InvokeSpecialAnonTest.java + * @run main ClassFileInstaller InvokeSpecialAnonTest AnonTester + * @run main/othervm -Xbootclasspath/a:. -Xverify:all InvokeSpecialAnonTest + */ +import jdk.internal.org.objectweb.asm.*; +import java.lang.reflect.Constructor; +import sun.misc.Unsafe; + +public class InvokeSpecialAnonTest implements Opcodes { + + static byte[] anonClassBytes() throws Exception { + ClassWriter cw = new ClassWriter(0); + MethodVisitor mv; + + cw.visit(V1_8, ACC_FINAL + ACC_SUPER, "Anon", null, "java/lang/Object", null); + + { + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V"); + mv.visitInsn(RETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + { + mv = cw.visitMethod(ACC_PUBLIC, "m", "(LInvokeSpecialAnonTest;)I", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESPECIAL, "InvokeSpecialAnonTest", "privMethod", "()I"); + mv.visitInsn(IRETURN); + mv.visitMaxs(2, 3); + mv.visitEnd(); + } + cw.visitEnd(); + + return cw.toByteArray(); + } + + private int privMethod() { return 1234; } + + public static void main(String[] args) throws Exception { + Class klass = InvokeSpecialAnonTest.class; + try { + Class result = AnonTester.defineTest(klass, anonClassBytes()); + System.out.println("Passed."); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} + + +class AnonTester { + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); + + public static Class defineTest(Class targetClass, byte[] classBytes) throws Exception { + return UNSAFE.defineAnonymousClass(targetClass, classBytes, null); + } +} diff --git a/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java new file mode 100644 index 00000000000..1892e6fd0b5 --- /dev/null +++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java @@ -0,0 +1,136 @@ +/* + * 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 + * 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. + */ + +/* + * @test + * @bug 8024927 + * @summary Testing address of compressed class pointer space as best as possible. + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.*; + +public class CompressedClassPointers { + + public static void smallHeapTest() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedBaseAddress=8g", + "-Xmx128m", + "-XX:+PrintCompressedOopsMode", + "-XX:+VerifyBeforeGC", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Narrow klass base: 0x0000000000000000"); + output.shouldHaveExitValue(0); + } + + public static void smallHeapTestWith3G() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:CompressedClassSpaceSize=3g", + "-Xmx128m", + "-XX:+PrintCompressedOopsMode", + "-XX:+VerifyBeforeGC", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Narrow klass base: 0x0000000000000000, Narrow klass shift: 3"); + output.shouldHaveExitValue(0); + } + + public static void largeHeapTest() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-Xmx30g", + "-XX:+PrintCompressedOopsMode", + "-XX:+VerifyBeforeGC", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldNotContain("Narrow klass base: 0x0000000000000000"); + output.shouldContain("Narrow klass shift: 0"); + output.shouldHaveExitValue(0); + } + + public static void largePagesTest() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-Xmx128m", + "-XX:+UseLargePages", + "-XX:+PrintCompressedOopsMode", + "-XX:+VerifyBeforeGC", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Narrow klass base:"); + output.shouldHaveExitValue(0); + } + + public static void sharingTest() throws Exception { + // Test small heaps + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedArchiveFile=./sample.jsa", + "-Xmx128m", + "-XX:SharedBaseAddress=8g", + "-XX:+PrintCompressedOopsMode", + "-XX:+VerifyBeforeGC", + "-Xshare:dump"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + try { + output.shouldContain("Loading classes to share"); + output.shouldHaveExitValue(0); + + pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedArchiveFile=./sample.jsa", + "-Xmx128m", + "-XX:SharedBaseAddress=8g", + "-XX:+PrintCompressedOopsMode", + "-Xshare:on", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("sharing"); + output.shouldHaveExitValue(0); + + } catch (RuntimeException e) { + output.shouldContain("Unable to use shared archive"); + output.shouldHaveExitValue(1); + } + } + + public static void main(String[] args) throws Exception { + if (!Platform.is64bit()) { + // Can't test this on 32 bit, just pass + System.out.println("Skipping test on 32bit"); + return; + } + // Solaris 10 can't mmap compressed oops space without a base + if (Platform.isSolaris()) { + String name = System.getProperty("os.version"); + if (name.equals("5.10")) { + System.out.println("Skipping test on Solaris 10"); + return; + } + } + smallHeapTest(); + smallHeapTestWith3G(); + largeHeapTest(); + largePagesTest(); + sharingTest(); + } +} diff --git a/jdk/.hgtags b/jdk/.hgtags index f93b4c85fc5..3b064a023d8 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -235,3 +235,4 @@ eea685b9ccaa1980e0a7e07d6a3a84bcc7e9ab82 jdk8-b107 719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111 f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112 5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113 +f26a0c8071bde1e3b923713c75156e4a58955623 jdk8-b114 diff --git a/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java b/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java index be0204eeeef..9f1204ca7fe 100644 --- a/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java +++ b/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java @@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler { // remove ROC, which is not supported in j.u.tz builtZones.remove("ROC"); links.remove("ROC"); + // remove EST, HST and MST. They are supported via + // the short-id mapping + builtZones.remove("EST"); + builtZones.remove("HST"); + builtZones.remove("MST"); } /** diff --git a/jdk/makefiles/Setup.gmk b/jdk/makefiles/Setup.gmk index b624afb6025..d2e706f6a1b 100644 --- a/jdk/makefiles/Setup.gmk +++ b/jdk/makefiles/Setup.gmk @@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,- # To build with all warnings enabled, do the following: # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" -JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,classfile,dep-ann,divzero,varargs -Werror +JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,classfile,dep-ann,divzero,empty,try,varargs -Werror # Any java code executed during a JDK build to build other parts of the JDK must be # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this diff --git a/jdk/makefiles/mapfiles/libjava/mapfile-vers b/jdk/makefiles/mapfiles/libjava/mapfile-vers index 29ce7eb26df..7b4d5472b14 100644 --- a/jdk/makefiles/mapfiles/libjava/mapfile-vers +++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers @@ -267,7 +267,8 @@ SUNWprivate_1.1 { Java_sun_misc_GC_maxObjectInspectionAge; Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; Java_sun_reflect_NativeMethodAccessorImpl_invoke0; - Java_sun_reflect_Reflection_getCallerClass; + Java_sun_reflect_Reflection_getCallerClass__; + Java_sun_reflect_Reflection_getCallerClass__I; Java_sun_reflect_Reflection_getClassAccessFlags; Java_sun_misc_Version_getJdkVersionInfo; Java_sun_misc_Version_getJdkSpecialVersion; diff --git a/jdk/makefiles/mapfiles/libjava/reorder-sparc b/jdk/makefiles/mapfiles/libjava/reorder-sparc index b64537e3edd..16573052576 100644 --- a/jdk/makefiles/mapfiles/libjava/reorder-sparc +++ b/jdk/makefiles/mapfiles/libjava/reorder-sparc @@ -27,7 +27,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_lang_System_setIn0; -text: .text%Java_sun_reflect_Reflection_getCallerClass; +text: .text%Java_sun_reflect_Reflection_getCallerClass__; +text: .text%Java_sun_reflect_Reflection_getCallerClass__I; text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_Object_getClass; text: .text%Java_sun_reflect_Reflection_getClassAccessFlags; diff --git a/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 b/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 index 8e6d249a440..fe80fca8b59 100644 --- a/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 +++ b/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 @@ -26,7 +26,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_lang_System_setIn0; -text: .text%Java_sun_reflect_Reflection_getCallerClass; +text: .text%Java_sun_reflect_Reflection_getCallerClass__; +text: .text%Java_sun_reflect_Reflection_getCallerClass__I; text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_String_intern; text: .text%Java_java_lang_Float_floatToIntBits; diff --git a/jdk/makefiles/mapfiles/libjava/reorder-x86 b/jdk/makefiles/mapfiles/libjava/reorder-x86 index ff4836f4612..839ee50caa8 100644 --- a/jdk/makefiles/mapfiles/libjava/reorder-x86 +++ b/jdk/makefiles/mapfiles/libjava/reorder-x86 @@ -28,7 +28,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_lang_System_setIn0; -text: .text%Java_sun_reflect_Reflection_getCallerClass; +text: .text%Java_sun_reflect_Reflection_getCallerClass__; +text: .text%Java_sun_reflect_Reflection_getCallerClass__I; text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_String_intern; text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; diff --git a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m b/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m index dabaac740b6..e2d904122ba 100644 --- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m +++ b/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m @@ -163,7 +163,7 @@ NSString *GetJavaRoot(NSDictionary *jvmInfoDict) { if ([[jvmInfo objectForKey:@"StartOnFirstThread"] boolValue]) { self.startOnFirstThread = YES; } else if ([[jvmInfo objectForKey:@"StartOnMainThread"] boolValue]) { - // for key compatability with the Apple JavaApplicationStub's 'Java' dictionary + // for key compatibility with the Apple JavaApplicationStub's 'Java' dictionary self.startOnFirstThread = YES; } diff --git a/jdk/src/macosx/classes/com/apple/eawt/event/package.html b/jdk/src/macosx/classes/com/apple/eawt/event/package.html index 9c05d88c821..0946e60f309 100644 --- a/jdk/src/macosx/classes/com/apple/eawt/event/package.html +++ b/jdk/src/macosx/classes/com/apple/eawt/event/package.html @@ -1,5 +1,7 @@ + + Classes for receiving gesture events. diff --git a/jdk/src/macosx/classes/com/apple/eawt/package.html b/jdk/src/macosx/classes/com/apple/eawt/package.html index e11ed40ba3f..81bc1a8d3f8 100644 --- a/jdk/src/macosx/classes/com/apple/eawt/package.html +++ b/jdk/src/macosx/classes/com/apple/eawt/package.html @@ -1,5 +1,7 @@ + + Provides classes for integrating Java applications with the native application environment. diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java index 046d693e329..b2cf557ce89 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java @@ -244,7 +244,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel { * used for getting localized defaults. Also initialize the default * locale used when no locale is passed into UIDefaults.get(). The * default locale should generally not be relied upon. It is here for - * compatability with releases prior to 1.4. + * compatibility with releases prior to 1.4. */ private void initResourceBundle(final UIDefaults table) { table.setDefaultLocale(Locale.getDefault()); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java b/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java index a6b7de64e08..57e51e2d61f 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java @@ -406,7 +406,7 @@ public class AquaMenuPainter { } /** Draw a string with the graphics g at location (x,y) just like g.drawString() would. - * The first occurence of underlineChar in text will be underlined. The matching is + * The first occurrence of underlineChar in text will be underlined. The matching is * not case sensitive. */ public void drawString(final Graphics g, final JComponent c, final String text, final int underlinedChar, final int x, final int y, final boolean isEnabled, final boolean isSelected) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java index 5a1cf0cdeb7..353eb10bc3f 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java @@ -3514,7 +3514,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -3528,7 +3528,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class TabSelectionHandler implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -3542,7 +3542,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class MouseHandler extends MouseAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -3556,7 +3556,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class FocusHandler extends FocusAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java index 93bcf7aafbc..0caf12d0eca 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java @@ -179,7 +179,7 @@ public class AquaTreeUI extends BasicTreeUI { } /** - * Paints the expand (toggle) part of a row. The reciever should NOT modify clipBounds, or + * Paints the expand (toggle) part of a row. The receiver should NOT modify clipBounds, or * insets. */ protected void paintExpandControl(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) { diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java index 644eaccc79d..bd922f3e143 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java @@ -93,9 +93,9 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis } if (fMenuItem instanceof JCheckBoxMenuItem) { - setState(((JCheckBoxMenuItem)fMenuItem).isSelected()); + forceSetState(fMenuItem.isSelected()); } else { - setState(fMenuItem.getModel().isSelected()); + forceSetState(fMenuItem.getModel().isSelected()); } } @@ -196,10 +196,10 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis switch (e.getStateChange()) { case ItemEvent.SELECTED: - setState(true); + forceSetState(true); break; case ItemEvent.DESELECTED: - setState(false); + forceSetState(false); break; } } @@ -210,4 +210,20 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis ((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate); } } + + /* + * The CCheckboxMenuItem peer is calling setState unconditionally every time user clicks the menu + * However for Swing controls in the screen menu bar it is wrong - the state should be changed only + * in response to the ITEM_STATE_CHANGED event. So the setState is overridden to no-op and all the + * correct state changes are made with forceSetState + */ + + @Override + public synchronized void setState(boolean b) { + // No Op + } + + private void forceSetState(boolean b) { + super.setState(b); + } } diff --git a/jdk/src/macosx/classes/java/net/DefaultInterface.java b/jdk/src/macosx/classes/java/net/DefaultInterface.java index 638ca3a7648..ba032cf448f 100644 --- a/jdk/src/macosx/classes/java/net/DefaultInterface.java +++ b/jdk/src/macosx/classes/java/net/DefaultInterface.java @@ -26,7 +26,7 @@ package java.net; /** - * Choose a network inteface to be the default for + * Choose a network interface to be the default for * outgoing IPv6 traffic that does not specify a scope_id (and which needs one). * We choose the first interface that is up and is (in order of preference): * 1. neither loopback nor point to point diff --git a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java index 4ff6a170267..ce63833da81 100644 --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java @@ -122,7 +122,7 @@ class MacOSXPreferencesFile { long user() { return user; } long host() { return host; } - // private contructor - use factory method getFile() instead + // private constructor - use factory method getFile() instead private MacOSXPreferencesFile(String newName, long newUser, long newHost) { appName = newName; diff --git a/jdk/src/macosx/classes/sun/font/CFontManager.java b/jdk/src/macosx/classes/sun/font/CFontManager.java index a37fd81c0c4..e3e216e7a33 100644 --- a/jdk/src/macosx/classes/sun/font/CFontManager.java +++ b/jdk/src/macosx/classes/sun/font/CFontManager.java @@ -342,7 +342,7 @@ public class CFontManager extends SunFontManager { @Override public String getFontPath(boolean noType1Fonts) { - // In the case of the Cocoa toolkit, since we go through NSFont, we dont need to register /Library/Fonts + // In the case of the Cocoa toolkit, since we go through NSFont, we don't need to register /Library/Fonts Toolkit tk = Toolkit.getDefaultToolkit(); if (tk instanceof HeadlessToolkit) { tk = ((HeadlessToolkit)tk).getUnderlyingToolkit(); diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 44aafc59d11..7b3cff536ad 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -56,15 +56,6 @@ public class LWWindowPeer private final PlatformWindow platformWindow; - // Window bounds reported by the native system (as opposed to - // regular bounds inherited from LWComponentPeer which are - // requested by user and may haven't been applied yet because - // of asynchronous requests to the windowing system) - private int sysX; - private int sysY; - private int sysW; - private int sysH; - private static final int MINIMUM_WIDTH = 1; private static final int MINIMUM_HEIGHT = 1; @@ -320,10 +311,18 @@ public class LWWindowPeer // Don't post ComponentMoved/Resized and Paint events // until we've got a notification from the delegate Rectangle cb = constrainBounds(x, y, w, h); - setBounds(cb.x, cb.y, cb.width, cb.height, op, false, false); - // Get updated bounds, so we don't have to handle 'op' here manually - Rectangle r = getBounds(); - platformWindow.setBounds(r.x, r.y, r.width, r.height); + + Rectangle newBounds = new Rectangle(getBounds()); + if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) { + newBounds.x = cb.x; + newBounds.y = cb.y; + } + if ((op & (SET_SIZE | SET_BOUNDS)) != 0) { + newBounds.width = cb.width; + newBounds.height = cb.height; + } + // Native system could constraint bounds, so the peer wold be updated in the callback + platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height); } public Rectangle constrainBounds(Rectangle bounds) { @@ -614,17 +613,10 @@ public class LWWindowPeer */ @Override public void notifyReshape(int x, int y, int w, int h) { - final boolean moved; - final boolean resized; + Rectangle oldBounds = getBounds(); final boolean invalid = updateInsets(platformWindow.getInsets()); - synchronized (getStateLock()) { - moved = (x != sysX) || (y != sysY); - resized = (w != sysW) || (h != sysH); - sysX = x; - sysY = y; - sysW = w; - sysH = h; - } + final boolean moved = (x != oldBounds.x) || (y != oldBounds.y); + final boolean resized = (w != oldBounds.width) || (h != oldBounds.height); // Check if anything changed if (!moved && !resized && !invalid) { diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java index ecb2d5217f6..3f6109a4120 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java @@ -620,8 +620,7 @@ public class CInputMethod extends InputMethodAdapter { retString[0] = new String(selectedText); }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } synchronized(retString) { return retString[0]; } } @@ -669,8 +668,7 @@ public class CInputMethod extends InputMethodAdapter { }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } synchronized(returnValue) { return returnValue; } } @@ -695,8 +693,7 @@ public class CInputMethod extends InputMethodAdapter { returnValue[0] = fIMContext.getInsertPositionOffset(); }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } returnValue[1] = fCurrentTextLength; synchronized(returnValue) { return returnValue; } @@ -743,8 +740,7 @@ public class CInputMethod extends InputMethodAdapter { } }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } synchronized(rect) { return rect; } } @@ -764,8 +760,7 @@ public class CInputMethod extends InputMethodAdapter { insertPositionOffset[0] = fIMContext.getInsertPositionOffset(); }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } // This bit of gymnastics ensures that the returned location is within the composed text. // If it falls outside that region, the input method will commit the text, which is inconsistent with native diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java index e5d99678b18..d09f1571d08 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java @@ -53,14 +53,6 @@ public class CPlatformLWView extends CPlatformView { public void setBounds(int x, int y, int width, int height) { } - @Override - public void enterFullScreenMode() { - } - - @Override - public void exitFullScreenMode() { - } - @Override public SurfaceData replaceSurfaceData() { return null; diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java index b287e7745b7..ba05ab0b6c3 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java @@ -96,14 +96,6 @@ public class CPlatformView extends CFRetainedResource { return peer; } - public void enterFullScreenMode() { - CWrapper.NSView.enterFullScreenMode(ptr); - } - - public void exitFullScreenMode() { - CWrapper.NSView.exitFullScreenMode(ptr); - } - public void setToolTip(String msg) { CWrapper.NSView.setToolTip(ptr, msg); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 8fca7df691d..f0eebfcdcb1 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -63,6 +63,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private static native void nativeSynthesizeMouseEnteredExitedEvents(); private static native void nativeDispose(long nsWindowPtr); private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse(); + private static native void nativeEnterFullScreenMode(long nsWindowPtr); + private static native void nativeExitFullScreenMode(long nsWindowPtr); // Loger to report issues happened during execution but that do not affect functionality private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow"); @@ -230,7 +232,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo contentView.initialize(peer, responder); final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L; - Rectangle bounds = _peer.constrainBounds(_target.getBounds()); + Rectangle bounds; + if (!IS(DECORATED, styleBits)) { + // For undecorated frames the move/resize event does not come if the frame is centered on the screen + // so we need to set a stub location to force an initial move/resize. Real bounds would be set later. + bounds = new Rectangle(0, 0, 1, 1); + } else { + bounds = _peer.constrainBounds(_target.getBounds()); + } final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height); setPtr(nativeWindowPtr); @@ -433,10 +442,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo @Override // PlatformWindow public Insets getInsets() { - if (!isFullScreenMode) { - return nativeGetNSWindowInsets(getNSWindowPtr()); - } - return new Insets(0, 0, 0, 0); + return nativeGetNSWindowInsets(getNSWindowPtr()); } @Override // PlatformWindow @@ -538,6 +544,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo updateIconImages(); updateFocusabilityForAutoRequestFocus(false); + boolean wasMaximized = isMaximized(); + // Actually show or hide the window LWWindowPeer blocker = (peer == null)? null : peer.getBlocker(); if (blocker == null || !visible) { @@ -571,16 +579,21 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo if (visible) { // Apply the extended state as expected in shared code if (target instanceof Frame) { - switch (((Frame)target).getExtendedState()) { - case Frame.ICONIFIED: - CWrapper.NSWindow.miniaturize(nsWindowPtr); - break; - case Frame.MAXIMIZED_BOTH: - maximize(); - break; - default: // NORMAL - unmaximize(); // in case it was maximized, otherwise this is a no-op - break; + if (!wasMaximized && isMaximized()) { + // setVisible could have changed the native maximized state + deliverZoom(true); + } else { + switch (((Frame)target).getExtendedState()) { + case Frame.ICONIFIED: + CWrapper.NSWindow.miniaturize(nsWindowPtr); + break; + case Frame.MAXIMIZED_BOTH: + maximize(); + break; + default: // NORMAL + unmaximize(); // in case it was maximized, otherwise this is a no-op + break; + } } } } @@ -750,18 +763,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo @Override public void enterFullScreenMode() { isFullScreenMode = true; - contentView.enterFullScreenMode(); - // the move/size notification from the underlying system comes - // but it contains a bounds smaller than the whole screen - // and therefore we need to create the synthetic notifications - Rectangle screenBounds = getPeer().getGraphicsConfiguration().getBounds(); - peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width, - screenBounds.height); + nativeEnterFullScreenMode(getNSWindowPtr()); } @Override public void exitFullScreenMode() { - contentView.exitFullScreenMode(); + nativeExitFullScreenMode(getNSWindowPtr()); isFullScreenMode = false; } @@ -884,7 +891,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo //Posting an empty to flush the EventQueue without blocking the main thread } }, target); - } catch (InterruptedException | InvocationTargetException e) { + } catch (InvocationTargetException e) { e.printStackTrace(); } } @@ -919,13 +926,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo protected void deliverMoveResizeEvent(int x, int y, int width, int height, boolean byUser) { - // when the content view enters the full-screen mode, the native - // move/resize notifications contain a bounds smaller than - // the whole screen and therefore we ignore the native notifications - // and the content view itself creates correct synthetic notifications - if (isFullScreenMode) { - return; - } + checkZoom(); final Rectangle oldB = nativeBounds; nativeBounds = new Rectangle(x, y, width, height); @@ -957,6 +958,17 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } } + private void checkZoom() { + if (target instanceof Frame && isVisible()) { + Frame targetFrame = (Frame)target; + if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) { + deliverZoom(true); + } else if (targetFrame.getExtendedState() == Frame.MAXIMIZED_BOTH && !isMaximized()) { + deliverZoom(false); + } + } + } + private void deliverNCMouseDown() { if (peer != null) { peer.notifyNCMouseDown(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java index b54a1baa2c5..0743c00ae63 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java @@ -233,6 +233,10 @@ public class CPrinterJob extends RasterPrinterJob { setAttributes(attributes); + // throw exception for invalid destination + if (destinationAttr != null) { + validateDestination(destinationAttr); + } /* Get the range of pages we are to print. If the * last page to print is unknown, then we print to diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java index 28acc26f6cc..6d843b88295 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java @@ -97,6 +97,6 @@ public class CViewEmbeddedFrame extends EmbeddedFrame { setVisible(true); } }, this); - } catch (InterruptedException | InvocationTargetException ex) {} + } catch (InvocationTargetException ex) {} } } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java index 879118cf2e1..a9c55237eee 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java @@ -82,9 +82,6 @@ public final class CWrapper { public static native Rectangle2D frame(long view); public static native long window(long view); - public static native void enterFullScreenMode(long view); - public static native void exitFullScreenMode(long view); - public static native void setHidden(long view, boolean hidden); public static native void setToolTip(long view, String msg); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index d698845e558..959b03868fb 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -548,22 +548,18 @@ public final class LWCToolkit extends LWToolkit { // Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop // The InvocationEvent will call LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual runloop // Does not dispatch native events while in the loop - public static void invokeAndWait(Runnable event, Component component) throws InterruptedException, InvocationTargetException { + public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException { final long mediator = createAWTRunLoopMediator(); InvocationEvent invocationEvent = - new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event) { - @Override - public void dispatch() { - try { - super.dispatch(); - } finally { + new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), + runnable, + () -> { if (mediator != 0) { stopAWTRunLoop(mediator); } - } - } - }; + }, + true); if (component != null) { AppContext appContext = SunToolkit.targetToAppContext(component); diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 28bdb4b9077..8fd088f426c 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -272,7 +272,6 @@ AWT_ASSERT_APPKIT_THREAD; */ - (void) keyDown: (NSEvent *)event { - fProcessingKeystroke = YES; fKeyEventsNeeded = YES; @@ -308,6 +307,23 @@ AWT_ASSERT_APPKIT_THREAD; - (BOOL) performKeyEquivalent: (NSEvent *) event { [self deliverJavaKeyEventHelper: event]; + + // Workaround for 8020209: special case for "Cmd =" and "Cmd ." + // because Cocoa calls performKeyEquivalent twice for these keystrokes + NSUInteger modFlags = [event modifierFlags] & + (NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask); + if (modFlags == NSCommandKeyMask) { + NSString *eventChars = [event charactersIgnoringModifiers]; + if ([eventChars length] == 1) { + unichar ch = [eventChars characterAtIndex:0]; + if (ch == '=' || ch == '.') { + [[NSApp mainMenu] performKeyEquivalent: event]; + return YES; + } + } + + } + return NO; } @@ -580,7 +596,7 @@ AWT_ASSERT_APPKIT_THREAD; // --- Services menu support for lightweights --- -// finds the focused accessable element, and if it's a text element, obtains the text from it +// finds the focused accessible element, and if it is a text element, obtains the text from it - (NSString *)accessibleSelectedText { id focused = [self accessibilityFocusedUIElement]; @@ -598,7 +614,7 @@ AWT_ASSERT_APPKIT_THREAD; return rtfdData; } -// finds the focused accessable element, and if it's a text element, sets the text in it +// finds the focused accessible element, and if it is a text element, sets the text in it - (BOOL)replaceAccessibleTextSelection:(NSString *)text { id focused = [self accessibilityFocusedUIElement]; diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h index 698820ade4d..7f7bac777bc 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -45,6 +45,7 @@ BOOL isEnabled; NSWindow *nsWindow; AWTWindow *ownerWindow; + jint preFullScreenLevel; } // An instance of either AWTWindow_Normal or AWTWindow_Panel @@ -57,6 +58,7 @@ @property (nonatomic) NSSize javaMaxSize; @property (nonatomic) jint styleBits; @property (nonatomic) BOOL isEnabled; +@property (nonatomic) jint preFullScreenLevel; - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 2231f10d1bf..687fa6b4d01 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -122,6 +122,7 @@ AWT_NS_WINDOW_IMPLEMENTATION @synthesize styleBits; @synthesize isEnabled; @synthesize ownerWindow; +@synthesize preFullScreenLevel; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -501,20 +502,6 @@ AWT_ASSERT_APPKIT_THREAD; // window exposing in _setVisible:(BOOL) } -- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)proposedFrame { -AWT_ASSERT_APPKIT_THREAD; - - [AWTToolkit eventCountPlusPlus]; - JNIEnv *env = [ThreadUtilities getJNIEnv]; - jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; - if (platformWindow != NULL) { - static JNF_MEMBER_CACHE(jm_deliverZoom, jc_CPlatformWindow, "deliverZoom", "(Z)V"); - JNFCallVoidMethod(env, platformWindow, jm_deliverZoom, ![window isZoomed]); - (*env)->DeleteLocalRef(env, platformWindow); - } - return YES; -} - - (void) _deliverIconify:(BOOL)iconify { AWT_ASSERT_APPKIT_THREAD; @@ -1226,3 +1213,58 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeEnterFullScreenMode +(JNIEnv *env, jclass clazz, jlong windowPtr) +{ +JNF_COCOA_ENTER(env); + + NSWindow *nsWindow = OBJC(windowPtr); + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + NSNumber* screenID = [AWTWindow getNSWindowDisplayID_AppKitThread: nsWindow]; + CGDirectDisplayID aID = [screenID intValue]; + + if (CGDisplayCapture(aID) == kCGErrorSuccess) { + // remove window decoration + NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:window.styleBits]; + [nsWindow setStyleMask:(styleMask & ~NSTitledWindowMask) | NSBorderlessWindowMask]; + + int shieldLevel = CGShieldingWindowLevel(); + window.preFullScreenLevel = [nsWindow level]; + [nsWindow setLevel: shieldLevel]; + + NSRect screenRect = [[nsWindow screen] frame]; + [nsWindow setFrame:screenRect display:YES]; + } else { + [JNFException raise:env as:kRuntimeException reason:"Failed to enter full screen."]; + } + }]; + +JNF_COCOA_EXIT(env); +} + +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeExitFullScreenMode +(JNIEnv *env, jclass clazz, jlong windowPtr) +{ +JNF_COCOA_ENTER(env); + + NSWindow *nsWindow = OBJC(windowPtr); + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + NSNumber* screenID = [AWTWindow getNSWindowDisplayID_AppKitThread: nsWindow]; + CGDirectDisplayID aID = [screenID intValue]; + + if (CGDisplayRelease(aID) == kCGErrorSuccess) { + NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:window.styleBits]; + [nsWindow setStyleMask:styleMask]; + [nsWindow setLevel: window.preFullScreenLevel]; + + // GraphicsDevice takes care of restoring pre full screen bounds + } else { + [JNFException raise:env as:kRuntimeException reason:"Failed to exit full screen."]; + } + }]; + +JNF_COCOA_EXIT(env); +} + diff --git a/jdk/src/macosx/native/sun/awt/CPrinterJob.m b/jdk/src/macosx/native/sun/awt/CPrinterJob.m index 3935240ff78..2b92c2250fb 100644 --- a/jdk/src/macosx/native/sun/awt/CPrinterJob.m +++ b/jdk/src/macosx/native/sun/awt/CPrinterJob.m @@ -359,7 +359,11 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj static JNF_CLASS_CACHE(jc_Pageable, "java/awt/print/Pageable"); static JNF_MEMBER_CACHE(jm_getCopies, sjc_CPrinterJob, "getCopiesInt", "()I"); static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z"); + static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I"); + static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I"); + static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I"); static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I"); + static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;"); NSMutableDictionary* printingDictionary = [dst dictionary]; @@ -368,19 +372,35 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object) [printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate]; - jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit) if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES) { - [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages]; + jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib); + if (selectID ==0) { + [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages]; + } else if (selectID == 2) { + // In Mac 10.7, Print ALL is deselected if PrintSelection is YES whether + // NSPrintAllPages is YES or NO + [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages]; + [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly]; + } else { + [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages]; + } - [printingDictionary setObject:[NSNumber numberWithInteger:1] forKey:NSPrintFirstPage]; - [printingDictionary setObject:[NSNumber numberWithInteger:jNumPages] forKey:NSPrintLastPage]; + jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage); + jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage); + // setting fromPage and toPage will not be shown in the dialog if printing All pages + [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage]; + [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage]; } else { [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages]; } + jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); + if (page != NULL) { + javaPageFormatToNSPrintInfo(env, NULL, page, dst); + } } /* diff --git a/jdk/src/macosx/native/sun/awt/CTextPipe.m b/jdk/src/macosx/native/sun/awt/CTextPipe.m index f6510f204ae..aaa5f1ee3b1 100644 --- a/jdk/src/macosx/native/sun/awt/CTextPipe.m +++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m @@ -322,7 +322,7 @@ static void DrawTextContext Each stage of the pipeline is responsible for doing only one major thing, like allocating buffers, aquiring transform arrays from JNI, filling buffers, or striking glyphs. All resources or memory - aquired at a given stage, must be released in that stage. Any error that occurs (like a failed malloc) + acquired at a given stage, must be released in that stage. Any error that occurs (like a failed malloc) is to be handled in the stage it occurs in, and is to return immediatly after freeing it's resources. -----------------------------------*/ diff --git a/jdk/src/macosx/native/sun/awt/CWrapper.m b/jdk/src/macosx/native/sun/awt/CWrapper.m index a658a5df64a..e5847bea960 100644 --- a/jdk/src/macosx/native/sun/awt/CWrapper.m +++ b/jdk/src/macosx/native/sun/awt/CWrapper.m @@ -585,46 +585,6 @@ JNF_COCOA_EXIT(env); return jRect; } -/* - * Class: sun_lwawt_macosx_CWrapper$NSView - * Method: enterFullScreenMode - * Signature: (J)V - */ -JNIEXPORT void JNICALL -Java_sun_lwawt_macosx_CWrapper_00024NSView_enterFullScreenMode -(JNIEnv *env, jclass cls, jlong viewPtr) -{ -JNF_COCOA_ENTER(env); - - NSView *view = (NSView *)jlong_to_ptr(viewPtr); - [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ - NSScreen *screen = [[view window] screen]; - NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFullScreenModeAllScreens, nil]; - [view enterFullScreenMode:screen withOptions:opts]; - }]; - -JNF_COCOA_EXIT(env); -} - -/* - * Class: sun_lwawt_macosx_CWrapper$NSView - * Method: exitFullScreenMode - * Signature: (J)V - */ -JNIEXPORT void JNICALL -Java_sun_lwawt_macosx_CWrapper_00024NSView_exitFullScreenMode -(JNIEnv *env, jclass cls, jlong viewPtr) -{ -JNF_COCOA_ENTER(env); - - NSView *view = (NSView *)jlong_to_ptr(viewPtr); - [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ - [view exitFullScreenModeWithOptions:nil]; - }]; - -JNF_COCOA_EXIT(env); -} - /* * Class: sun_lwawt_macosx_CWrapper$NSView * Method: window diff --git a/jdk/src/macosx/native/sun/awt/awt.m b/jdk/src/macosx/native/sun/awt/awt.m index e730a5ca920..0a491fd44f2 100644 --- a/jdk/src/macosx/native/sun/awt/awt.m +++ b/jdk/src/macosx/native/sun/awt/awt.m @@ -312,15 +312,17 @@ AWT_ASSERT_APPKIT_THREAD; if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex"); } - // Don't set the delegate until the NSApplication has been created and - // its finishLaunching has initialized it. - // ApplicationDelegate is the support code for com.apple.eawt. - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - id delegate = [ApplicationDelegate sharedDelegate]; - if (delegate != nil) { - OSXAPP_SetApplicationDelegate(delegate); - } - }]; + if (!headless) { + // Don't set the delegate until the NSApplication has been created and + // its finishLaunching has initialized it. + // ApplicationDelegate is the support code for com.apple.eawt. + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + id delegate = [ApplicationDelegate sharedDelegate]; + if (delegate != nil) { + OSXAPP_SetApplicationDelegate(delegate); + } + }]; + } } - (void)starter:(NSArray*)args { diff --git a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m index 141a8c21ade..5c21b3f6394 100644 --- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m +++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m @@ -341,6 +341,10 @@ AWT_ASSERT_APPKIT_THREAD; if ([event type] == NSApplicationDefined && TS_EQUAL([event timestamp], dummyEventTimestamp)) { [seenDummyEventLock lockWhenCondition:NO]; [seenDummyEventLock unlockWithCondition:YES]; + } else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) { + // Cocoa won't send us key up event when releasing a key while Cmd is down, + // so we have to do it ourselves. + [[self keyWindow] sendEvent:event]; } else { [super sendEvent:event]; } diff --git a/jdk/src/share/back/ThreadGroupReferenceImpl.c b/jdk/src/share/back/ThreadGroupReferenceImpl.c index 06ae01065d8..47b894a5894 100644 --- a/jdk/src/share/back/ThreadGroupReferenceImpl.c +++ b/jdk/src/share/back/ThreadGroupReferenceImpl.c @@ -47,7 +47,7 @@ name(PacketInputStream *in, PacketOutputStream *out) (void)memset(&info, 0, sizeof(info)); threadGroupInfo(group, &info); - (void)outStream_writeString(out, info.name); + (void)outStream_writeString(out, info.name == NULL ? "" : info.name); if ( info.name != NULL ) jvmtiDeallocate(info.name); diff --git a/jdk/src/share/back/commonRef.c b/jdk/src/share/back/commonRef.c index 8cb534a90cf..ce9c75eeace 100644 --- a/jdk/src/share/back/commonRef.c +++ b/jdk/src/share/back/commonRef.c @@ -52,7 +52,7 @@ * the number times an object has been referenced through * commonRef_refToID. A RefNode is freed once the reference * count is decremented to 0 (with commonRef_release*), even if the - * correspoding object has not been collected. + * corresponding object has not been collected. * * One hash table is maintained. The mapping of ID to jobject (or RefNode*) * is handled with one hash table that will re-size itself as the number diff --git a/jdk/src/share/back/eventFilter.c b/jdk/src/share/back/eventFilter.c index dd05758d6c9..d67aa96ba5b 100644 --- a/jdk/src/share/back/eventFilter.c +++ b/jdk/src/share/back/eventFilter.c @@ -644,7 +644,7 @@ eventFilter_predictFiltering(HandlerNode *node, jclass clazz, char *classname) case JDWP_REQUEST_MODIFIER(Count): { /* - * If preceeding filters have determined that events will + * If preceding filters have determined that events will * be filtered out, that is fine and we won't get here. * However, the count must be decremented - even if * subsequent filters will filter these events. We diff --git a/jdk/src/share/back/outStream.c b/jdk/src/share/back/outStream.c index 8eeebc4c66e..b48d5591c20 100644 --- a/jdk/src/share/back/outStream.c +++ b/jdk/src/share/back/outStream.c @@ -298,17 +298,15 @@ jdwpError outStream_writeString(PacketOutputStream *stream, char *string) { jdwpError error; - jint length; + jint length = string != NULL ? (int)strlen(string) : 0; /* Options utf8=y/n controls if we want Standard UTF-8 or Modified */ if ( gdata->modifiedUtf8 ) { - length = (int)strlen(string); (void)outStream_writeInt(stream, length); error = writeBytes(stream, (jbyte *)string, length); } else { jint new_length; - length = (int)strlen(string); new_length = (gdata->npt->utf8mToUtf8sLength) (gdata->npt->utf, (jbyte*)string, length); if ( new_length == length ) { diff --git a/jdk/src/share/back/util.c b/jdk/src/share/back/util.c index 315815caa43..40cca3c0fe8 100644 --- a/jdk/src/share/back/util.c +++ b/jdk/src/share/back/util.c @@ -1092,7 +1092,7 @@ debugMonitorWait(jrawMonitorID monitor) * we don't want to consume it. It came from * user code and is intended for user code, not us. * So, we will remember that the interrupt has - * occured and re-activate it when this thread + * occurred and re-activate it when this thread * goes back into user code. * That being said, what do we do here? Since * we could have been notified too, here we will diff --git a/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java index 93511bc5885..e2714f869e1 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java @@ -40,7 +40,7 @@ abstract class AccessorElementHandler extends ElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the name of the accessible entity diff --git a/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java index 5406891efbf..9a6d2284516 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -57,7 +57,7 @@ import java.lang.reflect.Array; * <int>456</int> * </array> * is equivalent to {@code int[] array = {123, 456}} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
length *
the array length @@ -76,7 +76,7 @@ final class ArrayElementHandler extends NewElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
length *
the array length @@ -109,6 +109,20 @@ final class ArrayElementHandler extends NewElementHandler { } } + /** + * Tests whether the value of this element can be used + * as an argument of the element that contained in this one. + * + * @return {@code true} if the value of this element can be used + * as an argument of the element that contained in this one, + * {@code false} otherwise + */ + @Override + protected boolean isArgument() { + return true; // hack for compatibility + } + + /** * Creates an instance of the array. * diff --git a/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java index e00af8c4c45..a88aa164693 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>true</string> * </method> * which is equivalent to {@code Boolean.valueOf("true")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java index a5347591793..a24f106fa9a 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>127</string> * </method> * which is equivalent to {@code Byte.decode("127")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java index 6e257d6c72a..e75a865e5ee 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java @@ -33,7 +33,7 @@ package com.sun.beans.decoder; * For example:
  * <char>X</char>
* which is equivalent to {@code Character.valueOf('X')} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
code *
this attribute specifies character code @@ -52,7 +52,7 @@ final class CharElementHandler extends StringElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
code *
this attribute specifies character code diff --git a/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java index 9decb9f2d6a..63ebafd64c8 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java @@ -36,7 +36,7 @@ package com.sun.beans.decoder; * <string>java.lang.Class</string> * </method> * which is equivalent to {@code Class.forName("java.lang.Class")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java index f8292aeea68..1fce298594b 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>1.23e45</string> * </method> * which is equivalent to {@code Double.valueOf("1.23e45")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java index dc24b011b15..f408223f3c3 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java @@ -126,7 +126,7 @@ public abstract class ElementHandler { /** * Parses attributes of the element. - * By default, the following atribute is supported: + * By default, the following attribute is supported: *
*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java index 608a827baed..c34c4a3ee24 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java @@ -31,7 +31,7 @@ package com.sun.beans.decoder; * For example:
  * <false/>
* is equivalent to {@code false} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java index caa3a1d8ede..69d84bb5939 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java @@ -43,7 +43,7 @@ import java.lang.reflect.Field; * For example:
  * <field name="id"><int>0</int></field>
* is equivalent to {@code id = 0} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
name *
the field name @@ -62,7 +62,7 @@ final class FieldElementHandler extends AccessorElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the field name diff --git a/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java index 0f934e660c1..320f17f020a 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>-1.23</string> * </method> * which is equivalent to {@code Float.valueOf("-1.23")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java index 0b9634af96b..56473b03de4 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>-1</string> * </method> * which is equivalent to {@code Integer.decode("-1")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java index 53f30864753..61f3faddaf1 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java @@ -32,7 +32,7 @@ import java.beans.XMLDecoder; * is evaluated in the context of the decoder itself. * Typically this outer context is used to retrieve the owner of the decoder, * which can be set before reading the archive. - *

The following atributes are supported: + *

The following attributes are supported: *

*
version *
the Java version (not supported) @@ -54,7 +54,7 @@ final class JavaElementHandler extends ElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
version *
the Java version (not supported) diff --git a/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java index 3147f473e0e..3c15008e293 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>0xFFFF</string> * </method> * which is equivalent to {@code Long.decode("0xFFFF")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java index 73fcb67fa4f..b1357206277 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java @@ -43,7 +43,7 @@ import sun.reflect.misc.MethodUtil; * <string>10</string> * </method> * is equivalent to {@code Long.valueOf("10")} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
name *
the method name @@ -62,7 +62,7 @@ final class MethodElementHandler extends NewElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the method name diff --git a/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java index 18998db4ca1..9cf86dcca44 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java @@ -43,7 +43,7 @@ import java.util.List; * <string>10</string> * </new> * is equivalent to {@code new Long("10")} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
class *
the type of object for instantiation @@ -63,7 +63,7 @@ class NewElementHandler extends ElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
class *
the type of object for instantiation diff --git a/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java index 59cb0e90f89..b47dd7063e9 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java @@ -31,7 +31,7 @@ package com.sun.beans.decoder; * For example:
  * <null/>
* is equivalent to {@code null} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java index 566947183e8..c791e6c722b 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java @@ -33,7 +33,7 @@ import static java.util.Locale.ENGLISH; * This element looks like <void> element, * but its value is always used as an argument for element * that contains this one. - *

The following atributes are supported: + *

The following attributes are supported: *

*
class *
the type is used for static methods and fields @@ -64,7 +64,7 @@ class ObjectElementHandler extends NewElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
class *
the type is used for static methods and fields diff --git a/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java index 8f4c40cac93..9473d5ceb8c 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java @@ -63,7 +63,7 @@ import sun.reflect.misc.MethodUtil; * <int>0</int> * </method> * which is equivalent to {@code set(0)} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
name *
the property name @@ -85,7 +85,7 @@ final class PropertyElementHandler extends AccessorElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the property name diff --git a/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java index f86ad3834ea..26c517f489e 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java @@ -37,7 +37,7 @@ package com.sun.beans.decoder; * <string>200</string> * </method> * which is equivalent to {@code Short.decode("200")} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java index bceb7ceb04f..fd6960a4be3 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java @@ -40,7 +40,7 @@ package com.sun.beans.decoder; * <string> * <true> * </string> - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java index f3bed67c7ca..dfb6553b911 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java @@ -31,7 +31,7 @@ package com.sun.beans.decoder; * For example:
  * <true/>
* is equivalent to {@code true} in Java code. - *

The following atribute is supported: + *

The following attribute is supported: *

*
id *
the identifier of the variable that is intended to store the result diff --git a/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java index 2d540fd9949..51a4fa13d4c 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java @@ -30,7 +30,7 @@ package com.sun.beans.decoder; * For example:
  * <var id="id1" idref="id2"/>
* is equivalent to {@code id1 = id2} in Java code. - *

The following atributes are supported: + *

The following attributes are supported: *

*
idref *
the identifier to refer to the variable @@ -47,7 +47,7 @@ final class VarElementHandler extends ElementHandler { /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
idref *
the identifier to refer to the variable diff --git a/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java b/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java index 63ce32c03f4..232772924ff 100644 --- a/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java +++ b/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java @@ -29,7 +29,7 @@ package com.sun.beans.decoder; * This element looks like <object> element, * but its value is not used as an argument for element * that contains this one. - *

The following atributes are supported: + *

The following attributes are supported: *

*
class *
the type is used for static methods and fields diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java b/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java index 2d06c901942..98f85cf04bd 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java @@ -408,7 +408,7 @@ final class PBECipherCore { * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ byte[] doFinal(byte[] input, int inputOffset, int inputLen) @@ -448,7 +448,7 @@ final class PBECipherCore { * block size * @exception ShortBufferException if the given output buffer is too small * to hold the result - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ int doFinal(byte[] input, int inputOffset, int inputLen, diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java b/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java index 88296c857d1..d5389ac40ac 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java @@ -408,7 +408,7 @@ final class PBES1Core { * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ byte[] doFinal(byte[] input, int inputOffset, int inputLen) @@ -448,7 +448,7 @@ final class PBES1Core { * block size * @exception ShortBufferException if the given output buffer is too small * to hold the result - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ int doFinal(byte[] input, int inputOffset, int inputLen, diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java index d448f277dcb..62394e784c2 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java @@ -307,7 +307,7 @@ public final class PBEWithMD5AndDESCipher extends CipherSpi { * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) @@ -348,7 +348,7 @@ public final class PBEWithMD5AndDESCipher extends CipherSpi { * block size * @exception ShortBufferException if the given output buffer is too small * to hold the result - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, diff --git a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java index d6216a81fb9..978e7b7b778 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java @@ -317,7 +317,7 @@ public final class PBEWithMD5AndTripleDESCipher extends CipherSpi { * no padding has been requested (only in encryption mode), and the total * input length of the data processed by this cipher is not a multiple of * block size - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) @@ -358,7 +358,7 @@ public final class PBEWithMD5AndTripleDESCipher extends CipherSpi { * block size * @exception ShortBufferException if the given output buffer is too small * to hold the result - * @exception BadPaddingException if decrypting and padding is choosen, + * @exception BadPaddingException if decrypting and padding is chosen, * but the last input data does not have proper padding bytes. */ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java index 94fd920ba31..b8c9a1e2b36 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java @@ -187,15 +187,24 @@ public class BMPImageReader extends ImageReader implements BMPConstants { return 1; } + @Override public int getWidth(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } return width; } public int getHeight(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } return height; } @@ -205,7 +214,18 @@ public class BMPImageReader extends ImageReader implements BMPConstants { } } - public void readHeader() throws IOException { + /** + * Process the image header. + * + * @exception IllegalStateException if source stream is not set. + * + * @exception IOException if image stream is corrupted. + * + * @exception IllegalArgumentException if the image stream does not contain + * a BMP image, or if a sample model instance to describe the + * image can not be created. + */ + protected void readHeader() throws IOException, IllegalArgumentException { if (gotHeader) return; @@ -307,6 +327,9 @@ public class BMPImageReader extends ImageReader implements BMPConstants { case BI_RLE4: // 4-bit RLE compression // Read in the palette + if (bitmapOffset < (size + 14)) { + throw new IIOException(I18N.getString("BMPImageReader7")); + } int numberOfEntries = (int)((bitmapOffset-14-size) / 4); int sizeOfPalette = numberOfEntries * 4; palette = new byte[sizeOfPalette]; @@ -375,7 +398,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { break; default: throw new - RuntimeException(I18N.getString("BMPImageReader2")); + IIOException(I18N.getString("BMPImageReader2")); } } else if (size == 108 || size == 124) { // Windows 4.x BMP @@ -478,7 +501,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { } } else { throw new - RuntimeException(I18N.getString("BMPImageReader3")); + IIOException(I18N.getString("BMPImageReader3")); } } @@ -660,7 +683,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { public Iterator getImageTypes(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } ArrayList list = new ArrayList(1); list.add(new ImageTypeSpecifier(originalColorModel, originalSampleModel)); @@ -675,7 +702,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { throws IOException { checkIndex(imageIndex); if (metadata == null) { - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } } return metadata; } @@ -686,7 +717,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { public boolean isRandomAccessEasy(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } return metadata.compression == BI_RGB; } @@ -705,7 +740,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { param = getDefaultReadParam(); //read header - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } sourceRegion = new Rectangle(0, 0, 0, 0); destinationRegion = new Rectangle(0, 0, 0, 0); @@ -817,7 +856,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; @@ -833,7 +872,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; @@ -874,7 +913,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } case VERSION_4_8_BIT: @@ -890,7 +929,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java b/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java index 08a17151f49..97e798a8e3d 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java @@ -32,7 +32,7 @@ import javax.imageio.metadata.IIOMetadataFormatImpl; public class StandardMetadataFormat extends IIOMetadataFormatImpl { - // Utility method for nodes with a single atttribute named "value" + // Utility method for nodes with a single attribute named "value" private void addSingleAttributeElement(String elementName, String parentName, int dataType) { diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties index 70a6f715211..85b108f8e3b 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties +++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties @@ -21,6 +21,8 @@ BMPImageReader2=Invalid compression specified in BMP stream. BMPImageReader3=New BMP version not implemented yet. BMPImageReader4=No ImageIO-style reader is found for BMPImageReader5=Input has not been set. +BMPImageReader6=Unable to read the image header. +BMPImageReader7=Invalid bitmap offset. BMPImageWriter0=Output is not an ImageOutputStream. BMPImageWriter1=The image region to be encoded is empty. BMPImageWriter2=Only 1 or 3 band image is encoded. @@ -34,7 +36,7 @@ BMPMetadata0=The provided metadata format isn't recognized. BMPMetadata1=Metadata is read-only. -# WBMP plugin properties +# WBMP plugin properties WBMPImageReader0=Only one image exists in the stream. WBMPImageReader1=Input has not been set. WBMPImageReader2=Bad WBMP header. diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java index 0fbdefb8e0e..5e3d852275d 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java @@ -115,6 +115,8 @@ public class GIFImageReader extends ImageReader { // The current interlace pass, starting with 0. int interlacePass = 0; + private byte[] fallbackColorTable = null; + // End per-stream settings // Constants used to control interlacing. @@ -239,10 +241,22 @@ public class GIFImageReader extends ImageReader { byte[] colorTable; if (imageMetadata.localColorTable != null) { colorTable = imageMetadata.localColorTable; + fallbackColorTable = imageMetadata.localColorTable; } else { colorTable = streamMetadata.globalColorTable; } + if (colorTable == null) { + if (fallbackColorTable == null) { + this.processWarningOccurred("Use default color table."); + + // no color table, the spec allows to use any palette. + fallbackColorTable = getDefaultPalette(); + } + + colorTable = fallbackColorTable; + } + // Normalize color table length to 2^1, 2^2, 2^4, or 2^8 int length = colorTable.length/3; int bits; @@ -1036,5 +1050,34 @@ public class GIFImageReader extends ImageReader { streamY = -1; rowsDone = 0; interlacePass = 0; + + fallbackColorTable = null; + } + + private static byte[] defaultPalette = null; + + private static synchronized byte[] getDefaultPalette() { + if (defaultPalette == null) { + BufferedImage img = new BufferedImage(1, 1, + BufferedImage.TYPE_BYTE_INDEXED); + IndexColorModel icm = (IndexColorModel) img.getColorModel(); + + final int size = icm.getMapSize(); + byte[] r = new byte[size]; + byte[] g = new byte[size]; + byte[] b = new byte[size]; + icm.getReds(r); + icm.getGreens(g); + icm.getBlues(b); + + defaultPalette = new byte[size * 3]; + + for (int i = 0; i < size; i++) { + defaultPalette[3 * i + 0] = r[i]; + defaultPalette[3 * i + 1] = g[i]; + defaultPalette[3 * i + 2] = b[i]; + } + } + return defaultPalette; } } diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java index 7dac8e4bc55..5ae93b1b685 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java @@ -1368,7 +1368,7 @@ class JFIFMarkerSegment extends MarkerSegment { /** * An APP2 marker segment containing an ICC profile. In the stream * a profile larger than 64K is broken up into a series of chunks. - * This inner class represents the complete profile as a single objec, + * This inner class represents the complete profile as a single object, * combining chunks as necessary. */ class ICCMarkerSegment extends MarkerSegment { diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java index fd8d1cd53c1..f38e30f3ae8 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java @@ -28,6 +28,7 @@ package com.sun.imageio.plugins.jpeg; import javax.imageio.metadata.IIOInvalidTreeException; import javax.imageio.metadata.IIOMetadataNode; import javax.imageio.stream.ImageOutputStream; +import javax.imageio.IIOException; import java.io.IOException; @@ -60,6 +61,10 @@ class MarkerSegment implements Cloneable { length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8; length |= buffer.buf[buffer.bufPtr++] & 0xff; length -= 2; // JPEG length includes itself, we don't + + if (length < 0) { + throw new IIOException("Invalid segment length: " + length); + } buffer.bufAvail -= 3; // Now that we know the true length, ensure that we've got it, // or at least a bufferful if length is too big. diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java index c1359e7b09d..904fa73777c 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java @@ -78,7 +78,7 @@ class SOFMarkerSegment extends MarkerSegment { numLines |= buffer.buf[buffer.bufPtr++] & 0xff; samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8; samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff; - int numComponents = buffer.buf[buffer.bufPtr++]; + int numComponents = buffer.buf[buffer.bufPtr++] & 0xff; componentSpecs = new ComponentSpec [numComponents]; for (int i = 0; i < numComponents; i++) { componentSpecs[i] = new ComponentSpec(buffer); diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java index e2ab9577dc4..abef6740f74 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java @@ -688,6 +688,21 @@ public class PNGImageReader extends ImageReader { loop: while (true) { int chunkLength = stream.readInt(); int chunkType = stream.readInt(); + int chunkCRC; + + // verify the chunk length + if (chunkLength < 0) { + throw new IIOException("Invalid chunk lenght " + chunkLength); + }; + + try { + stream.mark(); + stream.seek(stream.getStreamPosition() + chunkLength); + chunkCRC = stream.readInt(); + stream.reset(); + } catch (IOException e) { + throw new IIOException("Invalid chunk length " + chunkLength); + } switch (chunkType) { case IDAT_TYPE: @@ -762,7 +777,11 @@ public class PNGImageReader extends ImageReader { break; } - int chunkCRC = stream.readInt(); + // double check whether all chunk data were consumed + if (chunkCRC != stream.readInt()) { + throw new IIOException("Failed to read a chunk of type " + + chunkType); + } stream.flushBefore(stream.getStreamPosition()); } } catch (IOException e) { @@ -1277,6 +1296,16 @@ public class PNGImageReader extends ImageReader { is = new BufferedInputStream(is); this.pixelStream = new DataInputStream(is); + /* + * NB: the PNG spec declares that valid range for width + * and height is [1, 2^31-1], so here we may fail to allocate + * a buffer for destination image due to memory limitation. + * + * However, the recovery strategy for this case should be + * defined on the level of application, so we will not + * try to estimate the required amount of the memory and/or + * handle OOM in any way. + */ theImage = getDestination(param, getImageTypes(0), width, diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java index be764d09129..367a6ed731b 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java @@ -1041,7 +1041,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements } /** - * Rotates the triangle to accomodate the passed in hue. + * Rotates the triangle to accommodate the passed in hue. */ private void setAngleFromHue(float hue) { setHueAngle((1.0 - hue) * Math.PI * 2); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java index 1fe26b09f31..f615fa78fa8 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java @@ -304,7 +304,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { table.put("Synth.doNotSetTextAA", true); initResourceBundle(table); - // For compatability with apps expecting certain defaults we'll + // For compatibility with apps expecting certain defaults we'll // populate the table with the values from basic. initSystemColorDefaults(table); initComponentDefaults(table); @@ -332,7 +332,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { } protected void initComponentDefaults(UIDefaults table) { - // For compatability with apps expecting certain defaults we'll + // For compatibility with apps expecting certain defaults we'll // populate the table with the values from basic. super.initComponentDefaults(table); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java index 751c2d89a3f..20a384483da 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java @@ -131,7 +131,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { * Returns a SynthPainter that will route the appropriate * calls to a GTKEngine. * - * @param state SynthContext indentifying requestor + * @param state SynthContext identifying requestor * @return SynthPainter */ @Override @@ -204,7 +204,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { /** * Returns the color for the specified state. * - * @param context SynthContext identifying requester + * @param context SynthContext identifying requestor * @param state to get the color for * @param type of the color * @return Color to render with @@ -305,7 +305,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { * insets will be placed in it, otherwise a new Insets object will be * created and returned. * - * @param context SynthContext indentifying requestor + * @param context SynthContext identifying requestor * @param insets Where to place Insets * @return Insets. */ @@ -640,7 +640,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { /** * Convenience method to get a class specific integer value. * - * @param context SynthContext indentifying requestor + * @param context SynthContext identifying requestor * @param key Key identifying class specific value * @param defaultValue Returned if there is no value for the specified * type @@ -660,7 +660,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { /** * Convenience method to get a class specific Insets value. * - * @param context SynthContext indentifying requestor + * @param context SynthContext identifying requestor * @param key Key identifying class specific value * @param defaultValue Returned if there is no value for the specified * type @@ -680,7 +680,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { /** * Convenience method to get a class specific Boolean value. * - * @param context SynthContext indentifying requestor + * @param context SynthContext identifying requestor * @param key Key identifying class specific value * @param defaultValue Returned if there is no value for the specified * type @@ -702,7 +702,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { * to. A Style should NOT assume the opacity will remain this value, the * developer may reset it or override it. * - * @param context SynthContext indentifying requestor + * @param context SynthContext identifying requestor * @return opaque Whether or not the JComponent is opaque. */ @Override @@ -843,7 +843,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { // Is it another kind of value ? if (key != "engine") { - // For backward compatability we'll fallback to the UIManager. + // For backward compatibility we'll fallback to the UIManager. // We don't go to the UIManager for engine as the engine is GTK // specific. Object value = UIManager.get(key); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties index c4eeded333f..a8985ce605f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties @@ -41,7 +41,7 @@ FileChooser.saveDialogTitle.textAndMnemonic=Speichern FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen FileChooser.pathLabel.textAndMnemonic=Aus&wahl: FileChooser.filterLabel.textAndMnemonic=Filter: -FileChooser.foldersLabel.textAndMnemonic=Or&dner +FileChooser.foldersLabel.textAndMnemonic=O&rdner FileChooser.filesLabel.textAndMnemonic=&Dateien FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java index 31cd9fdb45b..a75a35e1ddd 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java @@ -86,19 +86,19 @@ public class MotifInternalFrameTitlePane protected void assembleSystemMenu() { systemMenu = new JPopupMenu(); - JMenuItem mi = systemMenu.add(new JMenuItem(restoreAction)); - mi.setMnemonic('R'); - mi = systemMenu.add(new JMenuItem(moveAction)); - mi.setMnemonic('M'); - mi = systemMenu.add(new JMenuItem(sizeAction)); - mi.setMnemonic('S'); - mi = systemMenu.add(new JMenuItem(iconifyAction)); - mi.setMnemonic('n'); - mi = systemMenu.add(new JMenuItem(maximizeAction)); - mi.setMnemonic('x'); + JMenuItem mi = systemMenu.add(restoreAction); + mi.setMnemonic(getButtonMnemonic("restore")); + mi = systemMenu.add(moveAction); + mi.setMnemonic(getButtonMnemonic("move")); + mi = systemMenu.add(sizeAction); + mi.setMnemonic(getButtonMnemonic("size")); + mi = systemMenu.add(iconifyAction); + mi.setMnemonic(getButtonMnemonic("minimize")); + mi = systemMenu.add(maximizeAction); + mi.setMnemonic(getButtonMnemonic("maximize")); systemMenu.add(new JSeparator()); - mi = systemMenu.add(new JMenuItem(closeAction)); - mi.setMnemonic('C'); + mi = systemMenu.add(closeAction); + mi.setMnemonic(getButtonMnemonic("close")); systemButton = new SystemButton(); systemButton.addActionListener(new ActionListener() { @@ -124,6 +124,14 @@ public class MotifInternalFrameTitlePane }); } + private static int getButtonMnemonic(String button) { + try { + return Integer.parseInt(UIManager.getString( + "InternalFrameTitlePane." + button + "Button.mnemonic")); + } catch (NumberFormatException e) { + return -1; + } + } protected void createButtons() { minimizeButton = new MinimizeButton(); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java index 9efb196c537..61090774ccc 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java @@ -45,7 +45,7 @@ public class WindowsGraphicsUtils { /** * Renders a text String in Windows without the mnemonic. - * This is here because the WindowsUI hiearchy doesn't match the Component heirarchy. All + * This is here because the WindowsUI hierarchy doesn't match the Component hierarchy. All * the overriden paintText methods of the ButtonUI delegates will call this static method. *

* @param g Graphics context diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java index 3e5d313436a..3bc26eb46c3 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -174,7 +174,7 @@ public class WindowsIconFactory implements Serializable XPStyle xp = XPStyle.getXP(); if (xp != null) { Skin skin = xp.getSkin(c, part); - JButton b = (JButton)c; + AbstractButton b = (AbstractButton)c; ButtonModel model = b.getModel(); // Find out if frame is inactive diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java index 715f26ced3d..f0ab1667fa8 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java @@ -326,18 +326,27 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane { protected void addSystemMenuItems(JPopupMenu menu) { JMenuItem mi = menu.add(restoreAction); - mi.setMnemonic('R'); + mi.setMnemonic(getButtonMnemonic("restore")); mi = menu.add(moveAction); - mi.setMnemonic('M'); + mi.setMnemonic(getButtonMnemonic("move")); mi = menu.add(sizeAction); - mi.setMnemonic('S'); + mi.setMnemonic(getButtonMnemonic("size")); mi = menu.add(iconifyAction); - mi.setMnemonic('n'); + mi.setMnemonic(getButtonMnemonic("minimize")); mi = menu.add(maximizeAction); - mi.setMnemonic('x'); - systemPopupMenu.add(new JSeparator()); + mi.setMnemonic(getButtonMnemonic("maximize")); + menu.add(new JSeparator()); mi = menu.add(closeAction); - mi.setMnemonic('C'); + mi.setMnemonic(getButtonMnemonic("close")); + } + + private static int getButtonMnemonic(String button) { + try { + return Integer.parseInt(UIManager.getString( + "InternalFrameTitlePane." + button + "Button.mnemonic")); + } catch (NumberFormatException e) { + return -1; + } } protected void showSystemMenu(){ diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java index 6213ac1e0c0..20d52c45ddf 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java @@ -2012,7 +2012,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel * results. *

* - * @param component Component the error occured in, may be + * @param component Component the error occurred in, may be * null indicating the error condition is * not directly associated with a * Component. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java index 1df612f08e4..b8a4a801074 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java @@ -50,7 +50,7 @@ import sun.swing.DefaultLookup; *
  • The cursor blinks at about 1/2 second intervals. *
  • The entire value is selected when focus is gained. *
  • Shift-left-arrow and shift-right-arrow extend selection - *
  • Cntrl-left-arrow and cntrl-right-arrow act like home and + *
  • Ctrl-left-arrow and ctrl-right-arrow act like home and * end respectively. * *

    diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java index 9d2a7ce4064..516770df43c 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java @@ -162,7 +162,7 @@ public abstract class WindowsTextUI extends BasicTextUI { * necessarily the region to paint. * @param c the editor * @param view View painting for - * @return region drawing occured in + * @return region drawing occurred in */ public Shape paintLayer(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c, View view) { diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java index 3f2f430fb84..2c33866e508 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java @@ -190,7 +190,7 @@ class NativeUnpack { copyInOption(Utils.DEBUG_VERBOSE); copyInOption(Pack200.Unpacker.DEFLATE_HINT); - if (modtime == Constants.NO_MODTIME) // Dont pass KEEP && NOW + if (modtime == Constants.NO_MODTIME) // Don't pass KEEP && NOW copyInOption(Utils.UNPACK_MODIFICATION_TIME); updateProgress(); // reset progress bar for (;;) { diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java index a78c9ae9969..bca629f8008 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java @@ -106,7 +106,7 @@ class PackageWriter extends BandStructure { Set requiredEntries; // for the CP Map backCountTable; // for layout callables - int[][] attrCounts; // count attr. occurences + int[][] attrCounts; // count attr. occurrences void setup() { requiredEntries = new HashSet<>(); diff --git a/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java b/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java index b6e4f0a2bb7..dc46af9ad16 100644 --- a/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java +++ b/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java @@ -70,7 +70,7 @@ public interface ListeningConnector extends Connector { * method). *

    * If arguments contains addressing information. and - * only one conection will be accepted, the {@link #accept accept} method + * only one connection will be accepted, the {@link #accept accept} method * can be called immediately without calling this method. * * @return the address at which the connector is listening diff --git a/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java b/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java index 297d3e25116..c3f410e718c 100644 --- a/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java +++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java @@ -250,7 +250,7 @@ public abstract class TransportService { * * @param address * The address to start listening for connections, - * or null to listen on an address choosen + * or null to listen on an address chosen * by the transport service. * * @return a listen key to be used in subsequent calls to be @@ -266,7 +266,7 @@ public abstract class TransportService { public abstract ListenKey startListening(String address) throws IOException; /** - * Listens on an address choosen by the transport service. + * Listens on an address chosen by the transport service. * *

    This convenience method works as if by invoking {@link * #startListening(String) startListening(null)}.

    diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java index c5e00005b87..b6286e5d1c9 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java @@ -1291,7 +1291,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { * ambiguous set. If this set itself corresponds to a constructor, * there is no ambiguity for that pair. In the usual case, one * of the constructors is a superset of the other so the union is - * just the bigger constuctor. + * just the bigger constructor. * * The algorithm here is quadratic in the number of constructors * with a @ConstructorProperties annotation. Typically this corresponds diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java index 0e08177d7f2..06cc19d2894 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java @@ -644,7 +644,7 @@ public class Introspector { /** * Returns the list of "getter" methods for the given class. The list * is ordered so that isXXX methods appear before getXXX methods - this - * is for compatability with the JavaBeans Introspector. + * is for compatibility with the JavaBeans Introspector. */ static List getReadMethods(Class clazz) { // return cached result if available @@ -682,7 +682,7 @@ public class Introspector { * {@code null} if no method is found. */ static Method getReadMethod(Class clazz, String property) { - // first character in uppercase (compatability with JavaBeans) + // first character in uppercase (compatibility with JavaBeans) property = property.substring(0, 1).toUpperCase(Locale.ENGLISH) + property.substring(1); String getMethod = GET_METHOD_PREFIX + property; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java index 75786ffb1b4..d4c67d4e91b 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java @@ -35,7 +35,7 @@ class TokenMgrError extends Error */ /** - * Lexical error occured. + * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; @@ -114,10 +114,10 @@ class TokenMgrError extends Error * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java index 9ec7f7cd520..76af600386a 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java @@ -130,7 +130,7 @@ public class SnmpString extends SnmpValue { * @return The value. */ public byte[] byteValue() { - return value ; + return value.clone() ; } /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java index ffa64b2f524..5d9b3e54cc4 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java @@ -70,7 +70,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * @param server The MBean server to register the service with. * @param name The object name. * - * @return The passed name paramter. + * @return The passed name parameter. * * @exception java.lang.Exception */ @@ -99,7 +99,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * * @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override @@ -147,7 +147,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * * @param inRequest The SnmpMibRequest object holding the list of variable to be set. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override @@ -165,7 +165,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * * @param inRequest The SnmpMibRequest object holding the list of variables to be retrieved. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override @@ -190,7 +190,7 @@ public class SnmpErrorHandlerAgent extends SnmpMibAgent * * @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java index df7587404ef..ac9c4bbd54f 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java @@ -476,8 +476,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { rootOid[i++]= val.longValue(); } } - return rootOid; - + return rootOid.clone(); } // -------------------------------------------------------------------- diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java index 451fa859df4..86892ee34d9 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java @@ -127,7 +127,7 @@ public abstract class SnmpMibAgent * be retrieved. This list is composed of * SnmpVarBind objects. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override public abstract void get(SnmpMibRequest req) @@ -142,7 +142,7 @@ public abstract class SnmpMibAgent * OIDs from which the next variables should be retrieved. * This list is composed of SnmpVarBind objects. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override public abstract void getNext(SnmpMibRequest req) @@ -166,7 +166,7 @@ public abstract class SnmpMibAgent * following the first nonRepeat variables for which * multiple lexicographic successors are requested. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ @Override public abstract void getBulk(SnmpMibRequest req, int nonRepeat, @@ -184,7 +184,7 @@ public abstract class SnmpMibAgent * be set. This list is composed of * SnmpVarBind objects. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. * Throwing an exception in this method will break the * atomicity of the SET operation. Care must be taken so that * the exception is thrown in the {@link #check(SnmpMibRequest)} @@ -643,7 +643,7 @@ public abstract class SnmpMibAgent * * @return The variable list containing returned values. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. */ void getBulkWithGetNext(SnmpMibRequest req, int nonRepeat, int maxRepeat) throws SnmpStatusException { diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java index b057823dc6f..9f48879ac7c 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java @@ -62,7 +62,7 @@ public interface SnmpMibAgentMBean { * be retrieved. This list is composed of * SnmpVarBind objects. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. * @see SnmpMibAgent#get(SnmpMibRequest) */ public void get(SnmpMibRequest req) throws SnmpStatusException; @@ -75,7 +75,7 @@ public interface SnmpMibAgentMBean { * be retrieved. This list is composed of * SnmpVarBind objects. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. * @see SnmpMibAgent#getNext(SnmpMibRequest) */ public void getNext(SnmpMibRequest req) throws SnmpStatusException; @@ -97,7 +97,7 @@ public interface SnmpMibAgentMBean { * following the first nonRepeat variables for which * multiple lexicographic successors are requested. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. * @see SnmpMibAgent#getBulk(SnmpMibRequest,int,int) */ public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat) @@ -111,7 +111,7 @@ public interface SnmpMibAgentMBean { * be set. This list is composed of * SnmpVarBind objects. * - * @exception SnmpStatusException An error occured during the operation. + * @exception SnmpStatusException An error occurred during the operation. * @see SnmpMibAgent#set(SnmpMibRequest) */ public void set(SnmpMibRequest req) throws SnmpStatusException; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java index 29882ce01d4..6050de77d70 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java @@ -119,7 +119,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid // needed... // For instance, the subclass could provide a generated isNestedArc() // method in which the subgroup OID arcs would be hardcoded. - // However, the generic approach was prefered because at this time + // However, the generic approach was preferred because at this time // groups and subgroups are dynamically registered in the MIB. // /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java index e0282c6cec0..2edcbde2a40 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java @@ -435,7 +435,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * If the entry is going to be registered, or if ObjectName's are * required, then * {@link com.sun.jmx.snmp.agent.SnmpMibTable#addEntry(SnmpOid, - * ObjectName, Object)} should be prefered. + * ObjectName, Object)} should be preferred. *
    This function is mainly provided for backward compatibility. * *

    @@ -1088,7 +1088,7 @@ public abstract class SnmpMibTable extends SnmpMibNode * @return true if the row can be placed in * notInService state. * - * @exception SnmpStatusException An error occured while trying + * @exception SnmpStatusException An error occurred while trying * to retrieve the row status, and the operation should * be aborted. * @@ -2444,7 +2444,7 @@ public abstract class SnmpMibTable extends SnmpMibNode l1+1,l2); } else if (pos < tablecount) { - // Vector is large enough to accomodate one additional + // Vector is large enough to accommodate one additional // entry. // // Shift vector, making an empty room at `pos' diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java index dbcca12d9ef..bfe2e0fee55 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java @@ -581,7 +581,7 @@ final class SnmpRequestTree { } else if (pos < entrycount) { - // Vectors are large enough to accomodate one additional + // Vectors are large enough to accommodate one additional // entry. // // Shift vectors, making an empty room at `pos' diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java index 8a015ce7c18..950bbce17e1 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java @@ -480,7 +480,7 @@ public abstract class SnmpTableSupport implements SnmpTableEntryFactory, * associated SnmpIndex. *

    * If the entry is going to be registered, then - * {@link com.sun.jmx.snmp.agent.SnmpTableSupport#addEntry(SnmpIndex, ObjectName, Object)} should be prefered. + * {@link com.sun.jmx.snmp.agent.SnmpTableSupport#addEntry(SnmpIndex, ObjectName, Object)} should be preferred. *
    This function is mainly provided for backward compatibility. * * @param index The SnmpIndex built from the given entry. diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java index b2634d8eee1..b0828e21be9 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java @@ -1248,7 +1248,7 @@ public abstract class CommunicatorServer "of this CommunicatorServer instance has changed."); } - return notifInfos; + return notifInfos.clone(); } /** diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java index 1b42ed4f043..325daa5b990 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java @@ -473,7 +473,7 @@ public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean { * @param specific The specific number of the trap. * @param varBindList A list of SnmpVarBind instances or null. * - * @exception IOException An I/O error occured while sending the trap. + * @exception IOException An I/O error occurred while sending the trap. * @exception SnmpStatusException If the trap exceeds the limit defined by bufferSize. */ public void snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException; @@ -563,7 +563,7 @@ public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean { * @param trapOid The OID identifying the trap. * @param varBindList A list of SnmpVarBind instances or null. * - * @exception IOException An I/O error occured while sending the trap. + * @exception IOException An I/O error occurred while sending the trap. * @exception SnmpStatusException If the trap exceeds the limit defined by bufferSize. */ public void snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java index 0b60e802270..3fea8fe08ca 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java @@ -559,7 +559,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions { // SnmpPduPacket result= executeSubRequest(req,userData); if (result != null) - // It means that an error occured. The error is already + // It means that an error occurred. The error is already // formatted by the executeSubRequest // method. return result; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java index 2754975082f..6dc479f242c 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java @@ -52,7 +52,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler { private SnmpAdaptorServer server = null; /** - * The constuctor initialize the subrequest with the whole varbind list contained + * The constructor initialize the subrequest with the whole varbind list contained * in the original request. */ protected SnmpSubBulkRequestHandler(SnmpEngine engine, @@ -68,7 +68,7 @@ class SnmpSubBulkRequestHandler extends SnmpSubRequestHandler { } /** - * The constuctor initialize the subrequest with the whole varbind list contained + * The constructor initialize the subrequest with the whole varbind list contained * in the original request. */ protected SnmpSubBulkRequestHandler(SnmpAdaptorServer server, diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java index bb4dd0bfd3b..3ff95f6a001 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java @@ -55,7 +55,7 @@ import com.sun.jmx.snmp.ThreadContext; class SnmpSubNextRequestHandler extends SnmpSubRequestHandler { private SnmpAdaptorServer server = null; /** - * The constuctor initialize the subrequest with the whole varbind + * The constructor initialize the subrequest with the whole varbind * list contained in the original request. */ protected SnmpSubNextRequestHandler(SnmpAdaptorServer server, diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java index 04f4ca67443..0b981311358 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java @@ -99,7 +99,7 @@ class SnmpSubRequestHandler implements SnmpDefinitions, Runnable { } /** - * SNMP V1/V2 The constuctor initialize the subrequest with the whole varbind list contained + * SNMP V1/V2 The constructor initialize the subrequest with the whole varbind list contained * in the original request. */ @SuppressWarnings("unchecked") // cast to NonSyncVector diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java index 0d96af74a9c..9a220b6cd89 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java @@ -568,7 +568,7 @@ public final class Connection implements Runnable { //System.err.println("ldap.abandon: " + ex); } - // Dont expect any response for the abandon request. + // Don't expect any response for the abandon request. } synchronized void abandonOutstandingReqs(Control[] reqCtls) { @@ -623,7 +623,7 @@ public final class Connection implements Runnable { //System.err.println("ldap.unbind: " + ex); } - // Dont expect any response for the unbind request. + // Don't expect any response for the unbind request. } /** diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java index 0eb1caa420c..994586c3d78 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java @@ -191,7 +191,7 @@ final class Filter { /** * convert character 'c' that represents a hexadecimal digit to an integer. - * if 'c' is not a hexidecimal digit [0-9A-Fa-f], -1 is returned. + * if 'c' is not a hexadecimal digit [0-9A-Fa-f], -1 is returned. * otherwise the converted value is returned. */ private static int hexchar2int( byte c ) { diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java index b861ea0300c..989f39be600 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java @@ -176,7 +176,7 @@ final public class LdapCtx extends ComponentDirContext "com.sun.jndi.ldap.netscape.schemaBugs"; // deprecated private static final String OLD_NETSCAPE_SCHEMA_BUG = - "com.sun.naming.netscape.schemaBugs"; // for backward compatability + "com.sun.naming.netscape.schemaBugs"; // for backward compatibility // Timeout for socket connect private static final String CONNECT_TIMEOUT = diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java index 5e2ec66a0da..a2f528b2056 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java @@ -862,7 +862,7 @@ public final class LdapName implements Name { --end; } - // Add back the trailing whitespace with a preceeding '\' + // Add back the trailing whitespace with a preceding '\' // (escaped or unescaped) that was taken off in the above // loop. Whether or not to retain this whitespace is // decided below. @@ -918,7 +918,7 @@ public final class LdapName implements Name { } // Get rid of the unescaped trailing whitespace with the - // preceeding '\' character that was previously added back. + // preceding '\' character that was previously added back. int len = buf.length(); if (isWhitespace(buf.charAt(len - 1)) && esc != (end - 1)) { buf.setLength(len - 1); diff --git a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java index 17d1cf08c2f..13b5daa602e 100644 --- a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java @@ -109,7 +109,7 @@ public abstract class PartialCompositeContext implements Context, Resolver { /** * A cheap way of getting the environment. - * Default implemenation is NOT cheap because it simply calls + * Default implementation is NOT cheap because it simply calls * getEnvironment(), which most implementations clone before returning. * Subclass should ALWAYS override this with the cheapest possible way. * The toolkit knows to clone when necessary. diff --git a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java index ac6eb40fdcd..d88a7e214e9 100644 --- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java @@ -82,7 +82,7 @@ public class ContextEnumerator implements NamingEnumeration { return ctx.listBindings(""); } - // Subclass should overrride so that instance is of same type as subclass + // Subclass should override so that instance is of same type as subclass protected ContextEnumerator newEnumerator(Context ctx, int scope, String contextName, boolean returnSelf) throws NamingException { return new ContextEnumerator(ctx, scope, contextName, returnSelf); diff --git a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java index 104af874ea5..874be7ddb05 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java +++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java @@ -106,7 +106,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice return info; } - /** Open the device from an aplication program. + /** Open the device from an application program. * Setting the open reference count to -1 here prevents Transmitters and Receivers that * opened the the device implicitly from closing it. The only way to close the device after * this call is a call to close(). diff --git a/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java b/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java index 93d425e862c..5a96effbbe8 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java +++ b/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java @@ -51,15 +51,6 @@ public final class AiffFileReader extends SunFileReader { private static final int MAX_READ_LENGTH = 8; - /** - * Constructs a new AiffParser object. - */ - public AiffFileReader() { - } - - - - // METHODS TO IMPLEMENT AudioFileReader /** @@ -292,9 +283,15 @@ public final class AiffFileReader extends SunFileReader { throw new UnsupportedAudioFileException("Invalid AIFF/COMM chunksize"); } // Read header info. - int channels = dis.readShort(); - dis.readInt(); - int sampleSizeInBits = dis.readShort(); + int channels = dis.readUnsignedShort(); + if (channels <= 0) { + throw new UnsupportedAudioFileException("Invalid number of channels"); + } + dis.readInt(); // numSampleFrames + int sampleSizeInBits = dis.readUnsignedShort(); + if (sampleSizeInBits < 1 || sampleSizeInBits > 32) { + throw new UnsupportedAudioFileException("Invalid AIFF/COMM sampleSize"); + } float sampleRate = (float) read_ieee_extended(dis); chunkRead += (2 + 4 + 2 + 10); @@ -438,7 +435,4 @@ public final class AiffFileReader extends SunFileReader { return f; } - - - } diff --git a/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java b/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java index d755d516efd..a12e461c95d 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java +++ b/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java @@ -49,13 +49,6 @@ import javax.sound.sampled.UnsupportedAudioFileException; */ public final class AuFileReader extends SunFileReader { - /** - * Constructs a new AuFileReader object. - */ - public AuFileReader() { - } - - // METHODS TO IMPLEMENT AudioFileReader /** @@ -90,7 +83,7 @@ public final class AuFileReader extends SunFileReader { int frameRate = -1; int frameSize = -1; int channels = -1; - int sampleSizeInBits = 0; + final int sampleSizeInBits; int length = 0; int nread = 0; AudioFormat.Encoding encoding = null; @@ -118,6 +111,10 @@ public final class AuFileReader extends SunFileReader { encoding_local = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4; sampleRate = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4; channels = (bigendian==true ? dis.readInt() : rllong(dis) ); nread += 4; + if (channels <= 0) { + dis.reset(); + throw new UnsupportedAudioFileException("Invalid number of channels"); + } frameRate = sampleRate; @@ -372,7 +369,4 @@ public final class AuFileReader extends SunFileReader { return result; } - - - } diff --git a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java index 9a3ef9970ca..d4305523526 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java +++ b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java @@ -34,7 +34,7 @@ public final class AudioSynthesizerPropertyInfo { /** * Constructs a AudioSynthesizerPropertyInfo object with a given * name and value. The description and choices - * are intialized by null values. + * are initialized by null values. * * @param name the name of the property * @param value the current value or class used for values. diff --git a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java index d6556f65f80..698bac9f766 100644 --- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java +++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java @@ -378,7 +378,7 @@ final class DirectAudioDevice extends AbstractMixer { protected final boolean isSource; // true for SourceDataLine, false for TargetDataLine protected volatile long bytePosition; protected volatile boolean doIO = false; // true in between start() and stop() calls - protected volatile boolean stoppedWritten = false; // true if a write occured in stopped state + protected volatile boolean stoppedWritten = false; // true if a write occurred in stopped state protected volatile boolean drained = false; // set to true when drain function returns, set to false in write() protected boolean monitoring = false; @@ -642,7 +642,7 @@ final class DirectAudioDevice extends AbstractMixer { public void drain() { noService = true; // additional safeguard against draining forever - // this occured on Solaris 8 x86, probably due to a bug + // this occurred on Solaris 8 x86, probably due to a bug // in the audio driver int counter = 0; long startPos = getLongFramePosition(); diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java b/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java index d827770a514..962b4d2537b 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java @@ -37,7 +37,7 @@ import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; /** - * SourceDataLine implemention for the SoftMixingMixer. + * SourceDataLine implementation for the SoftMixingMixer. * * @author Karl Helgason */ diff --git a/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java b/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java index 9ba6a6b8740..3599fdfab52 100644 --- a/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java +++ b/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java @@ -52,13 +52,6 @@ public final class WaveFileReader extends SunFileReader { private static final int MAX_READ_LENGTH = 12; - /** - * Constructs a new WaveFileReader object. - */ - public WaveFileReader() { - } - - /** * Obtains the audio file format of the input stream provided. The stream must * point to valid audio file data. In general, audio file providers may @@ -304,6 +297,9 @@ public final class WaveFileReader extends SunFileReader { } // channels channels = rlshort(dis); nread += 2; + if (channels <= 0) { + throw new UnsupportedAudioFileException("Invalid number of channels"); + } // sample rate. sampleRate = rllong(dis); nread += 4; @@ -316,6 +312,9 @@ public final class WaveFileReader extends SunFileReader { // this is the PCM-specific value bitsPerSample sampleSizeInBits = (int)rlshort(dis); nread += 2; + if (sampleSizeInBits <= 0) { + throw new UnsupportedAudioFileException("Invalid bitsPerSample"); + } // if sampleSizeInBits==8, we need to use PCM_UNSIGNED if ((sampleSizeInBits==8) && encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) @@ -373,5 +372,4 @@ public final class WaveFileReader extends SunFileReader { format, dataLength / format.getFrameSize()); } - } diff --git a/jdk/src/share/classes/com/sun/net/httpserver/Headers.java b/jdk/src/share/classes/com/sun/net/httpserver/Headers.java index c33e250d32b..7d07d42e8d0 100644 --- a/jdk/src/share/classes/com/sun/net/httpserver/Headers.java +++ b/jdk/src/share/classes/com/sun/net/httpserver/Headers.java @@ -33,7 +33,7 @@ import java.util.*; * {@link java.lang.String},{@link java.util.List}<{@link java.lang.String}>>. * The keys are case-insensitive Strings representing the header names and * the value associated with each key is a {@link List}<{@link String}> with one - * element for each occurence of the header name in the request or response. + * element for each occurrence of the header name in the request or response. *

    * For example, if a response header instance contains one key "HeaderName" with two values "value1 and value2" * then this object is output as two header lines: diff --git a/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java b/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java index 2ceacf764ae..f976ac2040e 100644 --- a/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java +++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java @@ -170,7 +170,7 @@ public abstract class HttpExchange { * then no response body is being sent. *

    * If the content-length response header has not already been set then - * this is set to the apropriate value depending on the response length parameter. + * this is set to the appropriate value depending on the response length parameter. *

    * This method must be called prior to calling {@link #getResponseBody()}. * @param rCode the response code to send diff --git a/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java b/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java index b1a08ce6f59..765c2322f1d 100644 --- a/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java +++ b/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java @@ -41,7 +41,7 @@ public final class Provider extends SunJSSE { super(); } - // prefered constructor to enable FIPS mode at runtime + // preferred constructor to enable FIPS mode at runtime public Provider(java.security.Provider cryptoProvider) { super(cryptoProvider); } diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java index 05c3cdc76cd..3f64cb3a41d 100644 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java @@ -110,7 +110,7 @@ public interface EncryptionMethod { * Returns an iterator over all the additional elements contained in the * EncryptionMethod. * - * @return an Iterator over all the additional infomation + * @return an Iterator over all the additional information * about the EncryptionMethod. */ Iterator getEncryptionMethodInformation(); diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java index ece475c983d..ec0e2880ff3 100644 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java @@ -63,7 +63,7 @@ import org.w3c.dom.Text; * * This includes: * - * Constuct a ds:Reference from an {@link org.w3c.dom.Element}. + * Constructs a ds:Reference from an {@link org.w3c.dom.Element}. * *

    Create a new reference

    *
    diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
    index 490f184c57f..bb7cc03778c 100644
    --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
    +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
    @@ -846,7 +846,7 @@ public final class XMLSignature extends SignatureElementProxy {
         }
     
         /**
    -     * Signal wether Manifest should be automatically validated.
    +     * Signal whether Manifest should be automatically validated.
          * Checking the digests in References in a Signature are mandatory, but for
          * References inside a Manifest it is application specific. This boolean is
          * to indicate that the References inside Manifests should be validated.
    diff --git a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
    index af0c988b5d1..7a7f693022d 100644
    --- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
    +++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
    @@ -41,7 +41,7 @@ import com.sun.rowset.providers.*;
     /**
      * The standard implementation of the CachedRowSet interface.
      *
    - * See interface defintion for full behaviour and implementation requirements.
    + * See interface definition for full behavior and implementation requirements.
      * This reference implementation has made provision for a one-to-one write back
      * facility and it is curremtly be possible to change the peristence provider
      * during the life-time of any CachedRowSetImpl.
    @@ -119,14 +119,14 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
         private Vector rvh;
     
         /**
    -     * The current postion of the cursor in this CachedRowSetImpl
    +     * The current position of the cursor in this CachedRowSetImpl
          * object.
          * @serial
          */
         private int cursorPos;
     
         /**
    -     * The current postion of the cursor in this CachedRowSetImpl
    +     * The current position of the cursor in this CachedRowSetImpl
          * object not counting rows that have been deleted, if any.
          * 

    * For example, suppose that the cursor is on the last row of a rowset @@ -236,7 +236,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern private int startPos; /** - * The integer value indicating the positon from where the page prior to this + * The integer value indicating the position from where the page prior to this * was populated. */ private int startPrev; @@ -3730,7 +3730,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern /* * Each call to internalPrevious may move the cursor - * over multiple rows, the absolute postion moves one one row + * over multiple rows, the absolute position moves one one row */ if (ret == true) --absolutePos; @@ -6265,7 +6265,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern /** * Returns a result set containing the original value of the rowset. The * original value is the state of the CachedRowSetImpl after the - * last population or synchronization (whichever occured most recently) with + * last population or synchronization (whichever occurred most recently) with * the data source. *

    * The cursor is positioned before the first row in the result set. @@ -6300,7 +6300,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern * Returns a result set containing the original value of the current * row only. * The original value is the state of the CachedRowSetImpl after - * the last population or synchronization (whichever occured most recently) + * the last population or synchronization (whichever occurred most recently) * with the data source. * * @return the original result set of the row @@ -9061,7 +9061,7 @@ a /** - * Sets the designated paramter to the given String object. + * Sets the designated parameter to the given String object. * The driver converts this to a SQL NCHAR or * NVARCHAR or LONGNVARCHAR value * (depending on the argument's @@ -9081,7 +9081,7 @@ a /** - * Sets the designated paramter to the given String object. + * Sets the designated parameter to the given String object. * The driver converts this to a SQL NCHAR or * NVARCHAR or LONGNVARCHAR * @param parameterName the name of the column to be set @@ -9421,7 +9421,7 @@ a * if parameterIndex does not correspond * to a parameter marker in the SQL statement, if the length specified * is less than zero or if the number of bytes in the inputstream does not match - * the specfied length. + * the specified length. * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method * * @since 1.6 @@ -9481,7 +9481,7 @@ a * @throws SQLException if parameterIndex does not correspond * to a parameter marker in the SQL statement, or if the length specified * is less than zero; if the number of bytes in the inputstream does not match - * the specfied length; if a database access error occurs or + * the specified length; if a database access error occurs or * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method diff --git a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java index eeda4b7e326..1e60fe8acef 100644 --- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java +++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java @@ -39,7 +39,7 @@ import com.sun.rowset.internal.*; /** * The standard implementation of the FilteredRowSet interface. See the interface - * defintion for full behaviour and implementation requirements. + * definition for full behavior and implementation requirements. * * @see javax.sql.rowset.Predicate * @author Jonathan Bruce, Amit Handa diff --git a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java index 8302c2922c0..45df1b8495e 100644 --- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java +++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java @@ -36,7 +36,7 @@ import javax.sql.rowset.*; /** * The standard implementation of the JdbcRowSet interface. See the interface - * defintion for full behavior and implementation requirements. + * definition for full behavior and implementation requirements. * * @author Jonathan Bruce, Amit Handa */ @@ -67,7 +67,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { private ResultSet rs; /** - * The RowSetMetaDataImpl object that is contructed when + * The RowSetMetaDataImpl object that is constructed when * a ResultSet object is passed to the JdbcRowSet * constructor. This helps in constructing all metadata associated * with the ResultSet object using the setter methods of @@ -3152,7 +3152,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { * DatabaseMetaData method, this method returns * null. * - * @return the Statment object that produced + * @return the Statement object that produced * this rowset's ResultSet object or null * if the result set was produced some other way * @throws SQLException if a database access error occurs @@ -4748,7 +4748,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { /** - * Sets the designated paramter to the given String object. + * Sets the designated parameter to the given String object. * The driver converts this to a SQL NCHAR or * NVARCHAR or LONGNVARCHAR value * (depending on the argument's @@ -5883,7 +5883,7 @@ a /** - * Sets the designated paramter to the given String object. + * Sets the designated parameter to the given String object. * The driver converts this to a SQL NCHAR or * NVARCHAR or LONGNVARCHAR * @param parameterName the name of the column to be set @@ -6222,7 +6222,7 @@ a * if parameterIndex does not correspond * to a parameter marker in the SQL statement, if the length specified * is less than zero or if the number of bytes in the inputstream does not match - * the specfied length. + * the specified length. * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method * * @since 1.6 @@ -6283,7 +6283,7 @@ a * @throws SQLException if parameterIndex does not correspond * to a parameter marker in the SQL statement, or if the length specified * is less than zero; if the number of bytes in the inputstream does not match - * the specfied length; if a database access error occurs or + * the specified length; if a database access error occurs or * this method is called on a closed CallableStatement * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method diff --git a/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java index a7afd4af563..a2d2c438d45 100644 --- a/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java +++ b/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java @@ -42,7 +42,7 @@ import com.sun.rowset.internal.*; /** * The standard implementation of the WebRowSet interface. See the interface - * defintion for full behaviour and implementation requirements. + * definition for full behavior and implementation requirements. * * @author Jonathan Bruce, Amit Handa */ diff --git a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java index b237150a701..c78e87415a0 100644 --- a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java +++ b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java @@ -4109,7 +4109,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { /** * Returns a result set containing the original value of the rowset. The * original value is the state of the CachedRowSetImpl after the - * last population or synchronization (whichever occured most recently) with + * last population or synchronization (whichever occurred most recently) with * the data source. *

    * The cursor is positioned before the first row in the result set. @@ -4128,7 +4128,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver { * Returns a result set containing the original value of the current * row only. * The original value is the state of the CachedRowSetImpl after - * the last population or synchronization (whichever occured most recently) + * the last population or synchronization (whichever occurred most recently) * with the data source. * * @return the original result set of the row diff --git a/jdk/src/share/classes/com/sun/rowset/package.html b/jdk/src/share/classes/com/sun/rowset/package.html index ca33ecafeb1..abd21b8b9ab 100644 --- a/jdk/src/share/classes/com/sun/rowset/package.html +++ b/jdk/src/share/classes/com/sun/rowset/package.html @@ -74,7 +74,7 @@ can with to other components of the Java platform.

    3.0 Extending the JDBC RowSet Implementations

    The JDBC RowSet reference implementations are provided as non-final -classess so that any developer can extend them to provider additional features +classes so that any developer can extend them to provide additional features while maintaining the core required standard functionality and compatibility. It is anticipated that many vendors and developers will extend the standard feature set to their their particular needs. The website for JDBC Technology will diff --git a/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java b/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java index 24c7571effe..e2acedecfbc 100644 --- a/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java +++ b/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java @@ -153,7 +153,7 @@ import com.sun.security.auth.UserPrincipal; * If the attribute cannot be found then the option is ignored. * When this option is supplied and the user has been successfully * authenticated then an additional {@link UserPrincipal} - * is created using the authorization identity and it is assocated with + * is created using the authorization identity and it is associated with * the current {@link Subject}. * *
    useSSL
    diff --git a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java index 3370de962ec..3b645854b1b 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java +++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java @@ -62,7 +62,7 @@ import javax.security.sasl.*; * LMv2: NTLM v2, LM only * NTLMv2: NTLM v2, NTLM only * If not specified, use system property "ntlm.version". If also - * not specfied, all versions are accepted. + * not specified, all versions are accepted. * * com.sun.security.sasl.ntlm.domain * String, the domain of the server, default is server name (fqdn parameter) diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties index 722d302ef8e..4a8d160c02c 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties @@ -144,12 +144,12 @@ InternalFrame.restoreButtonToolTip=Restore InternalFrame.closeButtonToolTip=Close ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=Restore -InternalFrameTitlePane.moveButton.textAndMnemonic=Move -InternalFrameTitlePane.sizeButton.textAndMnemonic=Size -InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimize -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximize -InternalFrameTitlePane.closeButton.textAndMnemonic=Close +InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restore +InternalFrameTitlePane.moveButton.textAndMnemonic=&Move +InternalFrameTitlePane.sizeButton.textAndMnemonic=&Size +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimize +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximize +InternalFrameTitlePane.closeButton.textAndMnemonic=&Close ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties index 1affb2fe589..823abc43130 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=Wiederherstellen InternalFrame.closeButtonToolTip=Schlie\u00DFen ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiederherstellen -InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben -InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe -InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimieren -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximieren -InternalFrameTitlePane.closeButton.textAndMnemonic=Schlie\u00DFen +InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiede&rherstellen +InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimieren +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximieren +InternalFrameTitlePane.closeButton.textAndMnemonic=S&chlie\u00DFen ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties index 2de493e00f6..08c77828759 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=Restaurar InternalFrame.closeButtonToolTip=Cerrar ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar -InternalFrameTitlePane.moveButton.textAndMnemonic=Mover -InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o -InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar -InternalFrameTitlePane.closeButton.textAndMnemonic=Cerrar +InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurar +InternalFrameTitlePane.moveButton.textAndMnemonic=&Mover +InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimizar +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximizar +InternalFrameTitlePane.closeButton.textAndMnemonic=&Cerrar ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties index f57feca66b0..902db71f44c 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=Restaurer InternalFrame.closeButtonToolTip=Fermer ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurer -InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer -InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille -InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir -InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer +InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurer +InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire(&N) +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir(&X) +InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer(&C) ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties index 243cf6af566..310d08f7779 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=Ripristina InternalFrame.closeButtonToolTip=Chiudi ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=Ripristina -InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta -InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimensioni -InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a icona -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci -InternalFrameTitlePane.closeButton.textAndMnemonic=Chiudi +InternalFrameTitlePane.restoreButton.textAndMnemonic=&Ripristina +InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimen&sioni +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a ico&na +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci(&X) +InternalFrameTitlePane.closeButton.textAndMnemonic=&Chiudi ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties index d8adf8cce82..c5314fa25a9 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=\u5FA9\u5143 InternalFrame.closeButtonToolTip=\u9589\u3058\u308B ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143 -InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5 -InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA -InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316 -InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316 -InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B +InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143(&R) +InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N) +InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X) +InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B(&C) ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties index a8504f7872c..7f313031ba2 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=\uBCF5\uC6D0 InternalFrame.closeButtonToolTip=\uB2EB\uAE30 ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0 -InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9 -InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30 -InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654 -InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654 -InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30 +InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0(&R) +InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654(&N) +InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654(&X) +InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30(&C) ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties index 61b4e122c9d..4f86d4c748e 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=Restaurar InternalFrame.closeButtonToolTip=Fechar ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar -InternalFrameTitlePane.moveButton.textAndMnemonic=Mover -InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho -InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar -InternalFrameTitlePane.closeButton.textAndMnemonic=Fechar +InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurar +InternalFrameTitlePane.moveButton.textAndMnemonic=&Mover +InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimizar +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximizar +InternalFrameTitlePane.closeButton.textAndMnemonic=Fe&char ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties index 2d40e3c849b..27f2498ffd8 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=\u00C5terst\u00E4ll InternalFrame.closeButtonToolTip=St\u00E4ng ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll -InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta -InternalFrameTitlePane.sizeButton.textAndMnemonic=Storlek -InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimera -InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximera -InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng +InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll(&R) +InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=&Storlek +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimera +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximera +InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng(&C) ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties index 4db5d181ff3..d4c357281f4 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=\u8FD8\u539F InternalFrame.closeButtonToolTip=\u5173\u95ED ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F -InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8 -InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F -InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316 -InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316 -InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED +InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F(&R) +InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N) +InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X) +InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED(&C) ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties index 8112751e397..c26b7a15b4f 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties @@ -143,12 +143,12 @@ InternalFrame.restoreButtonToolTip=\u5FA9\u539F InternalFrame.closeButtonToolTip=\u95DC\u9589 ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F -InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5 -InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F -InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316 -InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316 -InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589 +InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F(&R) +InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5(&M) +InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F(&S) +InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N) +InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X) +InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589(&C) ############ Text strings ############# # Used for html forms diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java index d63c3bdc6d3..1ab2a5be894 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java @@ -44,7 +44,7 @@ public class TokenMgrError extends Error private static final long serialVersionUID = -6236440836177601522L; /** - * Lexical error occured. + * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; @@ -123,10 +123,10 @@ public class TokenMgrError extends Error * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ diff --git a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js index ec15e15acd6..97e38a79342 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js +++ b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js @@ -33,7 +33,7 @@ var hatPkg = Packages.com.sun.tools.hat.internal; /** * This is JavaScript interface for heap analysis using HAT - * (Heap Analysis Tool). HAT classes are refered from + * (Heap Analysis Tool). HAT classes are referred from * this file. In particular, refer to classes in hat.model * package. * diff --git a/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java b/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java index 992dacdf018..36f5be2fec1 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java @@ -68,7 +68,7 @@ public class SocketAttachingConnector extends GenericAttachingConnector { transport = new Transport() { public String name() { - return "dt_socket"; // for compatability reasons + return "dt_socket"; // for compatibility reasons } }; diff --git a/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java b/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java index acfda94d0c6..7931dd9ff72 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java @@ -58,7 +58,7 @@ public class SocketListeningConnector extends GenericListeningConnector { transport = new Transport() { public String name() { - return "dt_socket"; // for compatability reasons + return "dt_socket"; // for compatibility reasons } }; } diff --git a/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java b/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java index 787539e04bc..d50c8051dad 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java @@ -31,7 +31,7 @@ import java.util.EventListener; interface ThreadListener extends EventListener { boolean threadResumable(ThreadAction action); /* - * Not needed for current implemenation, and hard to implement + * Not needed for current implementation, and hard to implement * correctly. (See TargetVM.handleEventCmdSet) * void threadSuspended(ThreadAction action); */ diff --git a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java index f469827e8d4..5826999458d 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java @@ -62,7 +62,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl // This is cached only while this one thread is suspended. Each time // the thread is resumed, we abandon the current cache object and - // create a new intialized one. + // create a new initialized one. private static class LocalCache { JDWP.ThreadReference.Status status = null; List frames = null; diff --git a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java index a5daab688dc..4fc6d52c8c7 100644 --- a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java +++ b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java @@ -998,7 +998,7 @@ public class AWTEventMulticaster implements * If a null listener is specified, this method returns an * empty array. If the specified listener is not an instance of * AWTEventMulticaster, this method returns an array which - * contains only the specified listener. If no such listeners are chanined, + * contains only the specified listener. If no such listeners are chained, * this method returns an empty array. * * @param l the specified java.util.EventListener diff --git a/jdk/src/share/classes/java/awt/AlphaComposite.java b/jdk/src/share/classes/java/awt/AlphaComposite.java index 6903e7ec712..9f8b64f2684 100644 --- a/jdk/src/share/classes/java/awt/AlphaComposite.java +++ b/jdk/src/share/classes/java/awt/AlphaComposite.java @@ -197,7 +197,7 @@ import sun.java2d.SunCompositeContext; *

    Performance Considerations

    * *

    - * For performance reasons, it is preferrable that + * For performance reasons, it is preferable that * Raster objects passed to the compose * method of a {@link CompositeContext} object created by the * AlphaComposite class have premultiplied data. diff --git a/jdk/src/share/classes/java/awt/BasicStroke.java b/jdk/src/share/classes/java/awt/BasicStroke.java index 55d59d4224f..5cc466640c2 100644 --- a/jdk/src/share/classes/java/awt/BasicStroke.java +++ b/jdk/src/share/classes/java/awt/BasicStroke.java @@ -88,7 +88,7 @@ import java.lang.annotation.Native; * but also by the transform attribute of the * Graphics2D object. Consider this code: *

    - * // sets the Graphics2D object's Tranform attribute + * // sets the Graphics2D object's Transform attribute * g2d.scale(10, 10); * // sets the Graphics2D object's Stroke attribute * g2d.setStroke(new BasicStroke(1.5f)); diff --git a/jdk/src/share/classes/java/awt/BorderLayout.java b/jdk/src/share/classes/java/awt/BorderLayout.java index 98bd4d5a9cd..8b131c485d3 100644 --- a/jdk/src/share/classes/java/awt/BorderLayout.java +++ b/jdk/src/share/classes/java/awt/BorderLayout.java @@ -69,7 +69,7 @@ import java.util.Hashtable; * components, the latter constants are preferred. *

    * Mixing both absolute and relative positioning constants can lead to - * unpredicable results. If + * unpredictable results. If * you use both types, the relative constants will take precedence. * For example, if you add components using both the NORTH * and PAGE_START constants in a container whose @@ -206,7 +206,7 @@ public class BorderLayout implements LayoutManager2, * * A relative positioning constant, that can be used instead of * north, south, east, west or center. - * mixing the two types of constants can lead to unpredicable results. If + * mixing the two types of constants can lead to unpredictable results. If * you use both types, the relative constants will take precedence. * For example, if you add components using both the NORTH * and BEFORE_FIRST_LINE constants in a container whose diff --git a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java index 4da887ee242..20265c7ad12 100644 --- a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java +++ b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java @@ -180,7 +180,7 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access } /** - * Sets this check box menu item to the specifed state. + * Sets this check box menu item to the specified state. * The boolean value true indicates "on" while * false indicates "off." * diff --git a/jdk/src/share/classes/java/awt/Choice.java b/jdk/src/share/classes/java/awt/Choice.java index e74bd094fb6..b50746205d9 100644 --- a/jdk/src/share/classes/java/awt/Choice.java +++ b/jdk/src/share/classes/java/awt/Choice.java @@ -418,7 +418,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { * an ItemEvent. The only way to trigger an * ItemEvent is by user interaction. * - * @param pos the positon of the selected item + * @param pos the position of the selected item * @exception IllegalArgumentException if the specified * position is greater than the * number of items or less than zero diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index f7e2fbdba05..bd913cbd50e 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -276,7 +276,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see #getFont * @see #setFont */ - Font font; + volatile Font font; /** * The font which the peer is currently using. @@ -1885,10 +1885,8 @@ public abstract class Component implements ImageObserver, MenuContainer, public void setFont(Font f) { Font oldFont, newFont; synchronized(getTreeLock()) { - synchronized (this) { - oldFont = font; - newFont = font = f; - } + oldFont = font; + newFont = font = f; ComponentPeer peer = this.peer; if (peer != null) { f = getFont(); @@ -2684,7 +2682,7 @@ public abstract class Component implements ImageObserver, MenuContainer, } /** - * Gets the mininimum size of this component. + * Gets the minimum size of this component. * @return a dimension object indicating this component's minimum size * @see #getPreferredSize * @see LayoutManager @@ -5254,7 +5252,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * Returns an array of all the component listeners * registered on this component. * - * @return all of this comonent's ComponentListeners + * @return all ComponentListeners of this component * or an empty array if no component * listeners are currently registered * diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 82b682db78e..a779d72d489 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -959,7 +959,7 @@ public class Container extends Component { * * @param comp the component to be added * @param constraints an object expressing - * layout contraints for this component + * layout constraints for this component * @exception NullPointerException if {@code comp} is {@code null} * @see #addImpl * @see #invalidate @@ -986,7 +986,7 @@ public class Container extends Component { * * * @param comp the component to be added - * @param constraints an object expressing layout contraints for this + * @param constraints an object expressing layout constraints for this * @param index the position in the container's list at which to insert * the component; -1 means insert at the end * component diff --git a/jdk/src/share/classes/java/awt/Dialog.java b/jdk/src/share/classes/java/awt/Dialog.java index a2248f033d7..b441100d9f2 100644 --- a/jdk/src/share/classes/java/awt/Dialog.java +++ b/jdk/src/share/classes/java/awt/Dialog.java @@ -338,7 +338,7 @@ public class Dialog extends Window { * * @param owner the owner of the dialog or null if * this dialog has no owner - * @param modal specifes whether dialog blocks user input to other top-level + * @param modal specifies whether dialog blocks user input to other top-level * windows when shown. If false, the dialog is MODELESS; * if true, the modality type property is set to * DEFAULT_MODALITY_TYPE @@ -387,7 +387,7 @@ public class Dialog extends Window { * this dialog has no owner * @param title the title of the dialog or null if this dialog * has no title - * @param modal specifes whether dialog blocks user input to other top-level + * @param modal specifies whether dialog blocks user input to other top-level * windows when shown. If false, the dialog is MODELESS; * if true, the modality type property is set to * DEFAULT_MODALITY_TYPE @@ -416,7 +416,7 @@ public class Dialog extends Window { * has no owner * @param title the title of the dialog or null if this dialog * has no title - * @param modal specifes whether dialog blocks user input to other top-level + * @param modal specifies whether dialog blocks user input to other top-level * windows when shown. If false, the dialog is MODELESS; * if true, the modality type property is set to * DEFAULT_MODALITY_TYPE @@ -488,7 +488,7 @@ public class Dialog extends Window { * dialog has no owner * @param title the title of the dialog or null if this * dialog has no title - * @param modal specifes whether dialog blocks user input to other top-level + * @param modal specifies whether dialog blocks user input to other top-level * windows when shown. If false, the dialog is MODELESS; * if true, the modality type property is set to * DEFAULT_MODALITY_TYPE @@ -519,7 +519,7 @@ public class Dialog extends Window { * dialog has no owner * @param title the title of the dialog or null if this * dialog has no title - * @param modal specifes whether dialog blocks user input to other top-level + * @param modal specifies whether dialog blocks user input to other top-level * windows when shown. If false, the dialog is MODELESS; * if true, the modality type property is set to * DEFAULT_MODALITY_TYPE @@ -764,7 +764,7 @@ public class Dialog extends Window { /** * Indicates whether the dialog is modal. *

    - * This method is obsolete and is kept for backwards compatiblity only. + * This method is obsolete and is kept for backwards compatibility only. * Use {@link #getModalityType getModalityType()} instead. * * @return true if this dialog window is modal; diff --git a/jdk/src/share/classes/java/awt/Event.java b/jdk/src/share/classes/java/awt/Event.java index 2bc5c31b235..b2a2e6b3f60 100644 --- a/jdk/src/share/classes/java/awt/Event.java +++ b/jdk/src/share/classes/java/awt/Event.java @@ -29,14 +29,14 @@ import java.io.*; /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Event is a platform-independent class that * encapsulates events from the platform's Graphical User * Interface in the Java 1.0 event model. In Java 1.1 * and later versions, the Event class is maintained - * only for backwards compatibilty. The information in this + * only for backwards compatibility. The information in this * class description is provided to assist programmers in * converting Java 1.0 programs to the new event model. *

    @@ -390,7 +390,7 @@ public class Event implements java.io.Serializable { /** * The user has moved the bubble (thumb) in a scroll bar, * moving to an "absolute" position, rather than to - * an offset from the last postion. + * an offset from the last position. */ public static final int SCROLL_ABSOLUTE = 5 + SCROLL_EVENT; @@ -609,7 +609,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Creates an instance of Event with the specified target @@ -660,7 +660,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Creates an instance of Event, with the specified target @@ -681,7 +681,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Creates an instance of Event with the specified @@ -696,7 +696,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Translates this event so that its x and y @@ -717,7 +717,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Checks if the Shift key is down. @@ -733,7 +733,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Checks if the Control key is down. @@ -749,7 +749,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Checks if the Meta key is down. @@ -766,7 +766,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. */ void consume() { @@ -784,7 +784,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. */ boolean isConsumed() { @@ -793,7 +793,7 @@ public class Event implements java.io.Serializable { /* * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Returns the integer key-code associated with the key in this event, @@ -811,7 +811,7 @@ public class Event implements java.io.Serializable { /* * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Returns a new KeyEvent char which corresponds to the int key @@ -828,7 +828,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Returns a string representing the state of this Event. @@ -864,7 +864,7 @@ public class Event implements java.io.Serializable { /** * NOTE: The Event class is obsolete and is - * available only for backwards compatilibility. It has been replaced + * available only for backwards compatibility. It has been replaced * by the AWTEvent class and its subclasses. *

    * Returns a representation of this event's values as a string. diff --git a/jdk/src/share/classes/java/awt/EventDispatchThread.java b/jdk/src/share/classes/java/awt/EventDispatchThread.java index ab1d3e6f70a..51344658c7e 100644 --- a/jdk/src/share/classes/java/awt/EventDispatchThread.java +++ b/jdk/src/share/classes/java/awt/EventDispatchThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -25,19 +25,11 @@ package java.awt; -import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.awt.event.ActionEvent; import java.awt.event.WindowEvent; -import java.lang.reflect.Method; -import java.security.AccessController; -import sun.security.action.GetPropertyAction; -import sun.awt.AWTAutoShutdown; -import sun.awt.SunToolkit; -import sun.awt.AppContext; import java.util.ArrayList; -import java.util.List; import sun.util.logging.PlatformLogger; import sun.awt.dnd.SunDragSourceContextPeer; @@ -67,8 +59,7 @@ class EventDispatchThread extends Thread { private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread"); private EventQueue theQueue; - private boolean doDispatch = true; - private volatile boolean shutdown = false; + private volatile boolean doDispatch = true; private static final int ANY_EVENT = -1; @@ -86,24 +77,15 @@ class EventDispatchThread extends Thread { doDispatch = false; } - public void interrupt() { - shutdown = true; - super.interrupt(); - } - public void run() { - while (true) { - try { - pumpEvents(new Conditional() { - public boolean evaluate() { - return true; - } - }); - } finally { - if(getEventQueue().detachDispatchThread(this, shutdown)) { - break; + try { + pumpEvents(new Conditional() { + public boolean evaluate() { + return true; } - } + }); + } finally { + getEventQueue().detachDispatchThread(this); } } @@ -130,8 +112,7 @@ class EventDispatchThread extends Thread { void pumpEventsForFilter(int id, Conditional cond, EventFilter filter) { addEventFilter(filter); doDispatch = true; - shutdown |= isInterrupted(); - while (doDispatch && !shutdown && cond.evaluate()) { + while (doDispatch && !isInterrupted() && cond.evaluate()) { pumpOneEventForFilters(id); } removeEventFilter(filter); @@ -223,12 +204,12 @@ class EventDispatchThread extends Thread { } } catch (ThreadDeath death) { - shutdown = true; + doDispatch = false; throw death; } catch (InterruptedException interruptedException) { - shutdown = true; // AppContext.dispose() interrupts all - // Threads in the AppContext + doDispatch = false; // AppContext.dispose() interrupts all + // Threads in the AppContext } catch (Throwable e) { processException(e); diff --git a/jdk/src/share/classes/java/awt/EventQueue.java b/jdk/src/share/classes/java/awt/EventQueue.java index d6a1dabfc72..af9e1bf08f3 100644 --- a/jdk/src/share/classes/java/awt/EventQueue.java +++ b/jdk/src/share/classes/java/awt/EventQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -1074,7 +1074,7 @@ public class EventQueue { } } - final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) { + final void detachDispatchThread(EventDispatchThread edt) { /* * Minimize discard possibility for non-posted events */ @@ -1090,17 +1090,9 @@ public class EventQueue { pushPopLock.lock(); try { if (edt == dispatchThread) { - /* - * Don't detach the thread if any events are pending. Not - * sure if it's a possible scenario, though. - */ - if (!forceDetach && (peekEvent() != null)) { - return false; - } dispatchThread = null; } AWTAutoShutdown.getInstance().notifyThreadFree(edt); - return true; } finally { pushPopLock.unlock(); } @@ -1159,6 +1151,10 @@ public class EventQueue { if (entry.event instanceof SentEvent) { ((SentEvent)entry.event).dispose(); } + if (entry.event instanceof InvocationEvent) { + AWTAccessor.getInvocationEventAccessor() + .dispose((InvocationEvent)entry.event); + } if (prev == null) { queues[i].head = entry.next; } else { diff --git a/jdk/src/share/classes/java/awt/Font.java b/jdk/src/share/classes/java/awt/Font.java index 3908b075c15..c5c400c651b 100644 --- a/jdk/src/share/classes/java/awt/Font.java +++ b/jdk/src/share/classes/java/awt/Font.java @@ -1334,7 +1334,7 @@ public class Font implements java.io.Serializable * Indicates whether or not this Font object's style is * PLAIN. * @return true if this Font has a - * PLAIN sytle; + * PLAIN style; * false otherwise. * @see java.awt.Font#getStyle * @since JDK1.0 diff --git a/jdk/src/share/classes/java/awt/Graphics.java b/jdk/src/share/classes/java/awt/Graphics.java index abd4b8cc50d..3e2dcb55008 100644 --- a/jdk/src/share/classes/java/awt/Graphics.java +++ b/jdk/src/share/classes/java/awt/Graphics.java @@ -105,7 +105,7 @@ public abstract class Graphics { /** * Constructs a new Graphics object. - * This constructor is the default contructor for a graphics + * This constructor is the default constructor for a graphics * context. *

    * Since Graphics is an abstract class, applications diff --git a/jdk/src/share/classes/java/awt/Graphics2D.java b/jdk/src/share/classes/java/awt/Graphics2D.java index f83bde71a36..c8bb23def69 100644 --- a/jdk/src/share/classes/java/awt/Graphics2D.java +++ b/jdk/src/share/classes/java/awt/Graphics2D.java @@ -305,7 +305,7 @@ import java.util.Map; * aliasing or antialiasing is being used. *

      *
    • Device coordinates are defined to be between device pixels which - * avoids any inconsistent results between aliased and antaliased + * avoids any inconsistent results between aliased and antialiased * rendering. If coordinates were defined to be at a pixel's center, some * of the pixels covered by a shape, such as a rectangle, would only be * half covered. @@ -806,7 +806,7 @@ public abstract class Graphics2D extends Graphics { * @param s the Shape to check for a hit * @param onStroke flag used to choose between testing the * stroked or the filled shape. If the flag is true, the - * Stroke oultine is tested. If the flag is + * Stroke outline is tested. If the flag is * false, the filled Shape is tested. * @return true if there is a hit; false * otherwise. @@ -1162,7 +1162,7 @@ public abstract class Graphics2D extends Graphics { * Component. To change the background * of the Component, use appropriate methods of * the Component. - * @param color the background color that isused in + * @param color the background color that is used in * subsequent calls to clearRect * @see #getBackground * @see java.awt.Graphics#clearRect diff --git a/jdk/src/share/classes/java/awt/GraphicsDevice.java b/jdk/src/share/classes/java/awt/GraphicsDevice.java index 5e3901a0dd3..3c9d4178bd6 100644 --- a/jdk/src/share/classes/java/awt/GraphicsDevice.java +++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java @@ -162,7 +162,7 @@ public abstract class GraphicsDevice { * GraphicsEnvironment. Although there is * no public method to set this String, a programmer can * use the String for debugging purposes. Vendors of - * the JavaTM Runtime Environment can + * the Java™ Runtime Environment can * format the return value of the String. To determine * how to interpret the value of the String, contact the * vendor of your Java Runtime. To find out who the vendor is, from @@ -325,7 +325,14 @@ public abstract class GraphicsDevice { // Note that we use the graphics configuration of the device, // not the window's, because we're setting the fs window for // this device. - Rectangle screenBounds = getDefaultConfiguration().getBounds(); + final GraphicsConfiguration gc = getDefaultConfiguration(); + final Rectangle screenBounds = gc.getBounds(); + if (SunToolkit.isDispatchThreadForAppContext(fullScreenWindow)) { + // Update graphics configuration here directly and do not wait + // asynchronous notification from the peer. Note that + // setBounds() will reset a GC, if it was set incorrectly. + fullScreenWindow.setGraphicsConfiguration(gc); + } fullScreenWindow.setBounds(screenBounds.x, screenBounds.y, screenBounds.width, screenBounds.height); fullScreenWindow.setVisible(true); diff --git a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java index 9e1da05e35f..8a655ba99b8 100644 --- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java +++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java @@ -263,7 +263,7 @@ public abstract class GraphicsEnvironment { * available in this GraphicsEnvironment. Typical usage * would be to allow a user to select a particular font. Then, the * application can size the font and set various font attributes by - * calling the deriveFont method on the choosen instance. + * calling the deriveFont method on the chosen instance. *

      * This method provides for the application the most precise control * over which Font instance is used to render text. diff --git a/jdk/src/share/classes/java/awt/GridBagLayout.java b/jdk/src/share/classes/java/awt/GridBagLayout.java index 1362e57dd76..8ac290a7a42 100644 --- a/jdk/src/share/classes/java/awt/GridBagLayout.java +++ b/jdk/src/share/classes/java/awt/GridBagLayout.java @@ -125,9 +125,9 @@ import java.util.Arrays; *

      * - * - * - * + * + * + * * * *

      Absolute Values

      Orientation Relative Values

      Baseline Relative Values

      Absolute Values

      Orientation Relative Values

      Baseline Relative Values

      @@ -255,10 +255,10 @@ import java.util.Arrays; *
      * * * * * @@ -366,7 +366,7 @@ java.io.Serializable { static final int EMPIRICMULTIPLIER = 2; /** - * This field is no longer used to reserve arrays and keeped for backward + * This field is no longer used to reserve arrays and kept for backward * compatibility. Previously, this was * the maximum number of grid positions (both horizontal and * vertical) that could be laid out by the grid bag layout. @@ -444,7 +444,7 @@ java.io.Serializable { * applied to the gridbag after all of the minimum row * heights have been calculated. * If rowHeights has more elements than the number of - * rows, rowa are added to the gridbag to match + * rows, rows are added to the gridbag to match * the number of elements in rowHeights. * * @serial @@ -533,7 +533,7 @@ java.io.Serializable { * and returns null. * * @param comp the component to be queried - * @return the contraints for the specified component + * @return the constraints for the specified component */ protected GridBagConstraints lookupConstraints(Component comp) { GridBagConstraints constraints = comptable.get(comp); @@ -800,7 +800,7 @@ java.io.Serializable { /** * Lays out the specified container using this grid bag layout. * This method reshapes components in the specified container in - * order to satisfy the contraints of this GridBagLayout + * order to satisfy the constraints of this GridBagLayout * object. *

      * Most applications do not call this method directly. @@ -897,7 +897,7 @@ java.io.Serializable { *

        *
      1. Figure out the dimensions of the layout grid. *
      2. Determine which cells the components occupy. - *
      3. Distribute the weights and min sizes amoung the rows/columns. + *
      4. Distribute the weights and min sizes among the rows/columns. *
      * * This also caches the minsizes for all the children when they are @@ -979,7 +979,7 @@ java.io.Serializable { /** * This method is obsolete and supplied for backwards - * compatability only; new code should call {@link + * compatibility only; new code should call {@link * #getLayoutInfo(java.awt.Container, int) getLayoutInfo} instead. * This method is the same as getLayoutInfo; * refer to getLayoutInfo for details on parameters @@ -1612,7 +1612,7 @@ java.io.Serializable { /** * This method is obsolete and supplied for backwards - * compatability only; new code should call {@link + * compatibility only; new code should call {@link * #adjustForGravity(java.awt.GridBagConstraints, java.awt.Rectangle) * adjustForGravity} instead. * This method is the same as adjustForGravity; @@ -1993,7 +1993,7 @@ java.io.Serializable { /** * This method is obsolete and supplied for backwards - * compatability only; new code should call {@link + * compatibility only; new code should call {@link * #getMinSize(java.awt.Container, GridBagLayoutInfo) getMinSize} instead. * This method is the same as getMinSize; * refer to getMinSize for details on parameters @@ -2033,7 +2033,7 @@ java.io.Serializable { /** * This method is obsolete and supplied for backwards - * compatability only; new code should call {@link + * compatibility only; new code should call {@link * #arrangeGrid(Container) arrangeGrid} instead. * This method is the same as arrangeGrid; * refer to arrangeGrid for details on the @@ -2229,6 +2229,6 @@ java.io.Serializable { } } - // Added for serial backwards compatability (4348425) + // Added for serial backwards compatibility (4348425) static final long serialVersionUID = 8838754796412211005L; } diff --git a/jdk/src/share/classes/java/awt/KeyEventDispatcher.java b/jdk/src/share/classes/java/awt/KeyEventDispatcher.java index 6d2215e2359..9970ac586e3 100644 --- a/jdk/src/share/classes/java/awt/KeyEventDispatcher.java +++ b/jdk/src/share/classes/java/awt/KeyEventDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -51,6 +51,7 @@ import java.awt.event.KeyEvent; * @see KeyboardFocusManager#removeKeyEventDispatcher * @since 1.4 */ +@FunctionalInterface public interface KeyEventDispatcher { /** diff --git a/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java b/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java index 12440aa1f95..5a36b9536b1 100644 --- a/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java +++ b/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -54,6 +54,7 @@ import java.awt.event.KeyEvent; * @see KeyboardFocusManager#removeKeyEventPostProcessor * @since 1.4 */ +@FunctionalInterface public interface KeyEventPostProcessor { /** diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index 8f869fa19c4..0184083ec5c 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -2663,7 +2663,7 @@ public abstract class KeyboardFocusManager * only if we have the last request to dispatch. If the last request * fails, focus will be restored to either the component of the last * previously succedded request, or to to the focus owner that was - * before this clearing proccess. + * before this clearing process. */ if (!iter.hasNext()) { disableRestoreFocus = false; diff --git a/jdk/src/share/classes/java/awt/LinearGradientPaint.java b/jdk/src/share/classes/java/awt/LinearGradientPaint.java index e9fbcfc5d86..f4af6026da2 100644 --- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java +++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java @@ -94,7 +94,8 @@ import java.beans.ConstructorProperties; * of the three cycle methods: *

      *

      - * LinearGradientPaint + * image showing the output of the example code *
      * * @see java.awt.Paint diff --git a/jdk/src/share/classes/java/awt/List.java b/jdk/src/share/classes/java/awt/List.java index dba6ac0bcdf..b3be9aeaf2e 100644 --- a/jdk/src/share/classes/java/awt/List.java +++ b/jdk/src/share/classes/java/awt/List.java @@ -797,7 +797,7 @@ public class List extends Component implements ItemSelectable, Accessible { } /** - * Gets the minumum dimensions for a list with the specified + * Gets the minimum dimensions for a list with the specified * number of rows. * @param rows number of rows in the list * @return the minimum dimensions for displaying this scrolling list @@ -1164,7 +1164,7 @@ public class List extends Component implements ItemSelectable, Accessible { /* * Serialization support. Since the value of the selected - * field isn't neccessarily up to date we sync it up with the + * field isn't necessarily up to date, we sync it up with the * peer before serializing. */ diff --git a/jdk/src/share/classes/java/awt/MediaTracker.java b/jdk/src/share/classes/java/awt/MediaTracker.java index 9b8ba3cfb23..23ec3577274 100644 --- a/jdk/src/share/classes/java/awt/MediaTracker.java +++ b/jdk/src/share/classes/java/awt/MediaTracker.java @@ -744,7 +744,7 @@ public class MediaTracker implements java.io.Serializable { * All instances of Image being tracked * under the specified ID are removed regardless of scale. * @param image the image to be removed - * @param id the tracking ID frrom which to remove the image + * @param id the tracking ID from which to remove the image * @see java.awt.MediaTracker#removeImage(java.awt.Image) * @see java.awt.MediaTracker#removeImage(java.awt.Image, int, int, int) * @since JDK1.1 diff --git a/jdk/src/share/classes/java/awt/MenuComponent.java b/jdk/src/share/classes/java/awt/MenuComponent.java index 4895fdc9548..8718821daaa 100644 --- a/jdk/src/share/classes/java/awt/MenuComponent.java +++ b/jdk/src/share/classes/java/awt/MenuComponent.java @@ -402,7 +402,7 @@ public abstract class MenuComponent implements java.io.Serializable { /** * Gets this component's locking object (the object that owns the thread - * sychronization monitor) for AWT component-tree and layout + * synchronization monitor) for AWT component-tree and layout * operations. * @return this component's locking object */ @@ -686,7 +686,7 @@ public abstract class MenuComponent implements java.io.Serializable { /** * Gets the Cursor of this object. * - * @return the Curso, if supported, of the object; + * @return the Cursor, if supported, of the object; * otherwise, null */ public Cursor getCursor() { diff --git a/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java b/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java index edf6bd8267b..cdff1907d95 100644 --- a/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java +++ b/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java @@ -81,7 +81,7 @@ abstract class MultipleGradientPaintContext implements PaintContext { protected float a00, a01, a10, a11, a02, a12; /** - * This boolean specifies wether we are in simple lookup mode, where an + * This boolean specifies whether we are in simple lookup mode, where an * input value between 0 and 1 may be used to directly index into a single * array of gradient colors. If this boolean value is false, then we have * to use a 2-step process where we have to determine which gradient array diff --git a/jdk/src/share/classes/java/awt/Polygon.java b/jdk/src/share/classes/java/awt/Polygon.java index 08a545b78bc..5e649da6d76 100644 --- a/jdk/src/share/classes/java/awt/Polygon.java +++ b/jdk/src/share/classes/java/awt/Polygon.java @@ -246,7 +246,7 @@ public class Polygon implements Shape, java.io.Serializable { } /* - * Resizes the bounding box to accomodate the specified coordinates. + * Resizes the bounding box to accommodate the specified coordinates. * @param x, y the specified coordinates */ void updateBounds(int x, int y) { diff --git a/jdk/src/share/classes/java/awt/PopupMenu.java b/jdk/src/share/classes/java/awt/PopupMenu.java index 0e700638240..70ece5970ed 100644 --- a/jdk/src/share/classes/java/awt/PopupMenu.java +++ b/jdk/src/share/classes/java/awt/PopupMenu.java @@ -150,7 +150,7 @@ public class PopupMenu extends Menu { * @exception IllegalArgumentException if this PopupMenu * has a non-Component parent * @exception IllegalArgumentException if the origin is not in the - * parent's heirarchy + * parent's hierarchy * @exception RuntimeException if the parent is not showing on screen */ public void show(Component origin, int x, int y) { diff --git a/jdk/src/share/classes/java/awt/RadialGradientPaint.java b/jdk/src/share/classes/java/awt/RadialGradientPaint.java index a0bf944b93c..5fd08734f14 100644 --- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java +++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java @@ -80,14 +80,16 @@ import java.beans.ConstructorProperties; * from the focus point. The following figure shows that the distance AB * is equal to the distance BC, and the distance AD is equal to the distance DE. *
      - * RadialGradientPaint-3 + * image showing the
+ * distance AB=BC, and AD=DE *
      * If the gradient and graphics rendering transforms are uniformly scaled and * the user sets the focus so that it coincides with the center of the circle, * the gradient color proportions are equal for any line drawn from the center. * The following figure shows the distances AB, BC, AD, and DE. They are all equal. *
      - * RadialGradientPaint-4 + * image showing the
+ * distance of AB, BC, AD, and DE are all equal *
      * Note that some minor variations in distances may occur due to sampling at * the granularity of a pixel. @@ -117,7 +119,8 @@ import java.beans.ConstructorProperties; * (centered) focus for each of the three cycle methods: *

      *

      - * RadialGradientPaint-1 + * image showing the
+ * output of the sameple code *
      * *

      @@ -141,7 +144,8 @@ import java.beans.ConstructorProperties; * focus for each of the three cycle methods: *

      *

      - * RadialGradientPaint-2 + * image showing the
+ * output of the sample code *
      * * @see java.awt.Paint diff --git a/jdk/src/share/classes/java/awt/RenderingHints.java b/jdk/src/share/classes/java/awt/RenderingHints.java index 48cf9e11d32..42386797055 100644 --- a/jdk/src/share/classes/java/awt/RenderingHints.java +++ b/jdk/src/share/classes/java/awt/RenderingHints.java @@ -101,7 +101,7 @@ public class RenderingHints // - the integer key of the Key // It is theoretically possible for 2 distinct keys to collide // along all 3 of those attributes in the context of multiple - // class loaders, but that occurence will be extremely rare and + // class loaders, but that occurrence will be extremely rare and // we account for that possibility below in the recordIdentity // method by slightly relaxing our uniqueness guarantees if we // end up in that situation. @@ -729,7 +729,7 @@ public class RenderingHints * from one side of a sample to the other. * As the image is scaled down, more image pixels have their * color samples represented in the resulting output since each - * output pixel recieves color information from up to 4 image + * output pixel receives color information from up to 4 image * pixels. * * @see #KEY_INTERPOLATION diff --git a/jdk/src/share/classes/java/awt/ScrollPane.java b/jdk/src/share/classes/java/awt/ScrollPane.java index a2e2fc7ee0a..626fed6c0b1 100644 --- a/jdk/src/share/classes/java/awt/ScrollPane.java +++ b/jdk/src/share/classes/java/awt/ScrollPane.java @@ -425,8 +425,8 @@ public class ScrollPane extends Container implements Accessible { /** * Determine the size to allocate the child component. - * If the viewport area is bigger than the childs - * preferred size then the child is allocated enough + * If the viewport area is bigger than the preferred size + * of the child then the child is allocated enough * to fill the viewport, otherwise the child is given * it's preferred size. */ diff --git a/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java b/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java index d51a84250c8..be3ad5fec6a 100644 --- a/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java +++ b/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java @@ -336,7 +336,7 @@ public class ScrollPaneAdjustable implements Adjustable, Serializable { * the AdjustementEvent with specified type and value. * * @param v the new value of the scrollbar - * @param type the type of the scrolling operation occured + * @param type the type of the scrolling operation occurred */ private void setTypedValue(int v, int type) { v = Math.max(v, minimum); diff --git a/jdk/src/share/classes/java/awt/Shape.java b/jdk/src/share/classes/java/awt/Shape.java index e478ea7f3d8..8015d4593de 100644 --- a/jdk/src/share/classes/java/awt/Shape.java +++ b/jdk/src/share/classes/java/awt/Shape.java @@ -269,7 +269,7 @@ public interface Shape { * Tests if the interior of the Shape entirely contains * the specified rectangular area. All coordinates that lie inside * the rectangular area must lie within the Shape for the - * entire rectanglar area to be considered contained within the + * entire rectangular area to be considered contained within the * Shape. *

      * The {@code Shape.contains()} method allows a {@code Shape} diff --git a/jdk/src/share/classes/java/awt/TextComponent.java b/jdk/src/share/classes/java/awt/TextComponent.java index 331b20f70cc..4b72de8d638 100644 --- a/jdk/src/share/classes/java/awt/TextComponent.java +++ b/jdk/src/share/classes/java/awt/TextComponent.java @@ -1000,7 +1000,7 @@ public class TextComponent extends Component implements Accessible { * Return 0 if the text is empty, or the caret position * if no selection. * - * @return the index into teh text of the end of the selection >= 0 + * @return the index into the text of the end of the selection >= 0 */ public int getSelectionEnd() { return TextComponent.this.getSelectionEnd(); diff --git a/jdk/src/share/classes/java/awt/TextField.java b/jdk/src/share/classes/java/awt/TextField.java index cfdaf51e213..85eaba2d17b 100644 --- a/jdk/src/share/classes/java/awt/TextField.java +++ b/jdk/src/share/classes/java/awt/TextField.java @@ -405,7 +405,7 @@ public class TextField extends TextComponent { } /** - * Gets the minumum dimensions for a text field with + * Gets the minimum dimensions for a text field with * the specified number of columns. * @param columns the number of columns in * this text field. @@ -430,7 +430,7 @@ public class TextField extends TextComponent { } /** - * Gets the minumum dimensions for this text field. + * Gets the minimum dimensions for this text field. * @return the minimum dimensions for * displaying this text field. * @since JDK1.1 diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index 606df3ed154..dcc1fa15b4e 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -1457,7 +1457,7 @@ public abstract class Toolkit { *

      Note that multi-frame images are invalid and may cause this * method to hang. * - * @param cursor the image to display when the cursor is actived + * @param cursor the image to display when the cursor is activated * @param hotSpot the X and Y of the large cursor's hot spot; the * hotSpot values must be less than the Dimension returned by * getBestCursorSize @@ -1809,8 +1809,7 @@ public abstract class Toolkit { // This property should never be cached if (propertyName.equals("awt.dynamicLayoutSupported")) { - value = lazilyLoadDesktopProperty(propertyName); - return value; + return getDefaultToolkit().lazilyLoadDesktopProperty(propertyName); } value = desktopProperties.get(propertyName); diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 6f66395169b..ceb901a3c4b 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -1656,7 +1656,7 @@ public class Window extends Container implements Accessible { * effect until it is hidden and then shown again. * * @param exclusionType the modal exclusion type for this window; a {@code null} - * value is equivivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE + * value is equivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE * NO_EXCLUDE} * @throws SecurityException if the calling thread does not have permission * to set the modal exclusion property to the window with the given @@ -2079,7 +2079,7 @@ public class Window extends Container implements Accessible { } /** - * Processes window focus event occuring on this window by + * Processes window focus event occurring on this window by * dispatching them to any registered WindowFocusListener objects. * NOTE: this method will not be called unless window focus events * are enabled for this window. This happens when one of the @@ -2114,7 +2114,7 @@ public class Window extends Container implements Accessible { } /** - * Processes window state event occuring on this window by + * Processes window state event occurring on this window by * dispatching them to any registered {@code WindowStateListener} * objects. * NOTE: this method will not be called unless window state events @@ -2191,13 +2191,11 @@ public class Window extends Container implements Accessible { * When the window is later shown, it will be always-on-top. * *

      When this method is called on a window with a value of - * {@code false} the always-on-top state is set to normal. The - * window remains in the top-most position but it`s z-order can be - * changed as for any other window. Calling this method with a value - * of {@code false} on a window that has a normal state has no - * effect. Setting the always-on-top state to false has no effect on - * the relative z-order of the windows if there are no other - * always-on-top windows. + * {@code false} the always-on-top state is set to normal. It may also + * cause an unspecified, platform-dependent change in the z-order of + * top-level windows, but other always-on-top windows will remain in + * top-most position. Calling this method with a value of {@code false} + * on a window that has a normal state has no effect. * *

      Note: some platforms might not support always-on-top * windows. To detect if always-on-top windows are supported by the @@ -2978,11 +2976,11 @@ public class Window extends Container implements Accessible { addToWindowList(); initGC(null); + ownedWindowList = new Vector<>(); } private void deserializeResources(ObjectInputStream s) throws ClassNotFoundException, IOException, HeadlessException { - ownedWindowList = new Vector<>(); if (windowSerializedDataVersion < 2) { // Translate old-style focus tracking to new model. For 1.4 and @@ -3678,7 +3676,7 @@ public class Window extends Container implements Accessible { * and either the {@code UnsupportedOperationException} or {@code * IllegalComponentStateException} will be thrown. *

      - * The tranlucency levels of individual pixels may also be effected by the + * The translucency levels of individual pixels may also be effected by the * alpha component of their color (see {@link Window#setBackground(Color)}) and the * opacity value (see {@link #setOpacity(float)}). See {@link * GraphicsDevice.WindowTranslucency} for more details. @@ -3749,7 +3747,7 @@ public class Window extends Container implements Accessible { *

      * If the windowing system supports the {@link * GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT} - * tranclucency, the alpha component of the given background color + * translucency, the alpha component of the given background color * may effect the mode of operation for this window: it indicates whether * this window must be opaque (alpha equals {@code 1.0f}) or per-pixel translucent * (alpha is less than {@code 1.0f}). If the given background color is diff --git a/jdk/src/share/classes/java/awt/color/package.html b/jdk/src/share/classes/java/awt/color/package.html index 8b82f8e59eb..13ab17419a3 100644 --- a/jdk/src/share/classes/java/awt/color/package.html +++ b/jdk/src/share/classes/java/awt/color/package.html @@ -25,6 +25,7 @@ + Provides classes for color spaces. It contains an diff --git a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java index 86ac95cb172..90789edc97c 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java +++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java @@ -104,7 +104,7 @@ import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION; public class DataFlavor implements Externalizable, Cloneable { private static final long serialVersionUID = 8367026044764648243L; - private static final Class ioInputStreamClass = java.io.InputStream.class; + private static final Class ioInputStreamClass = InputStream.class; /** * Tries to load a class from: the bootstrap loader, the system loader, @@ -151,7 +151,7 @@ public class DataFlavor implements Externalizable, Cloneable { /* * private initializer */ - static private DataFlavor createConstant(Class rc, String prn) { + static private DataFlavor createConstant(Class rc, String prn) { try { return new DataFlavor(rc, prn); } catch (Exception e) { @@ -323,7 +323,7 @@ public class DataFlavor implements Externalizable, Cloneable { * @exception NullPointerException if either primaryType, * subType or representationClass is null */ - private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class representationClass, String humanPresentableName) { + private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class representationClass, String humanPresentableName) { super(); if (primaryType == null) { throw new NullPointerException("primaryType"); @@ -340,7 +340,7 @@ public class DataFlavor implements Externalizable, Cloneable { params.set("class", representationClass.getName()); if (humanPresentableName == null) { - humanPresentableName = (String)params.get("humanPresentableName"); + humanPresentableName = params.get("humanPresentableName"); if (humanPresentableName == null) humanPresentableName = primaryType + "/" + subType; @@ -741,7 +741,7 @@ public class DataFlavor implements Externalizable, Cloneable { return bestFlavor; } - private static Comparator textFlavorComparator; + private static Comparator textFlavorComparator; static class TextFlavorComparator extends DataTransferer.DataFlavorComparator { @@ -1447,6 +1447,6 @@ public class DataFlavor implements Externalizable, Cloneable { /** Java class of objects this DataFlavor represents **/ - private Class representationClass; + private Class representationClass; } // class DataFlavor diff --git a/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java b/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java index e5041073401..6bfbd510fce 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java +++ b/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java @@ -30,7 +30,7 @@ import java.util.Map; /** * A two-way Map between "natives" (Strings), which correspond to platform- - * specfic data formats, and "flavors" (DataFlavors), which corerspond to + * specific data formats, and "flavors" (DataFlavors), which correspond to * platform-independent MIME types. FlavorMaps need not be symmetric, but * typically are. * diff --git a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java index 80947d9ea6f..2ef30747632 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java +++ b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java @@ -33,7 +33,7 @@ import java.util.Set; /** - * An object that encapsualtes the parameter list of a MimeType + * An object that encapsulates the parameter list of a MimeType * as defined in RFC 2045 and 2046. * * @author jeff.dunn@eng.sun.com @@ -44,13 +44,13 @@ class MimeTypeParameterList implements Cloneable { * Default constructor. */ public MimeTypeParameterList() { - parameters = new Hashtable(); + parameters = new Hashtable<>(); } public MimeTypeParameterList(String rawdata) throws MimeTypeParseException { - parameters = new Hashtable(); + parameters = new Hashtable<>(); // now parse rawdata parse(rawdata); @@ -59,10 +59,10 @@ class MimeTypeParameterList implements Cloneable { public int hashCode() { int code = Integer.MAX_VALUE/45; // "random" value for empty lists String paramName = null; - Enumeration enum_ = this.getNames(); + Enumeration enum_ = this.getNames(); while (enum_.hasMoreElements()) { - paramName = (String)enum_.nextElement(); + paramName = enum_.nextElement(); code += paramName.hashCode(); code += this.get(paramName).hashCode(); } @@ -87,14 +87,14 @@ class MimeTypeParameterList implements Cloneable { String name = null; String thisValue = null; String thatValue = null; - Set entries = parameters.entrySet(); - Iterator iterator = entries.iterator(); - Map.Entry entry = null; + Set> entries = parameters.entrySet(); + Iterator> iterator = entries.iterator(); + Map.Entry entry = null; while (iterator.hasNext()) { - entry = (Map.Entry)iterator.next(); - name = (String)entry.getKey(); - thisValue = (String)entry.getValue(); - thatValue = (String)that.parameters.get(name); + entry = iterator.next(); + name = entry.getKey(); + thisValue = entry.getValue(); + thatValue = that.parameters.get(name); if ((thisValue == null) || (thatValue == null)) { // both null -> equal, only one null -> not equal if (thisValue != thatValue) { @@ -250,7 +250,7 @@ class MimeTypeParameterList implements Cloneable { * is no current association. */ public String get(String name) { - return (String)parameters.get(name.trim().toLowerCase()); + return parameters.get(name.trim().toLowerCase()); } /** @@ -271,7 +271,7 @@ class MimeTypeParameterList implements Cloneable { /** * Retrieve an enumeration of all the names in this list. */ - public Enumeration getNames() { + public Enumeration getNames() { return parameters.keys(); } @@ -279,15 +279,15 @@ class MimeTypeParameterList implements Cloneable { // Heuristic: 8 characters per field StringBuilder buffer = new StringBuilder(parameters.size() * 16); - Enumeration keys = parameters.keys(); + Enumeration keys = parameters.keys(); while(keys.hasMoreElements()) { buffer.append("; "); - String key = (String)keys.nextElement(); + String key = keys.nextElement(); buffer.append(key); buffer.append('='); - buffer.append(quote((String)parameters.get(key))); + buffer.append(quote(parameters.get(key))); } return buffer.toString(); @@ -307,7 +307,7 @@ class MimeTypeParameterList implements Cloneable { return newObj; } - private Hashtable parameters; + private Hashtable parameters; // below here be scary parsing related things diff --git a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java index ef154acdc2e..1258881c1e8 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java +++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java @@ -1324,7 +1324,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { List retval = null; for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) { List natives = getFlavorToNative().get(dataFlavor); - if (!natives.isEmpty()) { + if (natives != null && !natives.isEmpty()) { if (retval == null) { retval = new ArrayList<>(); } diff --git a/jdk/src/share/classes/java/awt/datatransfer/package.html b/jdk/src/share/classes/java/awt/datatransfer/package.html index a16e0090889..f33946cac58 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/package.html +++ b/jdk/src/share/classes/java/awt/datatransfer/package.html @@ -25,6 +25,7 @@ + Provides interfaces and classes for transferring data diff --git a/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java b/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java index 76b719bf70b..5da844c80b4 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java @@ -50,8 +50,8 @@ import java.util.EventListener; /** * This method is invoked by the {@code DragGestureRecognizer} * when the {@code DragGestureRecognizer} detects a platform-dependent - * drag initiating gesture. To intiate the drag and drop operation, - * if approtiate, {@link DragGestureEvent#startDrag startDrag()} method on + * drag initiating gesture. To initiate the drag and drop operation, + * if appropriate, {@link DragGestureEvent#startDrag startDrag()} method on * the {@code DragGestureEvent} has to be invoked. *

      * @see java.awt.dnd.DragGestureRecognizer diff --git a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java index 60c1876fddf..331f085a3d3 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java @@ -46,7 +46,7 @@ import java.io.Serializable; *

      * The appropriate DragGestureRecognizer * subclass instance is obtained from the - * {@link DragSource} asssociated with + * {@link DragSource} associated with * a particular Component, or from the Toolkit object via its * {@link java.awt.Toolkit#createDragGestureRecognizer createDragGestureRecognizer()} * method. diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java index 9655689a237..dd2a4150a85 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java @@ -474,7 +474,7 @@ public class DragSourceContext protected synchronized void updateCurrentCursor(int sourceAct, int targetAct, int status) { - // if the cursor has been previously set then dont do any defaults + // if the cursor has been previously set then don't do any defaults // processing. if (useCustomCursor) { diff --git a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java index 62ab7fcb27a..05e29f53a45 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java @@ -38,7 +38,7 @@ import java.util.EventObject; * over, or exits a drop site, when the drop action changes, and when the drag * ends. The location for the generated DragSourceEvent specifies * the mouse cursor location in screen coordinates at the moment this event - * occured. + * occurred. *

      * In a multi-screen environment without a virtual device, the cursor location is * specified in the coordinate system of the initiator @@ -71,7 +71,7 @@ public class DragSourceEvent extends EventObject { /** * The horizontal coordinate for the cursor location at the moment this - * event occured if the cursor location is specified for this event; + * event occurred if the cursor location is specified for this event; * otherwise zero. * * @serial @@ -80,7 +80,7 @@ public class DragSourceEvent extends EventObject { /** * The vertical coordinate for the cursor location at the moment this event - * occured if the cursor location is specified for this event; + * occurred if the cursor location is specified for this event; * otherwise zero. * * @serial @@ -141,7 +141,7 @@ public class DragSourceEvent extends EventObject { /** * This method returns a Point indicating the cursor - * location in screen coordinates at the moment this event occured, or + * location in screen coordinates at the moment this event occurred, or * null if the cursor location is not specified for this * event. * @@ -159,7 +159,7 @@ public class DragSourceEvent extends EventObject { /** * This method returns the horizontal coordinate of the cursor location in - * screen coordinates at the moment this event occured, or zero if the + * screen coordinates at the moment this event occurred, or zero if the * cursor location is not specified for this event. * * @return an integer indicating the horizontal coordinate of the cursor @@ -172,7 +172,7 @@ public class DragSourceEvent extends EventObject { /** * This method returns the vertical coordinate of the cursor location in - * screen coordinates at the moment this event occured, or zero if the + * screen coordinates at the moment this event occurred, or zero if the * cursor location is not specified for this event. * * @return an integer indicating the vertical coordinate of the cursor diff --git a/jdk/src/share/classes/java/awt/dnd/DropTarget.java b/jdk/src/share/classes/java/awt/dnd/DropTarget.java index 4006f728c9b..0480ba5f67e 100644 --- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java +++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java @@ -612,7 +612,7 @@ public class DropTarget implements DropTargetListener, Serializable { dropTargetContext = (DropTargetContext)f.get("dropTargetContext", null); } catch (IllegalArgumentException e) { - // Pre-1.4 support. 'dropTargetContext' was previoulsy transient + // Pre-1.4 support. 'dropTargetContext' was previously transient } if (dropTargetContext == null) { dropTargetContext = createDropTargetContext(); @@ -789,7 +789,7 @@ public class DropTarget implements DropTargetListener, Serializable { } /** - * update autoscrolling with current cursor locn + * update autoscrolling with current cursor location *

      * @param dragCursorLocn the Point */ diff --git a/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java b/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java index 72a81fc75b8..37bf2cb8e1b 100644 --- a/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java +++ b/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java @@ -29,7 +29,7 @@ package java.awt.dnd; * This exception is thrown by various methods in the java.awt.dnd package. * It is usually thrown to indicate that the target in question is unable * to undertake the requested operation that the present time, since the - * undrelying DnD system is not in the appropriate state. + * underlying DnD system is not in the appropriate state. * * @since 1.2 */ diff --git a/jdk/src/share/classes/java/awt/dnd/package.html b/jdk/src/share/classes/java/awt/dnd/package.html index b39c069b0c5..f2df34617bd 100644 --- a/jdk/src/share/classes/java/awt/dnd/package.html +++ b/jdk/src/share/classes/java/awt/dnd/package.html @@ -25,6 +25,7 @@ + Drag and Drop is a direct manipulation gesture found in many Graphical @@ -51,18 +52,18 @@ states (not entirely sequentially): associated with some presentation element (Component) in the GUI, to initiate a Drag and Drop of some potentially Transferable data. -

      +

    • 1 or more DropTarget(s) come into/go out of existence, associated with presentation elements in the GUI (Components), potentially capable of consuming Transferable data types. -

      +

    • A DragGestureRecognizer is obtained from the DragSource and is associated with a Component in order to track and identify any Drag initiating gesture by the user over the Component. -

      +

    • A user makes a Drag gesture over the Component, which the registered DragGestureRecognizer detects, and notifies its @@ -76,13 +77,13 @@ contains the abstract class MouseDragGestureRecognizer for recognizing mouse device gestures. Other abstract subclasses may be provided by the platform to support other input devices or particular Component class semantics. -

      +

    • The DragGestureListener causes the DragSource to initiate the Drag and Drop operation on behalf of the user, perhaps animating the GUI Cursor and/or rendering an Image of the item(s) that are the subject of the operation. -

      +

    • As the user gestures navigate over Component(s) in the GUI with associated DropTarget(s), the DragSource @@ -111,11 +112,11 @@ as follows:
      • By the transfer "operation" selected by the user, and supported by both the DragSource and DropTarget: Copy, Move or Reference(link). -

        +

      • By the intersection of the set of data types provided by the DragSource and the set of data types comprehensible by the DropTarget. -

        +

      • When the user terminates the drag operation, normally resulting in a successful Drop, both the DragSource and DropTarget receive diff --git a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html index 735cfdd97d6..93d185181fe 100644 --- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html +++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html @@ -23,7 +23,11 @@ questions. --> + + + +

        AWT Threading Issues

        @@ -81,13 +85,13 @@ this machinery are as follows: dispatched:
        • Sequentially. -
          That is, it is not permitted that several events from - this queue are dispatched simultaneously. +
          That is, it is not permitted that several events from + this queue are dispatched simultaneously.
        • In the same order as they are enqueued. -
          That is, if AWTEvent A is enqueued +
          That is, if AWTEvent A is enqueued to the EventQueue before AWTEvent B then event B will not be - dispatched before event A. + dispatched before event A.
      • There is at least one alive non-daemon thread while there is at least one displayable AWT or Swing component within the diff --git a/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html b/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html index ff9b144951c..8a3923c0f40 100644 --- a/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html +++ b/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html @@ -23,7 +23,11 @@ questions. --> + + + +

        AWT Desktop Properties

        @@ -51,8 +55,8 @@ unavailable for any reason, the implementation will return

        The following table summarizes the desktop properties documented here, and their value types. -

        -

    • - * The preceeding text describes this graphic (Figure 1). + * The preceding text describes this graphic (Figure 1). * - * The preceeding text describes this graphic (Figure 2). + * The preceding text describes this graphic (Figure 2). *
      Figure 2: Horizontal, Left-to-Right
      @@ -60,17 +64,17 @@ here, and their value types. - - + + + - - + + +
      Property NameSummary Description
      awt.font.desktophints -java.util.MapFont smoothing (text antialiasing) settings.awt.font.desktophintsjava.util.MapFont smoothing (text antialiasing) settings.
      sun.awt.enableExtraMouseButtons -java.lang.BooleanControls if mouse events from extra buttons are to be generated or notsun.awt.enableExtraMouseButtonsjava.lang.BooleanControls if mouse events from extra buttons are to be generated or not
      -

      +

      Desktop Font Rendering Hints

      Desktop Property: "awt.font.desktophints"

      @@ -84,14 +88,14 @@ This is particularly important when creating Swing components which are required to appear consistent with native desktop components or other Swing components. -

      +

      Basic Usage

      The standard desktop property named "awt.font.desktophints" can be used to obtain the rendering hints that best match the desktop settings. The return value is a - Map of + Map of RenderingHints which can be directly applied to a Graphics2D.

      @@ -105,7 +109,7 @@ if (map != null) { }

      Advanced Usage Tips

      -

      +

      Listening for changes

      An application can listen for changes in the property @@ -161,7 +165,7 @@ RenderingHints getRenderingHints(Graphics2D g2d, if (hintsToSave.size() == 0) { return savedHints; } - /* RenderingHints.keySet() returns Set */ + /* RenderingHints.keySet() returns Set<Object> */ for (Object o : hintsToSave.keySet()) { RenderingHints.Key key = (RenderingHints.Key)o; Object value = g2d.getRenderingHint(key); @@ -185,17 +189,17 @@ if (map != null) {

      Details

      • The return value will always be null or a Map -

        +

      • If the return value is null, then no desktop properties are available, and dynamic updates will not be available. This is a typical behaviour if the JDK does not recognise the desktop environment, or it is one which has no such settings. The Headless toolkit is one such example. Therefore it is important to test against null before using the map. -

        +

      • If non-null the value will be a Map of RenderingHints such that every key is an instance of RenderingHints.Key and the value is a legal value for that key. -

        +

      • The map may contain the default value for a hint. This is needed in the event there is a previously a non-default value for the hint set on the Graphics2D. If the map did not contain @@ -204,7 +208,7 @@ the previous hint which may not correspond to the desktop setting.

        An application can use setRenderingHints(Map) to reinitialise all hints, but this would affect unrelated hints too. -

        +

      • A multi-screen desktop may support per-screen device settings in which case the returned value is for the default screen of the desktop. An application may want to use the settings for the screen on diff --git a/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html b/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html index 908afef4f55..910db97b3fc 100644 --- a/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html +++ b/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html @@ -27,7 +27,7 @@ - The AWT Focus Subsystem + The AWT Focus Subsystem @@ -660,16 +660,16 @@ All other applications, including pure AWT applications, will use FocusTraversalPolicy of its own. To do so, one needs to set Container's focus traversal policy provider property to true with the call to -
          +
          Container.setFocusTraversalPolicyProvider(boolean) -
        + To determine whether a Container is a focus traversal policy provider, the following method should be used: -
          +
          Container.isFocusTraversalPolicyProvider() -
        + If focus traversal policy provider property is set on a focus cycle root, it isn't considered a focus traversal policy provider and behaves just like any @@ -750,10 +750,10 @@ traversals. The preferred way to initiate a programmatic traversal is to use one of the following methods on KeyboardFocusManager:
          - KeyboardFocusManager.focusNextComponent() - KeyboardFocusManager.focusPreviousComponent() - KeyboardFocusManager.upFocusCycle() - KeyboardFocusManager.downFocusCycle() +
        • KeyboardFocusManager.focusNextComponent() +
        • KeyboardFocusManager.focusPreviousComponent() +
        • KeyboardFocusManager.upFocusCycle() +
        • KeyboardFocusManager.downFocusCycle()

        @@ -1149,7 +1149,7 @@ Microsoft Windows and Solaris is as follows: Microsoft Windows: The Window is moved to front and becomes the focused Window.
        - Solaris: The Window is moved to front. In a point-to-focus focus + Solaris: The Window is moved to front. In a point-to-focus focus window manager, the Window will be focused if it is now the top-most Window under the cursor. In a click-to-focus window manager, the Window will become the focused Window. diff --git a/jdk/src/share/classes/java/awt/doc-files/Modality.html b/jdk/src/share/classes/java/awt/doc-files/Modality.html index 777d16837ee..f0bf00ca2fa 100644 --- a/jdk/src/share/classes/java/awt/doc-files/Modality.html +++ b/jdk/src/share/classes/java/awt/doc-files/Modality.html @@ -43,7 +43,7 @@ modality features and how to use them. It contains the following sections:

        -

        Definitions

        +

        Definitions

        Document - a window without an owner that, together with all its child hierarchy, may be operated on as a single self-contained document. - Every window belongs to some document — its root can be found as + Every window belongs to some document — its root can be found as the closest ancestor window without an owner.

        @@ -73,7 +73,7 @@


        Warning! Some window managers allow users to change the window - Z-order in an arbitrary way — in that case the last requirement + Z-order in an arbitrary way — in that case the last requirement may not be met.
        @@ -92,12 +92,12 @@


        Note: Everywhere in this document the notion of "window" is equal - to a top-level window in the Java programming language — in other words + to a top-level window in the Java programming language — in other words an instance of java.awt.Window or any descendant class.
        -

        Modality types

        +

        Modality types

        There are four supported modality types : @@ -163,11 +163,11 @@


        -

        Show/hide blocking

        +

        Show/hide blocking

        Showing the window or modeless dialog: "F"
        - All the visible modal dialogs are looked through — if F is from the SB + All the visible modal dialogs are looked through — if F is from the SB of one of them, it becomes blocked by it. If there are several such dialogs, the first shown is used. If no such dialogs exist, F remains unblocked. @@ -185,7 +185,7 @@ dialogs outside M's SB and modal dialogs outside M's SB that do not block M).

      -

      +

      After the modal dialog M is shown, it becomes blocked by the first shown dialog from the first group (if there are any), all the windows from the second one become blocked by M, and all the windows from the third group @@ -197,12 +197,12 @@

      Showing the document-modal dialog: "M"
      All the visible application- and toolkit-modal dialogs are looked - through — if M is from the SB of one of them, + through — if M is from the SB of one of them, it becomes blocked by it. If there are several such dialogs, the first shown is used. If no such dialogs exist, M remains unblocked.

      Showing the application-modal dialog: "M"
      - All the visible toolkit-modal dialogs are looked through — + All the visible toolkit-modal dialogs are looked through — if M is from the SB of one of them, it becomes blocked by it. If there are several such dialogs, the first shown is used. If no such dialogs exist, M remains unblocked. @@ -212,7 +212,7 @@

      - +
      @@ -293,11 +293,10 @@
      Implementation note: Changing the modal exclusion type for a visible window may have no effect until it is hidden and then shown again. - - -

      Related AWT features

      +
      +

      Related AWT features

      Always-On-Top
      @@ -315,16 +314,16 @@

      Minimizing, maximizing and closing blocked windows
      When a modal dialog blocks a window, the user may not be able to maximize or - minimize the blocked window— however, the actual behavior is unspecified + minimize the blocked window— however, the actual behavior is unspecified and platform-dependent. In any case, the user can't close the blocked window - interactively— but it can be closed programmatically by calling the + interactively— but it can be closed programmatically by calling the setVisible(false) or dispose() methods on the blocked window.

      Blocked windows activations
      When the user selects a blocked window, it may be brought to the front, along - with the blocking modal dialog which would then become the active window— + with the blocking modal dialog which would then become the active window— however, the actual behavior is unspecified and platform-dependent.

      @@ -339,9 +338,9 @@ If the modal dialog to be hidden does not have focus, the active window remains unchanged. -

      + -

      Security

      +

      Security

      A special AWTPermission, "toolkitModality", @@ -386,35 +385,35 @@

      Examples

      -
      The Standard Blocking Matrix
      current/shown
      +
      - - - @@ -424,45 +423,45 @@ - - - - diff --git a/jdk/src/share/classes/java/awt/event/ActionEvent.java b/jdk/src/share/classes/java/awt/event/ActionEvent.java index d549db020ca..24a91ac0cd2 100644 --- a/jdk/src/share/classes/java/awt/event/ActionEvent.java +++ b/jdk/src/share/classes/java/awt/event/ActionEvent.java @@ -95,7 +95,7 @@ public class ActionEvent extends AWTEvent { public static final int ACTION_LAST = 1001; /** - * This event id indicates that a meaningful action occured. + * This event id indicates that a meaningful action occurred. */ @Native public static final int ACTION_PERFORMED = ACTION_FIRST; //Event.ACTION_EVENT diff --git a/jdk/src/share/classes/java/awt/event/InvocationEvent.java b/jdk/src/share/classes/java/awt/event/InvocationEvent.java index 1f411e1ac1a..3f04a2316e8 100644 --- a/jdk/src/share/classes/java/awt/event/InvocationEvent.java +++ b/jdk/src/share/classes/java/awt/event/InvocationEvent.java @@ -25,6 +25,8 @@ package java.awt.event; +import sun.awt.AWTAccessor; + import java.awt.ActiveEvent; import java.awt.AWTEvent; @@ -56,6 +58,15 @@ import java.awt.AWTEvent; */ public class InvocationEvent extends AWTEvent implements ActiveEvent { + static { + AWTAccessor.setInvocationEventAccessor(new AWTAccessor.InvocationEventAccessor() { + @Override + public void dispose(InvocationEvent invocationEvent) { + invocationEvent.finishedDispatching(false); + } + }); + } + /** * Marks the first integer id for the range of invocation event ids. */ @@ -78,11 +89,21 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { /** * The (potentially null) Object whose notifyAll() method will be called - * immediately after the Runnable.run() method has returned or thrown an exception. + * immediately after the Runnable.run() method has returned or thrown an exception + * or after the event was disposed. * * @see #isDispatched */ - protected Object notifier; + protected volatile Object notifier; + + /** + * The (potentially null) Runnable whose run() method will be called + * immediately after the event was dispatched or disposed. + * + * @see #isDispatched + * @since 1.8 + */ + private final Runnable listener; /** * Indicates whether the run() method of the runnable @@ -147,7 +168,7 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { * @see #InvocationEvent(Object, Runnable, Object, boolean) */ public InvocationEvent(Object source, Runnable runnable) { - this(source, runnable, null, false); + this(source, INVOCATION_DEFAULT, runnable, null, null, false); } /** @@ -171,7 +192,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { * @param notifier The {@code Object} whose notifyAll * method will be called after * Runnable.run has returned or - * thrown an exception + * thrown an exception or after the event was + * disposed * @param catchThrowables Specifies whether dispatch * should catch Throwable when executing * the Runnable's run @@ -185,7 +207,39 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { */ public InvocationEvent(Object source, Runnable runnable, Object notifier, boolean catchThrowables) { - this(source, INVOCATION_DEFAULT, runnable, notifier, catchThrowables); + this(source, INVOCATION_DEFAULT, runnable, notifier, null, catchThrowables); + } + + /** + * Constructs an InvocationEvent with the specified + * source which will execute the runnable's run + * method when dispatched. If listener is non-null, + * listener.run() will be called immediately after + * run has returned, thrown an exception or the event + * was disposed. + *

      This method throws an IllegalArgumentException + * if source is null. + * + * @param source The Object that originated + * the event + * @param runnable The Runnable whose + * run method will be + * executed + * @param listener The RunnableRunnable whose + * run() method will be called + * after the {@code InvocationEvent} + * was dispatched or disposed + * @param catchThrowables Specifies whether dispatch + * should catch Throwable when executing + * the Runnable's run + * method, or should instead propagate those + * Throwables to the EventDispatchThread's + * dispatch loop + * @throws IllegalArgumentException if source is null + */ + public InvocationEvent(Object source, Runnable runnable, Runnable listener, + boolean catchThrowables) { + this(source, INVOCATION_DEFAULT, runnable, null, listener, catchThrowables); } /** @@ -208,7 +262,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { * @param notifier The Object whose notifyAll * method will be called after * Runnable.run has returned or - * thrown an exception + * thrown an exception or after the event was + * disposed * @param catchThrowables Specifies whether dispatch * should catch Throwable when executing the * Runnable's run @@ -221,13 +276,18 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { */ protected InvocationEvent(Object source, int id, Runnable runnable, Object notifier, boolean catchThrowables) { + this(source, id, runnable, notifier, null, catchThrowables); + } + + private InvocationEvent(Object source, int id, Runnable runnable, + Object notifier, Runnable listener, boolean catchThrowables) { super(source, id); this.runnable = runnable; this.notifier = notifier; + this.listener = listener; this.catchExceptions = catchThrowables; this.when = System.currentTimeMillis(); } - /** * Executes the Runnable's run() method and notifies the * notifier (if any) when run() has returned or thrown an exception. @@ -251,13 +311,7 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { runnable.run(); } } finally { - dispatched = true; - - if (notifier != null) { - synchronized (notifier) { - notifier.notifyAll(); - } - } + finishedDispatching(true); } } @@ -330,6 +384,25 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { return dispatched; } + /** + * Called when the event was dispatched or disposed + * @param dispatched true if the event was dispatched + * false if the event was disposed + */ + private void finishedDispatching(boolean dispatched) { + this.dispatched = dispatched; + + if (notifier != null) { + synchronized (notifier) { + notifier.notifyAll(); + } + } + + if (listener != null) { + listener.run(); + } + } + /** * Returns a parameter string identifying this event. * This method is useful for event-logging and for debugging. diff --git a/jdk/src/share/classes/java/awt/event/KeyEvent.java b/jdk/src/share/classes/java/awt/event/KeyEvent.java index 5f88e3a9165..682c226fa3d 100644 --- a/jdk/src/share/classes/java/awt/event/KeyEvent.java +++ b/jdk/src/share/classes/java/awt/event/KeyEvent.java @@ -133,7 +133,7 @@ import sun.awt.AWTAccessor; * WARNING: Aside from those keys that are defined by the Java language * (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of the VK_ * constants. Sun reserves the right to change these values as needed - * to accomodate a wider range of keyboards in the future. + * to accommodate a wider range of keyboards in the future. *

      * An unspecified behavior will be caused if the {@code id} parameter * of any particular {@code KeyEvent} instance is not diff --git a/jdk/src/share/classes/java/awt/event/WindowEvent.java b/jdk/src/share/classes/java/awt/event/WindowEvent.java index ef5082937f2..6750805a9fa 100644 --- a/jdk/src/share/classes/java/awt/event/WindowEvent.java +++ b/jdk/src/share/classes/java/awt/event/WindowEvent.java @@ -79,8 +79,10 @@ public class WindowEvent extends ComponentEvent { @Native public static final int WINDOW_CLOSING = 1 + WINDOW_FIRST; //Event.WINDOW_DESTROY /** - * The window closed event. This event is delivered after - * the window has been closed as the result of a call to dispose. + * The window closed event. This event is delivered after the displayable + * window has been closed as the result of a call to dispose. + * @see java.awt.Component#isDisplayable + * @see Window#dispose */ @Native public static final int WINDOW_CLOSED = 2 + WINDOW_FIRST; diff --git a/jdk/src/share/classes/java/awt/event/package.html b/jdk/src/share/classes/java/awt/event/package.html index edf84c11476..eec07cacd6c 100644 --- a/jdk/src/share/classes/java/awt/event/package.html +++ b/jdk/src/share/classes/java/awt/event/package.html @@ -25,6 +25,7 @@ + Provides interfaces and classes for dealing with different diff --git a/jdk/src/share/classes/java/awt/font/FontRenderContext.java b/jdk/src/share/classes/java/awt/font/FontRenderContext.java index 8ad710607cc..f9f5f1eec79 100644 --- a/jdk/src/share/classes/java/awt/font/FontRenderContext.java +++ b/jdk/src/share/classes/java/awt/font/FontRenderContext.java @@ -126,7 +126,7 @@ public class FontRenderContext { * anti-aliasing or fractional metrics. * @param tx the transform which is used to scale typographical points * to pixels in this FontRenderContext. If null, an - * identity tranform is used. + * identity transform is used. * @param aaHint - one of the text antialiasing rendering hint values * defined in {@link java.awt.RenderingHints java.awt.RenderingHints}. * Any other value will throw IllegalArgumentException. diff --git a/jdk/src/share/classes/java/awt/font/GlyphMetrics.java b/jdk/src/share/classes/java/awt/font/GlyphMetrics.java index 267debc77c4..74f2b0a69aa 100644 --- a/jdk/src/share/classes/java/awt/font/GlyphMetrics.java +++ b/jdk/src/share/classes/java/awt/font/GlyphMetrics.java @@ -43,7 +43,7 @@ package java.awt.font; import java.awt.geom.Rectangle2D; /** - * The GlyphMetrics class represents infomation for a + * The GlyphMetrics class represents information for a * single glyph. A glyph is the visual representation of one or more * characters. Many different glyphs can be used to represent a single * character or combination of characters. GlyphMetrics @@ -143,24 +143,24 @@ public final class GlyphMetrics { * as a ligature, for example 'fi' or 'ffi'. It is followed by * filler glyphs for the remaining characters. Filler and combining * glyphs can be intermixed to control positioning of accent marks - * on the logically preceeding ligature. + * on the logically preceding ligature. */ public static final byte LIGATURE = 1; /** * Indicates a glyph that represents a combining character, * such as an umlaut. There is no caret position between this glyph - * and the preceeding glyph. + * and the preceding glyph. */ public static final byte COMBINING = 2; /** * Indicates a glyph with no corresponding character in the * backing store. The glyph is associated with the character - * represented by the logicaly preceeding non-component glyph. This + * represented by the logically preceding non-component glyph. This * is used for kashida justification or other visual modifications to * existing glyphs. There is no caret position between this glyph - * and the preceeding glyph. + * and the preceding glyph. */ public static final byte COMPONENT = 3; diff --git a/jdk/src/share/classes/java/awt/font/GlyphVector.java b/jdk/src/share/classes/java/awt/font/GlyphVector.java index 264a06f07ab..23ce1a9bdf0 100644 --- a/jdk/src/share/classes/java/awt/font/GlyphVector.java +++ b/jdk/src/share/classes/java/awt/font/GlyphVector.java @@ -395,7 +395,7 @@ public abstract class GlyphVector implements Cloneable { * indicates that no special transform is applied for the specified * glyph. * This method can be used to rotate, mirror, translate and scale the - * glyph. Adding a transform can result in signifant performance changes. + * glyph. Adding a transform can result in significant performance changes. * @param glyphIndex the index into this GlyphVector * @param newTX the new transform of the glyph at glyphIndex * @throws IndexOutOfBoundsException if glyphIndex diff --git a/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java b/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java index 2e2be83e58c..0688ab41969 100644 --- a/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java +++ b/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java @@ -112,7 +112,7 @@ import java.awt.font.FontRenderContext; * Examples:

      * Rendering a paragraph in a component *

      - *
      + * 
      {@code
        * public void paint(Graphics graphics) {
        *
        *     Point2D pen = new Point2D(10, 20);
      @@ -137,13 +137,13 @@ import java.awt.font.FontRenderContext;
        *         pen.y += layout.getDescent() + layout.getLeading();
        *     }
        * }
      - * 
      + * }
      *
      *

      * Rendering text with tabs. For simplicity, the overall text * direction is assumed to be left-to-right *

      - *
      + * 
      {@code
        * public void paint(Graphics graphics) {
        *
        *     float leftMargin = 10, rightMargin = 310;
      @@ -240,7 +240,7 @@ import java.awt.font.FontRenderContext;
        *         verticalPos += maxDescent;
        *     }
        * }
      - * 
      + * }
      *
      * @see TextLayout */ diff --git a/jdk/src/share/classes/java/awt/font/MultipleMaster.java b/jdk/src/share/classes/java/awt/font/MultipleMaster.java index 757ca01db23..8c672647939 100644 --- a/jdk/src/share/classes/java/awt/font/MultipleMaster.java +++ b/jdk/src/share/classes/java/awt/font/MultipleMaster.java @@ -41,7 +41,7 @@ public interface MultipleMaster { public int getNumDesignAxes(); /** - * Returns an array of design limits interleaved in the form [from->to] + * Returns an array of design limits interleaved in the form [from→to] * for each axis. For example, * design limits for weight could be from 0.1 to 1.0. The values are * returned in the same order returned by diff --git a/jdk/src/share/classes/java/awt/font/NumericShaper.java b/jdk/src/share/classes/java/awt/font/NumericShaper.java index 7685e65f918..0de80e91f39 100644 --- a/jdk/src/share/classes/java/awt/font/NumericShaper.java +++ b/jdk/src/share/classes/java/awt/font/NumericShaper.java @@ -1212,7 +1212,7 @@ public final class NumericShaper implements java.io.Serializable { * For example, to check if a shaper shapes to Arabic, you would use the * following: *
      - * if ((shaper.getRanges() & shaper.ARABIC) != 0) { ... + * if ((shaper.getRanges() & shaper.ARABIC) != 0) { ... *
      * *

      Note that this method supports only the bit mask-based diff --git a/jdk/src/share/classes/java/awt/font/OpenType.java b/jdk/src/share/classes/java/awt/font/OpenType.java index a5bcdce3dc3..559cb03f939 100644 --- a/jdk/src/share/classes/java/awt/font/OpenType.java +++ b/jdk/src/share/classes/java/awt/font/OpenType.java @@ -33,7 +33,7 @@ package java.awt.font; *

      * For more information on TrueType and OpenType fonts, see the * OpenType specification. - * ( http://www.microsoft.com/typography/otspec/l ). + * ( http://www.microsoft.com/typography/otspec/ ). */ public interface OpenType { @@ -268,7 +268,7 @@ public interface OpenType { public final static int TAG_ACNT = 0x61636e74; /** - * Axis variaiton. Table tag "avar" in the Open + * Axis variation. Table tag "avar" in the Open * Type Specification. */ public final static int TAG_AVAR = 0x61766172; diff --git a/jdk/src/share/classes/java/awt/font/TextLayout.java b/jdk/src/share/classes/java/awt/font/TextLayout.java index c09afd7e653..34e9f88e41f 100644 --- a/jdk/src/share/classes/java/awt/font/TextLayout.java +++ b/jdk/src/share/classes/java/awt/font/TextLayout.java @@ -223,7 +223,7 @@ import sun.text.CodePointIterator; * baseline-relative coordinates map the 'x' coordinate to the * distance along the baseline, (positive x is forward along the * baseline), and the 'y' coordinate to a distance along the - * perpendicular to the baseline at 'x' (postitive y is 90 degrees + * perpendicular to the baseline at 'x' (positive y is 90 degrees * clockwise from the baseline vector). Values in standard * coordinates are measured along the x and y axes, with 0,0 at the * origin of the TextLayout. Documentation for each relevant API @@ -337,7 +337,7 @@ public final class TextLayout implements Cloneable { TextHitInfo hit2, TextLayout layout) { - // default implmentation just calls private method on layout + // default implementation just calls private method on layout return layout.getStrongHit(hit1, hit2); } } @@ -912,7 +912,7 @@ public final class TextLayout implements Cloneable { * The ascent is the distance from the top (right) of the * TextLayout to the baseline. It is always either * positive or zero. The ascent is sufficient to - * accomodate superscripted text and is the maximum of the sum of the + * accommodate superscripted text and is the maximum of the sum of the * ascent, offset, and baseline of each glyph. The ascent is * the maximum ascent from the baseline of all the text in the * TextLayout. It is in baseline-relative coordinates. @@ -927,7 +927,7 @@ public final class TextLayout implements Cloneable { * Returns the descent of this TextLayout. * The descent is the distance from the baseline to the bottom (left) of * the TextLayout. It is always either positive or zero. - * The descent is sufficient to accomodate subscripted text and is the + * The descent is sufficient to accommodate subscripted text and is the * maximum of the sum of the descent, offset, and baseline of each glyph. * This is the maximum descent from the baseline of all the text in * the TextLayout. It is in baseline-relative coordinates. diff --git a/jdk/src/share/classes/java/awt/font/TransformAttribute.java b/jdk/src/share/classes/java/awt/font/TransformAttribute.java index 6156b4df7f3..e282c715cef 100644 --- a/jdk/src/share/classes/java/awt/font/TransformAttribute.java +++ b/jdk/src/share/classes/java/awt/font/TransformAttribute.java @@ -120,7 +120,7 @@ public final class TransformAttribute implements Serializable { return this; } - // Added for serial backwards compatability (4348425) + // Added for serial backwards compatibility (4348425) static final long serialVersionUID = 3356247357827709530L; /** diff --git a/jdk/src/share/classes/java/awt/font/package.html b/jdk/src/share/classes/java/awt/font/package.html index ec5d783e708..d4d0a0a998d 100644 --- a/jdk/src/share/classes/java/awt/font/package.html +++ b/jdk/src/share/classes/java/awt/font/package.html @@ -25,6 +25,7 @@ + Provides classes and interface relating to fonts. It diff --git a/jdk/src/share/classes/java/awt/geom/AffineTransform.java b/jdk/src/share/classes/java/awt/geom/AffineTransform.java index 0977cf8eaa4..d3c27ffa87e 100644 --- a/jdk/src/share/classes/java/awt/geom/AffineTransform.java +++ b/jdk/src/share/classes/java/awt/geom/AffineTransform.java @@ -47,7 +47,7 @@ import java.beans.ConstructorProperties; * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ] * *

      - *

      Handling 90-Degree Rotations

      + *

      Handling 90-Degree Rotations

      *

      * In some variations of the rotate methods in the * AffineTransform class, a double-precision argument @@ -525,7 +525,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { /** * Constructs a new AffineTransform from an array of * floating point values representing either the 4 non-translation - * enries or the 6 specifiable entries of the 3x3 transformation + * entries or the 6 specifiable entries of the 3x3 transformation * matrix. The values are retrieved from the array as * { m00 m10 m01 m11 [m02 m12]}. * @param flatmatrix the float array containing the values to be set @@ -715,7 +715,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { /** * Returns a transform that rotates coordinates around an anchor - * point accordinate to a rotation vector. + * point according to a rotation vector. * All coordinates rotate about the specified anchor coordinates * by the same amount. * The amount of rotation is such that coordinates along the former @@ -845,7 +845,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { * this transform. * The return value is either one of the constants TYPE_IDENTITY * or TYPE_GENERAL_TRANSFORM, or a combination of the - * appriopriate flag bits. + * appropriate flag bits. * A valid combination of flag bits is an exclusive OR operation * that can combine * the TYPE_TRANSLATION flag bit @@ -2876,7 +2876,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable { * @param ptDst the specified Point2D that stores the * result of transforming ptSrc * @return the ptDst after transforming - * ptSrc and stroring the result in ptDst. + * ptSrc and storing the result in ptDst. * @since 1.2 */ public Point2D transform(Point2D ptSrc, Point2D ptDst) { diff --git a/jdk/src/share/classes/java/awt/geom/Line2D.java b/jdk/src/share/classes/java/awt/geom/Line2D.java index a34e7941479..7d49d27e29b 100644 --- a/jdk/src/share/classes/java/awt/geom/Line2D.java +++ b/jdk/src/share/classes/java/awt/geom/Line2D.java @@ -477,7 +477,7 @@ public abstract class Line2D implements Shape, Cloneable { * direction is clockwise. *

      A return value of 0 indicates that the point lies * exactly on the line segment. Note that an indicator value - * of 0 is rare and not useful for determining colinearity + * of 0 is rare and not useful for determining collinearity * because of floating point rounding issues. *

      If the point is colinear with the line segment, but * not between the end points, then the value will be -1 if the point diff --git a/jdk/src/share/classes/java/awt/geom/Path2D.java b/jdk/src/share/classes/java/awt/geom/Path2D.java index 3aae874310c..acf781ad775 100644 --- a/jdk/src/share/classes/java/awt/geom/Path2D.java +++ b/jdk/src/share/classes/java/awt/geom/Path2D.java @@ -2064,7 +2064,7 @@ public abstract class Path2D implements Shape, Cloneable { * @param w the width of the specified rectangular area * @param h the height of the specified rectangular area * @return {@code true} if the specified {@code PathIterator} contains - * the specified rectangluar area; {@code false} otherwise. + * the specified rectangular area; {@code false} otherwise. * @since 1.6 */ public static boolean contains(PathIterator pi, diff --git a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java index 4df791e40b2..a2c41d91fae 100644 --- a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java +++ b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java @@ -511,7 +511,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable { /** * Returns the X coordinate of the end point in * double precision. - * @return the x coordiante of the end point. + * @return the x coordinate of the end point. * @since 1.2 */ public abstract double getX2(); diff --git a/jdk/src/share/classes/java/awt/geom/package.html b/jdk/src/share/classes/java/awt/geom/package.html index e0ff8681e04..4b18dee4c5f 100644 --- a/jdk/src/share/classes/java/awt/geom/package.html +++ b/jdk/src/share/classes/java/awt/geom/package.html @@ -25,6 +25,7 @@ + Provides the Java 2D classes for defining and performing operations diff --git a/jdk/src/share/classes/java/awt/im/InputContext.java b/jdk/src/share/classes/java/awt/im/InputContext.java index e2223fcbc50..615029120dd 100644 --- a/jdk/src/share/classes/java/awt/im/InputContext.java +++ b/jdk/src/share/classes/java/awt/im/InputContext.java @@ -98,7 +98,6 @@ public class InputContext { * an input method or keyboard layout has been successfully selected. The * following steps are taken until an input method has been selected: * - *

      *

        *
      • * If the currently selected input method or keyboard layout supports the diff --git a/jdk/src/share/classes/java/awt/im/InputMethodRequests.java b/jdk/src/share/classes/java/awt/im/InputMethodRequests.java index 080d25140db..414eaaad48f 100644 --- a/jdk/src/share/classes/java/awt/im/InputMethodRequests.java +++ b/jdk/src/share/classes/java/awt/im/InputMethodRequests.java @@ -83,7 +83,7 @@ public interface InputMethodRequests { * For example, for horizontal left-to-right text (such as English), the * location to the left of the left-most character on the last line * containing selected text is returned. For vertical top-to-bottom text, - * with lines proceding from right to left, the location to the top of the + * with lines proceeding from right to left, the location to the top of the * left-most line containing selected text is returned. * *

        diff --git a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java index c1a620c7d8f..ac97f06dcd0 100644 --- a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java @@ -39,7 +39,7 @@ package java.awt.image; * This class represents image data which is stored in a band interleaved * fashion and for * which each sample of a pixel occupies one data element of the DataBuffer. - * It subclasses ComponentSampleModel but provides a more efficent + * It subclasses ComponentSampleModel but provides a more efficient * implementation for accessing band interleaved image data than is provided * by ComponentSampleModel. This class should typically be used when working * with images which store sample data for each band in a different bank of the diff --git a/jdk/src/share/classes/java/awt/image/BufferStrategy.java b/jdk/src/share/classes/java/awt/image/BufferStrategy.java index de7877330b9..7a4f793b791 100644 --- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java +++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java @@ -34,7 +34,7 @@ import java.awt.Image; * to organize complex memory on a particular Canvas or * Window. Hardware and software limitations determine whether and * how a particular buffer strategy can be implemented. These limitations - * are detectible through the capabilities of the + * are detectable through the capabilities of the * GraphicsConfiguration used when creating the * Canvas or Window. *

        diff --git a/jdk/src/share/classes/java/awt/image/BufferedImage.java b/jdk/src/share/classes/java/awt/image/BufferedImage.java index b4222b1e740..811c209a983 100644 --- a/jdk/src/share/classes/java/awt/image/BufferedImage.java +++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java @@ -1336,7 +1336,7 @@ public class BufferedImage extends java.awt.Image /** * Returns the minimum tile index in the y direction. * This is always zero. - * @return the mininum tile index in the y direction. + * @return the minimum tile index in the y direction. */ public int getMinTileY() { return 0; diff --git a/jdk/src/share/classes/java/awt/image/ComponentColorModel.java b/jdk/src/share/classes/java/awt/image/ComponentColorModel.java index ec0bce587f0..28e41a2bc27 100644 --- a/jdk/src/share/classes/java/awt/image/ComponentColorModel.java +++ b/jdk/src/share/classes/java/awt/image/ComponentColorModel.java @@ -2318,7 +2318,7 @@ public class ComponentColorModel extends ColorModel { * and is not large enough to hold all the color and alpha components * (starting at normOffset). *

        - * This method must be overrridden by a subclass if that subclass + * This method must be overridden by a subclass if that subclass * is designed to translate pixel sample values to color component values * in a non-default way. The default translations implemented by this * class is described in the class comments. Any subclass implementing diff --git a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java index d5f86f35287..2a9def53a96 100644 --- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java @@ -167,6 +167,7 @@ public class ComponentSampleModel extends SampleModel for (int i=0; i (Integer.MAX_VALUE - 1)) { + throw new IllegalArgumentException("Invalid band offset"); + } + + if (pixelStride < 0 || pixelStride > (Integer.MAX_VALUE / width)) { + throw new IllegalArgumentException("Invalid pixel stride"); + } + + if (scanlineStride < 0 || scanlineStride > (Integer.MAX_VALUE / height)) { + throw new IllegalArgumentException("Invalid scanline stride"); + } + + int size = maxBandOff + 1; + + int val = pixelStride * (width - 1); + + if (val > (Integer.MAX_VALUE - size)) { + throw new IllegalArgumentException("Invalid pixel stride"); + } + + size += val; + + val = scanlineStride * (height - 1); + + if (val > (Integer.MAX_VALUE - size)) { + throw new IllegalArgumentException("Invalid scan stride"); + } + + size += val; - long size = 0; - if (maxBandOff >= 0) - size += maxBandOff+1; - if (pixelStride > 0) - size += pixelStride * (width-1); - if (scanlineStride > 0) - size += scanlineStride*(height-1); return size; } @@ -409,7 +439,7 @@ public class ComponentSampleModel extends SampleModel public DataBuffer createDataBuffer() { DataBuffer dataBuffer = null; - int size = (int)getBufferSize(); + int size = getBufferSize(); switch (dataType) { case DataBuffer.TYPE_BYTE: dataBuffer = new DataBufferByte(size, numBanks); @@ -584,7 +614,7 @@ public class ComponentSampleModel extends SampleModel * * @throws NullPointerException if data is null. * @throws ArrayIndexOutOfBoundsException if the coordinates are - * not in bounds, or if obj is too small to hold the ouput. + * not in bounds, or if obj is too small to hold the output. */ public Object getDataElements(int x, int y, Object obj, DataBuffer data) { if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) { diff --git a/jdk/src/share/classes/java/awt/image/ImageConsumer.java b/jdk/src/share/classes/java/awt/image/ImageConsumer.java index da2231008d3..5298c9d58f8 100644 --- a/jdk/src/share/classes/java/awt/image/ImageConsumer.java +++ b/jdk/src/share/classes/java/awt/image/ImageConsumer.java @@ -191,7 +191,7 @@ public interface ImageConsumer { * finished delivering all of the pixels that the source image * contains, or when a single frame of a multi-frame animation has * been completed, or when an error in loading or producing the - * image has occured. The ImageConsumer should remove itself from the + * image has occurred. The ImageConsumer should remove itself from the * list of consumers registered with the ImageProducer at this time, * unless it is interested in successive frames. * @param status the status of image loading diff --git a/jdk/src/share/classes/java/awt/image/IndexColorModel.java b/jdk/src/share/classes/java/awt/image/IndexColorModel.java index d26e3d381be..7e4317cd3ab 100644 --- a/jdk/src/share/classes/java/awt/image/IndexColorModel.java +++ b/jdk/src/share/classes/java/awt/image/IndexColorModel.java @@ -1152,7 +1152,7 @@ public class IndexColorModel extends ColorModel { * @throws ClassCastException if pixel is not a * primitive array of type transferType * @throws UnsupportedOperationException if transferType - * is not one of the supported transer types + * is not one of the supported transfer types * @see ColorModel#hasAlpha * @see ColorModel#getNumComponents */ @@ -1271,7 +1271,7 @@ public class IndexColorModel extends ColorModel { * array is not large enough to hold all of the color and alpha * components starting at offset * @throws UnsupportedOperationException if transferType - * is not one of the supported transer types + * is not one of the supported transfer types * @see WritableRaster#setDataElements * @see SampleModel#setDataElements */ diff --git a/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java b/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java index 1c5475d09bc..8cc3c179146 100644 --- a/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java @@ -29,7 +29,7 @@ package java.awt.image; * This class represents image data which is stored in a pixel interleaved * fashion and for * which each sample of a pixel occupies one data element of the DataBuffer. - * It subclasses ComponentSampleModel but provides a more efficent + * It subclasses ComponentSampleModel but provides a more efficient * implementation for accessing pixel interleaved image data than is provided * by ComponentSampleModel. This class * stores sample data for all bands in a single bank of the diff --git a/jdk/src/share/classes/java/awt/image/package.html b/jdk/src/share/classes/java/awt/image/package.html index 9ef6e7f419b..c2f4c69d5c5 100644 --- a/jdk/src/share/classes/java/awt/image/package.html +++ b/jdk/src/share/classes/java/awt/image/package.html @@ -25,6 +25,7 @@ + Provides classes for creating and modifying images. diff --git a/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java b/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java index 3fec6d62977..8b0b3de368d 100644 --- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java +++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java @@ -65,7 +65,7 @@ public interface RenderableImage { * String constant that can be used to identify a property on * a RenderedImage obtained via the createRendering or * createScaledRendering methods. If such a property exists, - * the value of the propoery will be a RenderingHints object + * the value of the property will be a RenderingHints object * specifying which hints were observed in creating the rendering. */ static final String HINTS_OBSERVED = "HINTS_OBSERVED"; @@ -162,7 +162,7 @@ public interface RenderableImage { * * @param w the width of rendered image in pixels, or 0. * @param h the height of rendered image in pixels, or 0. - * @param hints a RenderingHints object containg hints. + * @param hints a RenderingHints object containing hints. * @return a RenderedImage containing the rendered data. */ RenderedImage createScaledRendering(int w, int h, RenderingHints hints); diff --git a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java index f2247a309b7..92b3b96fc45 100644 --- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java +++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java @@ -236,7 +236,7 @@ public class RenderableImageOp implements RenderableImage { * * @param w the width of rendered image in pixels, or 0. * @param h the height of rendered image in pixels, or 0. - * @param hints a RenderingHints object containg hints. + * @param hints a RenderingHints object containing hints. * @return a RenderedImage containing the rendered data. */ public RenderedImage createScaledRendering(int w, int h, diff --git a/jdk/src/share/classes/java/awt/image/renderable/package.html b/jdk/src/share/classes/java/awt/image/renderable/package.html index 3bcff3c39ab..58a9694269f 100644 --- a/jdk/src/share/classes/java/awt/image/renderable/package.html +++ b/jdk/src/share/classes/java/awt/image/renderable/package.html @@ -25,6 +25,7 @@ + Provides classes and interfaces for producing diff --git a/jdk/src/share/classes/java/awt/package.html b/jdk/src/share/classes/java/awt/package.html index 184ca072c9a..1b6527e45b6 100644 --- a/jdk/src/share/classes/java/awt/package.html +++ b/jdk/src/share/classes/java/awt/package.html @@ -25,6 +25,7 @@ + Contains all of the classes for creating user @@ -53,7 +54,7 @@ If the bounds of a Component object exceed a platform limit, there is no way to properly arrange them within a Container object. The object's bounds are defined by any object's coordinate in combination with its size on a respective axis. -

        +

        Additional Specification

          diff --git a/jdk/src/share/classes/java/awt/print/package.html b/jdk/src/share/classes/java/awt/print/package.html index ddbecd2ee54..c04f6f9e33b 100644 --- a/jdk/src/share/classes/java/awt/print/package.html +++ b/jdk/src/share/classes/java/awt/print/package.html @@ -25,6 +25,7 @@ + Provides classes and interfaces for a general printing API. The diff --git a/jdk/src/share/classes/java/beans/AppletInitializer.java b/jdk/src/share/classes/java/beans/AppletInitializer.java index 2c271a236ca..c28f67434fd 100644 --- a/jdk/src/share/classes/java/beans/AppletInitializer.java +++ b/jdk/src/share/classes/java/beans/AppletInitializer.java @@ -32,7 +32,7 @@ import java.beans.beancontext.BeanContext; /** *

          * This interface is designed to work in collusion with java.beans.Beans.instantiate. - * The interafce is intended to provide mechanism to allow the proper + * The interface is intended to provide mechanism to allow the proper * initialization of JavaBeans that are also Applets, during their * instantiation by java.beans.Beans.instantiate(). *

          diff --git a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java index d4ec31a29e1..76ceaa65b22 100644 --- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java +++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java @@ -273,7 +273,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { TableModelListener (the JTable itself in this case) to the supplied table model. - We do not need to explictly add these listeners to the model in an + We do not need to explicitly add these listeners to the model in an archive as they will be added automatically by, in the above case, the JTable's "setModel" method. In some cases, we must specifically avoid trying to do this since the listener may be an inner class diff --git a/jdk/src/share/classes/java/beans/EventHandler.java b/jdk/src/share/classes/java/beans/EventHandler.java index 935f7359e26..470991e11bd 100644 --- a/jdk/src/share/classes/java/beans/EventHandler.java +++ b/jdk/src/share/classes/java/beans/EventHandler.java @@ -611,7 +611,7 @@ public class EventHandler implements InvocationHandler { * the empty string. * The format of the eventPropertyName string is a sequence of * methods or properties where each method or - * property is applied to the value returned by the preceeding method + * property is applied to the value returned by the preceding method * starting from the incoming event object. * The syntax is: propertyName{.propertyName}* * where propertyName matches a method or diff --git a/jdk/src/share/classes/java/beans/MethodDescriptor.java b/jdk/src/share/classes/java/beans/MethodDescriptor.java index f8cd73d3897..f7f527c7d42 100644 --- a/jdk/src/share/classes/java/beans/MethodDescriptor.java +++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java @@ -76,7 +76,7 @@ public class MethodDescriptor extends FeatureDescriptor { } /** - * Gets the method that this MethodDescriptor encapsualtes. + * Gets the method that this MethodDescriptor encapsulates. * * @return The low-level description of the method */ diff --git a/jdk/src/share/classes/java/beans/PropertyDescriptor.java b/jdk/src/share/classes/java/beans/PropertyDescriptor.java index aed5ec57a4d..07149f9752d 100644 --- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java +++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java @@ -335,7 +335,7 @@ public class PropertyDescriptor extends FeatureDescriptor { */ void setClass0(Class clz) { if (getClass0() != null && clz.isAssignableFrom(getClass0())) { - // dont replace a subclass with a superclass + // don't replace a subclass with a superclass return; } super.setClass0(clz); diff --git a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java index 246eca0ad61..ece9378aa0f 100644 --- a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java +++ b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java @@ -30,7 +30,7 @@ import java.beans.*; /** * This is a support class to help build property editors. *

          - * It can be used either as a base class or as a delagatee. + * It can be used either as a base class or as a delegate. */ public class PropertyEditorSupport implements PropertyEditor { diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java index b2b855867b5..897e5a8a4da 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java @@ -302,7 +302,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer /** * This method may be overridden by subclasses to provide their own - * initialization behaviors. When invoked any resources requried by the + * initialization behaviors. When invoked any resources required by the * BeanContextChild should be obtained from the current BeanContext. */ @@ -317,7 +317,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer private void writeObject(ObjectOutputStream oos) throws IOException { /* - * dont serialize if we are delegated and the delegator isnt also + * don't serialize if we are delegated and the delegator is not also * serializable. */ diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java index ecf4017c657..fe976f21dd1 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java @@ -38,7 +38,7 @@ public interface BeanContextServiceRevokedListener extends EventListener { /** * The service named has been revoked. getService requests for - * this service will no longer be satisifed. + * this service will no longer be satisfied. * @param bcsre the BeanContextServiceRevokedEvent received * by this listener. */ diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java index ca0942efef9..41cfa9d7a89 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java @@ -620,7 +620,7 @@ public class BeanContextServicesSupport extends BeanContextSupport /** * subclasses can override this method to create new subclasses of - * BCSSServiceProvider without having to overrride addService() in + * BCSSServiceProvider without having to override addService() in * order to instantiate. * @param sc the class * @param bcsp the service provider diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java index a549e2dc317..43dfcb02c97 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java @@ -183,7 +183,7 @@ public class BeanContextSupport extends BeanContextChildSupport * into a BeanContext. *

          *

          - * The semantics of the beanName parameter are defined by java.beans.Beans.instantate. + * The semantics of the beanName parameter are defined by java.beans.Beans.instantiate. *

          * * @param beanName the name of the Bean to instantiate within this BeanContext diff --git a/jdk/src/share/classes/java/io/ByteArrayInputStream.java b/jdk/src/share/classes/java/io/ByteArrayInputStream.java index e58c6e64a64..ce0b8d1f183 100644 --- a/jdk/src/share/classes/java/io/ByteArrayInputStream.java +++ b/jdk/src/share/classes/java/io/ByteArrayInputStream.java @@ -275,7 +275,6 @@ class ByteArrayInputStream extends InputStream { * Closing a ByteArrayInputStream has no effect. The methods in * this class can be called after the stream has been closed without * generating an IOException. - *

          */ public void close() throws IOException { } diff --git a/jdk/src/share/classes/java/io/ByteArrayOutputStream.java b/jdk/src/share/classes/java/io/ByteArrayOutputStream.java index d28d397b31c..cd3c139a27e 100644 --- a/jdk/src/share/classes/java/io/ByteArrayOutputStream.java +++ b/jdk/src/share/classes/java/io/ByteArrayOutputStream.java @@ -263,8 +263,6 @@ public class ByteArrayOutputStream extends OutputStream { * Closing a ByteArrayOutputStream has no effect. The methods in * this class can be called after the stream has been closed without * generating an IOException. - *

          - * */ public void close() throws IOException { } diff --git a/jdk/src/share/classes/java/io/Closeable.java b/jdk/src/share/classes/java/io/Closeable.java index 530cde86171..b4a1c81f004 100644 --- a/jdk/src/share/classes/java/io/Closeable.java +++ b/jdk/src/share/classes/java/io/Closeable.java @@ -34,7 +34,6 @@ import java.io.IOException; * * @since 1.5 */ -@FunctionalInterface public interface Closeable extends AutoCloseable { /** diff --git a/jdk/src/share/classes/java/io/DataInput.java b/jdk/src/share/classes/java/io/DataInput.java index 58a3a2bfd3f..c61aeb58eda 100644 --- a/jdk/src/share/classes/java/io/DataInput.java +++ b/jdk/src/share/classes/java/io/DataInput.java @@ -155,7 +155,7 @@ interface DataInput { * to the length of {@code b}. *

          * This method blocks until one of the - * following conditions occurs:

          + * following conditions occurs: *

            *
          • {@code b.length} * bytes of input data are available, in which @@ -197,7 +197,7 @@ interface DataInput { *

            * This method * blocks until one of the following conditions - * occurs:

            + * occurs: *

              *
            • {@code len} bytes * of input data are available, in which case @@ -316,8 +316,8 @@ interface DataInput { * be the second byte. The value * returned * is: - *

              (short)((a << 8) | (b & 0xff))
              -     * 
              + *
              {@code (short)((a << 8) | (b & 0xff))
              +     * }
              * This method * is suitable for reading the bytes written * by the {@code writeShort} method of @@ -337,8 +337,8 @@ interface DataInput { * be the first byte read and * {@code b} * be the second byte. The value returned is: - *

              (((a & 0xff) << 8) | (b & 0xff))
              -     * 
              + *
              {@code (((a & 0xff) << 8) | (b & 0xff))
              +     * }
              * This method is suitable for reading the bytes * written by the {@code writeShort} method * of interface {@code DataOutput} if @@ -359,8 +359,8 @@ interface DataInput { * be the first byte read and {@code b} * be the second byte. The value * returned is: - *

              (char)((a << 8) | (b & 0xff))
              -     * 
              + *
              {@code (char)((a << 8) | (b & 0xff))
              +     * }
              * This method * is suitable for reading bytes written by * the {@code writeChar} method of interface @@ -377,10 +377,10 @@ interface DataInput { * Reads four input bytes and returns an * {@code int} value. Let {@code a-d} * be the first through fourth bytes read. The value returned is: - *

              
              -     * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
              -     *  ((c & 0xff) << 8) | (d & 0xff))
              -     * 
              + *
              {@code
              +     * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
              +     *  ((c & 0xff) <<  8) | (d & 0xff))
              +     * }
              * This method is suitable * for reading bytes written by the {@code writeInt} * method of interface {@code DataOutput}. @@ -397,16 +397,16 @@ interface DataInput { * a {@code long} value. Let {@code a-h} * be the first through eighth bytes read. * The value returned is: - *

              
              -     * (((long)(a & 0xff) << 56) |
              -     *  ((long)(b & 0xff) << 48) |
              -     *  ((long)(c & 0xff) << 40) |
              -     *  ((long)(d & 0xff) << 32) |
              -     *  ((long)(e & 0xff) << 24) |
              -     *  ((long)(f & 0xff) << 16) |
              -     *  ((long)(g & 0xff) <<  8) |
              -     *  ((long)(h & 0xff)))
              -     * 
              + *
              {@code
              +     * (((long)(a & 0xff) << 56) |
              +     *  ((long)(b & 0xff) << 48) |
              +     *  ((long)(c & 0xff) << 40) |
              +     *  ((long)(d & 0xff) << 32) |
              +     *  ((long)(e & 0xff) << 24) |
              +     *  ((long)(f & 0xff) << 16) |
              +     *  ((long)(g & 0xff) <<  8) |
              +     *  ((long)(h & 0xff)))
              +     * }
              *

              * This method is suitable * for reading bytes written by the {@code writeLong} @@ -540,9 +540,9 @@ interface DataInput { * not match the bit pattern {@code 10xxxxxx}, * then a {@code UTFDataFormatException} * is thrown. Otherwise, the group is converted - * to the character:

              - *

              (char)(((a& 0x1F) << 6) | (b & 0x3F))
              -     * 
              + * to the character: + *
              {@code (char)(((a & 0x1F) << 6) | (b & 0x3F))
              +     * }
              * If the first byte of a group * matches the bit pattern {@code 1110xxxx}, * then the group consists of that byte {@code a} @@ -554,10 +554,10 @@ interface DataInput { * does not match the bit pattern {@code 10xxxxxx}, * then a {@code UTFDataFormatException} * is thrown. Otherwise, the group is converted - * to the character:

              - *

              
              -     * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
              -     * 
              + * to the character: + *
              {@code
              +     * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
              +     * }
              * If the first byte of a group matches the * pattern {@code 1111xxxx} or the pattern * {@code 10xxxxxx}, then a {@code UTFDataFormatException} diff --git a/jdk/src/share/classes/java/io/DataOutput.java b/jdk/src/share/classes/java/io/DataOutput.java index 07fbc3a927d..ce909d10238 100644 --- a/jdk/src/share/classes/java/io/DataOutput.java +++ b/jdk/src/share/classes/java/io/DataOutput.java @@ -134,11 +134,11 @@ interface DataOutput { * Writes two bytes to the output * stream to represent the value of the argument. * The byte values to be written, in the order - * shown, are:

              - *

              
              -     * (byte)(0xff & (v >> 8))
              -     * (byte)(0xff & v)
              -     *  

              + * shown, are: + *

              {@code
              +     * (byte)(0xff & (v >> 8))
              +     * (byte)(0xff & v)
              +     * }

              * The bytes written by this method may be * read by the readShort method * of interface DataInput , which @@ -156,10 +156,10 @@ interface DataOutput { * output stream. * The byte values to be written, in the order * shown, are: - *

              
              -     * (byte)(0xff & (v >> 8))
              -     * (byte)(0xff & v)
              -     * 

              + *

              {@code
              +     * (byte)(0xff & (v >> 8))
              +     * (byte)(0xff & v)
              +     * }

              * The bytes written by this method may be * read by the readChar method * of interface DataInput , which @@ -176,12 +176,12 @@ interface DataOutput { * comprised of four bytes, to the output stream. * The byte values to be written, in the order * shown, are: - *

              
              -     * (byte)(0xff & (v >> 24))
              -     * (byte)(0xff & (v >> 16))
              -     * (byte)(0xff & (v >>    8))
              -     * (byte)(0xff & v)
              -     * 

              + *

              {@code
              +     * (byte)(0xff & (v >> 24))
              +     * (byte)(0xff & (v >> 16))
              +     * (byte)(0xff & (v >>  8))
              +     * (byte)(0xff & v)
              +     * }

              * The bytes written by this method may be read * by the readInt method of interface * DataInput , which will then @@ -197,16 +197,16 @@ interface DataOutput { * comprised of eight bytes, to the output stream. * The byte values to be written, in the order * shown, are: - *

              
              -     * (byte)(0xff & (v >> 56))
              -     * (byte)(0xff & (v >> 48))
              -     * (byte)(0xff & (v >> 40))
              -     * (byte)(0xff & (v >> 32))
              -     * (byte)(0xff & (v >> 24))
              -     * (byte)(0xff & (v >> 16))
              -     * (byte)(0xff & (v >>  8))
              -     * (byte)(0xff & v)
              -     * 

              + *

              {@code
              +     * (byte)(0xff & (v >> 56))
              +     * (byte)(0xff & (v >> 48))
              +     * (byte)(0xff & (v >> 40))
              +     * (byte)(0xff & (v >> 32))
              +     * (byte)(0xff & (v >> 24))
              +     * (byte)(0xff & (v >> 16))
              +     * (byte)(0xff & (v >>  8))
              +     * (byte)(0xff & v)
              +     * }

              * The bytes written by this method may be * read by the readLong method * of interface DataInput , which @@ -314,24 +314,24 @@ interface DataOutput { * If a character c * is in the range \u0001 through * \u007f, it is represented - * by one byte:

              + * by one byte: *

              (byte)c 

              * If a character c is \u0000 * or is in the range \u0080 * through \u07ff, then it is * represented by two bytes, to be written - * in the order shown:

              
              -     * (byte)(0xc0 | (0x1f & (c >> 6)))
              -     * (byte)(0x80 | (0x3f & c))
              -     *  

              If a character + * in the order shown:

              {@code
              +     * (byte)(0xc0 | (0x1f & (c >> 6)))
              +     * (byte)(0x80 | (0x3f & c))
              +     * }

              If a character * c is in the range \u0800 * through uffff, then it is * represented by three bytes, to be written - * in the order shown:

              
              -     * (byte)(0xe0 | (0x0f & (c >> 12)))
              -     * (byte)(0x80 | (0x3f & (c >>  6)))
              -     * (byte)(0x80 | (0x3f & c))
              -     *  

              First, + * in the order shown:

              {@code
              +     * (byte)(0xe0 | (0x0f & (c >> 12)))
              +     * (byte)(0x80 | (0x3f & (c >>  6)))
              +     * (byte)(0x80 | (0x3f & c))
              +     * }

              First, * the total number of bytes needed to represent * all the characters of s is * calculated. If this number is larger than diff --git a/jdk/src/share/classes/java/io/File.java b/jdk/src/share/classes/java/io/File.java index bafcea5a839..846ddc3004d 100644 --- a/jdk/src/share/classes/java/io/File.java +++ b/jdk/src/share/classes/java/io/File.java @@ -1685,7 +1685,7 @@ public class File * operation will fail if the user does not have permission to * change the access permissions of this abstract pathname. If * executable is false and the underlying - * file system does not implement an excute permission, then the + * file system does not implement an execute permission, then the * operation will fail. * * @throws SecurityException diff --git a/jdk/src/share/classes/java/io/FilePermission.java b/jdk/src/share/classes/java/io/FilePermission.java index e70d292e0c8..89f2c33287a 100644 --- a/jdk/src/share/classes/java/io/FilePermission.java +++ b/jdk/src/share/classes/java/io/FilePermission.java @@ -55,7 +55,7 @@ import sun.security.util.SecurityConstants; * a list of one or more comma-separated keywords. The possible keywords are * "read", "write", "execute", "delete", and "readlink". Their meaning is * defined as follows: - *

              + * *

              *
              read
              read permission *
              write
              write permission @@ -297,11 +297,11 @@ public final class FilePermission extends Permission implements Serializable { /** * Checks if this FilePermission object "implies" the specified permission. *

              - * More specifically, this method returns true if:

              + * More specifically, this method returns true if: *

                - *
              • p is an instanceof FilePermission,

                + *

              • p is an instanceof FilePermission, *
              • p's actions are a proper subset of this - * object's actions, and

                + * object's actions, and *

              • p's pathname is implied by this object's * pathname. For example, "/tmp/*" implies "/tmp/foo", since * "/tmp/*" encompasses all files in the "/tmp" directory, diff --git a/jdk/src/share/classes/java/io/Flushable.java b/jdk/src/share/classes/java/io/Flushable.java index 8912316d4d2..fe90fbdf6e1 100644 --- a/jdk/src/share/classes/java/io/Flushable.java +++ b/jdk/src/share/classes/java/io/Flushable.java @@ -34,7 +34,6 @@ import java.io.IOException; * * @since 1.5 */ -@FunctionalInterface public interface Flushable { /** diff --git a/jdk/src/share/classes/java/io/InputStream.java b/jdk/src/share/classes/java/io/InputStream.java index 3c7ff17f609..6c46a40a8a0 100644 --- a/jdk/src/share/classes/java/io/InputStream.java +++ b/jdk/src/share/classes/java/io/InputStream.java @@ -306,8 +306,7 @@ public abstract class InputStream implements Closeable { * *

                The general contract of reset is: * - *

                  - * + *
                    *
                  • If the method markSupported returns * true, then: * diff --git a/jdk/src/share/classes/java/io/ObjectInputStream.java b/jdk/src/share/classes/java/io/ObjectInputStream.java index c71681c255d..15ecd9bee65 100644 --- a/jdk/src/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/share/classes/java/io/ObjectInputStream.java @@ -109,7 +109,7 @@ import sun.reflect.misc.ReflectUtil; * *

                    Serializable classes that require special handling during the * serialization and deserialization process should implement the following - * methods:

                    + * methods: * *

                      * private void writeObject(java.io.ObjectOutputStream stream)
                    diff --git a/jdk/src/share/classes/java/io/ObjectStreamConstants.java b/jdk/src/share/classes/java/io/ObjectStreamConstants.java
                    index ddbada963b1..89265fb4fb5 100644
                    --- a/jdk/src/share/classes/java/io/ObjectStreamConstants.java
                    +++ b/jdk/src/share/classes/java/io/ObjectStreamConstants.java
                    @@ -219,7 +219,7 @@ public interface ObjectStreamConstants {
                         * This protocol is written by JVM 1.2.
                         *
                         * Externalizable data is written in block data mode and is
                    -    * terminated with TC_ENDBLOCKDATA. Externalizable classdescriptor
                    +    * terminated with TC_ENDBLOCKDATA. Externalizable class descriptor
                         * flags has SC_BLOCK_DATA enabled. JVM 1.1.6 and greater can
                         * read this format change.
                         *
                    diff --git a/jdk/src/share/classes/java/io/PipedInputStream.java b/jdk/src/share/classes/java/io/PipedInputStream.java
                    index af07de5b4e6..83dde31ed42 100644
                    --- a/jdk/src/share/classes/java/io/PipedInputStream.java
                    +++ b/jdk/src/share/classes/java/io/PipedInputStream.java
                    @@ -172,15 +172,14 @@ public class PipedInputStream extends InputStream {
                          * unconnected piped output stream and snk
                          * is an unconnected piped input stream, they
                          * may be connected by either the call:
                    -     * 

                    + * *

                    snk.connect(src) 
                    *

                    * or the call: - *

                    + * *

                    src.connect(snk) 
                    *

                    - * The two - * calls have the same effect. + * The two calls have the same effect. * * @param src The piped output stream to connect to. * @exception IOException if an I/O error occurs. diff --git a/jdk/src/share/classes/java/io/PipedReader.java b/jdk/src/share/classes/java/io/PipedReader.java index bb86022af6f..34716466a44 100644 --- a/jdk/src/share/classes/java/io/PipedReader.java +++ b/jdk/src/share/classes/java/io/PipedReader.java @@ -145,15 +145,14 @@ public class PipedReader extends Reader { * unconnected piped writer and snk * is an unconnected piped reader, they * may be connected by either the call: - *

                    + * *

                    snk.connect(src) 
                    *

                    * or the call: - *

                    + * *

                    src.connect(snk) 
                    *

                    - * The two - * calls have the same effect. + * The two calls have the same effect. * * @param src The piped writer to connect to. * @exception IOException if an I/O error occurs. diff --git a/jdk/src/share/classes/java/io/PrintStream.java b/jdk/src/share/classes/java/io/PrintStream.java index b803c6a657f..d57984e298b 100644 --- a/jdk/src/share/classes/java/io/PrintStream.java +++ b/jdk/src/share/classes/java/io/PrintStream.java @@ -303,7 +303,7 @@ public class PrintStream extends FilterOutputStream * creating the file * * @throws SecurityException - * If a security manager is presentand {@link + * If a security manager is present and {@link * SecurityManager#checkWrite checkWrite(file.getPath())} * denies write access to the file * diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java index fd1c712d1e3..c48aa99b32f 100644 --- a/jdk/src/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java @@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { *

                    *

                    * then the result is equal to: - *

                    +     * 
                          *     ((long)b1 << 56) + ((long)b2 << 48)
                          *     + ((long)b3 << 40) + ((long)b4 << 32)
                          *     + ((long)b5 << 24) + ((long)b6 << 16)
                    diff --git a/jdk/src/share/classes/java/io/Serializable.java b/jdk/src/share/classes/java/io/Serializable.java
                    index fc717f7570e..2f7bea1833e 100644
                    --- a/jdk/src/share/classes/java/io/Serializable.java
                    +++ b/jdk/src/share/classes/java/io/Serializable.java
                    @@ -55,7 +55,7 @@ package java.io;
                      *
                      * Classes that require special handling during the serialization and
                      * deserialization process must implement special methods with these exact
                    - * signatures: 

                    + * signatures: * *

                      * private void writeObject(java.io.ObjectOutputStream out)
                    @@ -101,7 +101,7 @@ package java.io;
                      *
                      * 

                    Serializable classes that need to designate an alternative object to be * used when writing an object to the stream should implement this - * special method with the exact signature:

                    + * special method with the exact signature: * *

                      * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
                    @@ -115,7 +115,7 @@ package java.io;
                      *
                      * Classes that need to designate a replacement when an instance of it
                      * is read from the stream should implement this special method with the
                    - * exact signature.

                    + * exact signature. * *

                      * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
                    @@ -133,7 +133,7 @@ package java.io;
                      * deserialization will result in an {@link InvalidClassException}.  A
                      * serializable class can declare its own serialVersionUID explicitly by
                      * declaring a field named "serialVersionUID" that must be static,
                    - * final, and of type long:

                    + * final, and of type long: * *

                      * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
                    diff --git a/jdk/src/share/classes/java/io/SerializablePermission.java b/jdk/src/share/classes/java/io/SerializablePermission.java
                    index eaa2913243d..b208d24d2f5 100644
                    --- a/jdk/src/share/classes/java/io/SerializablePermission.java
                    +++ b/jdk/src/share/classes/java/io/SerializablePermission.java
                    @@ -43,7 +43,6 @@ import java.util.StringTokenizer;
                      * The following table lists all the possible SerializablePermission target names,
                      * and for each provides a description of what the permission allows
                      * and a discussion of the risks of granting code the permission.
                    - * 

                    * *

      +
      1. Frame "F" is shown
      2. Document-modal dialog "Di" is shown
        -
      3. F becomes blocked by Di — it's in the same document
        +
      4. F becomes blocked by Di — it's in the same document
      5. Document-modal dialog "Dii" is shown
        -
      6. Di becomes blocked by Dii — it's in the +
      7. Di becomes blocked by Dii — it's in the same document

      +
      +
      1. Frame "F" is shown
      2. Document-modal dialog "Di" is shown
        -
      3. F becomes blocked by Di — it's in the same document
        +
      4. F becomes blocked by Di — it's in the same document
      5. Document-modal dialog "Dii" is shown
        -
      6. Di becomes blocked by Dii — +
      7. Di becomes blocked by Dii — it's in the same document
      8. Di is hidden
        -
      9. F becomes blocked by Dii — it's in the same document
        +
      10. F becomes blocked by Dii — it's in the same document

      +
      1. Frame "F" is shown
      2. Toolkit-modal dialog "Di" is created, but not shown
      3. Document-modal dialog "Dii" is shown
        -
      4. F becomes blocked by Dii — it's in the same document
        +
      5. F becomes blocked by Dii — it's in the same document
      6. Application-modal dialog "Diii" is shown
        -
      7. Dii becomes blocked by Diii — +
      8. Dii becomes blocked by Diii — it's in the same application
      9. Di is shown
        -
      10. Di becomes blocked by Dii — it's its owner
        -
      11. Diii remains unblocked — it blocks Dii and +
      12. Di becomes blocked by Dii — it's its owner
        +
      13. Diii remains unblocked — it blocks Dii and Dii blocks Di

      +
      +
      1. Frame "F" is shown
      2. Toolkit-modal dialog "Di" is created, but not shown
      3. Document-modal dialog "Dii" is shown
        -
      4. F becomes blocked by Dii — it's in the same document
        +
      5. F becomes blocked by Dii — it's in the same document
      6. Application-modal dialog "Diii" is shown
        -
      7. Dii becomes blocked by Diii — it's in the +
      8. Dii becomes blocked by Diii — it's in the same application
      9. Di is shown
        -
      10. Diii becomes blocked by Di — Di +
      11. Diii becomes blocked by Di — Di is not blocked
      12. Di remains unblocked

      +
      * diff --git a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java index 3260da6ae99..3cde60d6437 100644 --- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java +++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java @@ -330,9 +330,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * characters to be copied is {@code srcEnd-srcBegin}. The * characters are copied into the subarray of {@code dst} starting * at index {@code dstBegin} and ending at index: - *

      +     * 
      {@code
            * dstbegin + (srcEnd-srcBegin) - 1
      -     * 
      + * } * * @param srcBegin start copying at this offset. * @param srcEnd stop copying at this offset. @@ -859,16 +859,16 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * *

      An invocation of this method of the form * - *

      -     * sb.subSequence(begin, end)
      + *
      {@code
      +     * sb.subSequence(begin, end)}
      * * behaves in exactly the same way as the invocation * - *
      -     * sb.substring(begin, end)
      + *
      {@code
      +     * sb.substring(begin, end)}
      * * This method is provided so that this class can - * implement the {@link CharSequence} interface.

      + * implement the {@link CharSequence} interface. * * @param start the start index, inclusive. * @param end the end index, exclusive. @@ -1287,9 +1287,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: - *
      +     * 
      {@code
            * this.toString().startsWith(str, k)
      -     * 
      + * } * is {@code true}. * * @param str any string. @@ -1306,10 +1306,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. The integer * returned is the smallest value {@code k} for which: - *
      +     * 
      {@code
            *     k >= Math.min(fromIndex, this.length()) &&
            *                   this.toString().startsWith(str, k)
      -     * 
      + * } * If no such value of k exists, then -1 is returned. * * @param str the substring for which to search. @@ -1326,9 +1326,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * of the specified substring. The rightmost empty string "" is * considered to occur at the index value {@code this.length()}. * The returned index is the largest value k such that - *
      +     * 
      {@code
            * this.toString().startsWith(str, k)
      -     * 
      + * } * is true. * * @param str the substring to search for. @@ -1345,10 +1345,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * Returns the index within this string of the last occurrence of the * specified substring. The integer returned is the largest value k * such that: - *
      +     * 
      {@code
            *     k <= Math.min(fromIndex, this.length()) &&
            *                   this.toString().startsWith(str, k)
      -     * 
      + * } * If no such value of k exists, then -1 is returned. * * @param str the substring to search for. diff --git a/jdk/src/share/classes/java/lang/ArrayStoreException.java b/jdk/src/share/classes/java/lang/ArrayStoreException.java index aec35f2de34..96fa7447a79 100644 --- a/jdk/src/share/classes/java/lang/ArrayStoreException.java +++ b/jdk/src/share/classes/java/lang/ArrayStoreException.java @@ -29,7 +29,7 @@ package java.lang; * Thrown to indicate that an attempt has been made to store the * wrong type of object into an array of objects. For example, the * following code generates an ArrayStoreException: - *

      + * 
        *     Object x[] = new String[3];
        *     x[0] = new Integer(0);
        * 
      diff --git a/jdk/src/share/classes/java/lang/AutoCloseable.java b/jdk/src/share/classes/java/lang/AutoCloseable.java index be47cd0835f..135d9fe746b 100644 --- a/jdk/src/share/classes/java/lang/AutoCloseable.java +++ b/jdk/src/share/classes/java/lang/AutoCloseable.java @@ -48,7 +48,6 @@ package java.lang; * @author Josh Bloch * @since 1.7 */ -@FunctionalInterface public interface AutoCloseable { /** * Closes this resource, relinquishing any underlying resources. diff --git a/jdk/src/share/classes/java/lang/Byte.java b/jdk/src/share/classes/java/lang/Byte.java index 275e33de5a7..3a894a5f5e2 100644 --- a/jdk/src/share/classes/java/lang/Byte.java +++ b/jdk/src/share/classes/java/lang/Byte.java @@ -244,7 +244,7 @@ public final class Byte extends Number implements Comparable { *
      Signopt {@code 0X} HexDigits *
      Signopt {@code #} HexDigits *
      Signopt {@code 0} OctalDigits - *

      + * *

      Sign: *
      {@code -} *
      {@code +} diff --git a/jdk/src/share/classes/java/lang/Character.java b/jdk/src/share/classes/java/lang/Character.java index 41576cca8d8..0926758b054 100644 --- a/jdk/src/share/classes/java/lang/Character.java +++ b/jdk/src/share/classes/java/lang/Character.java @@ -5394,7 +5394,7 @@ class Character implements java.io.Serializable, Comparable { * Other_Lowercase as defined by the Unicode Standard. *

      * The following are examples of lowercase characters: - *

      +     * 
            * a b c d e f g h i j k l m n o p q r s t u v w x y z
            * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
            * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
      @@ -5430,7 +5430,7 @@ class Character implements java.io.Serializable, Comparable {
            * Other_Lowercase as defined by the Unicode Standard.
            * 

      * The following are examples of lowercase characters: - *

      +     * 
            * a b c d e f g h i j k l m n o p q r s t u v w x y z
            * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
            * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
      @@ -5461,14 +5461,14 @@ class Character implements java.io.Serializable, Comparable {
            * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
            * 

      * The following are examples of uppercase characters: - *

      +     * 
            * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
            * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
            * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
            * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
            * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
            * 
      - *

      Many other Unicode characters are uppercase too.

      + *

      Many other Unicode characters are uppercase too. * *

      Note: This method cannot handle supplementary characters. To support @@ -5496,7 +5496,7 @@ class Character implements java.io.Serializable, Comparable { * or it has contributory property Other_Uppercase as defined by the Unicode Standard. *

      * The following are examples of uppercase characters: - *

      +     * 
            * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
            * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
            * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
      @@ -5540,7 +5540,7 @@ class Character implements java.io.Serializable, Comparable {
            * 
    • {@code LATIN CAPITAL LETTER N WITH SMALL LETTER J} *
    • {@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z} * - *

      Many other Unicode characters are titlecase too.

      + *

      Many other Unicode characters are titlecase too. * *

      Note: This method cannot handle supplementary characters. To support diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index 500f70d3cb5..45c00913f6c 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -91,7 +91,7 @@ import sun.reflect.misc.ReflectUtil; *

      The following example uses a {@code Class} object to print the * class name of an object: * - *

      + * 
        *     void printClassName(Object obj) {
        *         System.out.println("The class of " + obj +
        *                            " is " + obj.getClass().getName());
      @@ -103,7 +103,7 @@ import sun.reflect.misc.ReflectUtil;
        * The Java™ Language Specification.
        * For example:
        *
      - * 

      + *
      * {@code System.out.println("The name of class Foo is: "+Foo.class.getName());} *
      * @@ -1571,6 +1571,10 @@ public final class Class implements java.io.Serializable, *

      If this {@code Class} object represents a primitive type or void, * then the returned array has length 0. * + *

      Static methods declared in superinterfaces of the class or interface + * represented by this {@code Class} object are not considered members of + * the class or interface. + * *

      The elements in the returned array are not sorted and are not in any * particular order. * @@ -1729,6 +1733,10 @@ public final class Class implements java.io.Serializable, *

      If this {@code Class} object represents an array type, then this * method does not find the {@code clone()} method. * + *

      Static methods declared in superinterfaces of the class or interface + * represented by this {@code Class} object are not considered members of + * the class or interface. + * * @param name the name of the method * @param parameterTypes the list of parameters * @return the {@code Method} object that matches the specified @@ -1752,7 +1760,7 @@ public final class Class implements java.io.Serializable, public Method getMethod(String name, Class... parameterTypes) throws NoSuchMethodException, SecurityException { checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); - Method method = getMethod0(name, parameterTypes); + Method method = getMethod0(name, parameterTypes, true); if (method == null) { throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes)); } @@ -2727,6 +2735,14 @@ public final class Class implements java.io.Serializable, } } + void addAllNonStatic(Method[] methods) { + for (Method candidate : methods) { + if (!Modifier.isStatic(candidate.getModifiers())) { + add(candidate); + } + } + } + int length() { return length; } @@ -2797,7 +2813,7 @@ public final class Class implements java.io.Serializable, MethodArray inheritedMethods = new MethodArray(); Class[] interfaces = getInterfaces(); for (int i = 0; i < interfaces.length; i++) { - inheritedMethods.addAll(interfaces[i].privateGetPublicMethods()); + inheritedMethods.addAllNonStatic(interfaces[i].privateGetPublicMethods()); } if (!isInterface()) { Class c = getSuperclass(); @@ -2900,7 +2916,7 @@ public final class Class implements java.io.Serializable, } - private Method getMethod0(String name, Class[] parameterTypes) { + private Method getMethod0(String name, Class[] parameterTypes, boolean includeStaticMethods) { // Note: the intent is that the search algorithm this routine // uses be equivalent to the ordering imposed by // privateGetPublicMethods(). It fetches only the declared @@ -2913,25 +2929,23 @@ public final class Class implements java.io.Serializable, if ((res = searchMethods(privateGetDeclaredMethods(true), name, parameterTypes)) != null) { - return res; + if (includeStaticMethods || !Modifier.isStatic(res.getModifiers())) + return res; } // Search superclass's methods if (!isInterface()) { Class c = getSuperclass(); if (c != null) { - if ((res = c.getMethod0(name, parameterTypes)) != null) { + if ((res = c.getMethod0(name, parameterTypes, true)) != null) { return res; } } } // Search superinterfaces' methods Class[] interfaces = getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - Class c = interfaces[i]; - if ((res = c.getMethod0(name, parameterTypes)) != null) { + for (Class c : interfaces) + if ((res = c.getMethod0(name, parameterTypes, false)) != null) return res; - } - } // Not found return null; } @@ -3300,7 +3314,10 @@ public final class Class implements java.io.Serializable, public A[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(annotationData().annotations, annotationClass); + AnnotationData annotationData = annotationData(); + return AnnotationSupport.getAssociatedAnnotations(annotationData.declaredAnnotations, + this, + annotationClass); } /** @@ -3330,7 +3347,8 @@ public final class Class implements java.io.Serializable, public A[] getDeclaredAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(annotationData().declaredAnnotations, annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotationData().declaredAnnotations, + annotationClass); } /** @@ -3424,6 +3442,10 @@ public final class Class implements java.io.Serializable, return annotationType; } + Map, Annotation> getDeclaredAnnotationMap() { + return annotationData().declaredAnnotations; + } + /* Backing store of user-defined values pertaining to this class. * Maintained by the ClassValue class. */ diff --git a/jdk/src/share/classes/java/lang/ClassCastException.java b/jdk/src/share/classes/java/lang/ClassCastException.java index fc9b2616eff..93b61630d21 100644 --- a/jdk/src/share/classes/java/lang/ClassCastException.java +++ b/jdk/src/share/classes/java/lang/ClassCastException.java @@ -29,7 +29,7 @@ package java.lang; * Thrown to indicate that the code has attempted to cast an object * to a subclass of which it is not an instance. For example, the * following code generates a ClassCastException: - *

      + * 
        *     Object x = new Integer(0);
        *     System.out.println((String)x);
        * 
      diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java index 7aa5087ad2f..875f5ec8e97 100644 --- a/jdk/src/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/share/classes/java/lang/ClassLoader.java @@ -362,7 +362,7 @@ public abstract class ClassLoader { * default implementation of this method searches for classes in the * following order: * - *

        + *
          * *
        1. Invoke {@link #findLoadedClass(String)} to check if the class * has already been loaded.

        2. @@ -488,7 +488,7 @@ public abstract class ClassLoader { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { if (ReflectUtil.isNonPublicProxyClass(cls)) { - for (Class intf: cls.getInterfaces()) { + for (Class intf: cls.getInterfaces()) { checkPackageAccess(intf, pd); } return; diff --git a/jdk/src/share/classes/java/lang/ClassValue.java b/jdk/src/share/classes/java/lang/ClassValue.java index be190c0d4eb..676c2eccb30 100644 --- a/jdk/src/share/classes/java/lang/ClassValue.java +++ b/jdk/src/share/classes/java/lang/ClassValue.java @@ -692,7 +692,7 @@ public abstract class ClassValue { /** Remove all stale entries, everywhere. */ private void removeStaleEntries() { - Entry[] cache = getCache(); + Entry[] cache = getCache(); removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1); } diff --git a/jdk/src/share/classes/java/lang/Comparable.java b/jdk/src/share/classes/java/lang/Comparable.java index 9d607679a61..a88cf167fbd 100644 --- a/jdk/src/share/classes/java/lang/Comparable.java +++ b/jdk/src/share/classes/java/lang/Comparable.java @@ -93,7 +93,6 @@ import java.util.*; * @see java.util.Comparator * @since 1.2 */ -@FunctionalInterface public interface Comparable { /** * Compares this object with the specified object for order. Returns a diff --git a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java index 9f3d81624e9..d2ed9d91b50 100644 --- a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java +++ b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java @@ -74,7 +74,6 @@ final class ConditionalSpecialCasing { new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE - new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE //# ================================================================================ //# Turkish and Azeri @@ -85,10 +84,7 @@ final class ConditionalSpecialCasing { new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I - new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I - //# ================================================================================ - //# Other - new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE + new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0) // # LATIN SMALL LETTER I }; // A hash table that contains the above entries diff --git a/jdk/src/share/classes/java/lang/Double.java b/jdk/src/share/classes/java/lang/Double.java index 1b1aece8122..690ca6a8dc3 100644 --- a/jdk/src/share/classes/java/lang/Double.java +++ b/jdk/src/share/classes/java/lang/Double.java @@ -361,15 +361,11 @@ public final class Double extends Number implements Comparable { *
          SignedInteger * * - *

          - * *

          *
          HexFloatingPointLiteral: *
          HexSignificand BinaryExponent FloatTypeSuffixopt *
          * - *

          - * *

          *
          HexSignificand: *
          HexNumeral @@ -380,15 +376,11 @@ public final class Double extends Number implements Comparable { * {@code .} HexDigits *
          * - *

          - * *

          *
          BinaryExponent: *
          BinaryExponentIndicator SignedInteger *
          * - *

          - * *

          *
          BinaryExponentIndicator: *
          {@code p} diff --git a/jdk/src/share/classes/java/lang/Float.java b/jdk/src/share/classes/java/lang/Float.java index e130e92314e..5cc28f99bff 100644 --- a/jdk/src/share/classes/java/lang/Float.java +++ b/jdk/src/share/classes/java/lang/Float.java @@ -321,15 +321,11 @@ public final class Float extends Number implements Comparable { *
          SignedInteger *
          * - *

          - * *

          *
          HexFloatingPointLiteral: *
          HexSignificand BinaryExponent FloatTypeSuffixopt *
          * - *

          - * *

          *
          HexSignificand: *
          HexNumeral @@ -340,15 +336,11 @@ public final class Float extends Number implements Comparable { * {@code .} HexDigits *
          * - *

          - * *

          *
          BinaryExponent: *
          BinaryExponentIndicator SignedInteger *
          * - *

          - * *

          *
          BinaryExponentIndicator: *
          {@code p} diff --git a/jdk/src/share/classes/java/lang/Integer.java b/jdk/src/share/classes/java/lang/Integer.java index 7ee4b48855e..c5d971a54ae 100644 --- a/jdk/src/share/classes/java/lang/Integer.java +++ b/jdk/src/share/classes/java/lang/Integer.java @@ -1123,7 +1123,7 @@ public final class Integer extends Number implements Comparable { *
          Signopt {@code 0X} HexDigits *
          Signopt {@code #} HexDigits *
          Signopt {@code 0} OctalDigits - *

          + * *

          Sign: *
          {@code -} *
          {@code +} diff --git a/jdk/src/share/classes/java/lang/Iterable.java b/jdk/src/share/classes/java/lang/Iterable.java index fe9086f6874..eed39388a8f 100644 --- a/jdk/src/share/classes/java/lang/Iterable.java +++ b/jdk/src/share/classes/java/lang/Iterable.java @@ -42,7 +42,6 @@ import java.util.function.Consumer; * @since 1.5 * @jls 14.14.2 The enhanced for statement */ -@FunctionalInterface public interface Iterable { /** * Returns an iterator over elements of type {@code T}. @@ -52,10 +51,12 @@ public interface Iterable { Iterator iterator(); /** - * Performs the given action on the contents of the {@code Iterable}, in the - * order elements occur when iterating, until all elements have been - * processed or the action throws an exception. Errors or runtime - * exceptions thrown by the action are relayed to the caller. + * Performs the given action for each element of the {@code Iterable} + * until all elements have been processed or the action throws an + * exception. Unless otherwise specified by the implementing class, + * actions are performed in the order of iteration (if an iteration order + * is specified). Exceptions thrown by the action are relayed to the + * caller. * * @implSpec *

          The default implementation behaves as if: @@ -100,4 +101,3 @@ public interface Iterable { return Spliterators.spliteratorUnknownSize(iterator(), 0); } } - diff --git a/jdk/src/share/classes/java/lang/Long.java b/jdk/src/share/classes/java/lang/Long.java index bfaf0c4412f..fa43fa4d0b5 100644 --- a/jdk/src/share/classes/java/lang/Long.java +++ b/jdk/src/share/classes/java/lang/Long.java @@ -853,7 +853,7 @@ public final class Long extends Number implements Comparable { *

          Signopt {@code 0X} HexDigits *
          Signopt {@code #} HexDigits *
          Signopt {@code 0} OctalDigits - *

          + * *

          Sign: *
          {@code -} *
          {@code +} diff --git a/jdk/src/share/classes/java/lang/Readable.java b/jdk/src/share/classes/java/lang/Readable.java index e3d08d34b62..c7a3d1a800a 100644 --- a/jdk/src/share/classes/java/lang/Readable.java +++ b/jdk/src/share/classes/java/lang/Readable.java @@ -34,7 +34,6 @@ import java.io.IOException; * * @since 1.5 */ -@FunctionalInterface public interface Readable { /** diff --git a/jdk/src/share/classes/java/lang/RuntimePermission.java b/jdk/src/share/classes/java/lang/RuntimePermission.java index 6dcbc275e9e..9da131ba938 100644 --- a/jdk/src/share/classes/java/lang/RuntimePermission.java +++ b/jdk/src/share/classes/java/lang/RuntimePermission.java @@ -47,7 +47,6 @@ import java.util.StringTokenizer; * The following table lists all the possible RuntimePermission target names, * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. - *

          * *

    • diff --git a/jdk/src/share/classes/java/lang/SecurityManager.java b/jdk/src/share/classes/java/lang/SecurityManager.java index 3565082033c..635f6db093e 100644 --- a/jdk/src/share/classes/java/lang/SecurityManager.java +++ b/jdk/src/share/classes/java/lang/SecurityManager.java @@ -56,7 +56,7 @@ import sun.security.util.SecurityConstants; * are called by various methods in the Java libraries before those * methods perform certain potentially sensitive operations. The * invocation of such a check method typically looks like this: - *

      + * 
        *     SecurityManager security = System.getSecurityManager();
        *     if (security != null) {
        *         security.checkXXX(argument,  . . . );
      @@ -323,7 +323,7 @@ class SecurityManager {
            * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
            * 

      * This method will return - * null in the following three cases:

      + * null in the following three cases: *

        *
      1. All methods on the execution stack are from classes * defined using the system class loader or one of its ancestors. @@ -370,7 +370,7 @@ class SecurityManager { * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. *

        * This method will return - * null in the following three cases:

        + * null in the following three cases: *

          *
        1. All methods on the execution stack are from classes * defined using the system class loader or one of its ancestors. @@ -429,7 +429,7 @@ class SecurityManager { * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. *

          * This method will return - * -1 in the following three cases:

          + * -1 in the following three cases: *

            *
          1. All methods on the execution stack are from classes * defined using the system class loader or one of its ancestors. @@ -1281,7 +1281,6 @@ class SecurityManager { * This method calls checkPermission with the * PropertyPermission(key, "read") permission. *

            - *

            * If you override this method, then you should make a call to * super.checkPropertyAccess * at the point the overridden method would normally throw an @@ -1714,7 +1713,7 @@ class SecurityManager { throw new NullPointerException("class can't be null"); } if (which != Member.PUBLIC) { - Class stack[] = getClassContext(); + Class stack[] = getClassContext(); /* * stack depth of 4 should be the caller of one of the * methods in java.lang.Class that invoke checkMember diff --git a/jdk/src/share/classes/java/lang/Short.java b/jdk/src/share/classes/java/lang/Short.java index c7641807c56..9fb3913beae 100644 --- a/jdk/src/share/classes/java/lang/Short.java +++ b/jdk/src/share/classes/java/lang/Short.java @@ -249,7 +249,7 @@ public final class Short extends Number implements Comparable { *

            Signopt {@code 0X} HexDigits *
            Signopt {@code #} HexDigits *
            Signopt {@code 0} OctalDigits - *

            + * *

            Sign: *
            {@code -} *
            {@code +} diff --git a/jdk/src/share/classes/java/lang/String.java b/jdk/src/share/classes/java/lang/String.java index 2231aa3bb71..9223c0ab54f 100644 --- a/jdk/src/share/classes/java/lang/String.java +++ b/jdk/src/share/classes/java/lang/String.java @@ -47,16 +47,16 @@ import java.util.regex.PatternSyntaxException; * Strings are constant; their values cannot be changed after they * are created. String buffers support mutable strings. * Because String objects are immutable they can be shared. For example: - *

            + * 
              *     String str = "abc";
              * 

            * is equivalent to: - *

            + * 
              *     char data[] = {'a', 'b', 'c'};
              *     String str = new String(data);
              * 

            * Here are some more examples of how strings can be used: - *

            + * 
              *     System.out.println("abc");
              *     String cde = "cde";
              *     System.out.println("abc" + cde);
            @@ -786,7 +786,7 @@ public final class String
                  * {@code srcEnd-srcBegin}). The characters are copied into the
                  * subarray of {@code dst} starting at index {@code dstBegin}
                  * and ending at index:
            -     * 

            +     * 
                  *     dstbegin + (srcEnd-srcBegin) - 1
                  * 
            * @@ -2598,21 +2598,14 @@ public final class String } if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale); - } else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT - lowerChar = Character.ERROR; } else { lowerChar = Character.toLowerCase(srcChar); } if ((lowerChar == Character.ERROR) || (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) { if (lowerChar == Character.ERROR) { - if (!localeDependent && srcChar == '\u0130') { - lowerCharArray = - ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH); - } else { - lowerCharArray = - ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale); - } + lowerCharArray = + ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale); } else if (srcCount == 2) { resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount; continue; @@ -2669,7 +2662,7 @@ public final class String * {@code String} may be a different length than the original {@code String}. *

            * Examples of locale-sensitive and 1:M case mappings are in the following table. - *

            + * *

      * * diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java index c5b5e9e890b..f68a5401704 100644 --- a/jdk/src/share/classes/java/lang/System.java +++ b/jdk/src/share/classes/java/lang/System.java @@ -26,10 +26,12 @@ package java.lang; import java.io.*; import java.lang.reflect.Executable; +import java.lang.annotation.Annotation; import java.security.AccessControlContext; import java.util.Properties; import java.util.PropertyPermission; import java.util.StringTokenizer; +import java.util.Map; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.AllPermission; @@ -1227,6 +1229,9 @@ public final class System { public AnnotationType getAnnotationType(Class klass) { return klass.getAnnotationType(); } + public Map, Annotation> getDeclaredAnnotationMap(Class klass) { + return klass.getDeclaredAnnotationMap(); + } public byte[] getRawClassAnnotations(Class klass) { return klass.getRawAnnotations(); } diff --git a/jdk/src/share/classes/java/lang/Thread.java b/jdk/src/share/classes/java/lang/Thread.java index c2f5561bdf4..13d8ac26cad 100644 --- a/jdk/src/share/classes/java/lang/Thread.java +++ b/jdk/src/share/classes/java/lang/Thread.java @@ -76,7 +76,7 @@ import sun.security.util.SecurityConstants; * Thread. An instance of the subclass can then be * allocated and started. For example, a thread that computes primes * larger than a stated value could be written as follows: - *


      + * 
        *     class PrimeThread extends Thread {
        *         long minPrime;
        *         PrimeThread(long minPrime) {
      @@ -91,7 +91,7 @@ import sun.security.util.SecurityConstants;
        * 

      *

      * The following code would then create a thread and start it running: - *

      + * 
        *     PrimeThread p = new PrimeThread(143);
        *     p.start();
        * 
      @@ -102,7 +102,7 @@ import sun.security.util.SecurityConstants; * then be allocated, passed as an argument when creating * Thread, and started. The same example in this other * style looks like the following: - *


      + * 
        *     class PrimeRun implements Runnable {
        *         long minPrime;
        *         PrimeRun(long minPrime) {
      @@ -117,7 +117,7 @@ import sun.security.util.SecurityConstants;
        * 

      *

      * The following code would then create a thread and start it running: - *

      + * 
        *     PrimeRun p = new PrimeRun(143);
        *     new Thread(p).start();
        * 
      diff --git a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java index 793a2d13f01..e1c82d8f559 100644 --- a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java +++ b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java @@ -101,7 +101,6 @@ import static sun.invoke.util.Wrapper.isWrapperType; * should implement. * @param additionalBridges Method types for additional signatures to be * bridged to the implementation method - * @throws ReflectiveOperationException * @throws LambdaConversionException If any of the meta-factory protocol * invariants are violated */ @@ -114,7 +113,7 @@ import static sun.invoke.util.Wrapper.isWrapperType; boolean isSerializable, Class[] markerInterfaces, MethodType[] additionalBridges) - throws ReflectiveOperationException, LambdaConversionException { + throws LambdaConversionException { this.targetClass = caller.lookupClass(); this.invokedType = invokedType; @@ -160,7 +159,7 @@ import static sun.invoke.util.Wrapper.isWrapperType; * @throws ReflectiveOperationException */ abstract CallSite buildCallSite() - throws ReflectiveOperationException, LambdaConversionException; + throws LambdaConversionException; /** * Check the meta-factory arguments for errors diff --git a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index 486680712e0..a85c505c0f8 100644 --- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -26,16 +26,19 @@ package java.lang.invoke; import jdk.internal.org.objectweb.asm.*; +import sun.invoke.util.BytecodeDescriptor; import sun.misc.Unsafe; import sun.security.action.GetPropertyAction; import java.io.FilePermission; +import java.io.Serializable; import java.lang.reflect.Constructor; import java.security.AccessController; import java.security.PrivilegedAction; -import java.security.ProtectionDomain; +import java.util.LinkedHashSet; import java.util.concurrent.atomic.AtomicInteger; import java.util.PropertyPermission; +import java.util.Set; import static jdk.internal.org.objectweb.asm.Opcodes.*; @@ -50,14 +53,19 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; private static final int CLASSFILE_VERSION = 51; private static final String METHOD_DESCRIPTOR_VOID = Type.getMethodDescriptor(Type.VOID_TYPE); - private static final String NAME_MAGIC_ACCESSOR_IMPL = "java/lang/invoke/MagicLambdaImpl"; + private static final String JAVA_LANG_OBJECT = "java/lang/Object"; private static final String NAME_CTOR = ""; + private static final String NAME_FACTORY = "get$Lambda"; //Serialization support private static final String NAME_SERIALIZED_LAMBDA = "java/lang/invoke/SerializedLambda"; + private static final String NAME_NOT_SERIALIZABLE_EXCEPTION = "java/io/NotSerializableException"; private static final String DESCR_METHOD_WRITE_REPLACE = "()Ljava/lang/Object;"; + private static final String DESCR_METHOD_WRITE_OBJECT = "(Ljava/io/ObjectOutputStream;)V"; + private static final String DESCR_METHOD_READ_OBJECT = "(Ljava/io/ObjectInputStream;)V"; private static final String NAME_METHOD_WRITE_REPLACE = "writeReplace"; - private static final String NAME_OBJECT = "java/lang/Object"; + private static final String NAME_METHOD_READ_OBJECT = "readObject"; + private static final String NAME_METHOD_WRITE_OBJECT = "writeObject"; private static final String DESCR_CTOR_SERIALIZED_LAMBDA = MethodType.methodType(void.class, Class.class, @@ -65,6 +73,12 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; int.class, String.class, String.class, String.class, String.class, Object[].class).toMethodDescriptorString(); + private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION + = MethodType.methodType(void.class, String.class).toMethodDescriptorString(); + private static final String[] SER_HOSTILE_EXCEPTIONS = new String[] {NAME_NOT_SERIALIZABLE_EXCEPTION}; + + + private static final String[] EMPTY_STRING_ARRAY = new String[0]; // Used to ensure that each spun class name is unique private static final AtomicInteger counter = new AtomicInteger(0); @@ -84,15 +98,12 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; private final String implMethodClassName; // Name of type containing implementation "CC" private final String implMethodName; // Name of implementation method "impl" private final String implMethodDesc; // Type descriptor for implementation methods "(I)Ljava/lang/String;" - private final Type[] implMethodArgumentTypes; // ASM types for implementation method parameters - private final Type implMethodReturnType; // ASM type for implementation method return type "Ljava/lang/String;" + private final Class implMethodReturnClass; // class for implementaion method return type "Ljava/lang/String;" private final MethodType constructorType; // Generated class constructor type "(CC)void" - private final String constructorDesc; // Type descriptor for constructor "(LCC;)V" private final ClassWriter cw; // ASM class writer - private final Type[] argTypes; // ASM types for the constructor arguments private final String[] argNames; // Generated names for the constructor arguments + private final String[] argDescs; // Type descriptors for the constructor arguments private final String lambdaClassName; // Generated name for the generated class "X$$Lambda$1" - private final Type[] instantiatedArgumentTypes; // ASM types for the functional interface arguments /** * General meta-factory constructor, supporting both standard cases and @@ -128,7 +139,6 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; * should implement. * @param additionalBridges Method types for additional signatures to be * bridged to the implementation method - * @throws ReflectiveOperationException * @throws LambdaConversionException If any of the meta-factory protocol * invariants are violated */ @@ -141,29 +151,30 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; boolean isSerializable, Class[] markerInterfaces, MethodType[] additionalBridges) - throws ReflectiveOperationException, LambdaConversionException { + throws LambdaConversionException { super(caller, invokedType, samMethodName, samMethodType, implMethod, instantiatedMethodType, isSerializable, markerInterfaces, additionalBridges); implMethodClassName = implDefiningClass.getName().replace('.', '/'); implMethodName = implInfo.getName(); implMethodDesc = implMethodType.toMethodDescriptorString(); - Type implMethodAsmType = Type.getMethodType(implMethodDesc); - implMethodArgumentTypes = implMethodAsmType.getArgumentTypes(); - implMethodReturnType = (implKind == MethodHandleInfo.REF_newInvokeSpecial) - ? Type.getObjectType(implMethodClassName) - : implMethodAsmType.getReturnType(); + implMethodReturnClass = (implKind == MethodHandleInfo.REF_newInvokeSpecial) + ? implDefiningClass + : implMethodType.returnType(); constructorType = invokedType.changeReturnType(Void.TYPE); - constructorDesc = constructorType.toMethodDescriptorString(); lambdaClassName = targetClass.getName().replace('.', '/') + "$$Lambda$" + counter.incrementAndGet(); cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); - argTypes = Type.getArgumentTypes(constructorDesc); - argNames = new String[argTypes.length]; - for (int i = 0; i < argTypes.length; i++) { - argNames[i] = "arg$" + (i + 1); + int parameterCount = invokedType.parameterCount(); + if (parameterCount > 0) { + argNames = new String[parameterCount]; + argDescs = new String[parameterCount]; + for (int i = 0; i < parameterCount; i++) { + argNames[i] = "arg$" + (i + 1); + argDescs[i] = BytecodeDescriptor.unparse(invokedType.parameterType(i)); + } + } else { + argNames = argDescs = EMPTY_STRING_ARRAY; } - instantiatedArgumentTypes = Type.getArgumentTypes( - instantiatedMethodType.toMethodDescriptorString()); } /** @@ -179,36 +190,44 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; * is not found */ @Override - CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException { + CallSite buildCallSite() throws LambdaConversionException { final Class innerClass = spinInnerClass(); if (invokedType.parameterCount() == 0) { final Constructor[] ctrs = AccessController.doPrivileged( new PrivilegedAction() { @Override public Constructor[] run() { - return innerClass.getDeclaredConstructors(); + Constructor[] ctrs = innerClass.getDeclaredConstructors(); + if (ctrs.length == 1) { + // The lambda implementing inner class constructor is private, set + // it accessible (by us) before creating the constant sole instance + ctrs[0].setAccessible(true); + } + return ctrs; } - }); + }); if (ctrs.length != 1) { - throw new ReflectiveOperationException("Expected one lambda constructor for " + throw new LambdaConversionException("Expected one lambda constructor for " + innerClass.getCanonicalName() + ", got " + ctrs.length); } - // The lambda implementing inner class constructor is private, set - // it accessible (by us) before creating the constant sole instance - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - ctrs[0].setAccessible(true); - return null; - } - }); - Object inst = ctrs[0].newInstance(); - return new ConstantCallSite(MethodHandles.constant(samBase, inst)); + + try { + Object inst = ctrs[0].newInstance(); + return new ConstantCallSite(MethodHandles.constant(samBase, inst)); + } + catch (ReflectiveOperationException e) { + throw new LambdaConversionException("Exception instantiating lambda object", e); + } } else { - return new ConstantCallSite( - MethodHandles.Lookup.IMPL_LOOKUP - .findConstructor(innerClass, constructorType) - .asType(constructorType.changeReturnType(samBase))); + try { + UNSAFE.ensureClassInitialized(innerClass); + return new ConstantCallSite( + MethodHandles.Lookup.IMPL_LOOKUP + .findStatic(innerClass, NAME_FACTORY, invokedType)); + } + catch (ReflectiveOperationException e) { + throw new LambdaConversionException("Exception finding constructor", e); + } } } @@ -228,44 +247,59 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; * is not found */ private Class spinInnerClass() throws LambdaConversionException { - String[] interfaces = new String[markerInterfaces.length + 1]; - interfaces[0] = samBase.getName().replace('.', '/'); - for (int i=0; i itfs = new LinkedHashSet<>(markerInterfaces.length + 1); + itfs.add(samIntf); + for (Class markerInterface : markerInterfaces) { + itfs.add(markerInterface.getName().replace('.', '/')); + accidentallySerializable |= !isSerializable && Serializable.class.isAssignableFrom(markerInterface); + } + interfaces = itfs.toArray(new String[itfs.size()]); } + cw.visit(CLASSFILE_VERSION, ACC_SUPER + ACC_FINAL + ACC_SYNTHETIC, lambdaClassName, null, - NAME_MAGIC_ACCESSOR_IMPL, interfaces); + JAVA_LANG_OBJECT, interfaces); // Generate final fields to be filled in by constructor - for (int i = 0; i < argTypes.length; i++) { + for (int i = 0; i < argDescs.length; i++) { FieldVisitor fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, argNames[i], - argTypes[i].getDescriptor(), + argDescs[i], null, null); fv.visitEnd(); } generateConstructor(); + if (invokedType.parameterCount() != 0) { + generateFactory(); + } + // Forward the SAM method - String methodDescriptor = samMethodType.toMethodDescriptorString(); MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, samMethodName, - methodDescriptor, null, null); - new ForwardingMethodGenerator(mv).generate(methodDescriptor); + samMethodType.toMethodDescriptorString(), null, null); + new ForwardingMethodGenerator(mv).generate(samMethodType); // Forward the bridges if (additionalBridges != null) { for (MethodType mt : additionalBridges) { - methodDescriptor = mt.toMethodDescriptorString(); mv = cw.visitMethod(ACC_PUBLIC|ACC_BRIDGE, samMethodName, - methodDescriptor, null, null); - new ForwardingMethodGenerator(mv).generate(methodDescriptor); + mt.toMethodDescriptorString(), null, null); + new ForwardingMethodGenerator(mv).generate(mt); } } if (isSerializable) - generateWriteReplace(); + generateSerializationFriendlyMethods(); + else if (accidentallySerializable) + generateSerializationHostileMethods(); cw.visitEnd(); @@ -287,21 +321,27 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; new PropertyPermission("user.dir", "read")); } - ClassLoader loader = targetClass.getClassLoader(); - ProtectionDomain pd = (loader == null) - ? null - : AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public ProtectionDomain run() { - return targetClass.getProtectionDomain(); - } - } - ); + return UNSAFE.defineAnonymousClass(targetClass, classBytes, null); + } - return UNSAFE.defineClass(lambdaClassName, - classBytes, 0, classBytes.length, - loader, pd); + /** + * Generate the factory method for the class + */ + private void generateFactory() { + MethodVisitor m = cw.visitMethod(ACC_PRIVATE | ACC_STATIC, NAME_FACTORY, invokedType.toMethodDescriptorString(), null, null); + m.visitCode(); + m.visitTypeInsn(NEW, lambdaClassName); + m.visitInsn(Opcodes.DUP); + int parameterCount = invokedType.parameterCount(); + for (int typeIndex = 0, varIndex = 0; typeIndex < parameterCount; typeIndex++) { + Class argType = invokedType.parameterType(typeIndex); + m.visitVarInsn(getLoadOpcode(argType), varIndex); + varIndex += getParameterSize(argType); + } + m.visitMethodInsn(INVOKESPECIAL, lambdaClassName, NAME_CTOR, constructorType.toMethodDescriptorString()); + m.visitInsn(ARETURN); + m.visitMaxs(-1, -1); + m.visitEnd(); } /** @@ -310,18 +350,18 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; private void generateConstructor() { // Generate constructor MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, - constructorDesc, null, null); + constructorType.toMethodDescriptorString(), null, null); ctor.visitCode(); ctor.visitVarInsn(ALOAD, 0); - ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, + ctor.visitMethodInsn(INVOKESPECIAL, JAVA_LANG_OBJECT, NAME_CTOR, METHOD_DESCRIPTOR_VOID); - int lvIndex = 0; - for (int i = 0; i < argTypes.length; i++) { + int parameterCount = invokedType.parameterCount(); + for (int i = 0, lvIndex = 0; i < parameterCount; i++) { ctor.visitVarInsn(ALOAD, 0); - ctor.visitVarInsn(argTypes[i].getOpcode(ILOAD), lvIndex + 1); - lvIndex += argTypes[i].getSize(); - ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i], - argTypes[i].getDescriptor()); + Class argType = invokedType.parameterType(i); + ctor.visitVarInsn(getLoadOpcode(argType), lvIndex + 1); + lvIndex += getParameterSize(argType); + ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i], argDescs[i]); } ctor.visitInsn(RETURN); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored @@ -330,9 +370,9 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; } /** - * Generate the writeReplace method (if needed for serialization) + * Generate a writeReplace method that supports serialization */ - private void generateWriteReplace() { + private void generateSerializationFriendlyMethods() { TypeConvertingMethodAdapter mv = new TypeConvertingMethodAdapter( cw.visitMethod(ACC_PRIVATE + ACC_FINAL, @@ -351,16 +391,14 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; mv.visitLdcInsn(implInfo.getName()); mv.visitLdcInsn(implInfo.getMethodType().toMethodDescriptorString()); mv.visitLdcInsn(instantiatedMethodType.toMethodDescriptorString()); - - mv.iconst(argTypes.length); - mv.visitTypeInsn(ANEWARRAY, NAME_OBJECT); - for (int i = 0; i < argTypes.length; i++) { + mv.iconst(argDescs.length); + mv.visitTypeInsn(ANEWARRAY, JAVA_LANG_OBJECT); + for (int i = 0; i < argDescs.length; i++) { mv.visitInsn(DUP); mv.iconst(i); mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], - argTypes[i].getDescriptor()); - mv.boxIfTypePrimitive(argTypes[i]); + mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argDescs[i]); + mv.boxIfTypePrimitive(Type.getType(argDescs[i])); mv.visitInsn(AASTORE); } mv.visitMethodInsn(INVOKESPECIAL, NAME_SERIALIZED_LAMBDA, NAME_CTOR, @@ -371,6 +409,37 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; mv.visitEnd(); } + /** + * Generate a readObject/writeObject method that is hostile to serialization + */ + private void generateSerializationHostileMethods() { + MethodVisitor mv = cw.visitMethod(ACC_PRIVATE + ACC_FINAL, + NAME_METHOD_WRITE_OBJECT, DESCR_METHOD_WRITE_OBJECT, + null, SER_HOSTILE_EXCEPTIONS); + mv.visitCode(); + mv.visitTypeInsn(NEW, NAME_NOT_SERIALIZABLE_EXCEPTION); + mv.visitInsn(DUP); + mv.visitLdcInsn("Non-serializable lambda"); + mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR, + DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION); + mv.visitInsn(ATHROW); + mv.visitMaxs(-1, -1); + mv.visitEnd(); + + mv = cw.visitMethod(ACC_PRIVATE + ACC_FINAL, + NAME_METHOD_READ_OBJECT, DESCR_METHOD_READ_OBJECT, + null, SER_HOSTILE_EXCEPTIONS); + mv.visitCode(); + mv.visitTypeInsn(NEW, NAME_NOT_SERIALIZABLE_EXCEPTION); + mv.visitInsn(DUP); + mv.visitLdcInsn("Non-serializable lambda"); + mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR, + DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION); + mv.visitInsn(ATHROW); + mv.visitMaxs(-1, -1); + mv.visitEnd(); + } + /** * This class generates a method body which calls the lambda implementation * method, converting arguments, as needed. @@ -381,20 +450,19 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; super(mv); } - void generate(String methodDescriptor) { + void generate(MethodType methodType) { visitCode(); if (implKind == MethodHandleInfo.REF_newInvokeSpecial) { visitTypeInsn(NEW, implMethodClassName); visitInsn(DUP); } - for (int i = 0; i < argTypes.length; i++) { + for (int i = 0; i < argNames.length; i++) { visitVarInsn(ALOAD, 0); - visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], - argTypes[i].getDescriptor()); + visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argDescs[i]); } - convertArgumentTypes(Type.getArgumentTypes(methodDescriptor)); + convertArgumentTypes(methodType); // Invoke the method we want to forward to visitMethodInsn(invocationOpcode(), implMethodClassName, implMethodName, implMethodDesc); @@ -402,46 +470,36 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; // Convert the return value (if any) and return it // Note: if adapting from non-void to void, the 'return' // instruction will pop the unneeded result - Type samReturnType = Type.getReturnType(methodDescriptor); - convertType(implMethodReturnType, samReturnType, samReturnType); - visitInsn(samReturnType.getOpcode(Opcodes.IRETURN)); + Class samReturnClass = methodType.returnType(); + convertType(implMethodReturnClass, samReturnClass, samReturnClass); + visitInsn(getReturnOpcode(samReturnClass)); // Maxs computed by ClassWriter.COMPUTE_MAXS,these arguments ignored visitMaxs(-1, -1); visitEnd(); } - private void convertArgumentTypes(Type[] samArgumentTypes) { + private void convertArgumentTypes(MethodType samType) { int lvIndex = 0; boolean samIncludesReceiver = implIsInstanceMethod && - argTypes.length == 0; + invokedType.parameterCount() == 0; int samReceiverLength = samIncludesReceiver ? 1 : 0; if (samIncludesReceiver) { // push receiver - Type rcvrType = samArgumentTypes[0]; - Type instantiatedRcvrType = instantiatedArgumentTypes[0]; - - visitVarInsn(rcvrType.getOpcode(ILOAD), lvIndex + 1); - lvIndex += rcvrType.getSize(); - convertType(rcvrType, Type.getType(implDefiningClass), instantiatedRcvrType); + Class rcvrType = samType.parameterType(0); + visitVarInsn(getLoadOpcode(rcvrType), lvIndex + 1); + lvIndex += getParameterSize(rcvrType); + convertType(rcvrType, implDefiningClass, instantiatedMethodType.parameterType(0)); } - int argOffset = implMethodArgumentTypes.length - samArgumentTypes.length; - for (int i = samReceiverLength; i < samArgumentTypes.length; i++) { - Type argType = samArgumentTypes[i]; - Type targetType = implMethodArgumentTypes[argOffset + i]; - Type instantiatedArgType = instantiatedArgumentTypes[i]; - - visitVarInsn(argType.getOpcode(ILOAD), lvIndex + 1); - lvIndex += argType.getSize(); - convertType(argType, targetType, instantiatedArgType); + int samParametersLength = samType.parameterCount(); + int argOffset = implMethodType.parameterCount() - samParametersLength; + for (int i = samReceiverLength; i < samParametersLength; i++) { + Class argType = samType.parameterType(i); + visitVarInsn(getLoadOpcode(argType), lvIndex + 1); + lvIndex += getParameterSize(argType); + convertType(argType, implMethodType.parameterType(argOffset + i), instantiatedMethodType.parameterType(i)); } } - private void convertType(Type argType, Type targetType, Type functionalType) { - convertType(argType.getDescriptor(), - targetType.getDescriptor(), - functionalType.getDescriptor()); - } - private int invocationOpcode() throws InternalError { switch (implKind) { case MethodHandleInfo.REF_invokeStatic: @@ -459,4 +517,43 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; } } } + + static int getParameterSize(Class c) { + if (c == Void.TYPE) { + return 0; + } else if (c == Long.TYPE || c == Double.TYPE) { + return 2; + } + return 1; + } + + static int getLoadOpcode(Class c) { + if(c == Void.TYPE) { + throw new InternalError("Unexpected void type of load opcode"); + } + return ILOAD + getOpcodeOffset(c); + } + + static int getReturnOpcode(Class c) { + if(c == Void.TYPE) { + return RETURN; + } + return IRETURN + getOpcodeOffset(c); + } + + private static int getOpcodeOffset(Class c) { + if (c.isPrimitive()) { + if (c == Long.TYPE) { + return 1; + } else if (c == Float.TYPE) { + return 2; + } else if (c == Double.TYPE) { + return 3; + } + return 0; + } else { + return 4; + } + } + } diff --git a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java index 87c7923d9ba..5bea02055ef 100644 --- a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java +++ b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java @@ -29,88 +29,128 @@ import java.io.Serializable; import java.util.Arrays; /** - *

      Bootstrap methods for converting lambda expressions and method references to functional interface objects.

      + *

      Methods to facilitate the creation of simple "function objects" that + * implement one or more interfaces by delegation to a provided {@link MethodHandle}, + * possibly after type adaptation and partial evaluation of arguments. These + * methods are typically used as bootstrap methods for {@code invokedynamic} + * call sites, to support the lambda expression and method + * reference expression features of the Java Programming Language. * - *

      For every lambda expressions or method reference in the source code, there is a target type which is a - * functional interface. Evaluating a lambda expression produces an object of its target type. The mechanism for - * evaluating lambda expressions is to invoke an invokedynamic call site, which takes arguments describing the sole - * method of the functional interface and the implementation method, and returns an object (the lambda object) that - * implements the target type. Methods of the lambda object invoke the implementation method. For method - * references, the implementation method is simply the referenced method; for lambda expressions, the - * implementation method is produced by the compiler based on the body of the lambda expression. The methods in - * this file are the bootstrap methods for those invokedynamic call sites, called lambda factories, and the - * bootstrap methods responsible for linking the lambda factories are called lambda meta-factories. - * - *

      The bootstrap methods in this class take the information about the functional interface, the implementation - * method, and the static types of the captured lambda arguments, and link a call site which, when invoked, - * produces the lambda object. - * - *

      When parameterized types are used, the instantiated type of the functional interface method may be different - * from that in the functional interface. For example, consider - * {@code interface I { int m(T x); }} if this functional interface type is used in a lambda - * {@code I; v = ...}, we need both the actual functional interface method which has the signature - * {@code (Object)int} and the erased instantiated type of the functional interface method (or simply - * instantiated method type), which has signature - * {@code (Byte)int}. - * - *

      The argument list of the implementation method and the argument list of the functional interface method(s) - * may differ in several ways. The implementation methods may have additional arguments to accommodate arguments - * captured by the lambda expression; there may also be differences resulting from permitted adaptations of - * arguments, such as casting, boxing, unboxing, and primitive widening. They may also differ because of var-args, - * but this is expected to be handled by the compiler. - * - *

      Invokedynamic call sites have two argument lists: a static argument list and a dynamic argument list. The - * static argument list lives in the constant pool; the dynamic argument list lives on the operand stack at - * invocation time. The bootstrap method has access to the entire static argument list (which in this case, - * contains method handles describing the implementation method and the canonical functional interface method), - * as well as a method signature describing the number and static types (but not the values) of the dynamic - * arguments, and the static return type of the invokedynamic site. - * - *

      The implementation method is described with a method handle. In theory, any method handle could be used. - * Currently supported are method handles representing invocation of virtual, interface, constructor and static - * methods. - * - *

      Assume: + *

      Indirect access to the behavior specified by the provided {@code MethodHandle} + * proceeds in order through three phases: *

        - *
      • the functional interface method has N arguments, of types (U1, U2, ... Un) and return type Ru
      • - *
      • then the instantiated method type also has N arguments, of types (T1, T2, ... Tn) and return type Rt
      • - *
      • the implementation method has M arguments, of types (A1..Am) and return type Ra,
      • - *
      • the dynamic argument list has K arguments of types (D1..Dk), and the invokedynamic return site has - * type Rd
      • - *
      • the functional interface type is F
      • + *
      • Linkage occurs when the methods in this class are invoked. + * They take as arguments an interface to be implemented (typically a + * functional interface, one with a single abstract method), a + * name and signature of a method from that interface to be implemented, a + * method handle describing the desired implementation behavior + * for that method, and possibly other additional metadata, and produce a + * {@link CallSite} whose target can be used to create suitable function + * objects. Linkage may involve dynamically loading a new class that + * implements the target interface. The {@code CallSite} can be considered a + * "factory" for function objects and so these linkage methods are referred + * to as "metafactories".
      • + * + *
      • Capture occurs when the {@code CallSite}'s target is + * invoked, typically through an {@code invokedynamic} call site, + * producing a function object. This may occur many times for + * a single factory {@code CallSite}. Capture may involve allocation of a + * new function object, or may return an existing function object. The + * behavior {@code MethodHandle} may have additional parameters beyond those + * of the specified interface method; these are referred to as captured + * parameters, which must be provided as arguments to the + * {@code CallSite} target, and which may be early-bound to the behavior + * {@code MethodHandle}. The number of captured parameters and their types + * are determined during linkage.
      • + * + *
      • Invocation occurs when an implemented interface method + * is invoked on a function object. This may occur many times for a single + * function object. The method referenced by the behavior {@code MethodHandle} + * is invoked with the captured arguments and any additional arguments + * provided on invocation, as if by {@link MethodHandle#invoke(Object...)}.
      • *
      * - *

      The following signature invariants must hold: + *

      It is sometimes useful to restrict the set of inputs or results permitted + * at invocation. For example, when the generic interface {@code Predicate} + * is parameterized as {@code Predicate}, the input must be a + * {@code String}, even though the method to implement allows any {@code Object}. + * At linkage time, an additional {@link MethodType} parameter describes the + * "instantiated" method type; on invocation, the arguments and eventual result + * are checked against this {@code MethodType}. + * + *

      This class provides two forms of linkage methods: a standard version + * ({@link #metafactory(MethodHandles.Lookup, String, MethodType, MethodType, MethodHandle, MethodType)}) + * using an optimized protocol, and an alternate version + * {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}). + * The alternate version is a generalization of the standard version, providing + * additional control over the behavior of the generated function objects via + * flags and additional arguments. The alternate version adds the ability to + * manage the following attributes of function objects: + * *

        - *
      • Rd is a subtype of F
      • - *
      • For i=1..N, Ti is a subtype of Ui
      • - *
      • Either Rt and Ru are primitive and are the same type, or both are reference types and - * Rt is a subtype of Ru
      • - *
      • If the implementation method is a static method: - *
          - *
        • K + N = M
        • - *
        • For i=1..K, Di = Ai
        • - *
        • For i=1..N, Ti is adaptable to Aj, where j=i+k
        • - *
      • - *
      • If the implementation method is an instance method: - *
          - *
        • K + N = M + 1
        • - *
        • D1 must be a subtype of the enclosing class for the implementation method
        • - *
        • For i=2..K, Di = Aj, where j=i-1
        • - *
        • For i=1..N, Ti is adaptable to Aj, where j=i+k-1
        • - *
      • - *
      • The return type Rt is void, or the return type Ra is not void and is adaptable to Rt
      • + *
      • Bridging. It is sometimes useful to implement multiple + * variations of the method signature, involving argument or return type + * adaptation. This occurs when multiple distinct VM signatures for a method + * are logically considered to be the same method by the language. The + * flag {@code FLAG_BRIDGES} indicates that a list of additional + * {@code MethodType}s will be provided, each of which will be implemented + * by the resulting function object. These methods will share the same + * name and instantiated type.
      • + * + *
      • Multiple interfaces. If needed, more than one interface + * can be implemented by the function object. (These additional interfaces + * are typically marker interfaces with no methods.) The flag {@code FLAG_MARKERS} + * indicates that a list of additional interfaces will be provided, each of + * which should be implemented by the resulting function object.
      • + * + *
      • Serializability. The generated function objects do not + * generally support serialization. If desired, {@code FLAG_SERIALIZABLE} + * can be used to indicate that the function objects should be serializable. + * Serializable function objects will use, as their serialized form, + * instances of the class {@code SerializedLambda}, which requires additional + * assistance from the capturing class (the class described by the + * {@link MethodHandles.Lookup} parameter {@code caller}); see + * {@link SerializedLambda} for details.
      • *
      * - *

      Note that the potentially parameterized implementation return type provides the value for the SAM. Whereas - * the completely known instantiated return type is adapted to the implementation arguments. Because the - * instantiated type of the implementation method is not available, the adaptability of return types cannot be - * checked as precisely at link-time as the arguments can be checked. Thus a loose version of link-time checking is - * done on return type, while a strict version is applied to arguments. + *

      Assume the linkage arguments are as follows: + *

        + *
      • {@code invokedType} (describing the {@code CallSite} signature) has + * K parameters of types (D1..Dk) and return type Rd;
      • + *
      • {@code samMethodType} (describing the implemented method type) has N + * parameters, of types (U1..Un) and return type Ru;
      • + *
      • {@code implMethod} (the {@code MethodHandle} providing the + * implementation has M parameters, of types (A1..Am) and return type Ra + * (if the method describes an instance method, the method type of this + * method handle already includes an extra first argument corresponding to + * the receiver);
      • + *
      • {@code instantiatedMethodType} (allowing restrictions on invocation) + * has N parameters, of types (T1..Tn) and return type Rt.
      • + *
      + * + *

      Then the following linkage invariants must hold: + *

        + *
      • Rd is an interface
      • + *
      • {@code implMethod} is a direct method handle
      • + *
      • {@code samMethodType} and {@code instantiatedMethodType} have the same + * arity N, and for i=1..N, Ti and Ui are the same type, or Ti and Ui are + * both reference types and Ti is a subtype of Ui
      • + *
      • Either Rt and Ru are the same type, or both are reference types and + * Rt is a subtype of Ru
      • + *
      • K + N = M
      • + *
      • For i=1..K, Di = Ai
      • + *
      • For i=1..N, Ti is adaptable to Aj, where j=i+k
      • + *
      • The return type Rt is void, or the return type Ra is not void and is + * adaptable to Rt
      • + *
      + * + *

      Further, at capture time, if {@code implMethod} corresponds to an instance + * method, and there are any capture arguments ({@code K > 0}), then the first + * capture argument (corresponding to the receiver) must be non-null. * *

      A type Q is considered adaptable to S as follows: *

      Language Code of Locale
      - * + * * * * @@ -123,27 +163,59 @@ import java.util.Arrays; * * * - * - * + * + * * * * - * + * * * *
      QSLink-time checksCapture-time checks
      QSLink-time checksInvocation-time checks
      PrimitivePrimitiveQ can be converted to S via a primitive widening conversion
      ReferencePrimitivestrict: Q is a primitive wrapper and Primitive(Q) can be widened to S - *
      loose: If Q is a primitive wrapper, check that Primitive(Q) can be widened to S
      If Q is not a primitive wrapper, cast Q to the base Wrapper(S); for example Number for numeric typesfor parameter types: Q is a primitive wrapper and Primitive(Q) + * can be widened to S + *
      for return types: If Q is a primitive wrapper, check that + * Primitive(Q) can be widened to S
      If Q is not a primitive wrapper, cast Q to the base Wrapper(S); + * for example Number for numeric types
      ReferenceReferencestrict: S is a supertype of Q - *
      loose: none
      for parameter types: S is a supertype of Q + *
      for return types: none
      Cast from Q to S
      * - * The default bootstrap ({@link #metafactory}) represents the common cases and uses an optimized protocol. - * Alternate bootstraps (e.g., {@link #altMetafactory}) exist to support uncommon cases such as serialization - * or additional marker superinterfaces. + * @apiNote These linkage methods are designed to support the evaluation + * of lambda expressions and method references in the Java + * Language. For every lambda expressions or method reference in the source code, + * there is a target type which is a functional interface. Evaluating a lambda + * expression produces an object of its target type. The recommended mechanism + * for evaluating lambda expressions is to desugar the lambda body to a method, + * invoke an invokedynamic call site whose static argument list describes the + * sole method of the functional interface and the desugared implementation + * method, and returns an object (the lambda object) that implements the target + * type. (For method references, the implementation method is simply the + * referenced method; no desugaring is needed.) * + *

      The argument list of the implementation method and the argument list of + * the interface method(s) may differ in several ways. The implementation + * methods may have additional arguments to accommodate arguments captured by + * the lambda expression; there may also be differences resulting from permitted + * adaptations of arguments, such as casting, boxing, unboxing, and primitive + * widening. (Varargs adaptations are not handled by the metafactories; these are + * expected to be handled by the caller.) + * + *

      Invokedynamic call sites have two argument lists: a static argument list + * and a dynamic argument list. The static argument list is stored in the + * constant pool; the dynamic argument is pushed on the operand stack at capture + * time. The bootstrap method has access to the entire static argument list + * (which in this case, includes information describing the implementation method, + * the target interface, and the target interface method(s)), as well as a + * method signature describing the number and static types (but not the values) + * of the dynamic arguments and the static return type of the invokedynamic site. + * + * @implNote The implementation method is described with a method handle. In + * theory, any method handle could be used. Currently supported are direct method + * handles representing invocation of virtual, interface, constructor and static + * methods. */ public class LambdaMetafactory { - /** Flag for alternate metafactories indicating the lambda object is - * must to be serializable */ + /** Flag for alternate metafactories indicating the lambda object + * must be serializable */ public static final int FLAG_SERIALIZABLE = 1 << 0; /** @@ -163,41 +235,58 @@ public class LambdaMetafactory { private static final MethodType[] EMPTY_MT_ARRAY = new MethodType[0]; /** - * Standard meta-factory for conversion of lambda expressions or method - * references to functional interfaces. + * Facilitates the creation of simple "function objects" that implement one + * or more interfaces by delegation to a provided {@link MethodHandle}, + * after appropriate type adaptation and partial evaluation of arguments. + * Typically used as a bootstrap method for {@code invokedynamic} + * call sites, to support the lambda expression and method + * reference expression features of the Java Programming Language. * - * @param caller Stacked automatically by VM; represents a lookup context - * with the accessibility privileges of the caller. - * @param invokedName Stacked automatically by VM; the name of the invoked - * method as it appears at the call site. - * Used as the name of the functional interface method - * to which the lambda or method reference is being - * converted. - * @param invokedType Stacked automatically by VM; the signature of the - * invoked method, which includes the expected static - * type of the returned lambda object, and the static - * types of the captured arguments for the lambda. + *

      This is the standard, streamlined metafactory; additional flexibility + * is provided by {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}. + * A general description of the behavior of this method is provided + * {@link LambdaMetafactory above}. + * + *

      When the target of the {@code CallSite} returned from this method is + * invoked, the resulting function objects are instances of a class which + * implements the interface named by the return type of {@code invokedType}, + * declares a method with the name given by {@code invokedName} and the + * signature given by {@code samMethodType}. It may also override additional + * methods from {@code Object}. + * + * @param caller Represents a lookup context with the accessibility + * privileges of the caller. When used with {@code invokedynamic}, + * this is stacked automatically by the VM. + * @param invokedName The name of the method to implement. When used with + * {@code invokedynamic}, this is provided by the + * {@code NameAndType} of the {@code InvokeDynamic} + * structure and is stacked automatically by the VM. + * @param invokedType The expected signature of the {@code CallSite}. The + * parameter types represent the types of capture variables; + * the return type is the interface to implement. When + * used with {@code invokedynamic}, this is provided by + * the {@code NameAndType} of the {@code InvokeDynamic} + * structure and is stacked automatically by the VM. * In the event that the implementation method is an - * instance method, the first argument in the invocation - * signature will correspond to the receiver. - * @param samMethodType MethodType of the method in the functional interface - * to which the lambda or method reference is being - * converted, represented as a MethodType. - * @param implMethod The implementation method which should be called - * (with suitable adaptation of argument types, return - * types, and adjustment for captured arguments) when - * methods of the resulting functional interface instance - * are invoked. - * @param instantiatedMethodType The signature of the primary functional - * interface method after type variables - * are substituted with their instantiation - * from the capture site - * @return a CallSite, which, when invoked, will return an instance of the - * functional interface - * @throws ReflectiveOperationException if the caller is not able to - * reconstruct one of the method handles - * @throws LambdaConversionException If any of the meta-factory protocol - * invariants are violated + * instance method and this signature has any parameters, + * the first parameter in the invocation signature must + * correspond to the receiver. + * @param samMethodType Signature and return type of method to be implemented + * by the function object. + * @param implMethod A direct method handle describing the implementation + * method which should be called (with suitable adaptation + * of argument types, return types, and with captured + * arguments prepended to the invocation arguments) at + * invocation time. + * @param instantiatedMethodType The signature and return type that should + * be enforced dynamically at invocation time. + * This may be the same as {@code samMethodType}, + * or may be a specialization of it. + * @return a CallSite whose target can be used to perform capture, generating + * instances of the interface named by {@code invokedType} + * @throws LambdaConversionException If any of the linkage invariants + * described {@link LambdaMetafactory above} + * are violated */ public static CallSite metafactory(MethodHandles.Lookup caller, String invokedName, @@ -205,7 +294,7 @@ public class LambdaMetafactory { MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType) - throws ReflectiveOperationException, LambdaConversionException { + throws LambdaConversionException { AbstractValidatingLambdaMetafactory mf; mf = new InnerClassLambdaMetafactory(caller, invokedType, invokedName, samMethodType, @@ -216,60 +305,128 @@ public class LambdaMetafactory { } /** - * Alternate meta-factory for conversion of lambda expressions or method - * references to functional interfaces, which supports serialization and - * other uncommon options. + * Facilitates the creation of simple "function objects" that implement one + * or more interfaces by delegation to a provided {@link MethodHandle}, + * after appropriate type adaptation and partial evaluation of arguments. + * Typically used as a bootstrap method for {@code invokedynamic} + * call sites, to support the lambda expression and method + * reference expression features of the Java Programming Language. * - * The declared argument list for this method is: + *

      This is the general, more flexible metafactory; a streamlined version + * is provided by {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}. + * A general description of the behavior of this method is provided + * {@link LambdaMetafactory above}. * + *

      The argument list for this method includes three fixed parameters, + * corresponding to the parameters automatically stacked by the VM for the + * bootstrap method in an {@code invokedynamic} invocation, and an {@code Object[]} + * parameter that contains additional parameters. The declared argument + * list for this method is: + * + *

      {@code
            *  CallSite altMetafactory(MethodHandles.Lookup caller,
            *                          String invokedName,
            *                          MethodType invokedType,
            *                          Object... args)
      +     * }
      * - * but it behaves as if the argument list is: + *

      but it behaves as if the argument list is as follows: * + *

      {@code
            *  CallSite altMetafactory(MethodHandles.Lookup caller,
            *                          String invokedName,
            *                          MethodType invokedType,
      -     *                          MethodType samMethodType
      +     *                          MethodType samMethodType,
            *                          MethodHandle implMethod,
            *                          MethodType instantiatedMethodType,
            *                          int flags,
      -     *                          int markerInterfaceCount, // IF flags has MARKERS set
      -     *                          Class... markerInterfaces // IF flags has MARKERS set
      -     *                          int bridgeCount,          // IF flags has BRIDGES set
      -     *                          MethodType... bridges     // IF flags has BRIDGES set
      +     *                          int markerInterfaceCount,  // IF flags has MARKERS set
      +     *                          Class... markerInterfaces, // IF flags has MARKERS set
      +     *                          int bridgeCount,           // IF flags has BRIDGES set
      +     *                          MethodType... bridges      // IF flags has BRIDGES set
            *                          )
      +     * }
      * + *

      Arguments that appear in the argument list for + * {@link #metafactory(MethodHandles.Lookup, String, MethodType, MethodType, MethodHandle, MethodType)} + * have the same specification as in that method. The additional arguments + * are interpreted as follows: + *

        + *
      • {@code flags} indicates additional options; this is a bitwise + * OR of desired flags. Defined flags are {@link #FLAG_BRIDGES}, + * {@link #FLAG_MARKERS}, and {@link #FLAG_SERIALIZABLE}.
      • + *
      • {@code markerInterfaceCount} is the number of additional interfaces + * the function object should implement, and is present if and only if the + * {@code FLAG_MARKERS} flag is set.
      • + *
      • {@code markerInterfaces} is a variable-length list of additional + * interfaces to implement, whose length equals {@code markerInterfaceCount}, + * and is present if and only if the {@code FLAG_MARKERS} flag is set.
      • + *
      • {@code bridgeCount} is the number of additional method signatures + * the function object should implement, and is present if and only if + * the {@code FLAG_BRIDGES} flag is set.
      • + *
      • {@code bridges} is a variable-length list of additional + * methods signatures to implement, whose length equals {@code bridgeCount}, + * and is present if and only if the {@code FLAG_BRIDGES} flag is set.
      • + *
      * - * @param caller Stacked automatically by VM; represents a lookup context - * with the accessibility privileges of the caller. - * @param invokedName Stacked automatically by VM; the name of the invoked - * method as it appears at the call site. - * Used as the name of the functional interface method - * to which the lambda or method reference is being - * converted. - * @param invokedType Stacked automatically by VM; the signature of the - * invoked method, which includes the expected static - * type of the returned lambda object, and the static - * types of the captured arguments for the lambda. + *

      Each class named by {@code markerInterfaces} is subject to the same + * restrictions as {@code Rd}, the return type of {@code invokedType}, + * as described {@link LambdaMetafactory above}. Each {@code MethodType} + * named by {@code bridges} is subject to the same restrictions as + * {@code samMethodType}, as described {@link LambdaMetafactory above}. + * + *

      When FLAG_SERIALIZABLE is set in {@code flags}, the function objects + * will implement {@code Serializable}, and will have a {@code writeReplace} + * method that returns an appropriate {@link SerializedLambda}. The + * {@code caller} class must have an appropriate {@code $deserializeLambda$} + * method, as described in {@link SerializedLambda}. + * + *

      When the target of the {@code CallSite} returned from this method is + * invoked, the resulting function objects are instances of a class with + * the following properties: + *

        + *
      • The class implements the interface named by the return type + * of {@code invokedType} and any interfaces named by {@code markerInterfaces}
      • + *
      • The class declares methods with the name given by {@code invokedName}, + * and the signature given by {@code samMethodType} and additional signatures + * given by {@code bridges}
      • + *
      • The class may override methods from {@code Object}, and may + * implement methods related to serialization.
      • + *
      + * + * @param caller Represents a lookup context with the accessibility + * privileges of the caller. When used with {@code invokedynamic}, + * this is stacked automatically by the VM. + * @param invokedName The name of the method to implement. When used with + * {@code invokedynamic}, this is provided by the + * {@code NameAndType} of the {@code InvokeDynamic} + * structure and is stacked automatically by the VM. + * @param invokedType The expected signature of the {@code CallSite}. The + * parameter types represent the types of capture variables; + * the return type is the interface to implement. When + * used with {@code invokedynamic}, this is provided by + * the {@code NameAndType} of the {@code InvokeDynamic} + * structure and is stacked automatically by the VM. * In the event that the implementation method is an - * instance method, the first argument in the invocation - * signature will correspond to the receiver. - * @param args flags and optional arguments, as described above - * @return a CallSite, which, when invoked, will return an instance of the - * functional interface - * @throws ReflectiveOperationException if the caller is not able to - * reconstruct one of the method handles - * @throws LambdaConversionException If any of the meta-factory protocol - * invariants are violated + * instance method and this signature has any parameters, + * the first parameter in the invocation signature must + * correspond to the receiver. + * @param args An {@code Object[]} array containing the required + * arguments {@code samMethodType}, {@code implMethod}, + * {@code instantiatedMethodType}, {@code flags}, and any + * optional arguments, as described + * {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)} above} + * @return a CallSite whose target can be used to perform capture, generating + * instances of the interface named by {@code invokedType} + * @throws LambdaConversionException If any of the linkage invariants + * described {@link LambdaMetafactory above} + * are violated */ public static CallSite altMetafactory(MethodHandles.Lookup caller, String invokedName, MethodType invokedType, Object... args) - throws ReflectiveOperationException, LambdaConversionException { + throws LambdaConversionException { MethodType samMethodType = (MethodType)args[0]; MethodHandle implMethod = (MethodHandle)args[1]; MethodType instantiatedMethodType = (MethodType)args[2]; @@ -294,15 +451,15 @@ public class LambdaMetafactory { else bridges = EMPTY_MT_ARRAY; - boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(invokedType.returnType()); - for (Class c : markerInterfaces) - foundSerializableSupertype |= Serializable.class.isAssignableFrom(c); - boolean isSerializable = ((flags & LambdaMetafactory.FLAG_SERIALIZABLE) != 0) - || foundSerializableSupertype; - - if (isSerializable && !foundSerializableSupertype) { - markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1); - markerInterfaces[markerInterfaces.length-1] = Serializable.class; + boolean isSerializable = ((flags & FLAG_SERIALIZABLE) != 0); + if (isSerializable) { + boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(invokedType.returnType()); + for (Class c : markerInterfaces) + foundSerializableSupertype |= Serializable.class.isAssignableFrom(c); + if (!foundSerializableSupertype) { + markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1); + markerInterfaces[markerInterfaces.length-1] = Serializable.class; + } } AbstractValidatingLambdaMetafactory mf diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java index 56cb245e6ae..fd5cac8cd7b 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java @@ -441,8 +441,13 @@ class MethodHandleNatives { assert(refKindIsValid(refKind)); return lookup.linkMethodHandleConstant((byte) refKind, defc, name, type); } catch (IllegalAccessException ex) { - Error err = new IllegalAccessError(ex.getMessage()); - throw initCauseFrom(err, ex); + Throwable cause = ex.getCause(); + if (cause instanceof AbstractMethodError) { + throw (AbstractMethodError) cause; + } else { + Error err = new IllegalAccessError(ex.getMessage()); + throw initCauseFrom(err, ex); + } } catch (NoSuchMethodException ex) { Error err = new NoSuchMethodError(ex.getMessage()); throw initCauseFrom(err, ex); diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java index 1ad7e9cd23f..57a6f785164 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java @@ -1716,6 +1716,13 @@ return mh1; checkSymbolicClass(defc); return mh; } + // Treat MethodHandle.invoke and invokeExact specially. + if (defc == MethodHandle.class && refKind == REF_invokeVirtual) { + mh = findVirtualForMH(member.getName(), member.getMethodType()); + if (mh != null) { + return mh; + } + } MemberName resolved = resolveOrFail(refKind, member); mh = getDirectMethodForConstant(refKind, defc, resolved); if (mh instanceof DirectMethodHandle @@ -1768,12 +1775,6 @@ return mh1; if (MethodHandleNatives.refKindIsField(refKind)) { return getDirectFieldNoSecurityManager(refKind, defc, member); } else if (MethodHandleNatives.refKindIsMethod(refKind)) { - if (defc == MethodHandle.class && refKind == REF_invokeVirtual) { - MethodHandle mh = findVirtualForMH(member.getName(), member.getMethodType()); - if (mh != null) { - return mh; - } - } return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass); } else if (refKind == REF_newInvokeSpecial) { return getDirectConstructorNoSecurityManager(defc, member); diff --git a/jdk/src/share/classes/java/lang/invoke/MethodType.java b/jdk/src/share/classes/java/lang/invoke/MethodType.java index f8e0967c7af..cfef437cda6 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodType.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java @@ -813,7 +813,7 @@ class MethodType implements java.io.Serializable { * So this method returns {@link #parameterCount() parameterCount} plus the * number of long and double parameters (if any). *

      - * This method is included for the benfit of applications that must + * This method is included for the benefit of applications that must * generate bytecodes that process method handles and invokedynamic. * @return the number of JVM stack slots for this type's parameters */ @@ -844,7 +844,7 @@ class MethodType implements java.io.Serializable { * plus the number of long or double arguments * at or after after the argument for the given parameter. *

      - * This method is included for the benfit of applications that must + * This method is included for the benefit of applications that must * generate bytecodes that process method handles and invokedynamic. * @param num an index (zero-based, inclusive) within the parameter types * @return the index of the (shallowest) JVM stack slot transmitting the @@ -862,7 +862,7 @@ class MethodType implements java.io.Serializable { * If the {@link #returnType() return type} is void, it will be zero, * else if the return type is long or double, it will be two, else one. *

      - * This method is included for the benfit of applications that must + * This method is included for the benefit of applications that must * generate bytecodes that process method handles and invokedynamic. * @return the number of JVM stack slots (0, 1, or 2) for this type's return value * Will be removed for PFD. @@ -882,7 +882,7 @@ class MethodType implements java.io.Serializable { * constructed by this method, because their component types are * not all reachable from a common class loader. *

      - * This method is included for the benfit of applications that must + * This method is included for the benefit of applications that must * generate bytecodes that process method handles and {@code invokedynamic}. * @param descriptor a bytecode-level type descriptor string "(T...)T" * @param loader the class loader in which to look up the types @@ -912,7 +912,7 @@ class MethodType implements java.io.Serializable { * Two distinct classes which share a common name but have different class loaders * will appear identical when viewed within descriptor strings. *

      - * This method is included for the benfit of applications that must + * This method is included for the benefit of applications that must * generate bytecodes that process method handles and {@code invokedynamic}. * {@link #fromMethodDescriptorString(java.lang.String, java.lang.ClassLoader) fromMethodDescriptorString}, * because the latter requires a suitable class loader argument. diff --git a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java index 9be96ff685b..e6412012721 100644 --- a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java +++ b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java @@ -32,9 +32,26 @@ import java.security.PrivilegedExceptionAction; import java.util.Objects; /** - * Serialized form of a lambda expression. The properties of this class represent the information that is present - * at the lambda factory site, including the identity of the primary functional interface method, the identity of the - * implementation method, and any variables captured from the local environment at the time of lambda capture. + * Serialized form of a lambda expression. The properties of this class + * represent the information that is present at the lambda factory site, including + * static metafactory arguments such as the identity of the primary functional + * interface method and the identity of the implementation method, as well as + * dynamic metafactory arguments such as values captured from the lexical scope + * at the time of lambda capture. + * + *

      Implementors of serializable lambdas, such as compilers or language + * runtime libraries, are expected to ensure that instances deserialize properly. + * One means to do so is to ensure that the {@code writeReplace} method returns + * an instance of {@code SerializedLambda}, rather than allowing default + * serialization to proceed. + * + *

      {@code SerializedLambda} has a {@code readResolve} method that looks for + * a (possibly private) static method called + * {@code $deserializeLambda$(SerializedLambda)} in the capturing class, invokes + * that with itself as the first argument, and returns the result. Lambda classes + * implementing {@code $deserializeLambda$} are responsible for validating + * that the properties of the {@code SerializedLambda} are consistent with a + * lambda actually captured by that class. * * @see LambdaMetafactory */ diff --git a/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java b/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java index 3aa63c84ae7..f65049df036 100644 --- a/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java +++ b/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java @@ -28,6 +28,7 @@ package java.lang.invoke; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.Type; +import sun.invoke.util.BytecodeDescriptor; import sun.invoke.util.Wrapper; import static sun.invoke.util.Wrapper.*; @@ -204,27 +205,27 @@ class TypeConvertingMethodAdapter extends MethodVisitor { } /** - * Convert an argument of type 'argType' to be passed to 'targetType' assuring that it is 'functionalType'. + * Convert an argument of type 'arg' to be passed to 'target' assuring that it is 'functional'. * Insert the needed conversion instructions in the method code. - * @param argType - * @param targetType - * @param functionalType + * @param arg + * @param target + * @param functional */ - void convertType(String dArg, String dTarget, String dFunctional) { - if (dArg.equals(dTarget)) { + void convertType(Class arg, Class target, Class functional) { + if (arg.equals(target)) { return; } - Wrapper wArg = toWrapper(dArg); - Wrapper wTarget = toWrapper(dTarget); - if (wArg == VOID || wTarget == VOID) { + if (arg == Void.TYPE || target == Void.TYPE) { return; } - if (isPrimitive(wArg)) { - if (isPrimitive(wTarget)) { + if (arg.isPrimitive()) { + Wrapper wArg = Wrapper.forPrimitiveType(arg); + if (target.isPrimitive()) { // Both primitives: widening - widen(wArg, wTarget); + widen(wArg, Wrapper.forPrimitiveType(target)); } else { // Primitive argument to reference target + String dTarget = BytecodeDescriptor.unparse(target); Wrapper wPrimTarget = wrapperOrNullFromDescriptor(dTarget); if (wPrimTarget != null) { // The target is a boxed primitive type, widen to get there before boxing @@ -237,16 +238,18 @@ class TypeConvertingMethodAdapter extends MethodVisitor { } } } else { + String dArg = BytecodeDescriptor.unparse(arg); String dSrc; - Wrapper wFunctional = toWrapper(dFunctional); - if (isPrimitive(wFunctional)) { + if (functional.isPrimitive()) { dSrc = dArg; } else { // Cast to convert to possibly more specific type, and generate CCE for invalid arg - dSrc = dFunctional; - cast(dArg, dFunctional); + dSrc = BytecodeDescriptor.unparse(functional); + cast(dArg, dSrc); } - if (isPrimitive(wTarget)) { + String dTarget = BytecodeDescriptor.unparse(target); + if (target.isPrimitive()) { + Wrapper wTarget = toWrapper(dTarget); // Reference argument to primitive target Wrapper wps = wrapperOrNullFromDescriptor(dSrc); if (wps != null) { diff --git a/jdk/src/share/classes/java/lang/management/CompilationMXBean.java b/jdk/src/share/classes/java/lang/management/CompilationMXBean.java index 693beae1a01..bc411ed00ab 100644 --- a/jdk/src/share/classes/java/lang/management/CompilationMXBean.java +++ b/jdk/src/share/classes/java/lang/management/CompilationMXBean.java @@ -74,7 +74,7 @@ public interface CompilationMXBean extends PlatformManagedObject { public boolean isCompilationTimeMonitoringSupported(); /** - * Returns the approximate accumlated elapsed time (in milliseconds) + * Returns the approximate accumulated elapsed time (in milliseconds) * spent in compilation. * If multiple threads are used for compilation, this value is * summation of the approximate time that each thread spent in compilation. diff --git a/jdk/src/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/share/classes/java/lang/management/ManagementFactory.java index 6e00706ccd0..0c7297abe95 100644 --- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java @@ -60,7 +60,7 @@ import sun.management.ManagementFactoryHelper; * one or more platform MXBeans representing * the management interface of a component of the Java virtual * machine. - *

      + * *

      Platform MXBeans

      *

      * A platform MXBean is a managed bean that diff --git a/jdk/src/share/classes/java/lang/management/ManagementPermission.java b/jdk/src/share/classes/java/lang/management/ManagementPermission.java index 7f62c5e396a..ae3dc564518 100644 --- a/jdk/src/share/classes/java/lang/management/ManagementPermission.java +++ b/jdk/src/share/classes/java/lang/management/ManagementPermission.java @@ -33,10 +33,8 @@ package java.lang.management; * The following table * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. - *

      * - * + *
      * * * diff --git a/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java b/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java index 82aa1fcda87..ae0b97cbc85 100644 --- a/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java +++ b/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java @@ -147,7 +147,7 @@ package java.lang.management; * by calling either the {@link #getUsage} method for all * memory pools or the {@link #isUsageThresholdExceeded} method * for those memory pools that support a usage threshold. - * Below is example code that has a thread delicated for + * Below is example code that has a thread dedicated for * task distribution and processing. At every interval, * it will determine if it should receive and process new tasks based * on its memory usage. If the memory usage exceeds its usage threshold, @@ -191,7 +191,7 @@ package java.lang.management; *
      * The above example does not differentiate the case where * the memory usage has temporarily dropped below the usage threshold - * from the case where the memory usage remains above the threshould + * from the case where the memory usage remains above the threshold * between two iterations. The usage threshold count returned by * the {@link #getUsageThresholdCount} method * can be used to determine diff --git a/jdk/src/share/classes/java/lang/management/MemoryUsage.java b/jdk/src/share/classes/java/lang/management/MemoryUsage.java index bbb75a26484..6d11e323f6d 100644 --- a/jdk/src/share/classes/java/lang/management/MemoryUsage.java +++ b/jdk/src/share/classes/java/lang/management/MemoryUsage.java @@ -79,7 +79,7 @@ import sun.management.MemoryUsageCompositeData; *
      Permission Target NameWhat the Permission Allows
      * * Below is a picture showing an example of a memory pool: - *

      + * *

        *        +----------------------------------------------+
        *        +////////////////           |                  +
      @@ -250,7 +250,7 @@ public class MemoryUsage {
            * Returns a MemoryUsage object represented by the
            * given CompositeData. The given CompositeData
            * must contain the following attributes:
      -     * 

      + * *

      * * diff --git a/jdk/src/share/classes/java/lang/management/ThreadInfo.java b/jdk/src/share/classes/java/lang/management/ThreadInfo.java index e6f80b2eb23..b1028f31488 100644 --- a/jdk/src/share/classes/java/lang/management/ThreadInfo.java +++ b/jdk/src/share/classes/java/lang/management/ThreadInfo.java @@ -492,7 +492,7 @@ public class ThreadInfo { * @return the thread ID of the owner thread of the object * this thread is blocked on; * -1 if this thread is not blocked - * or if the object lis not owned by any thread. + * or if the object is not owned by any thread. * * @see #getLockInfo */ diff --git a/jdk/src/share/classes/java/lang/management/ThreadMXBean.java b/jdk/src/share/classes/java/lang/management/ThreadMXBean.java index 02a87dcf6d3..521ca7fe6dd 100644 --- a/jdk/src/share/classes/java/lang/management/ThreadMXBean.java +++ b/jdk/src/share/classes/java/lang/management/ThreadMXBean.java @@ -646,7 +646,7 @@ public interface ThreadMXBean extends PlatformManagedObject { * exists and the caller does not have * ManagementPermission("monitor"). * @throws java.lang.UnsupportedOperationException if the Java virtual - * machine does not support monitoriing of ownable synchronizer usage. + * machine does not support monitoring of ownable synchronizer usage. * * @see #isSynchronizerUsageSupported * @see #findMonitorDeadlockedThreads diff --git a/jdk/src/share/classes/java/lang/management/package.html b/jdk/src/share/classes/java/lang/management/package.html index 7d2fa99b737..c2c74d0ccdd 100644 --- a/jdk/src/share/classes/java/lang/management/package.html +++ b/jdk/src/share/classes/java/lang/management/package.html @@ -82,7 +82,7 @@ Java virtual machine and the runtime in the following ways: 1. Direct access to an MXBean interface

        -
      • Get an MXBean instance locally in the running Java virtual machine:

        +

      • Get an MXBean instance locally in the running Java virtual machine:
            RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
         
        @@ -103,7 +103,7 @@ Java virtual machine and the runtime in the following ways:
         

      • Construct an MXBean proxy instance that forwards the - method calls to a given MBeanServer:

        + method calls to a given MBeanServer:

            MBeanServerConnection mbs;
         
        diff --git a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java
        index 50a7e6af904..f169202132a 100644
        --- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java
        +++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java
        @@ -27,6 +27,15 @@ package java.lang.reflect;
         
         import java.lang.annotation.Annotation;
         import java.lang.annotation.AnnotationFormatError;
        +import java.lang.annotation.Repeatable;
        +import java.util.Arrays;
        +import java.util.LinkedHashMap;
        +import java.util.Map;
        +import java.util.Objects;
        +import java.util.function.Function;
        +import java.util.stream.Collectors;
        +import sun.reflect.annotation.AnnotationSupport;
        +import sun.reflect.annotation.AnnotationType;
         
         /**
          * Represents an annotated element of the program currently running in this
        @@ -222,6 +231,18 @@ public interface AnnotatedElement {
              * The caller of this method is free to modify the returned array; it will
              * have no effect on the arrays returned to other callers.
              *
        +     * @implSpec The default implementation first calls {@link
        +     * #getDeclaredAnnotationsByType(Class)} passing {@code
        +     * annotationClass} as the argument. If the returned array has
        +     * length greater than zero, the array is returned. If the returned
        +     * array is zero-length and this {@code AnnotatedElement} is a
        +     * class and the argument type is an inheritable annotation type,
        +     * and the superclass of this {@code AnnotatedElement} is non-null,
        +     * then the returned result is the result of calling {@link
        +     * #getAnnotationsByType(Class)} on the superclass with {@code
        +     * annotationClass} as the argument. Otherwise, a zero-length
        +     * array is returned.
        +     *
              * @param  the type of the annotation to query for and return if present
              * @param annotationClass the Class object corresponding to the
              *        annotation type
        @@ -230,7 +251,29 @@ public interface AnnotatedElement {
              * @throws NullPointerException if the given annotation class is null
              * @since 1.8
              */
        -     T[] getAnnotationsByType(Class annotationClass);
        +    default  T[] getAnnotationsByType(Class annotationClass) {
        +         /*
        +          * Definition of associated: directly or indirectly present OR
        +          * neither directly nor indirectly present AND the element is
        +          * a Class, the annotation type is inheritable, and the
        +          * annotation type is associated with the superclass of the
        +          * element.
        +          */
        +         T[] result = getDeclaredAnnotationsByType(annotationClass);
        +
        +         if (result.length == 0 && // Neither directly nor indirectly present
        +             this instanceof Class && // the element is a class
        +             AnnotationType.getInstance(annotationClass).isInherited()) { // Inheritable
        +             Class superClass = ((Class) this).getSuperclass();
        +             if (superClass != null) {
        +                 // Determine if the annotation is associated with the
        +                 // superclass
        +                 result = superClass.getAnnotationsByType(annotationClass);
        +             }
        +         }
        +
        +         return result;
        +     }
         
             /**
              * Returns this element's annotation for the specified type if
        @@ -239,6 +282,11 @@ public interface AnnotatedElement {
              * This method ignores inherited annotations. (Returns null if no
              * annotations are directly present on this element.)
              *
        +     * @implSpec The default implementation first performs a null check
        +     * and then loops over the results of {@link
        +     * #getDeclaredAnnotations} returning the first annotation whose
        +     * annotation type matches the argument type.
        +     *
              * @param  the type of the annotation to query for and return if directly present
              * @param annotationClass the Class object corresponding to the
              *        annotation type
        @@ -247,7 +295,18 @@ public interface AnnotatedElement {
              * @throws NullPointerException if the given annotation class is null
              * @since 1.8
              */
        -     T getDeclaredAnnotation(Class annotationClass);
        +    default  T getDeclaredAnnotation(Class annotationClass) {
        +         Objects.requireNonNull(annotationClass);
        +         // Loop over all directly-present annotations looking for a matching one
        +         for (Annotation annotation : getDeclaredAnnotations()) {
        +             if (annotationClass.equals(annotation.annotationType())) {
        +                 // More robust to do a dynamic cast at runtime instead
        +                 // of compile-time only.
        +                 return annotationClass.cast(annotation);
        +             }
        +         }
        +         return null;
        +     }
         
             /**
              * Returns this element's annotation(s) for the specified type if
        @@ -268,6 +327,22 @@ public interface AnnotatedElement {
              * The caller of this method is free to modify the returned array; it will
              * have no effect on the arrays returned to other callers.
              *
        +     * @implSpec The default implementation may call {@link
        +     * #getDeclaredAnnotation(Class)} one or more times to find a
        +     * directly present annotation and, if the annotation type is
        +     * repeatable, to find a container annotation. If annotations of
        +     * the annotation type {@code annotationClass} are found to be both
        +     * directly and indirectly present, then {@link
        +     * #getDeclaredAnnotations()} will get called to determine the
        +     * order of the elements in the returned array.
        +     *
        +     * 

        Alternatively, the default implementation may call {@link + * #getDeclaredAnnotations()} a single time and the returned array + * examined for both directly and indirectly present + * annotations. The results of calling {@link + * #getDeclaredAnnotations()} are assumed to be consistent with the + * results of calling {@link #getDeclaredAnnotation(Class)}. + * * @param the type of the annotation to query for and return * if directly or indirectly present * @param annotationClass the Class object corresponding to the @@ -277,7 +352,16 @@ public interface AnnotatedElement { * @throws NullPointerException if the given annotation class is null * @since 1.8 */ - T[] getDeclaredAnnotationsByType(Class annotationClass); + default T[] getDeclaredAnnotationsByType(Class annotationClass) { + Objects.requireNonNull(annotationClass); + return AnnotationSupport. + getDirectlyAndIndirectlyPresent(Arrays.stream(getDeclaredAnnotations()). + collect(Collectors.toMap(Annotation::annotationType, + Function.identity(), + ((first,second) -> first), + LinkedHashMap::new)), + annotationClass); + } /** * Returns annotations that are directly present on this element. diff --git a/jdk/src/share/classes/java/lang/reflect/Constructor.java b/jdk/src/share/classes/java/lang/reflect/Constructor.java index 202a7368fb1..d852fcd1741 100644 --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java @@ -28,6 +28,8 @@ package java.lang.reflect; import sun.reflect.CallerSensitive; import sun.reflect.ConstructorAccessor; import sun.reflect.Reflection; +import sun.reflect.annotation.TypeAnnotation; +import sun.reflect.annotation.TypeAnnotationParser; import sun.reflect.generics.repository.ConstructorRepository; import sun.reflect.generics.factory.CoreReflectionFactory; import sun.reflect.generics.factory.GenericsFactory; @@ -534,4 +536,22 @@ public final class Constructor extends Executable { public AnnotatedType getAnnotatedReturnType() { return getAnnotatedReturnType0(getDeclaringClass()); } + + /** + * {@inheritDoc} + * @since 1.8 + */ + @Override + public AnnotatedType getAnnotatedReceiverType() { + if (getDeclaringClass().getEnclosingClass() == null) + return super.getAnnotatedReceiverType(); + + return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(), + sun.misc.SharedSecrets.getJavaLangAccess(). + getConstantPool(getDeclaringClass()), + this, + getDeclaringClass(), + getDeclaringClass().getEnclosingClass(), + TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER); + } } diff --git a/jdk/src/share/classes/java/lang/reflect/Executable.java b/jdk/src/share/classes/java/lang/reflect/Executable.java index c92c9a57f78..d033e7e9300 100644 --- a/jdk/src/share/classes/java/lang/reflect/Executable.java +++ b/jdk/src/share/classes/java/lang/reflect/Executable.java @@ -383,7 +383,7 @@ public abstract class Executable extends AccessibleObject private transient volatile Parameter[] parameters; private native Parameter[] getParameters0(); - private native byte[] getTypeAnnotationBytes0(); + native byte[] getTypeAnnotationBytes0(); // Needed by reflectaccess byte[] getTypeAnnotationBytes() { @@ -527,7 +527,7 @@ public abstract class Executable extends AccessibleObject public T[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** diff --git a/jdk/src/share/classes/java/lang/reflect/Field.java b/jdk/src/share/classes/java/lang/reflect/Field.java index e84b6b242d3..6e243bc82b6 100644 --- a/jdk/src/share/classes/java/lang/reflect/Field.java +++ b/jdk/src/share/classes/java/lang/reflect/Field.java @@ -1123,7 +1123,7 @@ class Field extends AccessibleObject implements Member { public T[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** diff --git a/jdk/src/share/classes/java/lang/reflect/Parameter.java b/jdk/src/share/classes/java/lang/reflect/Parameter.java index 2285819c27b..d8c992c15bd 100644 --- a/jdk/src/share/classes/java/lang/reflect/Parameter.java +++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java @@ -295,7 +295,7 @@ public final class Parameter implements AnnotatedElement { public T[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** diff --git a/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java b/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java index 6570e792242..2674de47caa 100644 --- a/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java +++ b/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java @@ -31,7 +31,6 @@ package java.lang.reflect; * The following table * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. - *

        * *

      * diff --git a/jdk/src/share/classes/java/math/BigInteger.java b/jdk/src/share/classes/java/math/BigInteger.java index f7878ab3302..5fab7443295 100644 --- a/jdk/src/share/classes/java/math/BigInteger.java +++ b/jdk/src/share/classes/java/math/BigInteger.java @@ -97,6 +97,21 @@ import sun.misc.FloatConsts; * {@code NullPointerException} when passed * a null object reference for any input parameter. * + * BigInteger must support values in the range + * -2{@code Integer.MAX_VALUE} (exclusive) to + * +2{@code Integer.MAX_VALUE} (exclusive) + * and may support values outside of that range. + * + * The range of probable prime values is limited and may be less than + * the full supported positive range of {@code BigInteger}. + * The range must be at least 1 to 2500000000. + * + * @implNote + * BigInteger constructors and operations throw {@code ArithmeticException} when + * the result is out of the supported range of + * -2{@code Integer.MAX_VALUE} (exclusive) to + * +2{@code Integer.MAX_VALUE} (exclusive). + * * @see BigDecimal * @author Josh Bloch * @author Michael McCloskey @@ -182,6 +197,18 @@ public class BigInteger extends Number implements Comparable { */ final static long LONG_MASK = 0xffffffffL; + /** + * This constant limits {@code mag.length} of BigIntegers to the supported + * range. + */ + private static final int MAX_MAG_LENGTH = Integer.MAX_VALUE / Integer.SIZE + 1; // (1 << 26) + + /** + * Bit lengths larger than this constant can cause overflow in searchLen + * calculation and in BitSieve.singleSearch method. + */ + private static final int PRIME_SEARCH_BIT_LENGTH_LIMIT = 500000000; + /** * The threshold value for using Karatsuba multiplication. If the number * of ints in both mag arrays are greater than this number, then @@ -256,6 +283,9 @@ public class BigInteger extends Number implements Comparable { mag = stripLeadingZeroBytes(val); signum = (mag.length == 0 ? 0 : 1); } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -275,6 +305,9 @@ public class BigInteger extends Number implements Comparable { mag = trustedStripLeadingZeroInts(val); signum = (mag.length == 0 ? 0 : 1); } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -306,6 +339,9 @@ public class BigInteger extends Number implements Comparable { throw(new NumberFormatException("signum-magnitude mismatch")); this.signum = signum; } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -327,6 +363,9 @@ public class BigInteger extends Number implements Comparable { throw(new NumberFormatException("signum-magnitude mismatch")); this.signum = signum; } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -359,17 +398,20 @@ public class BigInteger extends Number implements Comparable { int sign = 1; int index1 = val.lastIndexOf('-'); int index2 = val.lastIndexOf('+'); - if ((index1 + index2) <= -1) { - // No leading sign character or at most one leading sign character - if (index1 == 0 || index2 == 0) { - cursor = 1; - if (len == 1) - throw new NumberFormatException("Zero length BigInteger"); + if (index1 >= 0) { + if (index1 != 0 || index2 >= 0) { + throw new NumberFormatException("Illegal embedded sign character"); } - if (index1 == 0) - sign = -1; - } else - throw new NumberFormatException("Illegal embedded sign character"); + sign = -1; + cursor = 1; + } else if (index2 >= 0) { + if (index2 != 0) { + throw new NumberFormatException("Illegal embedded sign character"); + } + cursor = 1; + } + if (cursor == len) + throw new NumberFormatException("Zero length BigInteger"); // Skip leading zeros and compute number of digits in magnitude while (cursor < len && @@ -388,8 +430,11 @@ public class BigInteger extends Number implements Comparable { // Pre-allocate array of expected size. May be too large but can // never be too small. Typically exact. - int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1); - int numWords = (numBits + 31) >>> 5; + long numBits = ((numDigits * bitsPerDigit[radix]) >>> 10) + 1; + if (numBits + 31 >= (1L << 32)) { + reportOverflow(); + } + int numWords = (int) (numBits + 31) >>> 5; int[] magnitude = new int[numWords]; // Process first (potentially short) digit group @@ -413,6 +458,9 @@ public class BigInteger extends Number implements Comparable { } // Required for cases where the array was overallocated. mag = trustedStripLeadingZeroInts(magnitude); + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /* @@ -439,8 +487,11 @@ public class BigInteger extends Number implements Comparable { if (len < 10) { numWords = 1; } else { - int numBits = (int)(((numDigits * bitsPerDigit[10]) >>> 10) + 1); - numWords = (numBits + 31) >>> 5; + long numBits = ((numDigits * bitsPerDigit[10]) >>> 10) + 1; + if (numBits + 31 >= (1L << 32)) { + reportOverflow(); + } + numWords = (int) (numBits + 31) >>> 5; } int[] magnitude = new int[numWords]; @@ -456,6 +507,9 @@ public class BigInteger extends Number implements Comparable { destructiveMulAdd(magnitude, intRadix[10], groupVal); } mag = trustedStripLeadingZeroInts(magnitude); + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } // Create an integer with the digits between the two indexes @@ -575,7 +629,7 @@ public class BigInteger extends Number implements Comparable { * this constructor is proportional to the value of this parameter. * @param rnd source of random bits used to select candidates to be * tested for primality. - * @throws ArithmeticException {@code bitLength < 2}. + * @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large. * @see #bitLength() */ public BigInteger(int bitLength, int certainty, Random rnd) { @@ -607,7 +661,7 @@ public class BigInteger extends Number implements Comparable { * @param rnd source of random bits used to select candidates to be * tested for primality. * @return a BigInteger of {@code bitLength} bits that is probably prime - * @throws ArithmeticException {@code bitLength < 2}. + * @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large. * @see #bitLength() * @since 1.4 */ @@ -677,7 +731,7 @@ public class BigInteger extends Number implements Comparable { p.mag[p.mag.length-1] &= 0xfffffffe; // Use a sieve length likely to contain the next prime number - int searchLen = (bitLength / 20) * 64; + int searchLen = getPrimeSearchLen(bitLength); BitSieve searchSieve = new BitSieve(p, searchLen); BigInteger candidate = searchSieve.retrieve(p, certainty, rnd); @@ -701,7 +755,7 @@ public class BigInteger extends Number implements Comparable { * * @return the first integer greater than this {@code BigInteger} that * is probably prime. - * @throws ArithmeticException {@code this < 0}. + * @throws ArithmeticException {@code this < 0} or {@code this} is too large. * @since 1.5 */ public BigInteger nextProbablePrime() { @@ -750,7 +804,7 @@ public class BigInteger extends Number implements Comparable { result = result.subtract(ONE); // Looking for the next large prime - int searchLen = (result.bitLength() / 20) * 64; + int searchLen = getPrimeSearchLen(result.bitLength()); while (true) { BitSieve searchSieve = new BitSieve(result, searchLen); @@ -762,6 +816,13 @@ public class BigInteger extends Number implements Comparable { } } + private static int getPrimeSearchLen(int bitLength) { + if (bitLength > PRIME_SEARCH_BIT_LENGTH_LIMIT + 1) { + throw new ArithmeticException("Prime search implementation restriction on bitLength"); + } + return bitLength / 20 * 64; + } + /** * Returns {@code true} if this BigInteger is probably prime, * {@code false} if it's definitely composite. @@ -965,6 +1026,9 @@ public class BigInteger extends Number implements Comparable { BigInteger(int[] magnitude, int signum) { this.signum = (magnitude.length == 0 ? 0 : signum); this.mag = magnitude; + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -974,6 +1038,25 @@ public class BigInteger extends Number implements Comparable { private BigInteger(byte[] magnitude, int signum) { this.signum = (magnitude.length == 0 ? 0 : signum); this.mag = stripLeadingZeroBytes(magnitude); + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } + } + + /** + * Throws an {@code ArithmeticException} if the {@code BigInteger} would be + * out of the supported range. + * + * @throws ArithmeticException if {@code this} exceeds the supported range. + */ + private void checkRange() { + if (mag.length > MAX_MAG_LENGTH || mag.length == MAX_MAG_LENGTH && mag[0] < 0) { + reportOverflow(); + } + } + + private static void reportOverflow() { + throw new ArithmeticException("BigInteger would overflow supported range"); } //Static Factory Methods @@ -2073,6 +2156,10 @@ public class BigInteger extends Number implements Comparable { // The remaining part can then be exponentiated faster. The // powers of two will be multiplied back at the end. int powersOfTwo = partToSquare.getLowestSetBit(); + long bitsToShift = (long)powersOfTwo * exponent; + if (bitsToShift > Integer.MAX_VALUE) { + reportOverflow(); + } int remainingBits; @@ -2126,11 +2213,10 @@ public class BigInteger extends Number implements Comparable { // Multiply back the powers of two (quickly, by shifting left) if (powersOfTwo > 0) { - int bitsToShift = powersOfTwo*exponent; if (bitsToShift + scaleFactor <= 62) { // Fits in long? return valueOf((result << bitsToShift) * newSign); } else { - return valueOf(result*newSign).shiftLeft(bitsToShift); + return valueOf(result*newSign).shiftLeft((int) bitsToShift); } } else { @@ -2375,8 +2461,17 @@ public class BigInteger extends Number implements Comparable { BigInteger y1 = m2.modInverse(m1); BigInteger y2 = m1.modInverse(m2); - result = a1.multiply(m2).multiply(y1).add - (a2.multiply(m1).multiply(y2)).mod(m); + if (m.mag.length < MAX_MAG_LENGTH / 2) { + result = a1.multiply(m2).multiply(y1).add(a2.multiply(m1).multiply(y2)).mod(m); + } else { + MutableBigInteger t1 = new MutableBigInteger(); + new MutableBigInteger(a1.multiply(m2)).multiply(new MutableBigInteger(y1), t1); + MutableBigInteger t2 = new MutableBigInteger(); + new MutableBigInteger(a2.multiply(m1)).multiply(new MutableBigInteger(y2), t2); + t1.add(t2); + MutableBigInteger q = new MutableBigInteger(); + result = t1.divide(new MutableBigInteger(m), q).toBigInteger(); + } } return (invertResult ? result.modInverse(m) : result); @@ -2797,27 +2892,31 @@ public class BigInteger extends Number implements Comparable { * * @param n shift distance, in bits. * @return {@code this << n} - * @throws ArithmeticException if the shift distance is {@code - * Integer.MIN_VALUE}. * @see #shiftRight */ public BigInteger shiftLeft(int n) { if (signum == 0) return ZERO; - if (n == 0) + if (n > 0) { + return new BigInteger(shiftLeft(mag, n), signum); + } else if (n == 0) { return this; - if (n < 0) { - if (n == Integer.MIN_VALUE) { - throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported."); - } else { - return shiftRight(-n); - } + } else { + // Possible int overflow in (-n) is not a trouble, + // because shiftRightImpl considers its argument unsigned + return shiftRightImpl(-n); } - int[] newMag = shiftLeft(mag, n); - - return new BigInteger(newMag, signum); } + /** + * Returns a magnitude array whose value is {@code (mag << n)}. + * The shift distance, {@code n}, is considered unnsigned. + * (Computes this * 2n.) + * + * @param mag magnitude, the most-significant int ({@code mag[0]}) must be non-zero. + * @param n unsigned shift distance, in bits. + * @return {@code mag << n} + */ private static int[] shiftLeft(int[] mag, int n) { int nInts = n >>> 5; int nBits = n & 0x1f; @@ -2853,21 +2952,31 @@ public class BigInteger extends Number implements Comparable { * * @param n shift distance, in bits. * @return {@code this >> n} - * @throws ArithmeticException if the shift distance is {@code - * Integer.MIN_VALUE}. * @see #shiftLeft */ public BigInteger shiftRight(int n) { - if (n == 0) + if (signum == 0) + return ZERO; + if (n > 0) { + return shiftRightImpl(n); + } else if (n == 0) { return this; - if (n < 0) { - if (n == Integer.MIN_VALUE) { - throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported."); - } else { - return shiftLeft(-n); - } + } else { + // Possible int overflow in {@code -n} is not a trouble, + // because shiftLeft considers its argument unsigned + return new BigInteger(shiftLeft(mag, -n), signum); } + } + /** + * Returns a BigInteger whose value is {@code (this >> n)}. The shift + * distance, {@code n}, is considered unsigned. + * (Computes floor(this * 2-n).) + * + * @param n unsigned shift distance, in bits. + * @return {@code this >> n} + */ + private BigInteger shiftRightImpl(int n) { int nInts = n >>> 5; int nBits = n & 0x1f; int magLen = mag.length; @@ -3899,7 +4008,7 @@ public class BigInteger extends Number implements Comparable { ; int extraByte = (k == byteLength) ? 1 : 0; - int intLength = ((byteLength - keep + extraByte) + 3)/4; + int intLength = ((byteLength - keep + extraByte) + 3) >>> 2; int result[] = new int[intLength]; /* Copy one's complement of input into output, leaving extra @@ -4135,7 +4244,8 @@ public class BigInteger extends Number implements Comparable { message = "BigInteger: Signum not present in stream"; throw new java.io.StreamCorruptedException(message); } - if ((magnitude.length == 0) != (sign == 0)) { + int[] mag = stripLeadingZeroBytes(magnitude); + if ((mag.length == 0) != (sign == 0)) { String message = "BigInteger: signum-magnitude mismatch"; if (fields.defaulted("magnitude")) message = "BigInteger: Magnitude not present in stream"; @@ -4146,7 +4256,14 @@ public class BigInteger extends Number implements Comparable { UnsafeHolder.putSign(this, sign); // Calculate mag field from magnitude and discard magnitude - UnsafeHolder.putMag(this, stripLeadingZeroBytes(magnitude)); + UnsafeHolder.putMag(this, mag); + if (mag.length >= MAX_MAG_LENGTH) { + try { + checkRange(); + } catch (ArithmeticException e) { + throw new java.io.StreamCorruptedException("BigInteger: Out of the supported range"); + } + } } // Support for resetting final fields while deserializing diff --git a/jdk/src/share/classes/java/math/MutableBigInteger.java b/jdk/src/share/classes/java/math/MutableBigInteger.java index 6f72f2d0c83..bc4e4841344 100644 --- a/jdk/src/share/classes/java/math/MutableBigInteger.java +++ b/jdk/src/share/classes/java/math/MutableBigInteger.java @@ -1257,14 +1257,14 @@ class MutableBigInteger { int j = (s+m-1) / m; // step 2a: j = ceil(s/m) int n = j * m; // step 2b: block length in 32-bit units - int n32 = 32 * n; // block length in bits - int sigma = Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n} + long n32 = 32L * n; // block length in bits + int sigma = (int) Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n} MutableBigInteger bShifted = new MutableBigInteger(b); bShifted.safeLeftShift(sigma); // step 4a: shift b so its length is a multiple of n safeLeftShift(sigma); // step 4b: shift this by the same amount // step 5: t is the number of blocks needed to accommodate this plus one additional bit - int t = (bitLength()+n32) / n32; + int t = (int) ((bitLength()+n32) / n32); if (t < 2) { t = 2; } @@ -1421,10 +1421,10 @@ class MutableBigInteger { } /** @see BigInteger#bitLength() */ - int bitLength() { + long bitLength() { if (intLen == 0) return 0; - return intLen*32 - Integer.numberOfLeadingZeros(value[offset]); + return intLen*32L - Integer.numberOfLeadingZeros(value[offset]); } /** diff --git a/jdk/src/share/classes/java/net/Authenticator.java b/jdk/src/share/classes/java/net/Authenticator.java index 28df05ca0d3..c88a6006b89 100644 --- a/jdk/src/share/classes/java/net/Authenticator.java +++ b/jdk/src/share/classes/java/net/Authenticator.java @@ -358,7 +358,7 @@ class Authenticator { * will be based on a URL, but in a future JDK it could be, for * example, "SOCKS" for a password-protected SOCKS5 firewall. * - * @return the protcol, optionally followed by "/version", where + * @return the protocol, optionally followed by "/version", where * version is a version number. * * @see java.net.URL#getProtocol() diff --git a/jdk/src/share/classes/java/net/CookieManager.java b/jdk/src/share/classes/java/net/CookieManager.java index bb80f0a7f25..f2d29cda82b 100644 --- a/jdk/src/share/classes/java/net/CookieManager.java +++ b/jdk/src/share/classes/java/net/CookieManager.java @@ -143,7 +143,7 @@ public class CookieManager extends CookieHandler * * @param store a {@code CookieStore} to be used by cookie manager. * if {@code null}, cookie manager will use a default one, - * which is an in-memory CookieStore implmentation. + * which is an in-memory CookieStore implementation. * @param cookiePolicy a {@code CookiePolicy} instance * to be used by cookie manager as policy callback. * if {@code null}, ACCEPT_ORIGINAL_SERVER will diff --git a/jdk/src/share/classes/java/net/CookieStore.java b/jdk/src/share/classes/java/net/CookieStore.java index 648817e4b52..105cc667579 100644 --- a/jdk/src/share/classes/java/net/CookieStore.java +++ b/jdk/src/share/classes/java/net/CookieStore.java @@ -48,7 +48,7 @@ public interface CookieStore { *

      A cookie to store may or may not be associated with an URI. If it * is not associated with an URI, the cookie's domain and path attribute * will indicate where it comes from. If it is associated with an URI and - * its domain and path attribute are not speicifed, given URI will indicate + * its domain and path attribute are not specified, given URI will indicate * where this cookie comes from. * *

      If a cookie corresponding to the given URI already exists, diff --git a/jdk/src/share/classes/java/net/DatagramSocket.java b/jdk/src/share/classes/java/net/DatagramSocket.java index ab60a263ac7..1e095dec731 100644 --- a/jdk/src/share/classes/java/net/DatagramSocket.java +++ b/jdk/src/share/classes/java/net/DatagramSocket.java @@ -196,7 +196,7 @@ class DatagramSocket implements java.io.Closeable { * socket address. *

      * If, if the address is {@code null}, creates an unbound socket. - *

      + * *

      If there is a security manager, * its {@code checkListen} method is first called * with the port from the socket address @@ -640,7 +640,7 @@ class DatagramSocket implements java.io.Closeable { SecurityManager security = System.getSecurityManager(); // The reason you want to synchronize on datagram packet - // is because you dont want an applet to change the address + // is because you don't want an applet to change the address // while you are trying to send the packet for example // after the security check but before the send. if (security != null) { @@ -1109,7 +1109,7 @@ class DatagramSocket implements java.io.Closeable { * represent the value of the TOS octet in IP packets sent by * the socket. * RFC 1349 defines the TOS values as follows: - *

      + * *

        *
      • IPTOS_LOWCOST (0x02)
      • *
      • IPTOS_RELIABILITY (0x04)
      • diff --git a/jdk/src/share/classes/java/net/HttpCookie.java b/jdk/src/share/classes/java/net/HttpCookie.java index fb02ae3e03d..00177122600 100644 --- a/jdk/src/share/classes/java/net/HttpCookie.java +++ b/jdk/src/share/classes/java/net/HttpCookie.java @@ -761,7 +761,7 @@ public final class HttpCookie implements Cloneable { // from RFC 2068, token special case characters // // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t"; - private static final String tspecials = ",;"; + private static final String tspecials = ",; "; // deliberately includes space /* * Tests a string and returns true if the string counts as a token. diff --git a/jdk/src/share/classes/java/net/Inet6Address.java b/jdk/src/share/classes/java/net/Inet6Address.java index 068a4ce235d..001c55ffc59 100644 --- a/jdk/src/share/classes/java/net/Inet6Address.java +++ b/jdk/src/share/classes/java/net/Inet6Address.java @@ -133,7 +133,7 @@ import java.util.Arrays; * representation. However, it will be converted into an IPv4 * address.
      *
      - *

      + * *

      Textual representation of IPv6 scoped addresses

      * *

      The textual representation of IPv6 addresses as described above can be @@ -150,11 +150,11 @@ import java.util.Arrays; * *

      The general format for specifying the scope_id is the following: * - *

      IPv6-address%scope_id
      + *
      IPv6-address%scope_id
      *

      The IPv6-address is a literal IPv6 address as described above. * The scope_id refers to an interface on the local system, and it can be * specified in two ways. - *

      1. As a numeric identifier. This must be a positive integer + *
        1. As a numeric identifier. This must be a positive integer * that identifies the particular interface and scope as understood by the * system. Usually, the numeric values can be determined through administration * tools on the system. Each interface may have multiple values, one for each diff --git a/jdk/src/share/classes/java/net/InetSocketAddress.java b/jdk/src/share/classes/java/net/InetSocketAddress.java index 6792979312b..e8a804fa601 100644 --- a/jdk/src/share/classes/java/net/InetSocketAddress.java +++ b/jdk/src/share/classes/java/net/InetSocketAddress.java @@ -196,7 +196,7 @@ public class InetSocketAddress * If that attempt fails, the address will be flagged as unresolved. *

          * If there is a security manager, its {@code checkConnect} method - * is called with the host name as its argument to check the permissiom + * is called with the host name as its argument to check the permission * to resolve it. This could result in a SecurityException. *

          * A valid port value is between 0 and 65535. diff --git a/jdk/src/share/classes/java/net/InterfaceAddress.java b/jdk/src/share/classes/java/net/InterfaceAddress.java index 704e1fae9d5..39354a0c233 100644 --- a/jdk/src/share/classes/java/net/InterfaceAddress.java +++ b/jdk/src/share/classes/java/net/InterfaceAddress.java @@ -56,7 +56,7 @@ public class InterfaceAddress { } /** - * Returns an {@code InetAddress} for the brodcast address + * Returns an {@code InetAddress} for the broadcast address * for this InterfaceAddress. *

          * Only IPv4 networks have broadcast address therefore, in the case diff --git a/jdk/src/share/classes/java/net/JarURLConnection.java b/jdk/src/share/classes/java/net/JarURLConnection.java index c6fd8cf94f7..70dedec795e 100644 --- a/jdk/src/share/classes/java/net/JarURLConnection.java +++ b/jdk/src/share/classes/java/net/JarURLConnection.java @@ -82,7 +82,7 @@ import sun.net.www.ParseUtil; * * * - *

          {@code !/} is refered to as the separator. + *

          {@code !/} is referred to as the separator. * *

          When constructing a JAR url via {@code new URL(context, spec)}, * the following rules apply: @@ -223,7 +223,7 @@ public abstract class JarURLConnection extends URLConnection { * for this connection. * * @exception IOException if getting the JAR file for this - * connection causes an IOException to be trown. + * connection causes an IOException to be thrown. * * @see #getJarFile */ @@ -240,7 +240,7 @@ public abstract class JarURLConnection extends URLConnection { * the JAR URL for this connection points to a JAR file. * * @exception IOException if getting the JAR file for this - * connection causes an IOException to be trown. + * connection causes an IOException to be thrown. * * @see #getJarFile * @see #getJarEntry diff --git a/jdk/src/share/classes/java/net/MulticastSocket.java b/jdk/src/share/classes/java/net/MulticastSocket.java index 9c5cb05acbb..1d42dfe6e87 100644 --- a/jdk/src/share/classes/java/net/MulticastSocket.java +++ b/jdk/src/share/classes/java/net/MulticastSocket.java @@ -140,7 +140,7 @@ class MulticastSocket extends DatagramSocket { * Create a MulticastSocket bound to the specified socket address. *

          * Or, if the address is {@code null}, create an unbound socket. - *

          + * *

          If there is a security manager, * its {@code checkListen} method is first called * with the SocketAddress port as its argument to ensure the operation is allowed. diff --git a/jdk/src/share/classes/java/net/NetPermission.java b/jdk/src/share/classes/java/net/NetPermission.java index cf7cbd2af67..9178f348723 100644 --- a/jdk/src/share/classes/java/net/NetPermission.java +++ b/jdk/src/share/classes/java/net/NetPermission.java @@ -46,7 +46,6 @@ import java.util.StringTokenizer; * The following table lists all the possible NetPermission target names, * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. - *

          * * * diff --git a/jdk/src/share/classes/java/net/Proxy.java b/jdk/src/share/classes/java/net/Proxy.java index fe481fadfa2..8ba020ef484 100644 --- a/jdk/src/share/classes/java/net/Proxy.java +++ b/jdk/src/share/classes/java/net/Proxy.java @@ -66,8 +66,8 @@ public class Proxy { * Used, for instance, to create sockets bypassing any other global * proxy settings (like SOCKS): *

          - * {@code Socket s = new Socket(Proxy.NO_PROXY);}
          - *

          + * {@code Socket s = new Socket(Proxy.NO_PROXY);} + * */ public final static Proxy NO_PROXY = new Proxy(); diff --git a/jdk/src/share/classes/java/net/ServerSocket.java b/jdk/src/share/classes/java/net/ServerSocket.java index bcc77ae42f3..2ee3420d548 100644 --- a/jdk/src/share/classes/java/net/ServerSocket.java +++ b/jdk/src/share/classes/java/net/ServerSocket.java @@ -610,7 +610,7 @@ class ServerSocket implements java.io.Closeable { /** * Returns the binding state of the ServerSocket. * - * @return true if the ServerSocket succesfuly bound to an address + * @return true if the ServerSocket successfully bound to an address * @since 1.4 */ public boolean isBound() { diff --git a/jdk/src/share/classes/java/net/Socket.java b/jdk/src/share/classes/java/net/Socket.java index 361260351f5..21cf5aae133 100644 --- a/jdk/src/share/classes/java/net/Socket.java +++ b/jdk/src/share/classes/java/net/Socket.java @@ -1230,13 +1230,13 @@ class Socket implements java.io.Closeable { * Generally, the window size can be modified at any time when a socket is * connected. However, if a receive window larger than 64K is required then * this must be requested before the socket is connected to the - * remote peer. There are two cases to be aware of:

          + * remote peer. There are two cases to be aware of: *

            *
          1. For sockets accepted from a ServerSocket, this must be done by calling * {@link ServerSocket#setReceiveBufferSize(int)} before the ServerSocket * is bound to a local address.

          2. *
          3. For client sockets, setReceiveBufferSize() must be called before - * connecting the socket to its remote peer.

          + * connecting the socket to its remote peer. * @param size the size to which to set the receive buffer * size. This value must be greater than 0. * @@ -1329,7 +1329,7 @@ class Socket implements java.io.Closeable { * represent the value of the TOS octet in IP packets sent by * the socket. * RFC 1349 defines the TOS values as follows: - *

          + * *

            *
          • IPTOS_LOWCOST (0x02)
          • *
          • IPTOS_RELIABILITY (0x04)
          • diff --git a/jdk/src/share/classes/java/net/SocketOptions.java b/jdk/src/share/classes/java/net/SocketOptions.java index b9508dbb266..7e1b0fc85b6 100644 --- a/jdk/src/share/classes/java/net/SocketOptions.java +++ b/jdk/src/share/classes/java/net/SocketOptions.java @@ -134,7 +134,7 @@ public interface SocketOptions { * previously written data. *

            * Valid for TCP only: SocketImpl. - *

            + * * @see Socket#setTcpNoDelay * @see Socket#getTcpNoDelay */ @@ -155,7 +155,7 @@ public interface SocketOptions { * This option must be specified in the constructor. *

            * Valid for: SocketImpl, DatagramSocketImpl - *

            + * * @see Socket#getLocalAddress * @see DatagramSocket#getLocalAddress */ @@ -186,7 +186,7 @@ public interface SocketOptions { * want to use other than the system default. Takes/returns an InetAddress. *

            * Valid for Multicast: DatagramSocketImpl - *

            + * * @see MulticastSocket#setInterface(InetAddress) * @see MulticastSocket#getInterface() */ diff --git a/jdk/src/share/classes/java/net/SocketPermission.java b/jdk/src/share/classes/java/net/SocketPermission.java index e90856eac8e..1b11437b1aa 100644 --- a/jdk/src/share/classes/java/net/SocketPermission.java +++ b/jdk/src/share/classes/java/net/SocketPermission.java @@ -779,27 +779,27 @@ public final class SocketPermission extends Permission * specified permission. *

            * More specifically, this method first ensures that all of the following - * are true (and returns false if any of them are not):

            + * are true (and returns false if any of them are not): *

              - *
            • p is an instanceof SocketPermission,

              + *

            • p is an instanceof SocketPermission, *
            • p's actions are a proper subset of this - * object's actions, and

              + * object's actions, and *

            • p's port range is included in this port range. Note: - * port range is ignored when p only contains the action, 'resolve'.

              + * port range is ignored when p only contains the action, 'resolve'. *

            * * Then {@code implies} checks each of the following, in order, - * and for each returns true if the stated condition is true:

            + * and for each returns true if the stated condition is true: *

              *
            • If this object was initialized with a single IP address and one of p's - * IP addresses is equal to this object's IP address.

              + * IP addresses is equal to this object's IP address. *

            • If this object is a wildcard domain (such as *.sun.com), and * p's canonical name (the name without any preceding *) * ends with this object's canonical host name. For example, *.sun.com - * implies *.eng.sun.com..

              + * implies *.eng.sun.com. *

            • If this object was not initialized with a single IP address, and one of this - * object's IP addresses equals one of p's IP addresses.

              - *

            • If this canonical name equals p's canonical name.

              + * object's IP addresses equals one of p's IP addresses. + *

            • If this canonical name equals p's canonical name. *
            * * If none of the above are true, {@code implies} returns false. diff --git a/jdk/src/share/classes/java/net/SocksSocketImpl.java b/jdk/src/share/classes/java/net/SocksSocketImpl.java index 3e4fb5fe74a..2138f9dfcf1 100644 --- a/jdk/src/share/classes/java/net/SocksSocketImpl.java +++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java @@ -437,7 +437,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { } } - // cmdIn & cmdOut were intialized during the privilegedConnect() call + // cmdIn & cmdOut were initialized during the privilegedConnect() call BufferedOutputStream out = new BufferedOutputStream(cmdOut, 512); InputStream in = cmdIn; diff --git a/jdk/src/share/classes/java/net/StandardSocketOptions.java b/jdk/src/share/classes/java/net/StandardSocketOptions.java index 84fedd804f1..25fb61aec71 100644 --- a/jdk/src/share/classes/java/net/StandardSocketOptions.java +++ b/jdk/src/share/classes/java/net/StandardSocketOptions.java @@ -257,7 +257,7 @@ public final class StandardSocketOptions { * represents the outgoing interface for multicast datagrams sent by the * datagram-oriented socket. For {@link StandardProtocolFamily#INET6 IPv6} * sockets then it is system dependent whether setting this option also - * sets the outgoing interface for multlicast datagrams sent to IPv4 + * sets the outgoing interface for multicast datagrams sent to IPv4 * addresses. * *

            The initial/default value of this socket option may be {@code null} diff --git a/jdk/src/share/classes/java/net/URI.java b/jdk/src/share/classes/java/net/URI.java index 71c4f6dc5de..813de5cf453 100644 --- a/jdk/src/share/classes/java/net/URI.java +++ b/jdk/src/share/classes/java/net/URI.java @@ -389,20 +389,20 @@ import java.lang.NullPointerException; // for javadoc * colon following a host name but no port (as in * {@code http://java.sun.com:} ), and that does not encode characters * except those that must be quoted, the following identities also hold: - *

            + * 
              *     new URI(u.getScheme(),
              *             u.getSchemeSpecificPart(),
              *             u.getFragment())
              *     .equals(u)
            * in all cases, - *

            + * 
              *     new URI(u.getScheme(),
              *             u.getUserInfo(), u.getAuthority(),
              *             u.getPath(), u.getQuery(),
              *             u.getFragment())
              *     .equals(u)
            * if u is hierarchical, and - *

            + * 
              *     new URI(u.getScheme(),
              *             u.getUserInfo(), u.getHost(), u.getPort(),
              *             u.getPath(), u.getQuery(),
            diff --git a/jdk/src/share/classes/java/net/URL.java b/jdk/src/share/classes/java/net/URL.java
            index e7946d22e89..1ff5d63a35a 100644
            --- a/jdk/src/share/classes/java/net/URL.java
            +++ b/jdk/src/share/classes/java/net/URL.java
            @@ -465,7 +465,7 @@ public final class URL implements java.io.Serializable {
                  * Otherwise, the path is treated as a relative path and is appended to the
                  * context path, as described in RFC2396. Also, in this case,
                  * the path is canonicalized through the removal of directory
            -     * changes made by occurences of ".." and ".".
            +     * changes made by occurrences of ".." and ".".
                  * 

            * For a more detailed description of URL parsing, refer to RFC2396. * diff --git a/jdk/src/share/classes/java/net/URLClassLoader.java b/jdk/src/share/classes/java/net/URLClassLoader.java index 748748520ea..f272346ce2f 100644 --- a/jdk/src/share/classes/java/net/URLClassLoader.java +++ b/jdk/src/share/classes/java/net/URLClassLoader.java @@ -25,21 +25,30 @@ package java.net; -import java.io.*; -import java.util.*; -import java.util.jar.Manifest; -import java.util.jar.JarFile; -import java.util.jar.Attributes; -import java.util.jar.Attributes.Name; -import java.security.CodeSigner; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.security.AccessController; +import java.io.Closeable; +import java.io.File; +import java.io.FilePermission; +import java.io.IOException; +import java.io.InputStream; import java.security.AccessControlContext; -import java.security.SecureClassLoader; +import java.security.AccessController; +import java.security.CodeSigner; import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.security.SecureClassLoader; +import java.util.Enumeration; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import java.util.WeakHashMap; +import java.util.jar.Attributes; +import java.util.jar.Attributes.Name; +import java.util.jar.JarFile; +import java.util.jar.Manifest; import sun.misc.Resource; import sun.misc.URLClassPath; import sun.net.www.ParseUtil; @@ -84,6 +93,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @exception SecurityException if a security manager exists and its * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. + * @exception NullPointerException if {@code urls} is {@code null}. * @see SecurityManager#checkCreateClassLoader */ public URLClassLoader(URL[] urls, ClassLoader parent) { @@ -127,6 +137,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @exception SecurityException if a security manager exists and its * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. + * @exception NullPointerException if {@code urls} is {@code null}. * @see SecurityManager#checkCreateClassLoader */ public URLClassLoader(URL[] urls) { @@ -169,6 +180,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @exception SecurityException if a security manager exists and its * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. + * @exception NullPointerException if {@code urls} is {@code null}. * @see SecurityManager#checkCreateClassLoader */ public URLClassLoader(URL[] urls, ClassLoader parent, @@ -260,13 +272,13 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * and errors are not caught. Calling close on an already closed * loader has no effect. *

            - * @throws IOException if closing any file opened by this class loader + * @exception IOException if closing any file opened by this class loader * resulted in an IOException. Any such exceptions are caught internally. * If only one is caught, then it is re-thrown. If more than one exception * is caught, then the second and following exceptions are added * as suppressed exceptions of the first one caught, which is then re-thrown. * - * @throws SecurityException if a security manager is set, and it denies + * @exception SecurityException if a security manager is set, and it denies * {@link RuntimePermission}{@code ("closeClassLoader")} * * @since 1.7 @@ -339,6 +351,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @return the resulting class * @exception ClassNotFoundException if the class could not be found, * or if the loader is closed. + * @exception NullPointerException if {@code name} is {@code null}. */ protected Class findClass(final String name) throws ClassNotFoundException @@ -621,6 +634,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * If the protocol is not "file", then permission * to connect to and accept connections from the URL's host is granted. * @param codesource the codesource + * @exception NullPointerException if {@code codesource} is {@code null}. * @return the permissions granted to the codesource */ protected PermissionCollection getPermissions(CodeSource codesource) @@ -700,6 +714,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * * @param urls the URLs to search for classes and resources * @param parent the parent class loader for delegation + * @exception NullPointerException if {@code urls} is {@code null}. * @return the resulting class loader */ public static URLClassLoader newInstance(final URL[] urls, @@ -725,6 +740,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * loading the class. * * @param urls the URLs to search for classes and resources + * @exception NullPointerException if {@code urls} is {@code null}. * @return the resulting class loader */ public static URLClassLoader newInstance(final URL[] urls) { diff --git a/jdk/src/share/classes/java/net/URLConnection.java b/jdk/src/share/classes/java/net/URLConnection.java index b731ac70d90..dd66ed26c54 100644 --- a/jdk/src/share/classes/java/net/URLConnection.java +++ b/jdk/src/share/classes/java/net/URLConnection.java @@ -45,7 +45,7 @@ import sun.net.www.MessageHeader; * application and a URL. Instances of this class can be used both to * read from and to write to the resource referenced by the URL. In * general, creating a connection to a URL is a multistep process: - *

            + * *

          * * @@ -371,7 +371,7 @@ public abstract class URLConnection { * java.net.SocketTimeoutException is raised. A timeout of zero is * interpreted as an infinite timeout. - *

          Some non-standard implmentation of this method may ignore + *

          Some non-standard implementation of this method may ignore * the specified timeout. To see the connect timeout set, please * call getConnectTimeout(). * @@ -1059,7 +1059,7 @@ public abstract class URLConnection { * *

          NOTE: HTTP requires all request properties which can * legally have multiple instances with the same key - * to use a comma-seperated list syntax which enables multiple + * to use a comma-separated list syntax which enables multiple * properties to be appended into a single property. * * @param key the keyword by which the request is known diff --git a/jdk/src/share/classes/java/net/URLDecoder.java b/jdk/src/share/classes/java/net/URLDecoder.java index eb5e36e5d82..1e1138ad7ec 100644 --- a/jdk/src/share/classes/java/net/URLDecoder.java +++ b/jdk/src/share/classes/java/net/URLDecoder.java @@ -43,7 +43,7 @@ import java.io.*; * as the start of a special escaped sequence. *

          * The following rules are applied in the conversion: - *

          + * *

            *
          • The alphanumeric characters "{@code a}" through * "{@code z}", "{@code A}" through @@ -116,7 +116,7 @@ public class URLDecoder { * "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars"> * World Wide Web Consortium Recommendation states that * UTF-8 should be used. Not doing so may introduce - * incompatibilites. + * incompatibilities. * * @param s the {@code String} to decode * @param enc The name of a supported diff --git a/jdk/src/share/classes/java/net/URLEncoder.java b/jdk/src/share/classes/java/net/URLEncoder.java index b5c4a8c32f9..86377b7a752 100644 --- a/jdk/src/share/classes/java/net/URLEncoder.java +++ b/jdk/src/share/classes/java/net/URLEncoder.java @@ -49,7 +49,6 @@ import sun.security.action.GetPropertyAction; *

            * When encoding a String, the following rules apply: * - *

            *

              *
            • The alphanumeric characters "{@code a}" through * "{@code z}", "{@code A}" through @@ -186,7 +185,7 @@ public class URLEncoder { * "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars"> * World Wide Web Consortium Recommendation states that * UTF-8 should be used. Not doing so may introduce - * incompatibilites. + * incompatibilities. * * @param s {@code String} to be translated. * @param enc The name of a supported diff --git a/jdk/src/share/classes/java/net/URLPermission.java b/jdk/src/share/classes/java/net/URLPermission.java index f6572cd3575..7ad56a1c20f 100644 --- a/jdk/src/share/classes/java/net/URLPermission.java +++ b/jdk/src/share/classes/java/net/URLPermission.java @@ -45,7 +45,7 @@ import java.security.Permission; * * scheme will typically be http or https, but is not restricted by this * class. - * authority is specified as:

              + * authority is specified as: *

                *     authority = hostrange [ : portrange ]
                *     portrange = portnumber | -portnumber | portnumber-[portnumber] | *
              @@ -223,7 +223,7 @@ public final class URLPermission extends Permission {
                    * Checks if this URLPermission implies the given permission.
                    * Specifically, the following checks are done as if in the
                    * following sequence:
              -     * 

                + *
                  *
                • if 'p' is not an instance of URLPermission return false
                • *
                • if any of p's methods are not in this's method list, and if * this's method list is not equal to "*", then return false.
                • @@ -242,7 +242,7 @@ public final class URLPermission extends Permission { *
                • otherwise, return false
                • *
                *

                Some examples of how paths are matched are shown below: - *

          {@code openConnection()}{@code connect()}
          + *
          * * * @@ -353,7 +353,7 @@ public final class URLPermission extends Permission { return getActions().hashCode() + scheme.hashCode() + authority.hashCode() - + path == null ? 0 : path.hashCode(); + + (path == null ? 0 : path.hashCode()); } diff --git a/jdk/src/share/classes/java/net/package-info.java b/jdk/src/share/classes/java/net/package-info.java index 6552b30b634..fda2e4f28b8 100644 --- a/jdk/src/share/classes/java/net/package-info.java +++ b/jdk/src/share/classes/java/net/package-info.java @@ -127,9 +127,9 @@ * resources, then convert it into a {@link java.net.URL} when it is time to * access the resource. From that URL, you can either get the * {@link java.net.URLConnection} for fine control, or get directly the - * InputStream.

          + * InputStream. *

          Here is an example:

          - *

          + * 
            * URI uri = new URI("http://java.sun.com/");
            * URL url = uri.toURL();
            * InputStream in = url.openStream();
          @@ -147,7 +147,7 @@
            *    the {@code java.protocol.handler.pkgs} system property. For instance if
            *    it is set to {@code myapp.protocols}, then the URL code will try, in the
            *    case of http, first to load {@code myapp.protocols.http.Handler}, then,
          - *    if this fails, {@code http.Handler} from the default location.

          + * if this fails, {@code http.Handler} from the default location. *

          Note that the Handler class has to be a subclass of the abstract * class {@link java.net.URLStreamHandler}.

          *

          Additional Specification

          diff --git a/jdk/src/share/classes/java/nio/X-Buffer.java.template b/jdk/src/share/classes/java/nio/X-Buffer.java.template index 60f0733c9ab..acc8fc89912 100644 --- a/jdk/src/share/classes/java/nio/X-Buffer.java.template +++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template @@ -1129,7 +1129,7 @@ public abstract class $Type$Buffer * *

          Two $type$ buffers are equal if, and only if, * - *

            + *
              * *
            1. They have the same element type,

            2. * diff --git a/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java b/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java index ace607323cb..aa56bbf38a2 100644 --- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java @@ -199,7 +199,7 @@ public abstract class AsynchronousChannelGroup { * *

              The {@code initialSize} parameter may be used by the implementation * as a hint as to the initial number of tasks it may submit. For - * example, it may be used to indictae the initial number of threads that + * example, it may be used to indicate the initial number of threads that * wait on I/O events. * *

              The executor is intended to be used exclusively by the resulting diff --git a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java index 3626317a982..b979cd398ff 100644 --- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java +++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java @@ -153,7 +153,7 @@ public abstract class DatagramChannel * Opens a datagram channel. * *

              The {@code family} parameter is used to specify the {@link - * ProtocolFamily}. If the datagram channel is to be used for IP multicasing + * ProtocolFamily}. If the datagram channel is to be used for IP multicasting * then this should correspond to the address type of the multicast groups * that this channel will join. * diff --git a/jdk/src/share/classes/java/nio/channels/MembershipKey.java b/jdk/src/share/classes/java/nio/channels/MembershipKey.java index ea7536ac344..cd955862ebe 100644 --- a/jdk/src/share/classes/java/nio/channels/MembershipKey.java +++ b/jdk/src/share/classes/java/nio/channels/MembershipKey.java @@ -103,7 +103,7 @@ public abstract class MembershipKey { * multicast datagrams from the given source address. If the given source * address is already blocked then this method has no effect. * After a source address is blocked it may still be possible to receive - * datagams from that source. This can arise when datagrams are waiting to + * datagrams from that source. This can arise when datagrams are waiting to * be received in the socket's receive buffer. * * @param source diff --git a/jdk/src/share/classes/java/nio/channels/package-info.java b/jdk/src/share/classes/java/nio/channels/package-info.java index cb55f8f8da7..81183472108 100644 --- a/jdk/src/share/classes/java/nio/channels/package-info.java +++ b/jdk/src/share/classes/java/nio/channels/package-info.java @@ -269,7 +269,7 @@ * own asynchronous channel groups or configure the {@code ExecutorService} * that will be used for the default group. * - *

              As with selectors, the implementatin of asynchronous channels can be + *

              As with selectors, the implementation of asynchronous channels can be * replaced by "plugging in" an alternative definition or instance of the {@link * java.nio.channels.spi.AsynchronousChannelProvider} class defined in the * {@link java.nio.channels.spi} package. It is not expected that many diff --git a/jdk/src/share/classes/java/nio/charset/Charset.java b/jdk/src/share/classes/java/nio/charset/Charset.java index e1a828dcb15..3d946f1d4bc 100644 --- a/jdk/src/share/classes/java/nio/charset/Charset.java +++ b/jdk/src/share/classes/java/nio/charset/Charset.java @@ -201,7 +201,7 @@ import sun.security.action.GetPropertyAction; * * * - * In any case, byte order marks occuring after the first element of an + * In any case, byte order marks occurring after the first element of an * input sequence are not omitted since the same code is used to represent * ZERO-WIDTH NON-BREAKING SPACE. * diff --git a/jdk/src/share/classes/java/nio/file/FileSystem.java b/jdk/src/share/classes/java/nio/file/FileSystem.java index 2296cada829..2a961fb8ecf 100644 --- a/jdk/src/share/classes/java/nio/file/FileSystem.java +++ b/jdk/src/share/classes/java/nio/file/FileSystem.java @@ -355,7 +355,7 @@ public abstract class FileSystem * *

              The following rules are used to interpret glob patterns: * - *

                + *
                  *
                • The {@code *} character matches zero or more {@link Character * characters} of a {@link Path#getName(int) name} component without * crossing directory boundaries.

                • diff --git a/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java b/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java index 2a1dd6e18f8..9840e849302 100644 --- a/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java +++ b/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java @@ -81,7 +81,7 @@ public interface UserDefinedFileAttributeView /** * Returns a list containing the names of the user-defined attributes. * - * @return An unmodifiable list continaing the names of the file's + * @return An unmodifiable list containing the names of the file's * user-defined * * @throws IOException @@ -179,7 +179,7 @@ public interface UserDefinedFileAttributeView *

                  If an attribute of the given name already exists then its value is * replaced. If the attribute does not exist then it is created. If it * implementation specific if a test to check for the existence of the - * attribute and the creation of attribute are atomic with repect to other + * attribute and the creation of attribute are atomic with respect to other * file system activities. * *

                  Where there is insufficient space to store the attribute, or the diff --git a/jdk/src/share/classes/java/rmi/MarshalledObject.java b/jdk/src/share/classes/java/rmi/MarshalledObject.java index 84675c11d1c..384230f88a3 100644 --- a/jdk/src/share/classes/java/rmi/MarshalledObject.java +++ b/jdk/src/share/classes/java/rmi/MarshalledObject.java @@ -135,7 +135,7 @@ public final class MarshalledObject implements Serializable { /** * Returns a new copy of the contained marshalledobject. The internal * representation is deserialized with the semantics used for - * unmarshaling paramters for RMI calls. + * unmarshaling parameters for RMI calls. * * @return a copy of the contained object * @exception IOException if an IOException occurs while @@ -182,7 +182,7 @@ public final class MarshalledObject implements Serializable { * in the serialized representation. * * @param obj the object to compare with this MarshalledObject - * @return true if the argument contains an equaivalent + * @return true if the argument contains an equivalent * serialized object; false otherwise * @since 1.2 */ diff --git a/jdk/src/share/classes/java/rmi/RMISecurityManager.java b/jdk/src/share/classes/java/rmi/RMISecurityManager.java index 3759e7f48ea..b260c49a1ce 100644 --- a/jdk/src/share/classes/java/rmi/RMISecurityManager.java +++ b/jdk/src/share/classes/java/rmi/RMISecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -28,35 +28,38 @@ package java.rmi; import java.security.*; /** - * A subclass of {@link SecurityManager} used by RMI applications that use - * downloaded code. RMI's class loader will not download any classes from - * remote locations if no security manager has been set. - * RMISecurityManager does not apply to applets, which run - * under the protection of their browser's security manager. + * {@code RMISecurityManager} implements a policy identical to the policy + * implemented by {@link SecurityManager}. RMI applications + * should use the {@code SecurityManager} class or another appropriate + * {@code SecurityManager} implementation instead of this class. RMI's class + * loader will download classes from remote locations only if a security + * manager has been set. * - * RMISecurityManager implements a policy that - * is no different than the policy implemented by {@link SecurityManager}. - * Therefore an RMI application should use the SecurityManager - * class or another application-specific SecurityManager - * implementation instead of this class. + * @implNote + *

                  Applets typically run in a container that already has a security + * manager, so there is generally no need for applets to set a security + * manager. If you have a standalone application, you might need to set a + * {@code SecurityManager} in order to enable class downloading. This can be + * done by adding the following to your code. (It needs to be executed before + * RMI can download code from remote hosts, so it most likely needs to appear + * in the {@code main} method of your application.) * - *

                  To use a SecurityManager in your application, add - * the following statement to your code (it needs to be executed before RMI - * can download code from remote hosts, so it most likely needs to appear - * in the main method of your application): - * - *

                  - * System.setSecurityManager(new SecurityManager());
                  - * 
                  + *
                  {@code
                  + *    if (System.getSecurityManager() == null) {
                  + *        System.setSecurityManager(new SecurityManager());
                  + *    }
                  + * }
                  * * @author Roger Riggs * @author Peter Jones * @since JDK1.1 - **/ + * @deprecated Use {@link SecurityManager} instead. + */ +@Deprecated public class RMISecurityManager extends SecurityManager { /** - * Constructs a new RMISecurityManager. + * Constructs a new {@code RMISecurityManager}. * @since JDK1.1 */ public RMISecurityManager() { diff --git a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java index 49dffd18e0e..bfa64ba3c6f 100644 --- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java +++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java @@ -74,7 +74,7 @@ import sun.security.action.GetIntegerAction; * ActivationGroup will override the system properties * with the properties requested when its * ActivationGroupDesc was created, and will set a - * java.rmi.RMISecurityManager as the default system + * {@link SecurityManager} as the default system * security manager. If your application requires specific properties * to be set when objects are activated in the group, the application * should create a special Properties object containing @@ -84,7 +84,7 @@ import sun.security.action.GetIntegerAction; * ActivationDescs (before the default * ActivationGroupDesc is created). If your application * requires the use of a security manager other than - * java.rmi.RMISecurityManager, in the + * {@link SecurityManager}, in the * ActivativationGroupDescriptor properties list you can set * java.security.manager property to the name of the security * manager you would like to install. @@ -154,21 +154,21 @@ public abstract class ActivationGroup * active). If the object does not call * Activatable.inactive when it deactivates, the * object will never be garbage collected since the group keeps - * strong references to the objects it creates.

                  + * strong references to the objects it creates. * *

                  The group's inactiveObject method unexports the * remote object from the RMI runtime so that the object can no * longer receive incoming RMI calls. An object will only be unexported * if the object has no pending or executing calls. * The subclass of ActivationGroup must override this - * method and unexport the object.

                  + * method and unexport the object. * *

                  After removing the object from the RMI runtime, the group * must inform its ActivationMonitor (via the monitor's * inactiveObject method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation - * request.

                  + * request. * *

                  This method simply informs the group's monitor that the object * is inactive. It is up to the concrete subclass of ActivationGroup @@ -235,7 +235,7 @@ public abstract class ActivationGroup *

                  Note that if your application creates its own custom * activation group, a security manager must be set for that * group. Otherwise objects cannot be activated in the group. - * java.rmi.RMISecurityManager is set by default. + * {@link SecurityManager} is set by default. * *

                  If a security manager is already set in the group VM, this * method first calls the security manager's diff --git a/jdk/src/share/classes/java/rmi/dgc/VMID.java b/jdk/src/share/classes/java/rmi/dgc/VMID.java index 45e58599d66..913c598be2e 100644 --- a/jdk/src/share/classes/java/rmi/dgc/VMID.java +++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java @@ -67,7 +67,7 @@ public final class VMID implements java.io.Serializable { * conditions: a) the conditions for uniqueness for objects of * the class java.rmi.server.UID are satisfied, and b) an * address can be obtained for this host that is unique and constant - * for the lifetime of this object.

                  + * for the lifetime of this object. */ public VMID() { addr = randomBytes; diff --git a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java index ec9ade2f54c..c9b8a4786a4 100644 --- a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java +++ b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java @@ -41,7 +41,15 @@ import java.net.*; * (due to a firewall), the runtime uses HTTP with the explicit port * number of the server. If the firewall does not allow this type of * communication, then HTTP to a cgi-bin script on the server is used - * to POST the RMI call. + * to POST the RMI call. The HTTP tunneling mechanisms are disabled by + * default. This behavior is controlled by the {@code java.rmi.server.disableHttp} + * property, whose default value is {@code true}. Setting this property's + * value to {@code false} will enable the HTTP tunneling mechanisms. + * + *

                  Deprecated: HTTP Tunneling. The HTTP tunneling mechanisms + * described above, specifically HTTP with an explicit port and HTTP to a + * cgi-bin script, are deprecated. These HTTP tunneling mechanisms are + * subject to removal in a future release of the platform. * *

                  The default socket factory implementation creates server sockets that * are bound to the wildcard address, which accepts requests from all network diff --git a/jdk/src/share/classes/java/rmi/server/RemoteStub.java b/jdk/src/share/classes/java/rmi/server/RemoteStub.java index 988132cacc8..36f8eb068e0 100644 --- a/jdk/src/share/classes/java/rmi/server/RemoteStub.java +++ b/jdk/src/share/classes/java/rmi/server/RemoteStub.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -25,7 +25,8 @@ package java.rmi.server; /** - * The RemoteStub class is the common superclass to client + * The {@code RemoteStub} class is the common superclass of + * statically generated client * stubs and provides the framework to support a wide range of remote * reference semantics. Stub objects are surrogates that support * exactly the same set of remote interfaces defined by the actual @@ -33,21 +34,26 @@ package java.rmi.server; * * @author Ann Wollrath * @since JDK1.1 + * + * @deprecated Statically generated stubs are deprecated, since + * stubs are generated dynamically. See {@link UnicastRemoteObject} + * for information about dynamic stub generation. */ +@Deprecated abstract public class RemoteStub extends RemoteObject { /** indicate compatibility with JDK 1.1.x version of class */ private static final long serialVersionUID = -1585587260594494182L; /** - * Constructs a RemoteStub. + * Constructs a {@code RemoteStub}. */ protected RemoteStub() { super(); } /** - * Constructs a RemoteStub, with the specified remote + * Constructs a {@code RemoteStub} with the specified remote * reference. * * @param ref the remote reference @@ -58,14 +64,17 @@ abstract public class RemoteStub extends RemoteObject { } /** - * Sets the remote reference inside the remote stub. + * Throws {@link UnsupportedOperationException}. * * @param stub the remote stub * @param ref the remote reference + * @throws UnsupportedOperationException always * @since JDK1.1 - * @deprecated no replacement. The setRef method - * is not needed since RemoteStubs can be created with - * the RemoteStub(RemoteRef) constructor. + * @deprecated No replacement. The {@code setRef} method + * was intended for setting the remote reference of a remote + * stub. This is unnecessary, since {@code RemoteStub}s can be created + * and initialized with a remote reference through use of + * the {@link #RemoteStub(RemoteRef)} constructor. */ @Deprecated protected static void setRef(RemoteStub stub, RemoteRef ref) { diff --git a/jdk/src/share/classes/java/rmi/server/ServerRef.java b/jdk/src/share/classes/java/rmi/server/ServerRef.java index cf73b7c9ab2..f0b521eaad7 100644 --- a/jdk/src/share/classes/java/rmi/server/ServerRef.java +++ b/jdk/src/share/classes/java/rmi/server/ServerRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -33,7 +33,9 @@ import java.rmi.*; * * @author Ann Wollrath * @since JDK1.1 + * @deprecated No replacement. This interface is unused and is obsolete. */ +@Deprecated public interface ServerRef extends RemoteRef { /** indicate compatibility with JDK 1.1.x version of class. */ diff --git a/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java b/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java index 61fc9154d90..3fbec26e341 100644 --- a/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java +++ b/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -30,7 +30,9 @@ package java.rmi.server; * * @author Ann Wollrath * @since JDK1.1 - **/ + * @deprecated This class is obsolete. Use {@link ExportException} instead. + */ +@Deprecated public class SocketSecurityException extends ExportException { /* indicate compatibility with JDK 1.1.x version of class */ diff --git a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java index be86c275246..802d7144ec2 100644 --- a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java +++ b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java @@ -30,52 +30,88 @@ import sun.rmi.server.UnicastServerRef2; /** * Used for exporting a remote object with JRMP and obtaining a stub - * that communicates to the remote object. + * that communicates to the remote object. Stubs are either generated + * at runtime using dynamic proxy objects, or they are generated statically + * at build time, typically using the {@code rmic} tool. * - *

                  For the constructors and static exportObject methods - * below, the stub for a remote object being exported is obtained as - * follows: + *

                  Deprecated: Static Stubs. Support for statically + * generated stubs is deprecated. This includes the API in this class that + * requires the use of static stubs, as well as the runtime support for + * loading static stubs. Generating stubs dynamically is preferred, using one + * of the five non-deprecated ways of exporting objects as listed below. Do + * not run {@code rmic} to generate static stub classes. It is unnecessary, and + * it is also deprecated. * - *

                    + *

                    There are six ways to export remote objects: + * + *

                      + * + *
                    1. Subclassing {@code UnicastRemoteObject} and calling the + * {@link #UnicastRemoteObject()} constructor. + * + *
                    2. Subclassing {@code UnicastRemoteObject} and calling the + * {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)} constructor. + * + *
                    3. Subclassing {@code UnicastRemoteObject} and calling the + * {@link #UnicastRemoteObject(int, RMIClientSocketFactory, RMIServerSocketFactory) + * UnicastRemoteObject(port, csf, ssf)} constructor. + * + *
                    4. Calling the + * {@link #exportObject(Remote) exportObject(Remote)} method. + * Deprecated. + * + *
                    5. Calling the + * {@link #exportObject(Remote, int) exportObject(Remote, port)} method. + * + *
                    6. Calling the + * {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory) + * exportObject(Remote, port, csf, ssf)} method. + * + *
                    + * + *

                    The fourth technique, {@link #exportObject(Remote)}, + * always uses statically generated stubs and is deprecated. + * + *

                    The other five techniques all use the following approach: if the + * {@code java.rmi.server.ignoreStubClasses} property is {@code true} + * (case insensitive) or if a static stub cannot be found, stubs are generated + * dynamically using {@link java.lang.reflect.Proxy Proxy} objects. Otherwise, + * static stubs are used. + * + *

                    The default value of the + * {@code java.rmi.server.ignoreStubClasses} property is {@code false}. + * + *

                    Statically generated stubs are typically pregenerated from the + * remote object's class using the {@code rmic} tool. A static stub is + * loaded and an instance of that stub class is constructed as described + * below. * - *

                  • If the remote object is exported using the {@link - * #exportObject(Remote) UnicastRemoteObject.exportObject(Remote)} method, - * a stub class (typically pregenerated from the remote object's class - * using the rmic tool) is loaded and an instance of that stub - * class is constructed as follows. *
                      * - *
                    • A "root class" is determined as follows: if the remote object's + *
                    • A "root class" is determined as follows: if the remote object's * class directly implements an interface that extends {@link Remote}, then * the remote object's class is the root class; otherwise, the root class is * the most derived superclass of the remote object's class that directly - * implements an interface that extends Remote. + * implements an interface that extends {@code Remote}. * *
                    • The name of the stub class to load is determined by concatenating - * the binary name of the root class with the suffix "_Stub". + * the binary name of the root class with the suffix {@code _Stub}. * *
                    • The stub class is loaded by name using the class loader of the root - * class. The stub class must extend {@link RemoteStub} and must have a - * public constructor that has one parameter, of type {@link RemoteRef}. + * class. The stub class must extend {@link RemoteStub} and must have a + * public constructor that has one parameter of type {@link RemoteRef}. * *
                    • Finally, an instance of the stub class is constructed with a * {@link RemoteRef}. - *
                    * - *
                  • If the appropriate stub class could not be found, or the stub class - * could not be loaded, or a problem occurs creating the stub instance, a + *
                  • If the appropriate stub class could not be found, or if the stub class + * could not be loaded, or if a problem occurs creating the stub instance, a * {@link StubNotFoundException} is thrown. * - *

                    - *

                  • For all other means of exporting: - *

                      + *
                    * - *
                  • If the remote object's stub class (as defined above) could not be - * loaded or the system property - * java.rmi.server.ignoreStubClasses is set to - * "true" (case insensitive), a {@link - * java.lang.reflect.Proxy} instance is constructed with the following - * properties: + *

                    Stubs are dynamically generated by constructing an instance of + * a {@link java.lang.reflect.Proxy Proxy} with the following characteristics: * *

                      * @@ -91,29 +127,13 @@ import sun.rmi.server.UnicastServerRef2; * *
                    • If the proxy could not be created, a {@link StubNotFoundException} * will be thrown. - *
                    - * - *

                    - *

                  • Otherwise, an instance of the remote object's stub class (as - * described above) is used as the stub. * *
                  - *
                - * - *

                If an object is exported with the - * {@link #exportObject(Remote) exportObject(Remote)} - * or - * {@link #exportObject(Remote, int) exportObject(Remote, port)} - * methods, or if a subclass constructor invokes one of the - * {@link #UnicastRemoteObject()} - * or - * {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)} - * constructors, the object is exported with a server socket created using the - * {@link RMISocketFactory} - * class. * * @implNote - *

                By default, server sockets created by the {@link RMISocketFactory} class + * Depending upon which constructor or static method is used for exporting an + * object, {@link RMISocketFactory} may be used for creating sockets. + * By default, server sockets created by {@link RMISocketFactory} * listen on all network interfaces. See the * {@link RMISocketFactory} class and the section * RMI Socket Factories @@ -148,6 +168,10 @@ public class UnicastRemoteObject extends RemoteServer { /** * Creates and exports a new UnicastRemoteObject object using an * anonymous port. + * + *

                The object is exported with a server socket + * created using the {@link RMISocketFactory} class. + * * @throws RemoteException if failed to export object * @since JDK1.1 */ @@ -159,6 +183,10 @@ public class UnicastRemoteObject extends RemoteServer { /** * Creates and exports a new UnicastRemoteObject object using the * particular supplied port. + * + *

                The object is exported with a server socket + * created using the {@link RMISocketFactory} class. + * * @param port the port number on which the remote object receives calls * (if port is zero, an anonymous port is chosen) * @throws RemoteException if failed to export object @@ -173,6 +201,11 @@ public class UnicastRemoteObject extends RemoteServer { /** * Creates and exports a new UnicastRemoteObject object using the * particular supplied port and socket factories. + * + *

                Either socket factory may be {@code null}, in which case + * the corresponding client or server socket creation method of + * {@link RMISocketFactory} is used instead. + * * @param port the port number on which the remote object receives calls * (if port is zero, an anonymous port is chosen) * @param csf the client-side socket factory for making calls to the @@ -238,12 +271,23 @@ public class UnicastRemoteObject extends RemoteServer { /** * Exports the remote object to make it available to receive incoming - * calls using an anonymous port. + * calls using an anonymous port. This method will always return a + * statically generated stub. + * + *

                The object is exported with a server socket + * created using the {@link RMISocketFactory} class. + * * @param obj the remote object to be exported * @return remote object stub * @exception RemoteException if export fails * @since JDK1.1 + * @deprecated This method is deprecated because it supports only static stubs. + * Use {@link #exportObject(Remote, int) exportObject(Remote, port)} or + * {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory) + * exportObject(Remote, port, csf, ssf)} + * instead. */ + @Deprecated public static RemoteStub exportObject(Remote obj) throws RemoteException { @@ -260,6 +304,10 @@ public class UnicastRemoteObject extends RemoteServer { /** * Exports the remote object to make it available to receive incoming * calls, using the particular supplied port. + * + *

                The object is exported with a server socket + * created using the {@link RMISocketFactory} class. + * * @param obj the remote object to be exported * @param port the port to export the object on * @return remote object stub @@ -275,6 +323,11 @@ public class UnicastRemoteObject extends RemoteServer { /** * Exports the remote object to make it available to receive incoming * calls, using a transport specified by the given socket factory. + * + *

                Either socket factory may be {@code null}, in which case + * the corresponding client or server socket creation method of + * {@link RMISocketFactory} is used instead. + * * @param obj the remote object to be exported * @param port the port to export the object on * @param csf the client-side socket factory for making calls to the diff --git a/jdk/src/share/classes/java/rmi/server/package.html b/jdk/src/share/classes/java/rmi/server/package.html index 290ca9a4ba2..1bfa46dfa8f 100644 --- a/jdk/src/share/classes/java/rmi/server/package.html +++ b/jdk/src/share/classes/java/rmi/server/package.html @@ -1,5 +1,5 @@ - + diff --git a/jdk/src/share/classes/javax/swing/colorchooser/package.html b/jdk/src/share/classes/javax/swing/colorchooser/package.html index d64ba91b64b..bf405aa45c1 100644 --- a/jdk/src/share/classes/javax/swing/colorchooser/package.html +++ b/jdk/src/share/classes/javax/swing/colorchooser/package.html @@ -25,6 +25,7 @@ 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. --> + diff --git a/jdk/src/share/classes/javax/swing/event/DocumentEvent.java b/jdk/src/share/classes/javax/swing/event/DocumentEvent.java index 9c9c796f8ec..a115660ec82 100644 --- a/jdk/src/share/classes/javax/swing/event/DocumentEvent.java +++ b/jdk/src/share/classes/javax/swing/event/DocumentEvent.java @@ -79,7 +79,7 @@ public interface DocumentEvent { * This method is for observers to discover the structural * changes that were made. This means that only elements * that existed prior to the mutation (and still exist after - * the mutatino) need to have ElementChange records. + * the mutation) need to have ElementChange records. * The changes made available need not be recursive. *

                * For example, if the an element is removed from it's diff --git a/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java b/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java index 004038af785..b3262e6f0fd 100644 --- a/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java +++ b/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java @@ -158,7 +158,7 @@ public class HyperlinkEvent extends EventObject { /** * Returns the Element that corresponds to the source of the * event. This will typically be an Element representing - * an anchor. If a constructur that is used that does not specify a source + * an anchor. If a constructor that is used that does not specify a source * Element, or null was specified as the source * Element, this will return null. * diff --git a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java index 038ccb36bb0..05c5c7bdc76 100644 --- a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java +++ b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java @@ -67,7 +67,7 @@ import javax.swing.table.*; */ public class TableModelEvent extends java.util.EventObject { - /** Identifies the addtion of new rows or columns. */ + /** Identifies the addition of new rows or columns. */ public static final int INSERT = 1; /** Identifies a change to existing data. */ public static final int UPDATE = 0; diff --git a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java index e67552df9c5..9b3bc05f331 100644 --- a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java +++ b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java @@ -89,7 +89,7 @@ public class TreeModelEvent extends EventObject { * before the deletes have occurred. Since the indexes must be specified in * order, the most natural processing methodology is to use a delete-counter. * Start by initializing the counter to zero and start work through the - * list from lowest to higest. Every time you do a delete, add the current + * list from lowest to highest. Every time you do a delete, add the current * value of the delete-counter to the index-position where the delete occurred, * and append the result to a Vector of delete-locations, using * addElement(). Then increment the delete-counter. The index diff --git a/jdk/src/share/classes/javax/swing/event/package.html b/jdk/src/share/classes/javax/swing/event/package.html index 5a90113561d..c1fab2cfd12 100644 --- a/jdk/src/share/classes/javax/swing/event/package.html +++ b/jdk/src/share/classes/javax/swing/event/package.html @@ -25,7 +25,7 @@ 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. --> - + diff --git a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java index 3e206e2df78..9d93b9b8ae1 100644 --- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java +++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java @@ -122,7 +122,7 @@ public abstract class FileSystemView { } /** - * Determines if the given file is a root in the navigatable tree(s). + * Determines if the given file is a root in the navigable tree(s). * Examples: Windows 98 has one root, the Desktop folder. DOS has one root * per drive letter, C:\, D:\, etc. Unix has one root, * the "/" directory. @@ -130,7 +130,7 @@ public abstract class FileSystemView { * The default implementation gets information from the ShellFolder class. * * @param f a File object representing a directory - * @return true if f is a root in the navigatable tree. + * @return true if f is a root in the navigable tree. * @see #isFileSystemRoot */ public boolean isRoot(File f) { @@ -201,7 +201,7 @@ public abstract class FileSystemView { /** * Type description for a file, directory, or folder as it would be displayed in * a system file browser. Example from Windows: the "Desktop" folder - * is desribed as "Desktop". + * is described as "Desktop". * * Override for platforms with native ShellFolder implementations. * @@ -254,7 +254,7 @@ public abstract class FileSystemView { * parent directory in the filesystem. Folder could for example be the * "Desktop" folder which is not the same as file.getParentFile(). * - * @param folder a File object repesenting a directory or special folder + * @param folder a File object representing a directory or special folder * @param file a File object * @return true if folder is a directory or special folder and contains file. * @since 1.4 @@ -281,7 +281,7 @@ public abstract class FileSystemView { /** * - * @param parent a File object repesenting a directory or special folder + * @param parent a File object representing a directory or special folder * @param fileName a name of a file or folder which exists in parent * @return a File object. This is normally constructed with new * File(parent, fileName) except when parent and child are both @@ -698,7 +698,7 @@ class WindowsFileSystemView extends FileSystemView { /** * Type description for a file, directory, or folder as it would be displayed in * a system file browser. Example from Windows: the "Desktop" folder - * is desribed as "Desktop". + * is described as "Desktop". * * The Windows implementation gets information from the ShellFolder class. */ diff --git a/jdk/src/share/classes/javax/swing/filechooser/package.html b/jdk/src/share/classes/javax/swing/filechooser/package.html index 58048bab801..6303e9fd35f 100644 --- a/jdk/src/share/classes/javax/swing/filechooser/package.html +++ b/jdk/src/share/classes/javax/swing/filechooser/package.html @@ -25,7 +25,7 @@ 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. --> - + diff --git a/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java index 57de91208af..92eb0e1afcd 100644 --- a/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java @@ -36,7 +36,7 @@ import javax.swing.JComboBox; public abstract class ComboBoxUI extends ComponentUI { /** - * Set the visiblity of the popup + * Set the visibility of the popup */ public abstract void setPopupVisible( JComboBox c, boolean v ); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java index b9773ff0900..9e67b81d0ad 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java @@ -497,7 +497,7 @@ public class BasicBorders { /** - * Draws the border around the splitpane. To work correctly you shoudl + * Draws the border around the splitpane. To work correctly you should * also install a border on the divider (property SplitPaneDivider.border). */ public static class SplitPaneBorder implements Border, UIResource { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java index 37764cce509..bd5276afa2d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -41,7 +41,7 @@ import sun.swing.UIAction; /** * Basic UI implementation for JComboBox. *

                - * The combo box is a compound component which means that it is an agregate of + * The combo box is a compound component which means that it is an aggregate of * many simpler components. This class creates and manages the listeners * on the combo box and the combo box model. These listeners update the user * interface in response to changes in the properties and state of the combo box. @@ -705,7 +705,7 @@ public class BasicComboBoxUI extends ComboBoxUI { } /** - * The aggregate components which compise the combo box are + * The aggregate components which comprise the combo box are * unregistered and uninitialized. This method is called as part of the * UI uninstallation process. */ @@ -911,7 +911,7 @@ public class BasicComboBoxUI extends ComboBoxUI { } /** - * The minumum size is the size of the display area plus insets plus the button. + * The minimum size is the size of the display area plus insets plus the button. */ @Override public Dimension getMinimumSize( JComponent c ) { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java index 21be1269e02..17ce072b6cc 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java @@ -456,7 +456,7 @@ public class BasicFileChooserUI extends FileChooserUI { public void mouseClicked(MouseEvent evt) { // Note: we can't depend on evt.getSource() because of backward - // compatability + // compatibility if (list != null && SwingUtilities.isLeftMouseButton(evt) && (evt.getClickCount()%2 == 0)) { @@ -565,7 +565,7 @@ public class BasicFileChooserUI extends FileChooserUI { } protected class DoubleClickListener extends MouseAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -591,7 +591,7 @@ public class BasicFileChooserUI extends FileChooserUI { } protected class SelectionListener implements ListSelectionListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java index 283ced62287..22eb7951066 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java @@ -270,18 +270,27 @@ public class BasicInternalFrameTitlePane extends JComponent protected void addSystemMenuItems(JMenu systemMenu) { JMenuItem mi = systemMenu.add(restoreAction); - mi.setMnemonic('R'); + mi.setMnemonic(getButtonMnemonic("restore")); mi = systemMenu.add(moveAction); - mi.setMnemonic('M'); + mi.setMnemonic(getButtonMnemonic("move")); mi = systemMenu.add(sizeAction); - mi.setMnemonic('S'); + mi.setMnemonic(getButtonMnemonic("size")); mi = systemMenu.add(iconifyAction); - mi.setMnemonic('n'); + mi.setMnemonic(getButtonMnemonic("minimize")); mi = systemMenu.add(maximizeAction); - mi.setMnemonic('x'); + mi.setMnemonic(getButtonMnemonic("maximize")); systemMenu.add(new JSeparator()); mi = systemMenu.add(closeAction); - mi.setMnemonic('C'); + mi.setMnemonic(getButtonMnemonic("close")); + } + + private static int getButtonMnemonic(String button) { + try { + return Integer.parseInt(UIManager.getString( + "InternalFrameTitlePane." + button + "Button.mnemonic")); + } catch (NumberFormatException e) { + return -1; + } } protected JMenu createSystemMenu() { @@ -556,7 +565,7 @@ public class BasicInternalFrameTitlePane extends JComponent * Instantiate it only within subclasses of Foo. */ public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -570,7 +579,7 @@ public class BasicInternalFrameTitlePane extends JComponent * Instantiate it only within subclasses of Foo. */ public class TitlePaneLayout implements LayoutManager { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java index f5cdaef24b4..1db95fb8f96 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java @@ -477,7 +477,7 @@ public class BasicInternalFrameUI extends InternalFrameUI public class InternalFramePropertyChangeListener implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -491,7 +491,7 @@ public class BasicInternalFrameUI extends InternalFrameUI } public class InternalFrameLayout implements LayoutManager { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1093,7 +1093,7 @@ public class BasicInternalFrameUI extends InternalFrameUI } /// End BorderListener Class protected class ComponentHandler implements ComponentListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1119,7 +1119,7 @@ public class BasicInternalFrameUI extends InternalFrameUI protected class GlassPaneDispatcher implements MouseInputListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1159,7 +1159,7 @@ public class BasicInternalFrameUI extends InternalFrameUI protected class BasicInternalFrameListener implements InternalFrameListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java index b8aff8a255a..4ad134756e9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java @@ -433,7 +433,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab * used for getting localized defaults. Also initialize the default * locale used when no locale is passed into UIDefaults.get(). The * default locale should generally not be relied upon. It is here for - * compatability with releases prior to 1.4. + * compatibility with releases prior to 1.4. */ private void initResourceBundle(UIDefaults table) { table.setDefaultLocale( Locale.getDefault() ); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index e32e12da0b8..c6b521c9cd0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -760,7 +760,7 @@ public class BasicMenuItemUI extends MenuItemUI Thread.dumpStack(); } protected class MouseInputHandler implements MouseInputListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java index 72b25eadafd..d849077b7ab 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java @@ -322,7 +322,7 @@ public class BasicMenuUI extends BasicMenuItemUI * @since 1.4 */ protected class MouseInputHandler implements MouseInputListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java index 4f784fa07e6..28b1d0a09bb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -923,7 +923,7 @@ public class BasicOptionPaneUI extends OptionPaneUI { private boolean reverseButtons; /** * Indicates whether or not centersChildren should be used vs - * the orientation. This is done for backward compatability + * the orientation. This is done for backward compatibility * for subclassers. */ private boolean useOrientation; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java index 94e47d043a0..c83172848bd 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java @@ -335,7 +335,7 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * Returns the width (if HORIZONTAL) or height (if VERTICAL) - * of each of the indivdual cells/units to be rendered in the + * of each of the individual cells/units to be rendered in the * progress bar. However, for text rendering simplification and * aesthetic considerations, this function will return 1 when * the progress string is being rendered. @@ -1215,7 +1215,7 @@ public class BasicProgressBarUI extends ProgressBarUI { * Instantiate it only within subclasses of {@code BasicProgressBarUI}. */ public class ChangeHandler implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java index 65e170a3181..765e948b030 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java @@ -1489,7 +1489,7 @@ public class BasicScrollBarUI public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java index 355f5fce2b9..08b8090613a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -443,7 +443,7 @@ public class BasicScrollPaneUI public class ViewportChangeHandler implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -464,7 +464,7 @@ public class BasicScrollPaneUI public class HSBChangeListener implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -494,7 +494,7 @@ public class BasicScrollPaneUI public class VSBChangeListener implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -534,7 +534,7 @@ public class BasicScrollPaneUI */ protected class MouseWheelHandler implements MouseWheelListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -665,7 +665,7 @@ public class BasicScrollPaneUI public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java index 7ca5c22cc59..e90c1e8bbee 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java @@ -743,7 +743,7 @@ public class BasicSliderUI extends SliderUI{ } public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1545,7 +1545,7 @@ public class BasicSliderUI extends SliderUI{ * Instantiate it only within subclasses of Foo. */ public class ChangeHandler implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1852,7 +1852,7 @@ public class BasicSliderUI extends SliderUI{ * Instantiate it only within subclasses of Foo. */ public class ComponentHandler extends ComponentAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1868,7 +1868,7 @@ public class BasicSliderUI extends SliderUI{ * Instantiate it only within subclasses of Foo. */ public class FocusHandler implements FocusListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1895,7 +1895,7 @@ public class BasicSliderUI extends SliderUI{ * Instantiate it only within subclasses of Foo. */ public class ActionScroller extends AbstractAction { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Actions. If you need to add // new functionality add it to the Actions, but make sure this // class calls into the Actions. @@ -1928,7 +1928,7 @@ public class BasicSliderUI extends SliderUI{ * A static version of the above. */ static class SharedActionScroller extends AbstractAction { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Actions. If you need to add // new functionality add it to the Actions, but make sure this // class calls into the Actions. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java index ba9ef818ae2..0f47e8965c5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java @@ -273,7 +273,7 @@ public class BasicSplitPaneUI extends SplitPaneUI private Color dividerDraggingColor; private boolean rememberPaneSizes; - // Indicates wether the one of splitpane sides is expanded + // Indicates whether the one of splitpane sides is expanded private boolean keepHidden = false; /** Indicates that we have painted once. */ @@ -637,7 +637,7 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Determines wether the JSplitPane is set to use a continuous layout. + * Determines whether the JSplitPane is set to use a continuous layout. */ public boolean isContinuousLayout() { return continuousLayout; @@ -683,7 +683,7 @@ public class BasicSplitPaneUI extends SplitPaneUI */ public class PropertyHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -707,7 +707,7 @@ public class BasicSplitPaneUI extends SplitPaneUI */ public class FocusHandler extends FocusAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1073,7 +1073,7 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the preferred size for the passed in component, - * This is passed off to the current layoutmanager. + * This is passed off to the current layout manager. */ public Dimension getPreferredSize(JComponent jc) { if(splitPane != null) @@ -1084,7 +1084,7 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the minimum size for the passed in component, - * This is passed off to the current layoutmanager. + * This is passed off to the current layout manager. */ public Dimension getMinimumSize(JComponent jc) { if(splitPane != null) @@ -1095,7 +1095,7 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the maximum size for the passed in component, - * This is passed off to the current layoutmanager. + * This is passed off to the current layout manager. */ public Dimension getMaximumSize(JComponent jc) { if(splitPane != null) @@ -1438,8 +1438,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the minimum size needed to contain the children. - * The width is the sum of all the childrens min widths and - * the height is the largest of the childrens minimum heights. + * The width is the sum of all the children's min widths and + * the height is the largest of the children's minimum heights. */ public Dimension minimumLayoutSize(Container container) { int minPrimary = 0; @@ -1471,8 +1471,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the preferred size needed to contain the children. - * The width is the sum of all the childrens preferred widths and - * the height is the largest of the childrens preferred heights. + * The width is the sum of all the preferred widths of the children and + * the height is the largest preferred height of the children. */ public Dimension preferredLayoutSize(Container container) { int prePrimary = 0; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index b239cd70280..f0e3ada72cb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -3748,7 +3748,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -3762,7 +3762,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class TabSelectionHandler implements ChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -3776,7 +3776,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class MouseHandler extends MouseAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -3790,7 +3790,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { * Instantiate it only within subclasses of BasicTabbedPaneUI. */ public class FocusHandler extends FocusAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java index f9f9c728ed1..dba3c6b23a1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java @@ -738,7 +738,7 @@ public class BasicTableUI extends TableUI * the current TableCellEditor. */ public class KeyHandler implements KeyListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -764,7 +764,7 @@ public class BasicTableUI extends TableUI * Instantiate it only within subclasses of {@code BasicTableUI}. */ public class FocusHandler implements FocusListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -786,7 +786,7 @@ public class BasicTableUI extends TableUI * Instantiate it only within subclasses of BasicTableUI. */ public class MouseInputHandler implements MouseInputListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java index bec3faacbfd..9d037c1e670 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1560,6 +1560,10 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * location that one might place a caret. Some views may not be visible, * they might not be in the same order found in the model, or they just * might not allow access to some of the locations in the model. + * This method enables specifying a position to convert + * within the range of >=0. If the value is -1, a position + * will be calculated automatically. If the value < -1, + * the {@code BadLocationException} will be thrown. * * @param pos the position to convert >= 0 * @param a the allocated region to render into @@ -1569,13 +1573,17 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * SwingConstants.NORTH, or SwingConstants.SOUTH. * @return the location within the model that best represents the next * location visual position. - * @exception BadLocationException + * @exception BadLocationException the given position is not a valid + * position within the document * @exception IllegalArgumentException for an invalid direction */ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) throws BadLocationException { + if (pos < -1) { + throw new BadLocationException("invalid position", pos); + } if( view != null ) { int nextPos = view.getNextVisualPositionFrom(pos, b, a, direction, biasRet); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java index 7f1d05af875..847e1db6551 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java @@ -583,7 +583,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants /** * Sets the flag for enabling rollover borders on the toolbar and it will - * also install the apropriate border depending on the state of the flag. + * also install the appropriate border depending on the state of the flag. * * @param rollover if true, rollover borders are installed. * Otherwise non-rollover borders are installed @@ -606,7 +606,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants * This is a convenience method to call setBorderToRollover * for each child component. * - * @param c container which holds the child components (usally a JToolBar) + * @param c container which holds the child components (usually a JToolBar) * @see #setBorderToRollover * @since 1.4 */ @@ -630,7 +630,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants * This is a convenience method to call setBorderToNonRollover * for each child component. * - * @param c container which holds the child components (usally a JToolBar) + * @param c container which holds the child components (usually a JToolBar) * @see #setBorderToNonRollover * @since 1.4 */ @@ -654,7 +654,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants * This is a convenience method to call setBorderNormal * for each child component. * - * @param c container which holds the child components (usally a JToolBar) + * @param c container which holds the child components (usually a JToolBar) * @see #setBorderToNonRollover * @since 1.4 */ @@ -1274,7 +1274,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants } protected class ToolBarContListener implements ContainerListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1289,7 +1289,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants } protected class ToolBarFocusListener implements FocusListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1303,7 +1303,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants } protected class PropertyListener implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -1317,7 +1317,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants * Instantiate it only within subclasses of BasicToolBarUI. */ public class DockingListener implements MouseInputListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java index 8309dd6aa40..79b2093d39b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java @@ -204,7 +204,7 @@ public class BasicToolTipUI extends ToolTipUI JComponent comp = ((JToolTip)c).getComponent(); if (comp != null && !(comp.isEnabled())) { - // For better backward compatability, only install inactive + // For better backward compatibility, only install inactive // properties if they are defined. if (UIManager.getBorder("ToolTip.borderInactive") != null) { LookAndFeel.installBorder(c, "ToolTip.borderInactive"); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java index de739dc1e75..821483049f0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java @@ -140,7 +140,7 @@ public class BasicTreeUI extends TreeUI /** Used to determine what to display. */ protected TreeModel treeModel; - /** Model maintaing the selection. */ + /** Model maintaining the selection. */ protected TreeSelectionModel treeSelectionModel; /** How much the depth should be offset to properly calculate @@ -1275,7 +1275,7 @@ public class BasicTreeUI extends TreeUI } /** - * Returns a ubounding box for the drop line. + * Returns a unbounding box for the drop line. * * @param loc a {@code DropLocation} * @return bounding box for the drop line @@ -2525,7 +2525,7 @@ public class BasicTreeUI extends TreeUI * Updates the TreeState in response to nodes expanding/collapsing. */ public class TreeExpansionHandler implements TreeExpansionListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2627,7 +2627,7 @@ public class BasicTreeUI extends TreeUI */ public class TreeModelHandler implements TreeModelListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2656,7 +2656,7 @@ public class BasicTreeUI extends TreeUI */ public class TreeSelectionHandler implements TreeSelectionListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2677,7 +2677,7 @@ public class BasicTreeUI extends TreeUI */ public class CellEditorHandler implements CellEditorListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2695,12 +2695,12 @@ public class BasicTreeUI extends TreeUI /** - * This is used to get mutliple key down events to appropriately generate + * This is used to get multiple key down events to appropriately generate * events. */ public class KeyHandler extends KeyAdapter { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2742,7 +2742,7 @@ public class BasicTreeUI extends TreeUI * Repaints the lead selection row when focus is lost/gained. */ public class FocusHandler implements FocusListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2844,7 +2844,7 @@ public class BasicTreeUI extends TreeUI */ public class MouseHandler extends MouseAdapter implements MouseMotionListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2877,12 +2877,12 @@ public class BasicTreeUI extends TreeUI /** * PropertyChangeListener for the tree. Updates the appropriate - * varaible, or TreeState, based on what changes. + * variable, or TreeState, based on what changes. */ public class PropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. @@ -2900,7 +2900,7 @@ public class BasicTreeUI extends TreeUI public class SelectionModelPropertyChangeHandler implements PropertyChangeListener { - // NOTE: This class exists only for backward compatability. All + // NOTE: This class exists only for backward compatibility. All // its functionality has been moved into Handler. If you need to add // new functionality add it to the Handler, but make sure this // class calls into the Handler. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/package.html b/jdk/src/share/classes/javax/swing/plaf/basic/package.html index f48ba91ad76..d453d348595 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/package.html +++ b/jdk/src/share/classes/javax/swing/plaf/basic/package.html @@ -25,7 +25,7 @@ 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. --> - + diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java b/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java index b0b42cfcf55..5527815d5b6 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java @@ -57,7 +57,7 @@ import sun.swing.SwingUtilities2; * UIManager.put("swing.boldMetal", Boolean.FALSE); *

              * The defaults property swing.boldMetal, if set, - * takes precendence over the system property of the same name. After + * takes precedence over the system property of the same name. After * setting this defaults property you need to re-install * MetalLookAndFeel, as well as update the UI * of any previously created widgets. Otherwise the results are undefined. @@ -284,7 +284,7 @@ public class DefaultMetalTheme extends MetalTheme { /** * Returns the system text font. This returns Dialog, 12pt, plain. * - * @return the sytem text font + * @return the system text font */ public FontUIResource getSystemTextFont() { return getFont(SYSTEM_TEXT_FONT); diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java index 76ece662b2f..7318815e691 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -1738,7 +1738,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel public static FontUIResource getControlTextFont() { return getCurrentTheme().getControlTextFont();} /** - * Returns the sytem text font of the current theme. This is a + * Returns the system text font of the current theme. This is a * cover method for {@code getCurrentTheme().getSystemTextFont()}. * * @return the system text font diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java index e2c6d519c53..e40721dddb5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java @@ -682,7 +682,7 @@ public class MetalRootPaneUI extends BasicRootPaneUI private boolean isMovingWindow; /** - * Used to determine the corner the resize is occuring from. + * Used to determine the corner the resize is occurring from. */ private int dragCursor; diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java index 8b50bb76961..3fbfb3fa55f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java @@ -64,14 +64,14 @@ public class MetalSliderUI extends BasicSliderUI { /** * A default horizontal thumb Icon. This field might not be - * used. To change the Icon used by this delgate directly set it + * used. To change the Icon used by this delegate directly set it * using the Slider.horizontalThumbIcon UIManager property. */ protected static Icon horizThumbIcon; /** * A default vertical thumb Icon. This field might not be - * used. To change the Icon used by this delgate directly set it + * used. To change the Icon used by this delegate directly set it * using the Slider.verticalThumbIcon UIManager property. */ protected static Icon vertThumbIcon; diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java index 6de36bea4f3..65b2cb4a572 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java @@ -64,7 +64,7 @@ public class MetalToolBarUI extends BasicToolBarUI private static List> components = new ArrayList>(); /** - * This protected field is implemenation specific. Do not access directly + * This protected field is implementation specific. Do not access directly * or override. Use the create method instead. * * @see #createContainerListener @@ -72,7 +72,7 @@ public class MetalToolBarUI extends BasicToolBarUI protected ContainerListener contListener; /** - * This protected field is implemenation specific. Do not access directly + * This protected field is implementation specific. Do not access directly * or override. Use the create method instead. * * @see #createRolloverListener diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java index 29e7f45db31..b3ba0ea969e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java @@ -64,7 +64,7 @@ import javax.swing.plaf.basic.*; *
          Examples of Path Matching
          this's pathp's pathmatch
          /a/b/a/byes
          * *

          - * As it is typically impratical to obtain the TreeUI from + * As it is typically impractical to obtain the TreeUI from * the JTree and cast to an instance of MetalTreeUI * you enable this property via the client property * JTree.lineStyle. For example, to switch to diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/package.html b/jdk/src/share/classes/javax/swing/plaf/metal/package.html index e60da42ed46..146cbbbc79b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/package.html +++ b/jdk/src/share/classes/javax/swing/plaf/metal/package.html @@ -25,7 +25,7 @@ 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. --> - + diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html b/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html index 5160494f750..3ae0bf2c6c0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html +++ b/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html @@ -14,14 +14,14 @@ Using the Multiplexing Look and Feel


          -

          + This document is based on an article originally published in The Swing Connection. -

          +


          @@ -43,7 +43,6 @@ the Java or Windows look and feel, for example -- and requires no modifications to work with auxiliary look and feels.

          -

          This document has the following sections: @@ -76,14 +75,12 @@ a Swing Connection article.

          - +


          - Overview -

          @@ -146,14 +143,12 @@ is called (unsurprisingly) the Multiplexing look and feel.

          - +


          - How to Use Auxiliary Look and Feels -

          It's easy to use auxiliary look and feels with Swing. To instruct @@ -204,14 +199,12 @@ of the UIs obtained from the default and auxiliary look and feels.

          - +


          - Tips for Writing an Auxiliary Look and Feel -

          An auxiliary look and feel is like any other look and feel, @@ -252,7 +245,6 @@ the javax.swing.plaf package. Dos and Don'ts

          -

          The following paragraphs provide some general recommendations for developing @@ -264,22 +256,19 @@ auxiliary look and feels. to perform all initialization, and the uninstallUI method to perform all cleanup. -

          -
            -

            +

            The installUI and uninstallUI methods are invoked when a component's look and feel is set. The installUI method gives the new UI object a chance to add listeners on the component and its data model. Similarly, the uninstallUI method lets the previous UI object remove its listeners. -

            -
          +

          Don't extend visual look and feels.

          -
            -

            We recommended that you don't implement +

            + We recommended that you don't implement UI classes of an auxiliary look and feel as subclasses of the UI classes of a visual look and feel. Why not? Because they might accidentally inherit code that installs listeners on a component @@ -290,13 +279,13 @@ lets the previous UI object remove its listeners. Instead, we recommend that the UI classes of an auxiliary look and feel directly extend the abstract UI classes in the javax.swing.plaf package. By using this strategy, the developer of an auxiliary - look and feel can avoid competing with the default look and feel.

            -
          + look and feel can avoid competing with the default look and feel. +

          Override all UI-specific methods your UI classes inherit.

          -
            -

            We recommend that each UI class of +

            + We recommend that each UI class of an auxiliary look and feel override the methods defined in the javax.swing.plaf UI classes it descends from @@ -309,15 +298,14 @@ lets the previous UI object remove its listeners. if the component is opaque. If a UI class from a non-visual auxiliary look and feel does not override this method, all - opaque components appear as blank areas on the screen!

            -
          + opaque components appear as blank areas on the screen! +


          Extending UIDefaults -

          In many cases, you might want an auxiliary look and feel to be "incomplete." That @@ -379,7 +367,6 @@ In the preceding example, an auxiliary look and feel named MyAux Examining Other UI Objects -

          In rare instances, a UI object from an auxiliary look and feel @@ -395,12 +382,10 @@ In the preceding example, an auxiliary look and feel named MyAux

          - +


          - How the Multiplexing Look and Feel Is Implemented -

          The Multiplexing look and feel @@ -437,8 +422,8 @@ all developers and users. and feel is always the first to be created. After that, a UI object is created from each auxiliary look and feel in the order they are specified in the swing.auxiliarylaf - property.

        2. -

          + property.

          +

        3. When a method that requests information from a UI object is invoked, the multiplexing UI object invokes the method on all the UI objects, but returns @@ -450,8 +435,8 @@ all developers and users. The getPreferredSize method is also invoked on the UI object for each auxiliary look and feel, but the return values are ignored. -
        4. -

          +

          +

        5. When a method that does not request information from the UI object is invoked, the multiplexing UI object invokes that method on all UIs -- @@ -474,14 +459,12 @@ all developers and users.

          - +


          - How to Provide a Custom Multiplexing Look and Feel -

          -

          While +

          While we hope the behavior of the Multiplexing look and feel is flexible enough not to require an alternative multiplexing look and feel, Swing allows the user to specify another multiplexing look diff --git a/jdk/src/share/classes/javax/swing/plaf/multi/package.html b/jdk/src/share/classes/javax/swing/plaf/multi/package.html index 31b212bfbdb..94e73080e3d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/multi/package.html +++ b/jdk/src/share/classes/javax/swing/plaf/multi/package.html @@ -25,7 +25,7 @@ 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. --> - + diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java index 355e68e95cb..6cdeb119c1e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java @@ -187,7 +187,7 @@ public abstract class AbstractRegionPainter implements Painter { protected abstract PaintContext getPaintContext(); /** - *

          Configures the given Graphics2D. Often, rendering hints or compositiing rules are + *

          Configures the given Graphics2D. Often, rendering hints or compositing rules are * applied to a Graphics2D object prior to painting, which should affect all of the * subsequent painting operations. This method provides a convenient hook for configuring * the Graphics object prior to rendering, regardless of whether the render operation is @@ -201,7 +201,7 @@ public abstract class AbstractRegionPainter implements Painter { /** * Actually performs the painting operation. Subclasses must implement this method. - * The graphics object passed may represent the actual surface being rendererd to, + * The graphics object passed may represent the actual surface being rendered to, * or it may be an intermediate buffer. It has also been pre-translated. Simply render * the component as if it were located at 0, 0 and had a width of width * and a height of height. For performance reasons, you may want to read @@ -313,13 +313,13 @@ public abstract class AbstractRegionPainter implements Painter { * Decodes and returns a color, which is derived from a base color in UI * defaults. * - * @param key A key corrosponding to the value in the UI Defaults table + * @param key A key corresponding to the value in the UI Defaults table * of UIManager where the base color is defined * @param hOffset The hue offset used for derivation. * @param sOffset The saturation offset used for derivation. * @param bOffset The brightness offset used for derivation. * @param aOffset The alpha offset used for derivation. Between 0...255 - * @return The derived color, whos color value will change if the parent + * @return The derived color, whose color value will change if the parent * uiDefault color changes. */ protected final Color decodeColor(String key, float hOffset, float sOffset, @@ -532,11 +532,11 @@ public abstract class AbstractRegionPainter implements Painter { * to one of the "decode" methods will return the passed in value. * @param inverted Whether to "invert" the meaning of the 9-square grid and stretching insets * @param cacheMode A hint as to which caching mode to use. If null, then set to no caching. - * @param maxH The maximium scale in the horizontal direction to use before punting and redrawing from scratch. + * @param maxH The maximum scale in the horizontal direction to use before punting and redrawing from scratch. * For example, if maxH is 2, then we will attempt to scale any cached images up to 2x the canvas * width before redrawing from scratch. Reasonable maxH values may improve painting performance. * If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1. - * @param maxV The maximium scale in the vertical direction to use before punting and redrawing from scratch. + * @param maxV The maximum scale in the vertical direction to use before punting and redrawing from scratch. * For example, if maxV is 2, then we will attempt to scale any cached images up to 2x the canvas * height before redrawing from scratch. Reasonable maxV values may improve painting performance. * If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1. diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java index 768d7721974..deeecddfbbd 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java @@ -64,7 +64,7 @@ class LoweredBorder extends AbstractRegionPainter implements Border { /** * Actually performs the painting operation. Subclasses must implement this * method. The graphics object passed may represent the actual surface being - * rendererd to, or it may be an intermediate buffer. It has also been + * rendered to, or it may be an intermediate buffer. It has also been * pre-translated. Simply render the component as if it were located at 0, 0 * and had a width of width and a height of * height. For performance reasons, you may want to read the diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java index fcb8cdb6a47..b4dfaffd124 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java @@ -808,7 +808,7 @@ public final class NimbusStyle extends SynthStyle { } /** - * Simple utility method that searchs the given array of Strings for the + * Simple utility method that searches the given array of Strings for the * given string. This method is only called from getExtendedState if * the developer has specified a specific state for the component to be * in (ie, has "wedged" the component in that state) by specifying @@ -1010,7 +1010,7 @@ public final class NimbusStyle extends SynthStyle { } /** - * Contains values such as the UIDefaults and painters asssociated with + * Contains values such as the UIDefaults and painters associated with * a state. Whereas State represents a distinct state that a * component can be in (such as Enabled), this class represents the colors, * fonts, painters, etc associated with some state for this diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html b/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html index bedeffb5db7..67048cf1087 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html @@ -1,5 +1,7 @@ + +

          Primary Colors

          diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html index 338df175b51..5a60f7a7885 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html @@ -25,7 +25,7 @@ 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. --> - + @@ -39,11 +39,11 @@ component states.

          Nimbus allows customizing many of its properties, including painters, by altering the {@link javax.swing.UIDefaults} table. Here's an example: -

          +
               UIManager.put("ProgressBar.tileWidth", myTileWidth);
               UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
               UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter);
          -
          +

          Per-component customization is also possible. When rendering a component, Nimbus checks its client property named "Nimbus.Overrides". The value of this @@ -53,14 +53,14 @@ only. An optional client property, "Nimbus.Overrides.InheritDefaults" of type Boolean, specifies whether the overriding settings should be merged with default ones ({@code true}), or replace them ({@code false}). By default they are merged: -

          +
               JProgressBar bar = new JProgressBar();
               UIDefaults overrides = new UIDefaults();
               overrides.put("ProgressBar.cycleTime", 330);
               ...
               bar.putClientProperty("Nimbus.Overrides", overrides);
               bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
          -
          +

          Colors in Nimbus are derived from a core set of primary colors. There are also diff --git a/jdk/src/share/classes/javax/swing/plaf/package.html b/jdk/src/share/classes/javax/swing/plaf/package.html index fdd354d8c0a..4e1745e4457 100644 --- a/jdk/src/share/classes/javax/swing/plaf/package.html +++ b/jdk/src/share/classes/javax/swing/plaf/package.html @@ -25,7 +25,7 @@ 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. --> - + diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java index 021d21de116..a6442da947c 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java @@ -191,20 +191,28 @@ class SynthInternalFrameTitlePane extends BasicInternalFrameTitlePane } protected void addSystemMenuItems(JPopupMenu menu) { - // PENDING: this should all be localizable! JMenuItem mi = menu.add(restoreAction); - mi.setMnemonic('R'); + mi.setMnemonic(getButtonMnemonic("restore")); mi = menu.add(moveAction); - mi.setMnemonic('M'); + mi.setMnemonic(getButtonMnemonic("move")); mi = menu.add(sizeAction); - mi.setMnemonic('S'); + mi.setMnemonic(getButtonMnemonic("size")); mi = menu.add(iconifyAction); - mi.setMnemonic('n'); + mi.setMnemonic(getButtonMnemonic("minimize")); mi = menu.add(maximizeAction); - mi.setMnemonic('x'); + mi.setMnemonic(getButtonMnemonic("maximize")); menu.add(new JSeparator()); mi = menu.add(closeAction); - mi.setMnemonic('C'); + mi.setMnemonic(getButtonMnemonic("close")); + } + + private static int getButtonMnemonic(String button) { + try { + return Integer.parseInt(UIManager.getString( + "InternalFrameTitlePane." + button + "Button.mnemonic")); + } catch (NumberFormatException e) { + return -1; + } } protected void showSystemMenu() { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java index bece289030f..1df0737620d 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java @@ -116,7 +116,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel { /** * Used by the renderers. For the most part the renderers are implemented * as Labels, which is problematic in so far as they are never selected. - * To accomodate this SynthLabelUI checks if the current + * To accommodate this SynthLabelUI checks if the current * UI matches that of selectedUI (which this methods sets), if * it does, then a state as set by this method is returned. This provides * a way for labels to have a state other than selected. diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html index aa0145cfce2..2837aaec4d7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html +++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html @@ -47,7 +47,7 @@ Components will create it to render a button with an arrow. The JComboBox, JScrollBar and JSplitPane (for the buttons on the divider). In addition to the Button properties, ArrowButton supports -the following propeties:

          +the following properties:

          ArrowButton Specific Properties
          @@ -887,7 +887,7 @@ invoked. JScrollPane is unique in that it provides a method for setting the Border around the JViewport with JViewport throwing an IllegalArgumentException from setBorder. To - accomodate this a special border is installed on the + accommodate this a special border is installed on the JScrollPane that uses the insets from the key ScrollPane.viewportBorderInsets. The @@ -1190,7 +1190,7 @@ space, along the y axis, to offset nodes from their parent. - diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html index dfb99f4ef50..ad84defba08 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html +++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html @@ -2,7 +2,7 @@ Synth File Format -
          Tree.scrollsHorizontallyAndVertically Boolean false If false and scrolling needs to happen to accomodate cells + If false and scrolling needs to happen to accommodate cells it will only happen along the vertical axis, if true, scrolling may happen along both the horizontal and vertical axis.