# HG changeset patch # User duke # Date 1499275286 -7200 # Node ID 624a61211dd7300232982404f3093b9f9b2b2ef4 # Parent 115e1128ce1a26bcf66a787f820d9669948f49e7# Parent 4d9ae2ec8ba6372b8194f68dd239ad1da65384a9 Merge diff -r 115e1128ce1a -r 624a61211dd7 .hgtags-top-repo --- a/.hgtags-top-repo Thu Oct 31 16:46:43 2013 -0700 +++ b/.hgtags-top-repo Wed Jul 05 19:21:26 2017 +0200 @@ -235,3 +235,4 @@ d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111 547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112 6ba4c7cb623ec612031e05cf8bf279d8f407bd1e jdk8-b113 +4f2011496393a26dcfd7b1f7787a3673ddd32599 jdk8-b114 diff -r 115e1128ce1a -r 624a61211dd7 common/autoconf/basics.m4 --- a/common/autoconf/basics.m4 Thu Oct 31 16:46:43 2013 -0700 +++ b/common/autoconf/basics.m4 Wed Jul 05 19:21:26 2017 +0200 @@ -514,7 +514,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Thu Oct 31 16:46:43 2013 -0700 +++ b/common/autoconf/generated-configure.sh Wed Jul 05 19:21:26 2017 +0200 @@ -3865,7 +3865,7 @@ #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:${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:${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:${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:${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:${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 -r 115e1128ce1a -r 624a61211dd7 common/autoconf/spec.gmk.in diff -r 115e1128ce1a -r 624a61211dd7 common/bin/hgforest.sh diff -r 115e1128ce1a -r 624a61211dd7 common/makefiles/Main.gmk diff -r 115e1128ce1a -r 624a61211dd7 corba/.hgtags --- a/corba/.hgtags Thu Oct 31 16:46:43 2013 -0700 +++ b/corba/.hgtags Wed Jul 05 19:21:26 2017 +0200 @@ -235,3 +235,4 @@ 85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111 43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112 a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113 +0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114 diff -r 115e1128ce1a -r 624a61211dd7 corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java --- a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -580,7 +580,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 corba/src/share/classes/javax/rmi/CORBA/Stub.java --- a/corba/src/share/classes/javax/rmi/CORBA/Stub.java Thu Oct 31 16:46:43 2013 -0700 +++ b/corba/src/share/classes/javax/rmi/CORBA/Stub.java Wed Jul 05 19:21:26 2017 +0200 @@ -61,13 +61,11 @@ 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 @@ // 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 @@ } if (className == null) { - className = defaultClassName; + return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl(); } try { diff -r 115e1128ce1a -r 624a61211dd7 corba/src/share/classes/javax/rmi/CORBA/Util.java --- a/corba/src/share/classes/javax/rmi/CORBA/Util.java Thu Oct 31 16:46:43 2013 -0700 +++ b/corba/src/share/classes/javax/rmi/CORBA/Util.java Wed Jul 05 19:21:26 2017 +0200 @@ -60,14 +60,11 @@ 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 @@ // 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 @@ } if (className == null) { - className = defaultClassName; + return new com.sun.corba.se.impl.javax.rmi.CORBA.Util(); } try { diff -r 115e1128ce1a -r 624a61211dd7 corba/src/share/classes/javax/rmi/PortableRemoteObject.java --- a/corba/src/share/classes/javax/rmi/PortableRemoteObject.java Thu Oct 31 16:46:43 2013 -0700 +++ b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java Wed Jul 05 19:21:26 2017 +0200 @@ -65,17 +65,14 @@ */ 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 @@ // 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 @@ } } if (className == null) { - className = defaultPortableRemoteObjectImplName; + return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject(); } try { diff -r 115e1128ce1a -r 624a61211dd7 corba/src/share/classes/org/omg/CORBA/ORB.java --- a/corba/src/share/classes/org/omg/CORBA/ORB.java Thu Oct 31 16:46:43 2013 -0700 +++ b/corba/src/share/classes/org/omg/CORBA/ORB.java Wed Jul 05 19:21:26 2017 +0200 @@ -174,15 +174,6 @@ 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. // TypeCodes should be immutable since they may be shared across @@ -294,10 +285,11 @@ 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/.hgtags --- a/hotspot/.hgtags Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/.hgtags Wed Jul 05 19:21:26 2017 +0200 @@ -389,3 +389,5 @@ 23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55 4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113 82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56 +7fd913010dbbf75260688fd2fa8964763fa49a09 jdk8-b114 +3b32d287da89a47a45d16f6d9ba5bd3cd9bf4b3e hs25-b57 diff -r 115e1128ce1a -r 624a61211dd7 hotspot/agent/src/os/bsd/ps_proc.c --- a/hotspot/agent/src/os/bsd/ps_proc.c Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/agent/src/os/bsd/ps_proc.c Wed Jul 05 19:21:26 2017 +0200 @@ -131,7 +131,7 @@ 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 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/make/hotspot_version --- a/hotspot/make/hotspot_version Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/make/hotspot_version Wed Jul 05 19:21:26 2017 +0200 @@ -35,7 +35,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -365,7 +365,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -4099,15 +4099,19 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/sparc/vm/sparc.ad --- a/hotspot/src/cpu/sparc/vm/sparc.ad Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/sparc.ad Wed Jul 05 19:21:26 2017 +0200 @@ -1660,12 +1660,16 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -153,13 +153,9 @@ } -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(); - Label cont; - address compiled_entry = __ pc(); - - 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 @@ // 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,29 +180,18 @@ __ 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 + const Register index = G1_scratch; + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); + + 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); - // 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); - } - return entry; } diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -2932,9 +2932,7 @@ 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 @@ __ 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 @@ __ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1468,19 +1468,18 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp --- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -367,7 +367,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -5049,25 +5049,32 @@ } 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 @@ // 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 @@ 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 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -150,13 +150,12 @@ } -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 @@ __ 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 @@ // 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,33 +193,22 @@ __ 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())); + const Register cache = rbx; + const Register index = rcx; + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); + + 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); - // 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); - } - return entry; } diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -166,7 +166,7 @@ } -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,28 +183,16 @@ __ 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)); + const Register cache = rbx; + const Register index = rcx; + __ get_cache_and_index_at_bcp(cache, index, 1, index_size); + + 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); - // 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); - } - return entry; } diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -2925,9 +2925,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -2980,9 +2980,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1006,7 +1006,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/cpu/zero/vm/globals_zero.hpp --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -57,6 +57,8 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -945,17 +945,15 @@ // 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 @@ Bsd::_main_thread = pthread_self(); Bsd::clock_init(); - initial_time_count = os::elapsed_counter(); + initial_time_count = javaTimeNanos(); #ifdef __APPLE__ // XXXDARWIN diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1333,17 +1333,15 @@ // 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/c1/c1_GraphBuilder.cpp --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1873,7 +1873,7 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/ci/ciInstanceKlass.cpp --- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -57,6 +57,7 @@ _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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/ci/ciInstanceKlass.hpp --- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -52,6 +52,7 @@ bool _has_finalizer; bool _has_subklass; bool _has_nonstatic_fields; + bool _has_default_methods; ciFlags _flags; jint _nonstatic_field_size; @@ -171,6 +172,11 @@ } } + 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/classfile/classLoaderData.cpp --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -131,6 +131,17 @@ } } +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::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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/classfile/classLoaderData.hpp --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -78,6 +78,7 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/classfile/systemDictionary.hpp --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -173,8 +173,6 @@ /* 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/compiler/compileBroker.cpp --- a/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -780,6 +780,10 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/interpreter/abstractInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -158,8 +158,8 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/interpreter/cppInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -78,7 +78,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/interpreter/interpreter.cpp --- a/hotspot/src/share/vm/interpreter/interpreter.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -329,15 +329,21 @@ //------------------------------------------------------------------------------------------------------------------------ // 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/interpreter/templateInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -184,8 +184,9 @@ 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 @@ #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 @@ } } - 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 @@ //------------------------------------------------------------------------------------------------------------------------ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/interpreter/templateInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -120,8 +120,9 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp --- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -53,7 +53,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/memory/metaspace.cpp --- a/hotspot/src/share/vm/memory/metaspace.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/memory/metaspace.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -56,7 +56,7 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ 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 @@ } #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 @@ 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 @@ 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/memory/metaspace.hpp --- a/hotspot/src/share/vm/memory/metaspace.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/memory/metaspace.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -115,13 +115,13 @@ 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 @@ 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 @@ static bool is_class_space_allocation(MetadataType mdType) { return mdType == ClassType && using_class_space(); } + }; class MetaspaceAux : AllStatic { diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/memory/universe.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -677,13 +677,13 @@ // 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 @@ // 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 @@ // 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/oops/instanceKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlass.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -2393,15 +2393,38 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/oops/method.cpp --- a/hotspot/src/share/vm/oops/method.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/oops/method.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1515,7 +1515,10 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/opto/library_call.cpp --- a/hotspot/src/share/vm/opto/library_call.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -2006,9 +2006,9 @@ 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 @@ if (is_decrement) { arg2 = longcon(1); } else { - Node* arg2 = argument(2); // type long + arg2 = argument(2); // type long // argument(3) == TOP } diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/opto/loopTransform.cpp --- a/hotspot/src/share/vm/opto/loopTransform.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/opto/loopTransform.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -713,6 +713,10 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/opto/postaloc.cpp --- a/hotspot/src/share/vm/opto/postaloc.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/opto/postaloc.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -97,7 +97,8 @@ 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 @@ 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 @@ u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input } if (u != NodeSentinel) { // Junk Phi. Remove - block->remove_node(j--); + phi->replace_by(u); + j -= yank_if_dead(phi, block, &value, ®nd); phi_dex--; - _cfg.unmap_node_from_block(phi); - phi->replace_by(u); - phi->disconnect_inputs(NULL, C); continue; } // Note that if value[pidx] exists, then we merged no new values here diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/opto/type.cpp --- a/hotspot/src/share/vm/opto/type.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/opto/type.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -2787,13 +2787,11 @@ //-----------------------------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 @@ // 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/opto/type.hpp --- a/hotspot/src/share/vm/opto/type.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/opto/type.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -63,7 +63,7 @@ class TypeOopPtr; class TypeInstPtr; class TypeAryPtr; -class TypeKlassPtr; +class TypeKlassPtr; class TypeMetadataPtr; //------------------------------Type------------------------------------------- @@ -1202,6 +1202,9 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp --- a/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ } } - // 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 @@ } } - 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 @@ 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); + + // Iterate through all classes in ClassLoaderDataGraph + // and collect them using the LoadedClassesClosure + ClassLoaderDataGraph::loaded_classes_do(&closure); + } - // 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. + // Return results by extracting the collected contents into a list + // allocated via JvmtiEnv + jclass* result_list; + 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; } - // Post results - jclass* result_list; - jvmtiError err = env->Allocate(closure.get_count() * sizeof(jclass), - (unsigned char**)&result_list); - if (err != JVMTI_ERROR_NONE) { - return err; - } - closure.extract(env, result_list); - *classCountPtr = closure.get_count(); - *classesPtr = result_list; - return JVMTI_ERROR_NONE; + return error; } jvmtiError diff -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1988,6 +1988,15 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/runtime/handles.cpp --- a/hotspot/src/share/vm/runtime/handles.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/runtime/handles.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1097,7 +1097,7 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/services/jmm.h --- a/hotspot/src/share/vm/services/jmm.h Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/services/jmm.h Wed Jul 05 19:21:26 2017 +0200 @@ -78,6 +78,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/services/management.cpp --- a/hotspot/src/share/vm/services/management.cpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/services/management.cpp Wed Jul 05 19:21:26 2017 +0200 @@ -1032,6 +1032,9 @@ 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/src/share/vm/utilities/globalDefinitions.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Wed Jul 05 19:21:26 2017 +0200 @@ -368,8 +368,6 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/test/compiler/inlining/InlineDefaultMethod.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/inlining/InlineDefaultMethod.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java Wed Jul 05 19:21:26 2017 +0200 @@ -0,0 +1,54 @@ +/* + * 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 8027444 + * @summary Test nested loops + * @compile NestedMathExactTest.java + * @run main NestedMathExactTest + * + */ + +public class NestedMathExactTest { + public static final int LIMIT = 100; + public static int[] result = new int[LIMIT]; + public static int value = 17; + + 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 -r 115e1128ce1a -r 624a61211dd7 hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java Wed Jul 05 19:21:26 2017 +0200 @@ -24,6 +24,7 @@ /* * @test * @bug 8026844 + * @bug 8027353 * @summary Test constant subtractExact * @compile SubExactLConstantTest.java Verify.java * @run main SubExactLConstantTest diff -r 115e1128ce1a -r 624a61211dd7 hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java Thu Oct 31 16:46:43 2013 -0700 +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java Wed Jul 05 19:21:26 2017 +0200 @@ -24,6 +24,7 @@ /* * @test * @bug 8026844 + * @bug 8027353 * @summary Test non constant subtractExact * @compile SubExactLNonConstantTest.java Verify.java * @run main SubExactLNonConstantTest diff -r 115e1128ce1a -r 624a61211dd7 hotspot/test/compiler/startup/StartupOutput.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/startup/StartupOutput.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 hotspot/test/runtime/CompressedOops/CompressedClassPointers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jaxp/.hgtags --- a/jaxp/.hgtags Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/.hgtags Wed Jul 05 19:21:26 2017 +0200 @@ -235,3 +235,4 @@ 17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111 c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112 0046d2278204b7eff76803fc4623cb48c7e6384d jdk8-b113 +1b1e12117fe2840e5d21ae9a4b309e4f981f3ea8 jdk8-b114 diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Wed Jul 05 19:21:26 2017 +0200 @@ -188,6 +188,19 @@ ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; /** + * Feature enableExtensionFunctions + */ + public static final String ORACLE_ENABLE_EXTENSION_FUNCTION = + ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions"; + public static final String SP_ORACLE_ENABLE_EXTENSION_FUNCTION = "javax.xml.enableExtensionFunctions"; + + /** + * Values for a feature + */ + public static final String FEATURE_TRUE = "true"; + public static final String FEATURE_FALSE = "false"; + + /** * Check if we're in jdk8 or above */ public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8); diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.org.apache.xalan.internal.utils; + + +import com.sun.org.apache.xalan.internal.XalanConstants; + +/** + * This class manages security related properties + * + */ +public final class FeatureManager extends FeaturePropertyBase { + + /** + * States of the settings of a property, in the order: default value, value + * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system + * properties, and jaxp api properties + */ + public static enum State { + //this order reflects the overriding order + DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY + } + + /** + * Xalan Features + */ + public static enum Feature { + ORACLE_ENABLE_EXTENSION_FUNCTION(XalanConstants.ORACLE_ENABLE_EXTENSION_FUNCTION, + "true"); + + final String name; + final String defaultValue; + + Feature(String name, String value) { + this.name = name; + this.defaultValue = value; + } + + public boolean equalsName(String propertyName) { + return (propertyName == null) ? false : name.equals(propertyName); + } + + String defaultValue() { + return defaultValue; + } + } + + /** + * Default constructor. Establishes default values + */ + public FeatureManager() { + values = new String[Feature.values().length]; + for (Feature feature : Feature.values()) { + values[feature.ordinal()] = feature.defaultValue(); + } + //read system properties or jaxp.properties + readSystemProperties(); + } + + + /** + * Check if the feature is enabled + * @param feature name of the feature + * @return true if enabled, false otherwise + */ + public boolean isFeatureEnabled(Feature feature) { + return Boolean.parseBoolean(values[feature.ordinal()]); + } + + /** + * Check if the feature is enabled + * @param propertyName name of the feature + * @return true if enabled, false otherwise + */ + public boolean isFeatureEnabled(String propertyName) { + return Boolean.parseBoolean(values[getIndex(propertyName)]); + } + + /** + * Get the index by property name + * @param propertyName property name + * @return the index of the property if found; return -1 if not + */ + public int getIndex(String propertyName){ + for (Feature feature : Feature.values()) { + if (feature.equalsName(propertyName)) { + return feature.ordinal(); + } + } + return -1; + } + + /** + * Read from system properties, or those in jaxp.properties + */ + private void readSystemProperties() { + getSystemProperty(Feature.ORACLE_ENABLE_EXTENSION_FUNCTION, + XalanConstants.SP_ORACLE_ENABLE_EXTENSION_FUNCTION); + } + +} diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java Wed Jul 05 19:21:26 2017 +0200 @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.org.apache.xalan.internal.utils; + +import com.sun.org.apache.xalan.internal.XalanConstants; + +/** + * This is the base class for features and properties + * + */ +public abstract class FeaturePropertyBase { + + /** + * States of the settings of a property, in the order: default value, value + * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system + * properties, and jaxp api properties + */ + public static enum State { + //this order reflects the overriding order + DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY + } + + + /** + * Values of the properties as defined in enum Properties + */ + String[] values = null; + /** + * States of the settings for each property in Properties above + */ + State[] states = {State.DEFAULT, State.DEFAULT}; + + + /** + * Set the value for a specific property. + * + * @param property the property + * @param state the state of the property + * @param value the value of the property + */ + public void setValue(Enum property, State state, String value) { + //only update if it shall override + if (state.compareTo(states[property.ordinal()]) >= 0) { + values[property.ordinal()] = value; + states[property.ordinal()] = state; + } + } + + /** + * Set the value of a property by its index + * @param index the index of the property + * @param state the state of the property + * @param value the value of the property + */ + public void setValue(int index, State state, String value) { + //only update if it shall override + if (state.compareTo(states[index]) >= 0) { + values[index] = value; + states[index] = state; + } + } + + /** + * Set value by property name and state + * @param propertyName property name + * @param state the state of the property + * @param value the value of the property + * @return true if the property is managed by the security property manager; + * false if otherwise. + */ + public boolean setValue(String propertyName, State state, Object value) { + int index = getIndex(propertyName); + if (index > -1) { + setValue(index, state, (String)value); + return true; + } + return false; + } + + /** + * Set value by property name and state + * @param propertyName property name + * @param state the state of the property + * @param value the value of the property + * @return true if the property is managed by the security property manager; + * false if otherwise. + */ + public boolean setValue(String propertyName, State state, boolean value) { + int index = getIndex(propertyName); + if (index > -1) { + if (value) { + setValue(index, state, XalanConstants.FEATURE_TRUE); + } else { + setValue(index, state, XalanConstants.FEATURE_FALSE); + } + return true; + } + return false; + } + + /** + * Return the value of the specified property + * + * @param property the property + * @return the value of the property + */ + public String getValue(Enum property) { + return values[property.ordinal()]; + } + + /** + * Return the value of the specified property + * + * @param property the property + * @return the value of the property + */ + public String getValue(String property) { + int index = getIndex(property); + if (index > -1) { + return getValueByIndex(index); + } + return null; + } + + /** + * Return the value of the specified property. + * + * @param propertyName the property name + * @return the value of the property as a string. If a property is managed + * by this manager, its value shall not be null. + */ + public String getValueAsString(String propertyName) { + int index = getIndex(propertyName); + if (index > -1) { + return getValueByIndex(index); + } + + return null; + } + + /** + * Return the value of a property by its ordinal + * @param index the index of a property + * @return value of a property + */ + public String getValueByIndex(int index) { + return values[index]; + } + + /** + * Get the index by property name + * @param propertyName property name + * @return the index of the property if found; return -1 if not + */ + public abstract int getIndex(String propertyName); + + public > int getIndex(Class property, String propertyName) { + for (Enum enumItem : property.getEnumConstants()) { + if (enumItem.toString().equals(propertyName)) { + //internally, ordinal is used as index + return enumItem.ordinal(); + } + } + return -1; + }; + + + /** + * Read from system properties, or those in jaxp.properties + * + * @param property the property + * @param systemProperty the name of the system property + */ + void getSystemProperty(Enum property, String systemProperty) { + try { + String value = SecuritySupport.getSystemProperty(systemProperty); + if (value != null) { + values[property.ordinal()] = value; + states[property.ordinal()] = State.SYSTEMPROPERTY; + return; + } + + value = SecuritySupport.readJAXPProperty(systemProperty); + if (value != null) { + values[property.ordinal()] = value; + states[property.ordinal()] = State.JAXPDOTPROPERTIES; + } + } catch (NumberFormatException e) { + //invalid setting ignored + } + } +} diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -1,42 +1,28 @@ /* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. + * 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. * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" + * 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). * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package com.sun.org.apache.xalan.internal.utils; import com.sun.org.apache.xalan.internal.XalanConstants; diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,20 +33,10 @@ * This class manages security related properties * */ -public final class XMLSecurityPropertyManager { +public final class XMLSecurityPropertyManager extends FeaturePropertyBase { /** - * States of the settings of a property, in the order: default value, value - * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system - * properties, and jaxp api properties - */ - public static enum State { - //this order reflects the overriding order - DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY - } - - /** - * Limits managed by the security manager + * Properties managed by the security property manager */ public static enum Property { ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD, @@ -73,15 +63,6 @@ /** - * Values of the properties as defined in enum Properties - */ - private final String[] values; - /** - * States of the settings for each property in Properties above - */ - private State[] states = {State.DEFAULT, State.DEFAULT}; - - /** * Default constructor. Establishes default values */ public XMLSecurityPropertyManager() { @@ -94,86 +75,6 @@ } /** - * Set limit by property name and state - * @param propertyName property name - * @param state the state of the property - * @param value the value of the property - * @return true if the property is managed by the security property manager; - * false if otherwise. - */ - public boolean setValue(String propertyName, State state, Object value) { - int index = getIndex(propertyName); - if (index > -1) { - setValue(index, state, (String)value); - return true; - } - return false; - } - - /** - * Set the value for a specific property. - * - * @param property the property - * @param state the state of the property - * @param value the value of the property - */ - public void setValue(Property property, State state, String value) { - //only update if it shall override - if (state.compareTo(states[property.ordinal()]) >= 0) { - values[property.ordinal()] = value; - states[property.ordinal()] = state; - } - } - - /** - * Set the value of a property by its index - * @param index the index of the property - * @param state the state of the property - * @param value the value of the property - */ - public void setValue(int index, State state, String value) { - //only update if it shall override - if (state.compareTo(states[index]) >= 0) { - values[index] = value; - states[index] = state; - } - } - - /** - * Return the value of the specified property - * - * @param propertyName the property name - * @return the value of the property as a string - */ - public String getValue(String propertyName) { - int index = getIndex(propertyName); - if (index > -1) { - return getValueByIndex(index); - } - - return null; - } - - /** - * Return the value of the specified property - * - * @param property the property - * @return the value of the property - */ - public String getValue(Property property) { - return values[property.ordinal()]; - } - - /** - * Return the value of a property by its ordinal - * @param index the index of a property - * @return value of a property - */ - public String getValueByIndex(int index) { - return values[index]; - } - - /** * Get the index by property name * @param propertyName property name * @return the index of the property if found; return -1 if not @@ -198,28 +99,4 @@ XalanConstants.SP_ACCESS_EXTERNAL_STYLESHEET); } - /** - * Read from system properties, or those in jaxp.properties - * - * @param property the property - * @param systemProperty the name of the system property - */ - private void getSystemProperty(Property property, String systemProperty) { - try { - String value = SecuritySupport.getSystemProperty(systemProperty); - if (value != null) { - values[property.ordinal()] = value; - states[property.ordinal()] = State.SYSTEMPROPERTY; - return; - } - - value = SecuritySupport.readJAXPProperty(systemProperty); - if (value != null) { - values[property.ordinal()] = value; - states[property.ordinal()] = State.JAXPDOTPROPERTIES; - } - } catch (NumberFormatException e) { - //invalid setting ignored - } - } } diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java Wed Jul 05 19:21:26 2017 +0200 @@ -23,6 +23,7 @@ package com.sun.org.apache.xalan.internal.xsltc.cmdline; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; import java.io.File; import java.net.URL; import java.util.Vector; @@ -77,7 +78,7 @@ final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); if (args.length < 1) printUsage(); - final XSLTC xsltc = new XSLTC(true); + final XSLTC xsltc = new XSLTC(true, new FeatureManager()); xsltc.init(); int c; diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java Wed Jul 05 19:21:26 2017 +0200 @@ -42,6 +42,7 @@ import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; import com.sun.org.apache.bcel.internal.generic.NEW; import com.sun.org.apache.bcel.internal.generic.PUSH; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; @@ -717,6 +718,8 @@ final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing(); + final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC() + .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION); int index; // Translate calls to methods in the BasisLibrary @@ -760,7 +763,7 @@ il.append(new INVOKESTATIC(index)); } else if (_isExtConstructor) { - if (isSecureProcessing) + if (isSecureProcessing && !isExtensionFunctionEnabled) translateUnallowedExtension(cpg, il); final String clazz = @@ -822,7 +825,7 @@ } // Invoke function calls that are handled in separate classes else { - if (isSecureProcessing) + if (isSecureProcessing && !isExtensionFunctionEnabled) translateUnallowedExtension(cpg, il); final String clazz = _chosenMethod.getDeclaringClass().getName(); diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Wed Jul 05 19:21:26 2017 +0200 @@ -43,6 +43,8 @@ import com.sun.org.apache.bcel.internal.classfile.JavaClass; import com.sun.org.apache.xalan.internal.XalanConstants; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; +import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; @@ -148,11 +150,14 @@ private XMLSecurityManager _xmlSecurityManager; + private final FeatureManager _featureManager; + /** * XSLTC compiler constructor */ - public XSLTC(boolean useServicesMechanism) { + public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) { _parser = new Parser(this, useServicesMechanism); + _featureManager = featureManager; } /** @@ -182,6 +187,15 @@ _useServicesMechanism = flag; } + /** + * Return the value of the specified feature + * @param name name of the feature + * @return true if the feature is enabled, false otherwise + */ + public boolean getFeature(Feature name) { + return _featureManager.isFeatureEnabled(name); + } + /** * Return allowed protocols for accessing external stylesheet. */ diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java Wed Jul 05 19:21:26 2017 +0200 @@ -74,12 +74,12 @@ DocumentBuilderFactory.newInstance(); private boolean _internal = true; - public SAX2DOM(boolean useServicesMachnism) throws ParserConfigurationException { - _document = createDocument(useServicesMachnism); + public SAX2DOM(boolean useServicesMechanism) throws ParserConfigurationException { + _document = createDocument(useServicesMechanism); _root = _document; } - public SAX2DOM(Node root, Node nextSibling, boolean useServicesMachnism) throws ParserConfigurationException { + public SAX2DOM(Node root, Node nextSibling, boolean useServicesMechanism) throws ParserConfigurationException { _root = root; if (root instanceof Document) { _document = (Document)root; @@ -88,15 +88,15 @@ _document = root.getOwnerDocument(); } else { - _document = createDocument(useServicesMachnism); + _document = createDocument(useServicesMechanism); _root = _document; } _nextSibling = nextSibling; } - public SAX2DOM(Node root, boolean useServicesMachnism) throws ParserConfigurationException { - this(root, null, useServicesMachnism); + public SAX2DOM(Node root, boolean useServicesMechanism) throws ParserConfigurationException { + this(root, null, useServicesMechanism); } public Node getDOM() { @@ -308,18 +308,19 @@ public void startDTD(String name, String publicId, String systemId) throws SAXException {} - private Document createDocument(boolean useServicesMachnism) throws ParserConfigurationException { + private Document createDocument(boolean useServicesMechanism) throws ParserConfigurationException { if (_factory == null) { - if (useServicesMachnism) + if (useServicesMechanism) { _factory = DocumentBuilderFactory.newInstance(); if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) { _internal = false; } - else + } else { _factory = DocumentBuilderFactory.newInstance( "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAX2DOM.class.getClassLoader() ); + } } Document doc; if (_internal) { diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -95,7 +95,7 @@ _tfactory = tfactory; // Instantiate XSLTC and get reference to parser object - XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism()); + XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager()); if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) xsltc.setSecureProcessing(true); diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -25,12 +25,14 @@ import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; +import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase; import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.SecuritySupport; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property; -import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State; +import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State; import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader; import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC; @@ -227,6 +229,8 @@ private XMLSecurityPropertyManager _xmlSecurityPropertyMgr; private XMLSecurityManager _xmlSecurityManager; + private final FeatureManager _featureManager; + /** * javax.xml.transform.sax.TransformerFactory implementation. */ @@ -240,10 +244,13 @@ private TransformerFactoryImpl(boolean useServicesMechanism) { this._useServicesMechanism = useServicesMechanism; + _featureManager = new FeatureManager(); if (System.getSecurityManager() != null) { _isSecureMode = true; _isNotSecureProcessing = false; + _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION, + FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE); } _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager(); @@ -504,6 +511,10 @@ Property.ACCESS_EXTERNAL_STYLESHEET); } + if (value && _featureManager != null) { + _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION, + FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE); + } return; } else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { @@ -512,6 +523,11 @@ _useServicesMechanism = value; } else { + if (_featureManager != null && + _featureManager.setValue(name, State.APIPROPERTY, value)) { + return; + } + // unknown feature ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name); throw new TransformerConfigurationException(err.toString()); @@ -561,6 +577,13 @@ return !_isNotSecureProcessing; } + /** Check to see if the property is managed by the security manager **/ + String propertyValue = (_featureManager != null) ? + _featureManager.getValueAsString(name) : null; + if (propertyValue != null) { + return Boolean.parseBoolean(propertyValue); + } + // Feature not supported return false; } @@ -571,6 +594,13 @@ return _useServicesMechanism; } + /** + * @return the feature manager + */ + public FeatureManager getFeatureManager() { + return _featureManager; + } + /** * javax.xml.transform.sax.TransformerFactory implementation. * Get the object that is used by default during the transformation to @@ -857,7 +887,7 @@ } // Create and initialize a stylesheet compiler - final XSLTC xsltc = new XSLTC(_useServicesMechanism); + final XSLTC xsltc = new XSLTC(_useServicesMechanism, _featureManager); if (_debug) xsltc.setDebug(true); if (_enableInlining) xsltc.setTemplateInlining(true); diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -569,32 +569,13 @@ // xerces features fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true); - fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null); - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); - - fElementAttributeLimit = (fSecurityManager != null)? - fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0; - fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false); Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null); fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ? (ExternalSubsetResolver) resolver : null; - // initialize vars - fMarkupDepth = 0; - fCurrentElement = null; - fElementStack.clear(); - fHasExternalDTD = false; - fStandaloneSet = false; - fStandalone = false; - fInScanContent = false; - //skipping algorithm - fShouldSkip = false; - fAdd = false; - fSkip = false; - //attribute fReadingAttributes = false; //xxx: external entities are supported in Xerces @@ -606,9 +587,6 @@ // setup Driver setScannerState(SCANNER_STATE_CONTENT); setDriver(fContentDriver); - fEntityStore = fEntityManager.getEntityStore(); - - dtdGrammarUtil = null; // JAXP 1.5 features and properties XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) @@ -617,6 +595,7 @@ fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false); + resetCommon(); //fEntityManager.test(); } // reset(XMLComponentManager) @@ -630,17 +609,7 @@ fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue(); fNotifyBuiltInRefs = false ; - // initialize vars - fMarkupDepth = 0; - fCurrentElement = null; - fShouldSkip = false; - fAdd = false; - fSkip = false; - fElementStack.clear(); //fElementStack2.clear(); - fHasExternalDTD = false; - fStandaloneSet = false; - fStandalone = false; //fReplaceEntityReferences = true; //fSupportExternalEntities = true; Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES); @@ -661,20 +630,43 @@ //we dont need to do this -- nb. //setScannerState(SCANNER_STATE_CONTENT); //setDriver(fContentDriver); - fEntityStore = fEntityManager.getEntityStore(); //fEntityManager.test(); - dtdGrammarUtil = null; - // JAXP 1.5 features and properties XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER); - fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + resetCommon(); } // reset(XMLComponentManager) + void resetCommon() { + // initialize vars + fMarkupDepth = 0; + fCurrentElement = null; + fElementStack.clear(); + fHasExternalDTD = false; + fStandaloneSet = false; + fStandalone = false; + fInScanContent = false; + //skipping algorithm + fShouldSkip = false; + fAdd = false; + fSkip = false; + + fEntityStore = fEntityManager.getEntityStore(); + dtdGrammarUtil = null; + + if (fSecurityManager != null) { + fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); + fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT); + } else { + fLimitAnalyzer = null; + fElementAttributeLimit = 0; + } + } + /** * Returns a list of feature identifiers that are recognized by * this component. This method may return null if no features @@ -1328,7 +1320,7 @@ fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", - new Object[]{rawname, new Integer(fAttributes.getLength()) }, + new Object[]{rawname, fElementAttributeLimit }, XMLErrorReporter.SEVERITY_FATAL_ERROR ); } diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -256,7 +256,7 @@ fAttributes.getLength() > fElementAttributeLimit){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "ElementAttributeLimit", - new Object[]{rawname, new Integer(fAttributes.getLength()) }, + new Object[]{rawname, fElementAttributeLimit }, XMLErrorReporter.SEVERITY_FATAL_ERROR ); } diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java --- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java Wed Jul 05 19:21:26 2017 +0200 @@ -211,7 +211,7 @@ if (i > 0) { return uri.substring(i+1, uri.length()); } - return ""; + return uri; } /** diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java --- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,6 +33,7 @@ import com.sun.org.apache.xpath.internal.objects.XNodeSet; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xalan.internal.res.XSLMessages; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; import com.sun.org.apache.xpath.internal.functions.FuncExtFunction; import java.util.Vector; @@ -54,9 +55,12 @@ } public JAXPExtensionsProvider(XPathFunctionResolver resolver, - boolean featureSecureProcessing ) { + boolean featureSecureProcessing, FeatureManager featureManager ) { this.resolver = resolver; - this.extensionInvocationDisabled = featureSecureProcessing; + if (featureSecureProcessing && + !featureManager.isFeatureEnabled(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION)) { + this.extensionInvocationDisabled = true; + } } /** diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java --- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -30,6 +30,7 @@ import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; @@ -67,33 +68,36 @@ private boolean featureSecureProcessing = false; private boolean useServicesMechanism = true; + + private final FeatureManager featureManager; + /** Protected constructor to prevent direct instantiation; use compile() * from the context. */ - protected XPathExpressionImpl() { }; + protected XPathExpressionImpl() { + this(null, null, null, null, + false, true, new FeatureManager()); + }; protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath, JAXPPrefixResolver prefixResolver, XPathFunctionResolver functionResolver, XPathVariableResolver variableResolver ) { - this.xpath = xpath; - this.prefixResolver = prefixResolver; - this.functionResolver = functionResolver; - this.variableResolver = variableResolver; - this.featureSecureProcessing = false; + this(xpath, prefixResolver, functionResolver, variableResolver, + false, true, new FeatureManager()); }; protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath, - JAXPPrefixResolver prefixResolver, - XPathFunctionResolver functionResolver, - XPathVariableResolver variableResolver, - boolean featureSecureProcessing, boolean useServicesMechanism ) { + JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver, + XPathVariableResolver variableResolver, boolean featureSecureProcessing, + boolean useServicesMechanism, FeatureManager featureManager ) { this.xpath = xpath; this.prefixResolver = prefixResolver; this.functionResolver = functionResolver; this.variableResolver = variableResolver; this.featureSecureProcessing = featureSecureProcessing; this.useServicesMechanism = useServicesMechanism; + this.featureManager = featureManager; }; public void setXPath (com.sun.org.apache.xpath.internal.XPath xpath ) { @@ -111,7 +115,7 @@ com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null; if ( functionResolver != null ) { JAXPExtensionsProvider jep = new JAXPExtensionsProvider( - functionResolver, featureSecureProcessing ); + functionResolver, featureSecureProcessing, featureManager ); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep ); } else { xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(); diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java --- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -24,6 +24,8 @@ import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xalan.internal.res.XSLMessages; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; +import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase; import javax.xml.XMLConstants; import javax.xml.xpath.XPathFactory; @@ -68,6 +70,8 @@ private boolean _useServicesMechanism = true; + private final FeatureManager _featureManager; + public XPathFactoryImpl() { this(true); } @@ -77,9 +81,12 @@ } public XPathFactoryImpl(boolean useServicesMechanism) { + _featureManager = new FeatureManager(); if (System.getSecurityManager() != null) { _isSecureMode = true; _isNotSecureProcessing = false; + _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION, + FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE); } this._useServicesMechanism = useServicesMechanism; } @@ -131,7 +138,8 @@ public javax.xml.xpath.XPath newXPath() { return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl( xPathVariableResolver, xPathFunctionResolver, - !_isNotSecureProcessing, _useServicesMechanism ); + !_isNotSecureProcessing, _useServicesMechanism, + _featureManager ); } /** @@ -181,6 +189,10 @@ } _isNotSecureProcessing = !value; + if (value && _featureManager != null) { + _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION, + FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE); + } // all done processing feature return; @@ -192,6 +204,11 @@ return; } + if (_featureManager != null && + _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) { + return; + } + // unknown feature String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_UNKNOWN, @@ -240,6 +257,14 @@ if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { return _useServicesMechanism; } + + /** Check to see if the property is managed by the security manager **/ + String propertyValue = (_featureManager != null) ? + _featureManager.getValueAsString(name) : null; + if (propertyValue != null) { + return _featureManager.isFeatureEnabled(name); + } + // unknown feature String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE, diff -r 115e1128ce1a -r 624a61211dd7 jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java --- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -35,6 +35,7 @@ import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.utils.FactoryImpl; +import com.sun.org.apache.xalan.internal.utils.FeatureManager; import org.w3c.dom.Node; import org.w3c.dom.Document; @@ -70,18 +71,20 @@ // extensions function need to throw XPathFunctionException private boolean featureSecureProcessing = false; private boolean useServiceMechanism = true; + private final FeatureManager featureManager; XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) { - this.origVariableResolver = this.variableResolver = vr; - this.origFunctionResolver = this.functionResolver = fr; + this(vr, fr, false, true, new FeatureManager()); } XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr, - boolean featureSecureProcessing, boolean useServiceMechanism ) { + boolean featureSecureProcessing, boolean useServiceMechanism, + FeatureManager featureManager) { this.origVariableResolver = this.variableResolver = vr; this.origFunctionResolver = this.functionResolver = fr; this.featureSecureProcessing = featureSecureProcessing; this.useServiceMechanism = useServiceMechanism; + this.featureManager = featureManager; } /** @@ -190,7 +193,7 @@ com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null; if ( functionResolver != null ) { JAXPExtensionsProvider jep = new JAXPExtensionsProvider( - functionResolver, featureSecureProcessing ); + functionResolver, featureSecureProcessing, featureManager ); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep ); } else { xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(); @@ -391,7 +394,7 @@ // Can have errorListener XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath, prefixResolver, functionResolver, variableResolver, - featureSecureProcessing, useServiceMechanism ); + featureSecureProcessing, useServiceMechanism, featureManager ); return ximpl; } catch ( javax.xml.transform.TransformerException te ) { throw new XPathExpressionException ( te ) ; diff -r 115e1128ce1a -r 624a61211dd7 jaxws/.hgtags --- a/jaxws/.hgtags Thu Oct 31 16:46:43 2013 -0700 +++ b/jaxws/.hgtags Wed Jul 05 19:21:26 2017 +0200 @@ -235,3 +235,4 @@ 32edc7a2c86696dfcbdb6ffae641ff153f8e34bd jdk8-b111 dbdd5c76250928582cb5342bcf7b299a6007d538 jdk8-b112 9261f342aa73a79bbd1a817ae72fa72b15ef30bc jdk8-b113 +9ad289610fc6effe9076280b7920d0f16470709f jdk8-b114 diff -r 115e1128ce1a -r 624a61211dd7 jdk/.hgtags --- a/jdk/.hgtags Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/.hgtags Wed Jul 05 19:21:26 2017 +0200 @@ -235,3 +235,4 @@ 719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111 f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112 5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113 +f26a0c8071bde1e3b923713c75156e4a58955623 jdk8-b114 diff -r 115e1128ce1a -r 624a61211dd7 jdk/THIRD_PARTY_README diff -r 115e1128ce1a -r 624a61211dd7 jdk/make/launchers/Makefile diff -r 115e1128ce1a -r 624a61211dd7 jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java --- a/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java Wed Jul 05 19:21:26 2017 +0200 @@ -618,6 +618,11 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/CompileLaunchers.gmk diff -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/CreateJars.gmk diff -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/CreateSecurityJars.gmk diff -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/Setup.gmk --- a/jdk/makefiles/Setup.gmk Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/makefiles/Setup.gmk Wed Jul 05 19:21:26 2017 +0200 @@ -27,7 +27,7 @@ # 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 -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/mapfiles/libjava/mapfile-vers --- a/jdk/makefiles/mapfiles/libjava/mapfile-vers Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers Wed Jul 05 19:21:26 2017 +0200 @@ -267,7 +267,8 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/mapfiles/libjava/reorder-sparc --- a/jdk/makefiles/mapfiles/libjava/reorder-sparc Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/makefiles/mapfiles/libjava/reorder-sparc Wed Jul 05 19:21:26 2017 +0200 @@ -27,7 +27,8 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/mapfiles/libjava/reorder-sparcv9 --- a/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 Wed Jul 05 19:21:26 2017 +0200 @@ -26,7 +26,8 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/makefiles/mapfiles/libjava/reorder-x86 --- a/jdk/makefiles/mapfiles/libjava/reorder-x86 Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/makefiles/mapfiles/libjava/reorder-x86 Wed Jul 05 19:21:26 2017 +0200 @@ -28,7 +28,8 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m --- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m Wed Jul 05 19:21:26 2017 +0200 @@ -163,7 +163,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/eawt/event/package.html --- a/jdk/src/macosx/classes/com/apple/eawt/event/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/eawt/event/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -1,5 +1,7 @@ + + Classes for receiving gesture events. diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/eawt/package.html --- a/jdk/src/macosx/classes/com/apple/eawt/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/eawt/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -1,5 +1,7 @@ + + Provides classes for integrating Java applications with the native application environment. diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java --- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Wed Jul 05 19:21:26 2017 +0200 @@ -244,7 +244,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java --- a/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java Wed Jul 05 19:21:26 2017 +0200 @@ -406,7 +406,7 @@ } /** 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -3514,7 +3514,7 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java --- a/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -179,7 +179,7 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java Wed Jul 05 19:21:26 2017 +0200 @@ -93,9 +93,9 @@ } if (fMenuItem instanceof JCheckBoxMenuItem) { - setState(((JCheckBoxMenuItem)fMenuItem).isSelected()); + forceSetState(fMenuItem.isSelected()); } else { - setState(fMenuItem.getModel().isSelected()); + forceSetState(fMenuItem.getModel().isSelected()); } } @@ -196,10 +196,10 @@ switch (e.getStateChange()) { case ItemEvent.SELECTED: - setState(true); + forceSetState(true); break; case ItemEvent.DESELECTED: - setState(false); + forceSetState(false); break; } } @@ -210,4 +210,20 @@ ((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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/java/net/DefaultInterface.java --- a/jdk/src/macosx/classes/java/net/DefaultInterface.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/java/net/DefaultInterface.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java Wed Jul 05 19:21:26 2017 +0200 @@ -122,7 +122,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/font/CFontManager.java --- a/jdk/src/macosx/classes/sun/font/CFontManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/font/CFontManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -342,7 +342,7 @@ @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Wed Jul 05 19:21:26 2017 +0200 @@ -56,15 +56,6 @@ 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 @@ // 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 @@ */ @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java Wed Jul 05 19:21:26 2017 +0200 @@ -620,8 +620,7 @@ 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 @@ }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } synchronized(returnValue) { return returnValue; } } @@ -695,8 +693,7 @@ 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 @@ } }} }, fAwtFocussedComponent); - } catch (InterruptedException ie) { ie.printStackTrace(); } - catch (InvocationTargetException ite) { ite.printStackTrace(); } + } catch (InvocationTargetException ite) { ite.printStackTrace(); } synchronized(rect) { return rect; } } @@ -764,8 +760,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java Wed Jul 05 19:21:26 2017 +0200 @@ -54,14 +54,6 @@ } @Override - public void enterFullScreenMode() { - } - - @Override - public void exitFullScreenMode() { - } - - @Override public SurfaceData replaceSurfaceData() { return null; } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Wed Jul 05 19:21:26 2017 +0200 @@ -96,14 +96,6 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jul 05 19:21:26 2017 +0200 @@ -63,6 +63,8 @@ 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 @@ 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 @@ @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 @@ 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 @@ 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 @@ @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 @@ //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 @@ 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 @@ } } + 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Wed Jul 05 19:21:26 2017 +0200 @@ -233,6 +233,10 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java Wed Jul 05 19:21:26 2017 +0200 @@ -97,6 +97,6 @@ setVisible(true); } }, this); - } catch (InterruptedException | InvocationTargetException ex) {} + } catch (InvocationTargetException ex) {} } } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Wed Jul 05 19:21:26 2017 +0200 @@ -82,9 +82,6 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Jul 05 19:21:26 2017 +0200 @@ -548,22 +548,18 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/AWTView.m --- a/jdk/src/macosx/native/sun/awt/AWTView.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/AWTView.m Wed Jul 05 19:21:26 2017 +0200 @@ -272,7 +272,6 @@ */ - (void) keyDown: (NSEvent *)event { - fProcessingKeystroke = YES; fKeyEventsNeeded = YES; @@ -308,6 +307,23 @@ - (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 @@ // --- 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/AWTWindow.h --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/AWTWindow.m --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m Wed Jul 05 19:21:26 2017 +0200 @@ -122,6 +122,7 @@ @synthesize styleBits; @synthesize isEnabled; @synthesize ownerWindow; +@synthesize preFullScreenLevel; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -501,20 +502,6 @@ // 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_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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/CPrinterJob.m --- a/jdk/src/macosx/native/sun/awt/CPrinterJob.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/CPrinterJob.m Wed Jul 05 19:21:26 2017 +0200 @@ -359,7 +359,11 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/CTextPipe.m --- a/jdk/src/macosx/native/sun/awt/CTextPipe.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m Wed Jul 05 19:21:26 2017 +0200 @@ -322,7 +322,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/CWrapper.m --- a/jdk/src/macosx/native/sun/awt/CWrapper.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/CWrapper.m Wed Jul 05 19:21:26 2017 +0200 @@ -587,46 +587,6 @@ /* * 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 * Signature: (J)J */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/awt/awt.m --- a/jdk/src/macosx/native/sun/awt/awt.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/awt.m Wed Jul 05 19:21:26 2017 +0200 @@ -312,15 +312,17 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m --- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m Wed Jul 05 19:21:26 2017 +0200 @@ -341,6 +341,10 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/back/ThreadGroupReferenceImpl.c --- a/jdk/src/share/back/ThreadGroupReferenceImpl.c Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/back/ThreadGroupReferenceImpl.c Wed Jul 05 19:21:26 2017 +0200 @@ -47,7 +47,7 @@ (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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/back/commonRef.c --- a/jdk/src/share/back/commonRef.c Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/back/commonRef.c Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/back/eventFilter.c --- a/jdk/src/share/back/eventFilter.c Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/back/eventFilter.c Wed Jul 05 19:21:26 2017 +0200 @@ -644,7 +644,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/back/outStream.c --- a/jdk/src/share/back/outStream.c Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/back/outStream.c Wed Jul 05 19:21:26 2017 +0200 @@ -298,17 +298,15 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/back/util.c --- a/jdk/src/share/back/util.c Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/back/util.c Wed Jul 05 19:21:26 2017 +0200 @@ -1092,7 +1092,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -40,7 +40,7 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the name of the accessible entity diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ * <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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
length *
the array length @@ -110,6 +110,20 @@ } /** + * 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. * * @param type the base class diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,7 +33,7 @@ * 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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
code *
this attribute specifies character code diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -36,7 +36,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -126,7 +126,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -31,7 +31,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -43,7 +43,7 @@ * 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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the field name diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -32,7 +32,7 @@ * 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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
version *
the Java version (not supported) diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -43,7 +43,7 @@ * <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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the method name diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -43,7 +43,7 @@ * <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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
class *
the type of object for instantiation diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -31,7 +31,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,7 +33,7 @@ * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -63,7 +63,7 @@ * <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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
name *
the property name diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -40,7 +40,7 @@ * <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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -31,7 +31,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -30,7 +30,7 @@ * 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 @@ /** * Parses attributes of the element. - * The following atributes are supported: + * The following attributes are supported: *
*
idref *
the identifier to refer to the variable diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java --- a/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,7 +29,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java --- a/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java Wed Jul 05 19:21:26 2017 +0200 @@ -408,7 +408,7 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java --- a/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java Wed Jul 05 19:21:26 2017 +0200 @@ -408,7 +408,7 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java --- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java Wed Jul 05 19:21:26 2017 +0200 @@ -307,7 +307,7 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java --- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java Wed Jul 05 19:21:26 2017 +0200 @@ -317,7 +317,7 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -187,15 +187,24 @@ 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 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 @@ 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 @@ 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 @@ } } else { throw new - RuntimeException(I18N.getString("BMPImageReader3")); + IIOException(I18N.getString("BMPImageReader3")); } } @@ -660,7 +683,11 @@ 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 @@ 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 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 @@ 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 @@ default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; @@ -833,7 +872,7 @@ default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; @@ -874,7 +913,7 @@ default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } case VERSION_4_8_BIT: @@ -890,7 +929,7 @@ default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java Wed Jul 05 19:21:26 2017 +0200 @@ -32,7 +32,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties --- a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties Wed Jul 05 19:21:26 2017 +0200 @@ -21,6 +21,8 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -115,6 +115,8 @@ // 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java Wed Jul 05 19:21:26 2017 +0200 @@ -1368,7 +1368,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java Wed Jul 05 19:21:26 2017 +0200 @@ -28,6 +28,7 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java Wed Jul 05 19:21:26 2017 +0200 @@ -78,7 +78,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -688,6 +688,21 @@ 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java Wed Jul 05 19:21:26 2017 +0200 @@ -1041,7 +1041,7 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Wed Jul 05 19:21:26 2017 +0200 @@ -304,7 +304,7 @@ 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 @@ } 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Wed Jul 05 19:21:26 2017 +0200 @@ -131,7 +131,7 @@ * 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 @@ /** * 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 @@ * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ * 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 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties Wed Jul 05 19:21:26 2017 +0200 @@ -41,7 +41,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java Wed Jul 05 19:21:26 2017 +0200 @@ -86,19 +86,19 @@ 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 @@ }); } + 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Wed Jul 05 19:21:26 2017 +0200 @@ -45,7 +45,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Wed Jul 05 19:21:26 2017 +0200 @@ -326,18 +326,27 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Wed Jul 05 19:21:26 2017 +0200 @@ -2012,7 +2012,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -50,7 +50,7 @@ *
  • 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -162,7 +162,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Wed Jul 05 19:21:26 2017 +0200 @@ -190,7 +190,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Wed Jul 05 19:21:26 2017 +0200 @@ -106,7 +106,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java --- a/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java Wed Jul 05 19:21:26 2017 +0200 @@ -70,7 +70,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java --- a/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java Wed Jul 05 19:21:26 2017 +0200 @@ -250,7 +250,7 @@ * * @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 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -1291,7 +1291,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java Wed Jul 05 19:21:26 2017 +0200 @@ -644,7 +644,7 @@ /** * 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 @@ * {@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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java Wed Jul 05 19:21:26 2017 +0200 @@ -35,7 +35,7 @@ */ /** - * Lexical error occured. + * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; @@ -114,10 +114,10 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java Wed Jul 05 19:21:26 2017 +0200 @@ -130,7 +130,7 @@ * @return The value. */ public byte[] byteValue() { - return value ; + return value.clone() ; } /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java Wed Jul 05 19:21:26 2017 +0200 @@ -70,7 +70,7 @@ * @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 @@ * * @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 @@ * * @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 @@ * * @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 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java Wed Jul 05 19:21:26 2017 +0200 @@ -476,8 +476,7 @@ rootOid[i++]= val.longValue(); } } - return rootOid; - + return rootOid.clone(); } // -------------------------------------------------------------------- diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java Wed Jul 05 19:21:26 2017 +0200 @@ -127,7 +127,7 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java Wed Jul 05 19:21:26 2017 +0200 @@ -62,7 +62,7 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java Wed Jul 05 19:21:26 2017 +0200 @@ -119,7 +119,7 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java Wed Jul 05 19:21:26 2017 +0200 @@ -435,7 +435,7 @@ * 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 @@ * @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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java Wed Jul 05 19:21:26 2017 +0200 @@ -581,7 +581,7 @@ } 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java Wed Jul 05 19:21:26 2017 +0200 @@ -480,7 +480,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java Wed Jul 05 19:21:26 2017 +0200 @@ -1248,7 +1248,7 @@ "of this CommunicatorServer instance has changed."); } - return notifInfos; + return notifInfos.clone(); } /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java Wed Jul 05 19:21:26 2017 +0200 @@ -473,7 +473,7 @@ * @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 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -559,7 +559,7 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -52,7 +52,7 @@ 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 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -55,7 +55,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java --- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -99,7 +99,7 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jndi/ldap/Connection.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Wed Jul 05 19:21:26 2017 +0200 @@ -568,7 +568,7 @@ //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 @@ //System.err.println("ldap.unbind: " + ex); } - // Dont expect any response for the unbind request. + // Don't expect any response for the unbind request. } /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jndi/ldap/Filter.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java Wed Jul 05 19:21:26 2017 +0200 @@ -191,7 +191,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Wed Jul 05 19:21:26 2017 +0200 @@ -176,7 +176,7 @@ "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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java Wed Jul 05 19:21:26 2017 +0200 @@ -862,7 +862,7 @@ --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 @@ } // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java --- a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java Wed Jul 05 19:21:26 2017 +0200 @@ -109,7 +109,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java --- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Wed Jul 05 19:21:26 2017 +0200 @@ -82,7 +82,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java --- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java Wed Jul 05 19:21:26 2017 +0200 @@ -106,7 +106,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java --- a/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -51,15 +51,6 @@ private static final int MAX_READ_LENGTH = 8; - /** - * Constructs a new AiffParser object. - */ - public AiffFileReader() { - } - - - - // METHODS TO IMPLEMENT AudioFileReader /** @@ -292,9 +283,15 @@ 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 @@ return f; } - - - } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/AuFileReader.java --- a/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -49,13 +49,6 @@ */ public final class AuFileReader extends SunFileReader { - /** - * Constructs a new AuFileReader object. - */ - public AuFileReader() { - } - - // METHODS TO IMPLEMENT AudioFileReader /** @@ -90,7 +83,7 @@ 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 @@ 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 @@ return result; } - - - } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java --- a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java Wed Jul 05 19:21:26 2017 +0200 @@ -34,7 +34,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java --- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Wed Jul 05 19:21:26 2017 +0200 @@ -378,7 +378,7 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java --- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java Wed Jul 05 19:21:26 2017 +0200 @@ -37,7 +37,7 @@ import javax.sound.sampled.SourceDataLine; /** - * SourceDataLine implemention for the SoftMixingMixer. + * SourceDataLine implementation for the SoftMixingMixer. * * @author Karl Helgason */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java --- a/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -53,13 +53,6 @@ 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 * need to read some data from the stream before determining whether they @@ -304,6 +297,9 @@ } // 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 @@ // 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 @@ format, dataLength / format.getFrameSize()); } - } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/net/httpserver/Headers.java --- a/jdk/src/share/classes/com/sun/net/httpserver/Headers.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/net/httpserver/Headers.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,7 +33,7 @@ * {@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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java --- a/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java Wed Jul 05 19:21:26 2017 +0200 @@ -170,7 +170,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java --- a/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java Wed Jul 05 19:21:26 2017 +0200 @@ -41,7 +41,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java Wed Jul 05 19:21:26 2017 +0200 @@ -110,7 +110,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java Wed Jul 05 19:21:26 2017 +0200 @@ -63,7 +63,7 @@ * * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java
    --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Thu Oct 31 16:46:43 2013 -0700
    +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Wed Jul 05 19:21:26 2017 +0200
    @@ -846,7 +846,7 @@
         }
     
         /**
    -     * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
    --- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Thu Oct 31 16:46:43 2013 -0700
    +++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Wed Jul 05 19:21:26 2017 +0200
    @@ -41,7 +41,7 @@
     /**
      * 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 @@
         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 @@ 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 @@ /* * 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 @@ /** * 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 @@ * 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 @@ /** - * 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 @@ /** - * 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 @@ * 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 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -39,7 +39,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -36,7 +36,7 @@ /** * 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 @@ 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 @@ * 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 @@ /** - * 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 @@ /** - * 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 @@ * 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 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -42,7 +42,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java --- a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -4109,7 +4109,7 @@ /** * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/rowset/package.html --- a/jdk/src/share/classes/com/sun/rowset/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -74,7 +74,7 @@

    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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java --- a/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java Wed Jul 05 19:21:26 2017 +0200 @@ -153,7 +153,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java --- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java Wed Jul 05 19:21:26 2017 +0200 @@ -62,7 +62,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties Wed Jul 05 19:21:26 2017 +0200 @@ -144,12 +144,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties Wed Jul 05 19:21:26 2017 +0200 @@ -143,12 +143,12 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java Wed Jul 05 19:21:26 2017 +0200 @@ -44,7 +44,7 @@ private static final long serialVersionUID = -6236440836177601522L; /** - * Lexical error occured. + * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; @@ -123,10 +123,10 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/tools/hat/resources/hat.js --- a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js Wed Jul 05 19:21:26 2017 +0200 @@ -33,7 +33,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java --- a/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Wed Jul 05 19:21:26 2017 +0200 @@ -68,7 +68,7 @@ transport = new Transport() { public String name() { - return "dt_socket"; // for compatability reasons + return "dt_socket"; // for compatibility reasons } }; diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java --- a/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Wed Jul 05 19:21:26 2017 +0200 @@ -58,7 +58,7 @@ transport = new Transport() { public String name() { - return "dt_socket"; // for compatability reasons + return "dt_socket"; // for compatibility reasons } }; } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java Wed Jul 05 19:21:26 2017 +0200 @@ -31,7 +31,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -62,7 +62,7 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/AWTEventMulticaster.java --- a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java Wed Jul 05 19:21:26 2017 +0200 @@ -998,7 +998,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/AlphaComposite.java --- a/jdk/src/share/classes/java/awt/AlphaComposite.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/AlphaComposite.java Wed Jul 05 19:21:26 2017 +0200 @@ -197,7 +197,7 @@ *

    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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/BasicStroke.java --- a/jdk/src/share/classes/java/awt/BasicStroke.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/BasicStroke.java Wed Jul 05 19:21:26 2017 +0200 @@ -88,7 +88,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/BorderLayout.java --- a/jdk/src/share/classes/java/awt/BorderLayout.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/BorderLayout.java Wed Jul 05 19:21:26 2017 +0200 @@ -69,7 +69,7 @@ * 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 @@ * * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/CheckboxMenuItem.java --- a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java Wed Jul 05 19:21:26 2017 +0200 @@ -180,7 +180,7 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Choice.java --- a/jdk/src/share/classes/java/awt/Choice.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Choice.java Wed Jul 05 19:21:26 2017 +0200 @@ -418,7 +418,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Component.java --- a/jdk/src/share/classes/java/awt/Component.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Component.java Wed Jul 05 19:21:26 2017 +0200 @@ -276,7 +276,7 @@ * @see #getFont * @see #setFont */ - Font font; + volatile Font font; /** * The font which the peer is currently using. @@ -1885,10 +1885,8 @@ 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 @@ } /** - * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Container.java --- a/jdk/src/share/classes/java/awt/Container.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Container.java Wed Jul 05 19:21:26 2017 +0200 @@ -959,7 +959,7 @@ * * @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 @@ * * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Dialog.java --- a/jdk/src/share/classes/java/awt/Dialog.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Dialog.java Wed Jul 05 19:21:26 2017 +0200 @@ -338,7 +338,7 @@ * * @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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Event.java --- a/jdk/src/share/classes/java/awt/Event.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Event.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,14 +29,14 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /* * 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 @@ /* * 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 @@ /** * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/EventDispatchThread.java --- a/jdk/src/share/classes/java/awt/EventDispatchThread.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/EventDispatchThread.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ 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 @@ 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 @@ 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 @@ } } 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/EventQueue.java --- a/jdk/src/share/classes/java/awt/EventQueue.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/EventQueue.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ } } - final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) { + final void detachDispatchThread(EventDispatchThread edt) { /* * Minimize discard possibility for non-posted events */ @@ -1090,17 +1090,9 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Font.java --- a/jdk/src/share/classes/java/awt/Font.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Font.java Wed Jul 05 19:21:26 2017 +0200 @@ -1334,7 +1334,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Graphics.java --- a/jdk/src/share/classes/java/awt/Graphics.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Graphics.java Wed Jul 05 19:21:26 2017 +0200 @@ -105,7 +105,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Graphics2D.java --- a/jdk/src/share/classes/java/awt/Graphics2D.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Graphics2D.java Wed Jul 05 19:21:26 2017 +0200 @@ -305,7 +305,7 @@ * 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 @@ * @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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/GraphicsDevice.java --- a/jdk/src/share/classes/java/awt/GraphicsDevice.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java Wed Jul 05 19:21:26 2017 +0200 @@ -162,7 +162,7 @@ * 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 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/GraphicsEnvironment.java --- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java Wed Jul 05 19:21:26 2017 +0200 @@ -263,7 +263,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/GridBagLayout.java --- a/jdk/src/share/classes/java/awt/GridBagLayout.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/GridBagLayout.java Wed Jul 05 19:21:26 2017 +0200 @@ -125,9 +125,9 @@ *

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

      Absolute Values

      Orientation Relative Values

      Baseline Relative Values

      Absolute Values

      Orientation Relative Values

      Baseline Relative Values

      @@ -255,10 +255,10 @@ *
      * * * * * @@ -366,7 +366,7 @@ 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 @@ * 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 @@ * 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 @@ /** * 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 @@ *

        *
      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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ } } - // Added for serial backwards compatability (4348425) + // Added for serial backwards compatibility (4348425) static final long serialVersionUID = 8838754796412211005L; } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/KeyEventDispatcher.java --- a/jdk/src/share/classes/java/awt/KeyEventDispatcher.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/KeyEventDispatcher.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ * @see KeyboardFocusManager#removeKeyEventDispatcher * @since 1.4 */ +@FunctionalInterface public interface KeyEventDispatcher { /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/KeyEventPostProcessor.java --- a/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ * @see KeyboardFocusManager#removeKeyEventPostProcessor * @since 1.4 */ +@FunctionalInterface public interface KeyEventPostProcessor { /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/KeyboardFocusManager.java --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -2663,7 +2663,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/LinearGradientPaint.java --- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java Wed Jul 05 19:21:26 2017 +0200 @@ -94,7 +94,8 @@ * of the three cycle methods: *

      *

      - * LinearGradientPaint + * image showing the output of the example code *
      * * @see java.awt.Paint diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/List.java --- a/jdk/src/share/classes/java/awt/List.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/List.java Wed Jul 05 19:21:26 2017 +0200 @@ -797,7 +797,7 @@ } /** - * 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 @@ /* * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/MediaTracker.java --- a/jdk/src/share/classes/java/awt/MediaTracker.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/MediaTracker.java Wed Jul 05 19:21:26 2017 +0200 @@ -744,7 +744,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/MenuComponent.java --- a/jdk/src/share/classes/java/awt/MenuComponent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/MenuComponent.java Wed Jul 05 19:21:26 2017 +0200 @@ -402,7 +402,7 @@ /** * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java --- a/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java Wed Jul 05 19:21:26 2017 +0200 @@ -81,7 +81,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Polygon.java --- a/jdk/src/share/classes/java/awt/Polygon.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Polygon.java Wed Jul 05 19:21:26 2017 +0200 @@ -246,7 +246,7 @@ } /* - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/PopupMenu.java --- a/jdk/src/share/classes/java/awt/PopupMenu.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/PopupMenu.java Wed Jul 05 19:21:26 2017 +0200 @@ -150,7 +150,7 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/RadialGradientPaint.java --- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java Wed Jul 05 19:21:26 2017 +0200 @@ -80,14 +80,16 @@ * 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 @@ * (centered) focus for each of the three cycle methods: *

      *

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

      @@ -141,7 +144,8 @@ * focus for each of the three cycle methods: *

      *

      - * RadialGradientPaint-2 + * image showing the
+ * output of the sample code *
      * * @see java.awt.Paint diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/RenderingHints.java --- a/jdk/src/share/classes/java/awt/RenderingHints.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/RenderingHints.java Wed Jul 05 19:21:26 2017 +0200 @@ -101,7 +101,7 @@ // - 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/ScrollPane.java --- a/jdk/src/share/classes/java/awt/ScrollPane.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/ScrollPane.java Wed Jul 05 19:21:26 2017 +0200 @@ -425,8 +425,8 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java --- a/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java Wed Jul 05 19:21:26 2017 +0200 @@ -336,7 +336,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Shape.java --- a/jdk/src/share/classes/java/awt/Shape.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Shape.java Wed Jul 05 19:21:26 2017 +0200 @@ -269,7 +269,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/TextComponent.java --- a/jdk/src/share/classes/java/awt/TextComponent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/TextComponent.java Wed Jul 05 19:21:26 2017 +0200 @@ -1000,7 +1000,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/TextField.java --- a/jdk/src/share/classes/java/awt/TextField.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/TextField.java Wed Jul 05 19:21:26 2017 +0200 @@ -405,7 +405,7 @@ } /** - * 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 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Toolkit.java --- a/jdk/src/share/classes/java/awt/Toolkit.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Toolkit.java Wed Jul 05 19:21:26 2017 +0200 @@ -1457,7 +1457,7 @@ *

      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 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/Window.java --- a/jdk/src/share/classes/java/awt/Window.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/Window.java Wed Jul 05 19:21:26 2017 +0200 @@ -1656,7 +1656,7 @@ * 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 @@ } /** - * 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 @@ } /** - * 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 @@ * 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 @@ 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 @@ * 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 @@ *

      * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/color/package.html --- a/jdk/src/share/classes/java/awt/color/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/color/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides classes for color spaces. It contains an diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java --- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java Wed Jul 05 19:21:26 2017 +0200 @@ -104,7 +104,7 @@ 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 @@ /* * 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 @@ * @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 @@ 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 @@ return bestFlavor; } - private static Comparator textFlavorComparator; + private static Comparator textFlavorComparator; static class TextFlavorComparator extends DataTransferer.DataFlavorComparator { @@ -1447,6 +1447,6 @@ /** Java class of objects this DataFlavor represents **/ - private Class representationClass; + private Class representationClass; } // class DataFlavor diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java --- a/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java Wed Jul 05 19:21:26 2017 +0200 @@ -30,7 +30,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java --- a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,7 +33,7 @@ /** - * 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 @@ * 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 @@ 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 @@ 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 @@ * 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 @@ /** * Retrieve an enumeration of all the names in this list. */ - public Enumeration getNames() { + public Enumeration getNames() { return parameters.keys(); } @@ -279,15 +279,15 @@ // 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 @@ return newObj; } - private Hashtable parameters; + private Hashtable parameters; // below here be scary parsing related things diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java --- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java Wed Jul 05 19:21:26 2017 +0200 @@ -1324,7 +1324,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/datatransfer/package.html --- a/jdk/src/share/classes/java/awt/datatransfer/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/datatransfer/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides interfaces and classes for transferring data diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/DragGestureListener.java --- a/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java Wed Jul 05 19:21:26 2017 +0200 @@ -50,8 +50,8 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java --- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java Wed Jul 05 19:21:26 2017 +0200 @@ -46,7 +46,7 @@ *

      * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/DragSourceContext.java --- a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java Wed Jul 05 19:21:26 2017 +0200 @@ -474,7 +474,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java --- a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -38,7 +38,7 @@ * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/DropTarget.java --- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java Wed Jul 05 19:21:26 2017 +0200 @@ -612,7 +612,7 @@ 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 @@ } /** - * update autoscrolling with current cursor locn + * update autoscrolling with current cursor location *

      * @param dragCursorLocn the Point */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java --- a/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,7 +29,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/dnd/package.html --- a/jdk/src/share/classes/java/awt/dnd/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/dnd/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Drag and Drop is a direct manipulation gesture found in many Graphical @@ -51,18 +52,18 @@ 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 @@ 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 @@
      • 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html --- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html Wed Jul 05 19:21:26 2017 +0200 @@ -23,7 +23,11 @@ questions. --> + + + +

        AWT Threading Issues

        @@ -81,13 +85,13 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html --- a/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html Wed Jul 05 19:21:26 2017 +0200 @@ -23,7 +23,11 @@ questions. --> + + + +

        AWT Desktop Properties

        @@ -51,8 +55,8 @@

        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 @@ - - + + + - - + + +
      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 @@ 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 @@ }

      Advanced Usage Tips

      -

      +

      Listening for changes

      An application can listen for changes in the property @@ -161,7 +165,7 @@ 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 @@

      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 @@

        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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/doc-files/FocusSpec.html --- a/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html Wed Jul 05 19:21:26 2017 +0200 @@ -27,7 +27,7 @@ - The AWT Focus Subsystem + The AWT Focus Subsystem @@ -660,16 +660,16 @@ 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 @@ 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: 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/doc-files/Modality.html --- a/jdk/src/share/classes/java/awt/doc-files/Modality.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/doc-files/Modality.html Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/event/ActionEvent.java --- a/jdk/src/share/classes/java/awt/event/ActionEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/event/ActionEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -95,7 +95,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/event/InvocationEvent.java --- a/jdk/src/share/classes/java/awt/event/InvocationEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/event/InvocationEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,8 @@ package java.awt.event; +import sun.awt.AWTAccessor; + import java.awt.ActiveEvent; import java.awt.AWTEvent; @@ -56,6 +58,15 @@ */ 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 @@ /** * 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 @@ * @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 @@ * @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 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 @@ * @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 @@ */ 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 @@ runnable.run(); } } finally { - dispatched = true; - - if (notifier != null) { - synchronized (notifier) { - notifier.notifyAll(); - } - } + finishedDispatching(true); } } @@ -331,6 +385,25 @@ } /** + * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/event/KeyEvent.java --- a/jdk/src/share/classes/java/awt/event/KeyEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/event/KeyEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -133,7 +133,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/event/WindowEvent.java --- a/jdk/src/share/classes/java/awt/event/WindowEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/event/WindowEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -79,8 +79,10 @@ @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/event/package.html --- a/jdk/src/share/classes/java/awt/event/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/event/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides interfaces and classes for dealing with different diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/FontRenderContext.java --- a/jdk/src/share/classes/java/awt/font/FontRenderContext.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/FontRenderContext.java Wed Jul 05 19:21:26 2017 +0200 @@ -126,7 +126,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/GlyphMetrics.java --- a/jdk/src/share/classes/java/awt/font/GlyphMetrics.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/GlyphMetrics.java Wed Jul 05 19:21:26 2017 +0200 @@ -43,7 +43,7 @@ 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/GlyphVector.java --- a/jdk/src/share/classes/java/awt/font/GlyphVector.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/GlyphVector.java Wed Jul 05 19:21:26 2017 +0200 @@ -395,7 +395,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java --- a/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java Wed Jul 05 19:21:26 2017 +0200 @@ -112,7 +112,7 @@ * Examples:

      * Rendering a paragraph in a component *

      - *
      + * 
      {@code
        * public void paint(Graphics graphics) {
        *
        *     Point2D pen = new Point2D(10, 20);
      @@ -137,13 +137,13 @@
        *         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 @@
        *         verticalPos += maxDescent;
        *     }
        * }
      - * 
      + * }
      *
      * @see TextLayout */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/MultipleMaster.java --- a/jdk/src/share/classes/java/awt/font/MultipleMaster.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/MultipleMaster.java Wed Jul 05 19:21:26 2017 +0200 @@ -41,7 +41,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/NumericShaper.java --- a/jdk/src/share/classes/java/awt/font/NumericShaper.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/NumericShaper.java Wed Jul 05 19:21:26 2017 +0200 @@ -1212,7 +1212,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/OpenType.java --- a/jdk/src/share/classes/java/awt/font/OpenType.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/OpenType.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,7 +33,7 @@ *

      * 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 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/TextLayout.java --- a/jdk/src/share/classes/java/awt/font/TextLayout.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/TextLayout.java Wed Jul 05 19:21:26 2017 +0200 @@ -223,7 +223,7 @@ * 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 @@ 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/TransformAttribute.java --- a/jdk/src/share/classes/java/awt/font/TransformAttribute.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/TransformAttribute.java Wed Jul 05 19:21:26 2017 +0200 @@ -120,7 +120,7 @@ return this; } - // Added for serial backwards compatability (4348425) + // Added for serial backwards compatibility (4348425) static final long serialVersionUID = 3356247357827709530L; /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/font/package.html --- a/jdk/src/share/classes/java/awt/font/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/font/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides classes and interface relating to fonts. It diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/geom/AffineTransform.java --- a/jdk/src/share/classes/java/awt/geom/AffineTransform.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/geom/AffineTransform.java Wed Jul 05 19:21:26 2017 +0200 @@ -47,7 +47,7 @@ * [ 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 @@ /** * 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 @@ /** * 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 @@ * 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 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/geom/Line2D.java --- a/jdk/src/share/classes/java/awt/geom/Line2D.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/geom/Line2D.java Wed Jul 05 19:21:26 2017 +0200 @@ -477,7 +477,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/geom/Path2D.java --- a/jdk/src/share/classes/java/awt/geom/Path2D.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/geom/Path2D.java Wed Jul 05 19:21:26 2017 +0200 @@ -2064,7 +2064,7 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/geom/QuadCurve2D.java --- a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java Wed Jul 05 19:21:26 2017 +0200 @@ -511,7 +511,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/geom/package.html --- a/jdk/src/share/classes/java/awt/geom/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/geom/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides the Java 2D classes for defining and performing operations diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/im/InputContext.java --- a/jdk/src/share/classes/java/awt/im/InputContext.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/im/InputContext.java Wed Jul 05 19:21:26 2017 +0200 @@ -98,7 +98,6 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/im/InputMethodRequests.java --- a/jdk/src/share/classes/java/awt/im/InputMethodRequests.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/im/InputMethodRequests.java Wed Jul 05 19:21:26 2017 +0200 @@ -83,7 +83,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/BandedSampleModel.java --- a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java Wed Jul 05 19:21:26 2017 +0200 @@ -39,7 +39,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/BufferStrategy.java --- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java Wed Jul 05 19:21:26 2017 +0200 @@ -34,7 +34,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/BufferedImage.java --- a/jdk/src/share/classes/java/awt/image/BufferedImage.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java Wed Jul 05 19:21:26 2017 +0200 @@ -1336,7 +1336,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/ComponentColorModel.java --- a/jdk/src/share/classes/java/awt/image/ComponentColorModel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/ComponentColorModel.java Wed Jul 05 19:21:26 2017 +0200 @@ -2318,7 +2318,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/ComponentSampleModel.java --- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java Wed Jul 05 19:21:26 2017 +0200 @@ -167,6 +167,7 @@ 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"); + } - long size = 0; - if (maxBandOff >= 0) - size += maxBandOff+1; - if (pixelStride > 0) - size += pixelStride * (width-1); - if (scanlineStride > 0) - size += scanlineStride*(height-1); + 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; + return size; } @@ -409,7 +439,7 @@ 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 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/ImageConsumer.java --- a/jdk/src/share/classes/java/awt/image/ImageConsumer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/ImageConsumer.java Wed Jul 05 19:21:26 2017 +0200 @@ -191,7 +191,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/IndexColorModel.java --- a/jdk/src/share/classes/java/awt/image/IndexColorModel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/IndexColorModel.java Wed Jul 05 19:21:26 2017 +0200 @@ -1152,7 +1152,7 @@ * @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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java --- a/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,7 +29,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/package.html --- a/jdk/src/share/classes/java/awt/image/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides classes for creating and modifying images. diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java --- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java Wed Jul 05 19:21:26 2017 +0200 @@ -65,7 +65,7 @@ * 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 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java --- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java Wed Jul 05 19:21:26 2017 +0200 @@ -236,7 +236,7 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/image/renderable/package.html --- a/jdk/src/share/classes/java/awt/image/renderable/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/image/renderable/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides classes and interfaces for producing diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/package.html --- a/jdk/src/share/classes/java/awt/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Contains all of the classes for creating user @@ -53,7 +54,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/awt/print/package.html --- a/jdk/src/share/classes/java/awt/print/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/awt/print/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ + Provides classes and interfaces for a general printing API. The diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/AppletInitializer.java --- a/jdk/src/share/classes/java/beans/AppletInitializer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/AppletInitializer.java Wed Jul 05 19:21:26 2017 +0200 @@ -32,7 +32,7 @@ /** *

          * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java --- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java Wed Jul 05 19:21:26 2017 +0200 @@ -273,7 +273,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/EventHandler.java --- a/jdk/src/share/classes/java/beans/EventHandler.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/EventHandler.java Wed Jul 05 19:21:26 2017 +0200 @@ -611,7 +611,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/MethodDescriptor.java --- a/jdk/src/share/classes/java/beans/MethodDescriptor.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java Wed Jul 05 19:21:26 2017 +0200 @@ -76,7 +76,7 @@ } /** - * Gets the method that this MethodDescriptor encapsualtes. + * Gets the method that this MethodDescriptor encapsulates. * * @return The low-level description of the method */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/PropertyDescriptor.java --- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java Wed Jul 05 19:21:26 2017 +0200 @@ -335,7 +335,7 @@ */ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/PropertyEditorSupport.java --- a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java Wed Jul 05 19:21:26 2017 +0200 @@ -30,7 +30,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java Wed Jul 05 19:21:26 2017 +0200 @@ -302,7 +302,7 @@ /** * 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java Wed Jul 05 19:21:26 2017 +0200 @@ -38,7 +38,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java Wed Jul 05 19:21:26 2017 +0200 @@ -620,7 +620,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java Wed Jul 05 19:21:26 2017 +0200 @@ -183,7 +183,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/ByteArrayInputStream.java --- a/jdk/src/share/classes/java/io/ByteArrayInputStream.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/ByteArrayInputStream.java Wed Jul 05 19:21:26 2017 +0200 @@ -275,7 +275,6 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/ByteArrayOutputStream.java --- a/jdk/src/share/classes/java/io/ByteArrayOutputStream.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/ByteArrayOutputStream.java Wed Jul 05 19:21:26 2017 +0200 @@ -263,8 +263,6 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/Closeable.java --- a/jdk/src/share/classes/java/io/Closeable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/Closeable.java Wed Jul 05 19:21:26 2017 +0200 @@ -34,7 +34,6 @@ * * @since 1.5 */ -@FunctionalInterface public interface Closeable extends AutoCloseable { /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/DataInput.java --- a/jdk/src/share/classes/java/io/DataInput.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/DataInput.java Wed Jul 05 19:21:26 2017 +0200 @@ -155,7 +155,7 @@ * 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 @@ *

            * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/DataOutput.java --- a/jdk/src/share/classes/java/io/DataOutput.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/DataOutput.java Wed Jul 05 19:21:26 2017 +0200 @@ -134,11 +134,11 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/File.java --- a/jdk/src/share/classes/java/io/File.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/File.java Wed Jul 05 19:21:26 2017 +0200 @@ -1685,7 +1685,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/FilePermission.java --- a/jdk/src/share/classes/java/io/FilePermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/FilePermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -55,7 +55,7 @@ * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/Flushable.java --- a/jdk/src/share/classes/java/io/Flushable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/Flushable.java Wed Jul 05 19:21:26 2017 +0200 @@ -34,7 +34,6 @@ * * @since 1.5 */ -@FunctionalInterface public interface Flushable { /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/InputStream.java --- a/jdk/src/share/classes/java/io/InputStream.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/InputStream.java Wed Jul 05 19:21:26 2017 +0200 @@ -306,8 +306,7 @@ * *

                The general contract of reset is: * - *

                  - * + *
                    *
                  • If the method markSupported returns * true, then: * diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/ObjectInputStream.java --- a/jdk/src/share/classes/java/io/ObjectInputStream.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/ObjectInputStream.java Wed Jul 05 19:21:26 2017 +0200 @@ -109,7 +109,7 @@ * *

                    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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/ObjectStreamConstants.java
                    --- a/jdk/src/share/classes/java/io/ObjectStreamConstants.java	Thu Oct 31 16:46:43 2013 -0700
                    +++ b/jdk/src/share/classes/java/io/ObjectStreamConstants.java	Wed Jul 05 19:21:26 2017 +0200
                    @@ -219,7 +219,7 @@
                         * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/PipedInputStream.java
                    --- a/jdk/src/share/classes/java/io/PipedInputStream.java	Thu Oct 31 16:46:43 2013 -0700
                    +++ b/jdk/src/share/classes/java/io/PipedInputStream.java	Wed Jul 05 19:21:26 2017 +0200
                    @@ -172,15 +172,14 @@
                          * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/PipedReader.java --- a/jdk/src/share/classes/java/io/PipedReader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/PipedReader.java Wed Jul 05 19:21:26 2017 +0200 @@ -145,15 +145,14 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/PrintStream.java --- a/jdk/src/share/classes/java/io/PrintStream.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/PrintStream.java Wed Jul 05 19:21:26 2017 +0200 @@ -303,7 +303,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/RandomAccessFile.java --- a/jdk/src/share/classes/java/io/RandomAccessFile.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java Wed Jul 05 19:21:26 2017 +0200 @@ -784,7 +784,7 @@ *

                    *

                    * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/Serializable.java
                    --- a/jdk/src/share/classes/java/io/Serializable.java	Thu Oct 31 16:46:43 2013 -0700
                    +++ b/jdk/src/share/classes/java/io/Serializable.java	Wed Jul 05 19:21:26 2017 +0200
                    @@ -55,7 +55,7 @@
                      *
                      * 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 @@
                      *
                      * 

                    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 @@
                      *
                      * 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 @@
                      * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/io/SerializablePermission.java
                    --- a/jdk/src/share/classes/java/io/SerializablePermission.java	Thu Oct 31 16:46:43 2013 -0700
                    +++ b/jdk/src/share/classes/java/io/SerializablePermission.java	Wed Jul 05 19:21:26 2017 +0200
                    @@ -43,7 +43,6 @@
                      * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/AbstractStringBuilder.java --- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java Wed Jul 05 19:21:26 2017 +0200 @@ -330,9 +330,9 @@ * 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 @@ * *

      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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/ArrayStoreException.java --- a/jdk/src/share/classes/java/lang/ArrayStoreException.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/ArrayStoreException.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,7 +29,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/AutoCloseable.java --- a/jdk/src/share/classes/java/lang/AutoCloseable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/AutoCloseable.java Wed Jul 05 19:21:26 2017 +0200 @@ -48,7 +48,6 @@ * @author Josh Bloch * @since 1.7 */ -@FunctionalInterface public interface AutoCloseable { /** * Closes this resource, relinquishing any underlying resources. diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Byte.java --- a/jdk/src/share/classes/java/lang/Byte.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Byte.java Wed Jul 05 19:21:26 2017 +0200 @@ -244,7 +244,7 @@ *
      Signopt {@code 0X} HexDigits *
      Signopt {@code #} HexDigits *
      Signopt {@code 0} OctalDigits - *

      + * *

      Sign: *
      {@code -} *
      {@code +} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Character.java --- a/jdk/src/share/classes/java/lang/Character.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Character.java Wed Jul 05 19:21:26 2017 +0200 @@ -5394,7 +5394,7 @@ * 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 @@
            * 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 @@
            * 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 @@ * 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 @@
            * 
    • {@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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Class.java --- a/jdk/src/share/classes/java/lang/Class.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Class.java Wed Jul 05 19:21:26 2017 +0200 @@ -91,7 +91,7 @@ *

      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 @@
        * The Java™ Language Specification.
        * For example:
        *
      - * 

      + *
      * {@code System.out.println("The name of class Foo is: "+Foo.class.getName());} *
      * @@ -1571,6 +1571,10 @@ *

      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 @@ *

      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 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 @@ } } + void addAllNonStatic(Method[] methods) { + for (Method candidate : methods) { + if (!Modifier.isStatic(candidate.getModifiers())) { + add(candidate); + } + } + } + int length() { return length; } @@ -2797,7 +2813,7 @@ 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 @@ } - 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 @@ 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 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 A[] getDeclaredAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(annotationData().declaredAnnotations, annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotationData().declaredAnnotations, + annotationClass); } /** @@ -3424,6 +3442,10 @@ return annotationType; } + Map, Annotation> getDeclaredAnnotationMap() { + return annotationData().declaredAnnotations; + } + /* Backing store of user-defined values pertaining to this class. * Maintained by the ClassValue class. */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/ClassCastException.java --- a/jdk/src/share/classes/java/lang/ClassCastException.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/ClassCastException.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,7 +29,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/ClassLoader.java --- a/jdk/src/share/classes/java/lang/ClassLoader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/ClassLoader.java Wed Jul 05 19:21:26 2017 +0200 @@ -362,7 +362,7 @@ * 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/ClassValue.java --- a/jdk/src/share/classes/java/lang/ClassValue.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/ClassValue.java Wed Jul 05 19:21:26 2017 +0200 @@ -692,7 +692,7 @@ /** Remove all stale entries, everywhere. */ private void removeStaleEntries() { - Entry[] cache = getCache(); + Entry[] cache = getCache(); removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1); } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Comparable.java --- a/jdk/src/share/classes/java/lang/Comparable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Comparable.java Wed Jul 05 19:21:26 2017 +0200 @@ -93,7 +93,6 @@ * @see java.util.Comparator * @since 1.2 */ -@FunctionalInterface public interface Comparable { /** * Compares this object with the specified object for order. Returns a diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java --- a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Wed Jul 05 19:21:26 2017 +0200 @@ -74,7 +74,6 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Double.java --- a/jdk/src/share/classes/java/lang/Double.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Double.java Wed Jul 05 19:21:26 2017 +0200 @@ -361,15 +361,11 @@ *
          SignedInteger * * - *

          - * *

          *
          HexFloatingPointLiteral: *
          HexSignificand BinaryExponent FloatTypeSuffixopt *
          * - *

          - * *

          *
          HexSignificand: *
          HexNumeral @@ -380,15 +376,11 @@ * {@code .} HexDigits *
          * - *

          - * *

          *
          BinaryExponent: *
          BinaryExponentIndicator SignedInteger *
          * - *

          - * *

          *
          BinaryExponentIndicator: *
          {@code p} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Float.java --- a/jdk/src/share/classes/java/lang/Float.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Float.java Wed Jul 05 19:21:26 2017 +0200 @@ -321,15 +321,11 @@ *
          SignedInteger *
          * - *

          - * *

          *
          HexFloatingPointLiteral: *
          HexSignificand BinaryExponent FloatTypeSuffixopt *
          * - *

          - * *

          *
          HexSignificand: *
          HexNumeral @@ -340,15 +336,11 @@ * {@code .} HexDigits *
          * - *

          - * *

          *
          BinaryExponent: *
          BinaryExponentIndicator SignedInteger *
          * - *

          - * *

          *
          BinaryExponentIndicator: *
          {@code p} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Integer.java --- a/jdk/src/share/classes/java/lang/Integer.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Integer.java Wed Jul 05 19:21:26 2017 +0200 @@ -1123,7 +1123,7 @@ *
          Signopt {@code 0X} HexDigits *
          Signopt {@code #} HexDigits *
          Signopt {@code 0} OctalDigits - *

          + * *

          Sign: *
          {@code -} *
          {@code +} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Iterable.java --- a/jdk/src/share/classes/java/lang/Iterable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Iterable.java Wed Jul 05 19:21:26 2017 +0200 @@ -42,7 +42,6 @@ * @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 @@ 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 @@ return Spliterators.spliteratorUnknownSize(iterator(), 0); } } - diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Long.java --- a/jdk/src/share/classes/java/lang/Long.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Long.java Wed Jul 05 19:21:26 2017 +0200 @@ -853,7 +853,7 @@ *

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

          + * *

          Sign: *
          {@code -} *
          {@code +} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Readable.java --- a/jdk/src/share/classes/java/lang/Readable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Readable.java Wed Jul 05 19:21:26 2017 +0200 @@ -34,7 +34,6 @@ * * @since 1.5 */ -@FunctionalInterface public interface Readable { /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/RuntimePermission.java --- a/jdk/src/share/classes/java/lang/RuntimePermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/RuntimePermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -47,7 +47,6 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/SecurityManager.java --- a/jdk/src/share/classes/java/lang/SecurityManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/SecurityManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -56,7 +56,7 @@ * 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 @@
            * 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 @@ * 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 @@ * 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 @@ * 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Short.java --- a/jdk/src/share/classes/java/lang/Short.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Short.java Wed Jul 05 19:21:26 2017 +0200 @@ -249,7 +249,7 @@ *

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

            + * *

            Sign: *
            {@code -} *
            {@code +} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/String.java --- a/jdk/src/share/classes/java/lang/String.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/String.java Wed Jul 05 19:21:26 2017 +0200 @@ -47,16 +47,16 @@ * 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 @@
                  * {@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 @@ } 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 @@ * {@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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/System.java --- a/jdk/src/share/classes/java/lang/System.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/System.java Wed Jul 05 19:21:26 2017 +0200 @@ -26,10 +26,12 @@ 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 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/Thread.java --- a/jdk/src/share/classes/java/lang/Thread.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Thread.java Wed Jul 05 19:21:26 2017 +0200 @@ -76,7 +76,7 @@ * 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 @@
        * 

      *

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

      + * 
        *     PrimeThread p = new PrimeThread(143);
        *     p.start();
        * 
      @@ -102,7 +102,7 @@ * 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 @@
        * 

      *

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

      + * 
        *     PrimeRun p = new PrimeRun(143);
        *     new Thread(p).start();
        * 
      diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java --- a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -101,7 +101,6 @@ * 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 @@ boolean isSerializable, Class[] markerInterfaces, MethodType[] additionalBridges) - throws ReflectiveOperationException, LambdaConversionException { + throws LambdaConversionException { this.targetClass = caller.lookupClass(); this.invokedType = invokedType; @@ -160,7 +159,7 @@ * @throws ReflectiveOperationException */ abstract CallSite buildCallSite() - throws ReflectiveOperationException, LambdaConversionException; + throws LambdaConversionException; /** * Check the meta-factory arguments for errors diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java --- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ 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 @@ 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 @@ 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 @@ * 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 @@ 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 @@ * 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 @@ * 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 @@ 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 @@ 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 @@ } /** - * 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 @@ 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, @@ -372,6 +410,37 @@ } /** + * 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 @@ 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 @@ // 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 @@ } } } + + 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java --- a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -29,88 +29,128 @@ import java.util.Arrays; /** - *

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

      - * - *

      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}. + *

      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. * - *

      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. + *

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

        + *
      • 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".
      • * - *

        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. + *

      • 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.
      • * - *

        Assume: - *

          - *
        • 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
        • + *
        • 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 @@ * * * - * - * + * + * * * * - * + * * * *
      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 @@ 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. + * + *

      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}. * - * @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. + *

      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 @@ MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType) - throws ReflectiveOperationException, LambdaConversionException { + throws LambdaConversionException { AbstractValidatingLambdaMetafactory mf; mf = new InnerClassLambdaMetafactory(caller, invokedType, invokedName, samMethodType, @@ -216,60 +305,128 @@ } /** - * 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.
      • + *
      + * + *

      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}. * - * @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. + *

      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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java --- a/jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package 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.

      - -

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

      */ - -class MagicLambdaImpl { -} diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java Wed Jul 05 19:21:26 2017 +0200 @@ -441,8 +441,13 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/MethodHandles.java --- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Wed Jul 05 19:21:26 2017 +0200 @@ -1716,6 +1716,13 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/MethodType.java --- a/jdk/src/share/classes/java/lang/invoke/MethodType.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java Wed Jul 05 19:21:26 2017 +0200 @@ -813,7 +813,7 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/SerializedLambda.java --- a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java Wed Jul 05 19:21:26 2017 +0200 @@ -32,9 +32,26 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java --- a/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java Wed Jul 05 19:21:26 2017 +0200 @@ -28,6 +28,7 @@ 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 @@ } /** - * 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 @@ } } } 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/CompilationMXBean.java --- a/jdk/src/share/classes/java/lang/management/CompilationMXBean.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/CompilationMXBean.java Wed Jul 05 19:21:26 2017 +0200 @@ -74,7 +74,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/ManagementFactory.java --- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -60,7 +60,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/ManagementPermission.java --- a/jdk/src/share/classes/java/lang/management/ManagementPermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/ManagementPermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -33,10 +33,8 @@ * The following table * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. - *

      * - * + *
      * * * diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java --- a/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java Wed Jul 05 19:21:26 2017 +0200 @@ -147,7 +147,7 @@ * 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 @@ *
      * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/MemoryUsage.java --- a/jdk/src/share/classes/java/lang/management/MemoryUsage.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/MemoryUsage.java Wed Jul 05 19:21:26 2017 +0200 @@ -79,7 +79,7 @@ *
      Permission Target NameWhat the Permission Allows
      * * Below is a picture showing an example of a memory pool: - *

      + * *

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

      + * *

      * * diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/ThreadInfo.java --- a/jdk/src/share/classes/java/lang/management/ThreadInfo.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/ThreadInfo.java Wed Jul 05 19:21:26 2017 +0200 @@ -492,7 +492,7 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/ThreadMXBean.java --- a/jdk/src/share/classes/java/lang/management/ThreadMXBean.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/ThreadMXBean.java Wed Jul 05 19:21:26 2017 +0200 @@ -646,7 +646,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/management/package.html --- a/jdk/src/share/classes/java/lang/management/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/management/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -82,7 +82,7 @@ 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 @@
         

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

        + method calls to a given MBeanServer:

            MBeanServerConnection mbs;
         
        diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java
        --- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Thu Oct 31 16:46:43 2013 -0700
        +++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Wed Jul 05 19:21:26 2017 +0200
        @@ -27,6 +27,15 @@
         
         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 @@
              * 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 @@
              * @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 @@
              * 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 @@
              * @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 @@
              * 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 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/reflect/Constructor.java --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java Wed Jul 05 19:21:26 2017 +0200 @@ -28,6 +28,8 @@ 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 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/reflect/Executable.java --- a/jdk/src/share/classes/java/lang/reflect/Executable.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Executable.java Wed Jul 05 19:21:26 2017 +0200 @@ -383,7 +383,7 @@ 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 T[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/reflect/Field.java --- a/jdk/src/share/classes/java/lang/reflect/Field.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Field.java Wed Jul 05 19:21:26 2017 +0200 @@ -1123,7 +1123,7 @@ public T[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/reflect/Parameter.java --- a/jdk/src/share/classes/java/lang/reflect/Parameter.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java Wed Jul 05 19:21:26 2017 +0200 @@ -295,7 +295,7 @@ public T[] getAnnotationsByType(Class annotationClass) { Objects.requireNonNull(annotationClass); - return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); + return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/lang/reflect/ReflectPermission.java --- a/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -31,7 +31,6 @@ * The following table * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. - *

        * *

      * diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/math/BigInteger.java --- a/jdk/src/share/classes/java/math/BigInteger.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/math/BigInteger.java Wed Jul 05 19:21:26 2017 +0200 @@ -97,6 +97,21 @@ * {@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 @@ -183,6 +198,18 @@ 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 * Karatsuba multiplication will be used. This value is found @@ -256,6 +283,9 @@ mag = stripLeadingZeroBytes(val); signum = (mag.length == 0 ? 0 : 1); } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -275,6 +305,9 @@ mag = trustedStripLeadingZeroInts(val); signum = (mag.length == 0 ? 0 : 1); } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -306,6 +339,9 @@ throw(new NumberFormatException("signum-magnitude mismatch")); this.signum = signum; } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -327,6 +363,9 @@ throw(new NumberFormatException("signum-magnitude mismatch")); this.signum = signum; } + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /** @@ -359,17 +398,20 @@ 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 @@ // 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 @@ } // Required for cases where the array was overallocated. mag = trustedStripLeadingZeroInts(magnitude); + if (mag.length >= MAX_MAG_LENGTH) { + checkRange(); + } } /* @@ -439,8 +487,11 @@ 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 @@ 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 @@ * 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 @@ * @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 @@ 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 @@ * * @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 @@ 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 @@ } } + 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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ 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 @@ * * @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 @@ * * @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 @@ ; 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/math/MutableBigInteger.java --- a/jdk/src/share/classes/java/math/MutableBigInteger.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/math/MutableBigInteger.java Wed Jul 05 19:21:26 2017 +0200 @@ -1257,14 +1257,14 @@ 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 @@ } /** @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/Authenticator.java --- a/jdk/src/share/classes/java/net/Authenticator.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/Authenticator.java Wed Jul 05 19:21:26 2017 +0200 @@ -358,7 +358,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/CookieManager.java --- a/jdk/src/share/classes/java/net/CookieManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/CookieManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -143,7 +143,7 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/CookieStore.java --- a/jdk/src/share/classes/java/net/CookieStore.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/CookieStore.java Wed Jul 05 19:21:26 2017 +0200 @@ -48,7 +48,7 @@ *

      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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/DatagramSocket.java --- a/jdk/src/share/classes/java/net/DatagramSocket.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/DatagramSocket.java Wed Jul 05 19:21:26 2017 +0200 @@ -196,7 +196,7 @@ * 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 @@ 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/HttpCookie.java --- a/jdk/src/share/classes/java/net/HttpCookie.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/HttpCookie.java Wed Jul 05 19:21:26 2017 +0200 @@ -761,7 +761,7 @@ // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/Inet6Address.java --- a/jdk/src/share/classes/java/net/Inet6Address.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/Inet6Address.java Wed Jul 05 19:21:26 2017 +0200 @@ -133,7 +133,7 @@ * 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 @@ * *

      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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/InetSocketAddress.java --- a/jdk/src/share/classes/java/net/InetSocketAddress.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/InetSocketAddress.java Wed Jul 05 19:21:26 2017 +0200 @@ -196,7 +196,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/InterfaceAddress.java --- a/jdk/src/share/classes/java/net/InterfaceAddress.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/InterfaceAddress.java Wed Jul 05 19:21:26 2017 +0200 @@ -56,7 +56,7 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/JarURLConnection.java --- a/jdk/src/share/classes/java/net/JarURLConnection.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/JarURLConnection.java Wed Jul 05 19:21:26 2017 +0200 @@ -82,7 +82,7 @@ * * * - *

          {@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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/MulticastSocket.java --- a/jdk/src/share/classes/java/net/MulticastSocket.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/MulticastSocket.java Wed Jul 05 19:21:26 2017 +0200 @@ -140,7 +140,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/NetPermission.java --- a/jdk/src/share/classes/java/net/NetPermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/NetPermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -46,7 +46,6 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/Proxy.java --- a/jdk/src/share/classes/java/net/Proxy.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/Proxy.java Wed Jul 05 19:21:26 2017 +0200 @@ -66,8 +66,8 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/ServerSocket.java --- a/jdk/src/share/classes/java/net/ServerSocket.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/ServerSocket.java Wed Jul 05 19:21:26 2017 +0200 @@ -610,7 +610,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/Socket.java --- a/jdk/src/share/classes/java/net/Socket.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/Socket.java Wed Jul 05 19:21:26 2017 +0200 @@ -1230,13 +1230,13 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/SocketOptions.java --- a/jdk/src/share/classes/java/net/SocketOptions.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/SocketOptions.java Wed Jul 05 19:21:26 2017 +0200 @@ -134,7 +134,7 @@ * previously written data. *

            * Valid for TCP only: SocketImpl. - *

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

            * Valid for: SocketImpl, DatagramSocketImpl - *

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

            * Valid for Multicast: DatagramSocketImpl - *

            + * * @see MulticastSocket#setInterface(InetAddress) * @see MulticastSocket#getInterface() */ diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/SocketPermission.java --- a/jdk/src/share/classes/java/net/SocketPermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/SocketPermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -779,27 +779,27 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/SocksSocketImpl.java --- a/jdk/src/share/classes/java/net/SocksSocketImpl.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java Wed Jul 05 19:21:26 2017 +0200 @@ -437,7 +437,7 @@ } } - // 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/StandardSocketOptions.java --- a/jdk/src/share/classes/java/net/StandardSocketOptions.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/StandardSocketOptions.java Wed Jul 05 19:21:26 2017 +0200 @@ -257,7 +257,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URI.java --- a/jdk/src/share/classes/java/net/URI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/URI.java Wed Jul 05 19:21:26 2017 +0200 @@ -389,20 +389,20 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URL.java
            --- a/jdk/src/share/classes/java/net/URL.java	Thu Oct 31 16:46:43 2013 -0700
            +++ b/jdk/src/share/classes/java/net/URL.java	Wed Jul 05 19:21:26 2017 +0200
            @@ -465,7 +465,7 @@
                  * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URLClassLoader.java --- a/jdk/src/share/classes/java/net/URLClassLoader.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/URLClassLoader.java Wed Jul 05 19:21:26 2017 +0200 @@ -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.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.AccessController; import java.security.CodeSigner; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.security.AccessController; -import java.security.AccessControlContext; -import java.security.SecureClassLoader; 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 @@ * @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 @@ * @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 @@ * @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 @@ * 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 @@ * @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 @@ * 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 @@ * * @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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URLConnection.java --- a/jdk/src/share/classes/java/net/URLConnection.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/URLConnection.java Wed Jul 05 19:21:26 2017 +0200 @@ -45,7 +45,7 @@ * 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 @@ * 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 @@ * *

          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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URLDecoder.java --- a/jdk/src/share/classes/java/net/URLDecoder.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/URLDecoder.java Wed Jul 05 19:21:26 2017 +0200 @@ -43,7 +43,7 @@ * 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 @@ * "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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URLEncoder.java --- a/jdk/src/share/classes/java/net/URLEncoder.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/URLEncoder.java Wed Jul 05 19:21:26 2017 +0200 @@ -49,7 +49,6 @@ *

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

            *

              *
            • The alphanumeric characters "{@code a}" through * "{@code z}", "{@code A}" through @@ -186,7 +185,7 @@ * "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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/URLPermission.java --- a/jdk/src/share/classes/java/net/URLPermission.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/URLPermission.java Wed Jul 05 19:21:26 2017 +0200 @@ -45,7 +45,7 @@ * * 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 @@
                    * 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 @@ *
                • otherwise, return false
                • *
                *

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

          {@code openConnection()}{@code connect()}
          + *
          * * * @@ -353,7 +353,7 @@ return getActions().hashCode() + scheme.hashCode() + authority.hashCode() - + path == null ? 0 : path.hashCode(); + + (path == null ? 0 : path.hashCode()); } diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/net/package-info.java --- a/jdk/src/share/classes/java/net/package-info.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/net/package-info.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/X-Buffer.java.template --- a/jdk/src/share/classes/java/nio/X-Buffer.java.template Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template Wed Jul 05 19:21:26 2017 +0200 @@ -1129,7 +1129,7 @@ * *

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

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

            2. * diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java Wed Jul 05 19:21:26 2017 +0200 @@ -199,7 +199,7 @@ * *

              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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/channels/DatagramChannel.java --- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java Wed Jul 05 19:21:26 2017 +0200 @@ -153,7 +153,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/channels/MembershipKey.java --- a/jdk/src/share/classes/java/nio/channels/MembershipKey.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/MembershipKey.java Wed Jul 05 19:21:26 2017 +0200 @@ -103,7 +103,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/channels/package-info.java --- a/jdk/src/share/classes/java/nio/channels/package-info.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/package-info.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/charset/Charset.java --- a/jdk/src/share/classes/java/nio/charset/Charset.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/charset/Charset.java Wed Jul 05 19:21:26 2017 +0200 @@ -201,7 +201,7 @@ * * * - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/file/FileSystem.java --- a/jdk/src/share/classes/java/nio/file/FileSystem.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/FileSystem.java Wed Jul 05 19:21:26 2017 +0200 @@ -355,7 +355,7 @@ * *

              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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java --- a/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java Wed Jul 05 19:21:26 2017 +0200 @@ -81,7 +81,7 @@ /** * 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 @@ *

                  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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/MarshalledObject.java --- a/jdk/src/share/classes/java/rmi/MarshalledObject.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/MarshalledObject.java Wed Jul 05 19:21:26 2017 +0200 @@ -135,7 +135,7 @@ /** * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/RMISecurityManager.java --- a/jdk/src/share/classes/java/rmi/RMISecurityManager.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/RMISecurityManager.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/activation/ActivationGroup.java --- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java Wed Jul 05 19:21:26 2017 +0200 @@ -74,7 +74,7 @@ * 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 @@ * 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 @@ * 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 @@ *

                  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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/dgc/VMID.java --- a/jdk/src/share/classes/java/rmi/dgc/VMID.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java Wed Jul 05 19:21:26 2017 +0200 @@ -67,7 +67,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/server/RMISocketFactory.java --- a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java Wed Jul 05 19:21:26 2017 +0200 @@ -41,7 +41,15 @@ * (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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/server/RemoteStub.java --- a/jdk/src/share/classes/java/rmi/server/RemoteStub.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/RemoteStub.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ * * @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 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/server/ServerRef.java --- a/jdk/src/share/classes/java/rmi/server/ServerRef.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/ServerRef.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/server/SocketSecurityException.java --- a/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java Wed Jul 05 19:21:26 2017 +0200 @@ -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 @@ * * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java --- a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java Wed Jul 05 19:21:26 2017 +0200 @@ -30,52 +30,88 @@ /** * 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. + * + *

                  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. * - *

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

                  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. * - *

                      + *
                    • Calling the + * {@link #exportObject(Remote) exportObject(Remote)} method. + * Deprecated. + * + *
                    • Calling the + * {@link #exportObject(Remote, int) exportObject(Remote, port)} method. + * + *
                    • Calling the + * {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory) + * exportObject(Remote, port, csf, ssf)} method. + * + *
                  * - *
                • 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. + *

                  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. + * *

                    * - *
                  • 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 @@ * *
                  • 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/java/rmi/server/package.html --- a/jdk/src/share/classes/java/rmi/server/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -1,5 +1,5 @@ - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/colorchooser/package.html --- a/jdk/src/share/classes/javax/swing/colorchooser/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/colorchooser/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,6 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/event/DocumentEvent.java --- a/jdk/src/share/classes/javax/swing/event/DocumentEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/event/DocumentEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -79,7 +79,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java --- a/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -158,7 +158,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/event/TableModelEvent.java --- a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -67,7 +67,7 @@ */ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/event/TreeModelEvent.java --- a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java Wed Jul 05 19:21:26 2017 +0200 @@ -89,7 +89,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/event/package.html --- a/jdk/src/share/classes/javax/swing/event/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/event/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java --- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Wed Jul 05 19:21:26 2017 +0200 @@ -122,7 +122,7 @@ } /** - * 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 @@ * 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 @@ /** * 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 @@ * 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 @@ /** * - * @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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/filechooser/package.html --- a/jdk/src/share/classes/javax/swing/filechooser/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/filechooser/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java --- a/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -36,7 +36,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java Wed Jul 05 19:21:26 2017 +0200 @@ -497,7 +497,7 @@ /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -41,7 +41,7 @@ /** * 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 @@ } /** - * 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 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -456,7 +456,7 @@ 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 @@ } 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 @@ } 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Wed Jul 05 19:21:26 2017 +0200 @@ -270,18 +270,27 @@ 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -477,7 +477,7 @@ 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 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 @@ } /// 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 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Wed Jul 05 19:21:26 2017 +0200 @@ -433,7 +433,7 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -760,7 +760,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -322,7 +322,7 @@ * @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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -923,7 +923,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -335,7 +335,7 @@ /** * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -1489,7 +1489,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -443,7 +443,7 @@ 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 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 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 @@ */ 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 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -743,7 +743,7 @@ } 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -273,7 +273,7 @@ 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 @@ /** - * 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 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 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -3748,7 +3748,7 @@ * 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 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -738,7 +738,7 @@ * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -1560,6 +1560,10 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -583,7 +583,7 @@ /** * 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 @@ * 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 @@ * 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 @@ * 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 @@ } 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 @@ } 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 @@ } 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -204,7 +204,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -140,7 +140,7 @@ /** 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 @@ } /** - * 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 @@ * 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 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 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 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 @@ /** - * 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 @@ * 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 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 @@ /** * 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 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/basic/package.html --- a/jdk/src/share/classes/javax/swing/plaf/basic/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java Wed Jul 05 19:21:26 2017 +0200 @@ -57,7 +57,7 @@ * 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 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Wed Jul 05 19:21:26 2017 +0200 @@ -1738,7 +1738,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -682,7 +682,7 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -64,14 +64,14 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -64,7 +64,7 @@ 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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Wed Jul 05 19:21:26 2017 +0200 @@ -64,7 +64,7 @@ *

          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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/metal/package.html --- a/jdk/src/share/classes/javax/swing/plaf/metal/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html --- a/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html Wed Jul 05 19:21:26 2017 +0200 @@ -14,14 +14,14 @@


          +

          -

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

          -
          @@ -43,7 +43,6 @@ and requires no modifications to work with auxiliary look and feels.

          -

          This document has the following sections: @@ -76,14 +75,12 @@

          - +


          - Overview -

          @@ -146,14 +143,12 @@ 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 @@

          - +


          - Tips for Writing an Auxiliary Look and Feel -

          An auxiliary look and feel is like any other look and feel, @@ -252,7 +245,6 @@ Dos and Don'ts

          -

          The following paragraphs provide some general recommendations for developing @@ -264,22 +256,19 @@ 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 @@ 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 @@ 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 @@ Examining Other UI Objects -

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

          - +


          - How the Multiplexing Look and Feel Is Implemented -

          The Multiplexing look and feel @@ -437,8 +422,8 @@ 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 @@ 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 @@

          - +


          - 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/multi/package.html --- a/jdk/src/share/classes/javax/swing/plaf/multi/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/multi/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Wed Jul 05 19:21:26 2017 +0200 @@ -187,7 +187,7 @@ 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 @@ /** * 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 @@ * 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 @@ * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java Wed Jul 05 19:21:26 2017 +0200 @@ -64,7 +64,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Wed Jul 05 19:21:26 2017 +0200 @@ -808,7 +808,7 @@ } /** - * 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 @@ } /** - * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html Wed Jul 05 19:21:26 2017 +0200 @@ -1,5 +1,7 @@ + +

          Primary Colors

          diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/nimbus/package.html --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + @@ -39,11 +39,11 @@

          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 @@ 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/package.html --- a/jdk/src/share/classes/javax/swing/plaf/package.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/package.html Wed Jul 05 19:21:26 2017 +0200 @@ -25,7 +25,7 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java Wed Jul 05 19:21:26 2017 +0200 @@ -191,20 +191,28 @@ } 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java Wed Jul 05 19:21:26 2017 +0200 @@ -116,7 +116,7 @@ /** * 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 -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html --- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html Wed Jul 05 19:21:26 2017 +0200 @@ -47,7 +47,7 @@ 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 @@ 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 @@ - diff -r 115e1128ce1a -r 624a61211dd7 jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html --- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html Thu Oct 31 16:46:43 2013 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html Wed Jul 05 19:21:26 2017 +0200 @@ -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.