# HG changeset patch # User duke # Date 1499270310 -7200 # Node ID 0d73629f3a8d121493e03407ddc10c6472c10e66 # Parent 8e546b2b9dd0950128e97ef5da5132f62eb0ba51# Parent 4435192939b82bdb2c84d82e3c468b028db50f19 Merge diff -r 8e546b2b9dd0 -r 0d73629f3a8d .hgtags-top-repo --- a/.hgtags-top-repo Fri Dec 23 16:39:22 2011 -0800 +++ b/.hgtags-top-repo Wed Jul 05 17:58:30 2017 +0200 @@ -139,3 +139,4 @@ a4f28069d44a379cda99dd1d921d19f819726d22 jdk8-b15 4e06ae613e99549835896720c7a68c29ad5543f5 jdk8-b17 4e06ae613e99549835896720c7a68c29ad5543f5 jdk8-b16 +7010bd24cdd07bc7daef80702f39124854dec36c jdk8-b18 diff -r 8e546b2b9dd0 -r 0d73629f3a8d corba/.hgtags --- a/corba/.hgtags Fri Dec 23 16:39:22 2011 -0800 +++ b/corba/.hgtags Wed Jul 05 17:58:30 2017 +0200 @@ -139,3 +139,4 @@ 7da69e7175a7c7564ee6d0e52255cbb8a57ef577 jdk8-b15 82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b17 82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b16 +312cf15d16577ef198b033d2a4cc0a52369b7343 jdk8-b18 diff -r 8e546b2b9dd0 -r 0d73629f3a8d corba/make/jprt.properties --- a/corba/make/jprt.properties Fri Dec 23 16:39:22 2011 -0800 +++ b/corba/make/jprt.properties Wed Jul 05 17:58:30 2017 +0200 @@ -25,21 +25,21 @@ # Properties for jprt -# The release to build +# Locked down to jdk8 jprt.tools.default.release=jdk8 # The different build flavors we want, we override here so we just get these 2 jprt.build.flavors=product,fastdebug # Standard list of jprt build targets for this source tree -jprt.build.targets= \ - solaris_sparc_5.10-{product|fastdebug}, \ - solaris_sparcv9_5.10-{product|fastdebug}, \ - solaris_i586_5.10-{product|fastdebug}, \ - solaris_x64_5.10-{product|fastdebug}, \ - linux_i586_2.6-{product|fastdebug}, \ - linux_x64_2.6-{product|fastdebug}, \ - windows_i586_5.1-{product|fastdebug}, \ +jprt.build.targets= \ + solaris_sparc_5.10-{product|fastdebug}, \ + solaris_sparcv9_5.10-{product|fastdebug}, \ + solaris_i586_5.10-{product|fastdebug}, \ + solaris_x64_5.10-{product|fastdebug}, \ + linux_i586_2.6-{product|fastdebug}, \ + linux_x64_2.6-{product|fastdebug}, \ + windows_i586_5.1-{product|fastdebug}, \ windows_x64_5.2-{product|fastdebug} # Directories to be excluded from the source bundles diff -r 8e546b2b9dd0 -r 0d73629f3a8d corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -113,6 +113,9 @@ import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; import com.sun.corba.se.impl.util.JDKBridge; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ConcurrentHashMap; + /** * ClientDelegate is the RMI client-side subcontract or representation * It implements RMI delegate as well as our internal ClientRequestDispatcher @@ -122,6 +125,9 @@ implements ClientRequestDispatcher { + private ConcurrentMap locks = + new ConcurrentHashMap(); + public OutputObject beginRequest(Object self, String opName, boolean isOneWay, ContactInfo contactInfo) { @@ -148,8 +154,21 @@ // This locking is done so that multiple connections are not created // for the same endpoint - //6929137 - Synchronized on contactInfo to avoid blocking across multiple endpoints - synchronized (contactInfo) { + // 7046238 - Synchronization on a single monitor for contactInfo parameters + // with identical hashCode(), so we lock on same monitor for equal parameters + // (which can refer to equal (in terms of equals()) but not the same objects) + + Object lock = locks.get(contactInfo); + + if (lock == null) { + Object newLock = new Object(); + lock = locks.putIfAbsent(contactInfo, newLock); + if (lock == null) { + lock = newLock; + } + } + + synchronized (lock) { if (contactInfo.isConnectionBased()) { if (contactInfo.shouldCacheConnection()) { connection = (CorbaConnection) @@ -254,7 +273,7 @@ registerWaiter(messageMediator); // Do connection reclaim now - synchronized (contactInfo) { + synchronized (lock) { if (contactInfo.isConnectionBased()) { if (contactInfo.shouldCacheConnection()) { OutboundConnectionCache connectionCache = diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/.hgtags --- a/hotspot/.hgtags Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/.hgtags Wed Jul 05 17:58:30 2017 +0200 @@ -205,3 +205,5 @@ d1f29d4e0bc60e8bd7ae961f1306d8ab33290212 jdk8-b16 6de8c9ba5907e4c5ca05ac4b8d84a8e2cbd92399 hs23-b07 a2fef924d8e6f37dac2a887315e3502876cc8e24 hs23-b08 +61165f53f1656b9f99e4fb806429bf98b99d59c3 jdk8-b18 +4bcf61041217f8677dcec18e90e9196acc945bba hs23-b09 diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/make/hotspot_version --- a/hotspot/make/hotspot_version Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/make/hotspot_version Wed Jul 05 17:58:30 2017 +0200 @@ -35,7 +35,7 @@ HS_MAJOR_VER=23 HS_MINOR_VER=0 -HS_BUILD_NUMBER=08 +HS_BUILD_NUMBER=09 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/cpu/x86/vm/assembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -5968,7 +5968,9 @@ assert(number_of_arguments >= 0 , "cannot have negative number of arguments"); LP64_ONLY(assert(java_thread == r15_thread, "unexpected register")); #ifdef ASSERT - LP64_ONLY(if (UseCompressedOops) verify_heapbase("call_VM_base");) + // TraceBytecodes does not use r12 but saves it over the call, so don't verify + // r12 is the heapbase. + LP64_ONLY(if (UseCompressedOops && !TraceBytecodes) verify_heapbase("call_VM_base");) #endif // ASSERT assert(java_thread != oop_result , "cannot use the same register for java_thread & oop_result"); diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/bsd/vm/jvm_bsd.h --- a/hotspot/src/os/bsd/vm/jvm_bsd.h Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/bsd/vm/jvm_bsd.h Wed Jul 05 17:58:30 2017 +0200 @@ -33,7 +33,6 @@ // All local includes have been commented out. */ - #ifndef JVM_MD_H #define JVM_MD_H @@ -59,6 +58,7 @@ #include /* For DIR */ #include /* For MAXPATHLEN */ +#include /* For socklen_t */ #include /* For F_OK, R_OK, W_OK */ #define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} @@ -128,8 +128,4 @@ #endif #endif /* JVM_MD_H */ -// Reconciliation History -// jvm_solaris.h 1.6 99/06/22 16:38:47 -// End - #endif // OS_BSD_VM_JVM_BSD_H diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -150,7 +150,6 @@ // for timer info max values which include all bits #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) -#define SEC_IN_NANOSECS 1000000000LL #define LARGEPAGES_BIT (1 << 6) //////////////////////////////////////////////////////////////////////////////// @@ -3445,8 +3444,6 @@ // generates a SIGUSRx signal. Note that SIGUSR1 can interfere with // SIGSEGV, see 4355769. -const int NANOSECS_PER_MILLISECS = 1000000; - int os::sleep(Thread* thread, jlong millis, bool interruptible) { assert(thread == Thread::current(), "thread consistency check"); @@ -3469,7 +3466,7 @@ // not a guarantee() because JVM should not abort on kernel/glibc bugs assert(!Bsd::supports_monotonic_clock(), "time moving backwards"); } else { - millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS; + millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC; } if(millis <= 0) { @@ -3508,7 +3505,7 @@ // not a guarantee() because JVM should not abort on kernel/glibc bugs assert(!Bsd::supports_monotonic_clock(), "time moving backwards"); } else { - millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS; + millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC; } if(millis <= 0) break ; @@ -4197,7 +4194,7 @@ int rc = os::Bsd::clock_gettime(clockid, &tp); assert(rc == 0, "clock_gettime is expected to return 0 code"); - return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec; + return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec; } #endif @@ -5522,9 +5519,6 @@ * is no need to track notifications. */ - -#define NANOSECS_PER_SEC 1000000000 -#define NANOSECS_PER_MILLISEC 1000000 #define MAX_SECS 100000000 /* * This code is common to bsd and solaris and will be moved to a diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/bsd/vm/os_bsd.inline.hpp --- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -198,15 +198,15 @@ return ::socket(domain, type, protocol); } -inline int os::recv(int fd, char *buf, int nBytes, int flags) { - RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags)); +inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) { + RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags)); } -inline int os::send(int fd, char *buf, int nBytes, int flags) { - RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags)); +inline int os::send(int fd, char* buf, size_t nBytes, uint flags) { + RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); } -inline int os::raw_send(int fd, char *buf, int nBytes, int flags) { +inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { return os::send(fd, buf, nBytes, flags); } @@ -246,57 +246,52 @@ return ::listen(fd, count); } -inline int os::connect(int fd, struct sockaddr *him, int len) { +inline int os::connect(int fd, struct sockaddr* him, socklen_t len) { RESTARTABLE_RETURN_INT(::connect(fd, him, len)); } -inline int os::accept(int fd, struct sockaddr *him, int *len) { - // This cast is from int to unsigned int on bsd. Since we - // only pass the parameter "len" around the vm and don't try to - // fetch it's value, this cast is safe for now. The java.net group - // may need and want to change this interface someday if socklen_t goes - // to 64 bits on some platform that we support. - +inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) { // At least OpenBSD and FreeBSD can return EINTR from accept. - RESTARTABLE_RETURN_INT(::accept(fd, him, (socklen_t *)len)); + RESTARTABLE_RETURN_INT(::accept(fd, him, len)); } -inline int os::recvfrom(int fd, char *buf, int nBytes, int flags, - sockaddr *from, int *fromlen) { - RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen)); +inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags, + sockaddr* from, socklen_t* fromlen) { + RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen)); } -inline int os::sendto(int fd, char *buf, int len, int flags, - struct sockaddr *to, int tolen) { - RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen)); +inline int os::sendto(int fd, char* buf, size_t len, uint flags, + struct sockaddr *to, socklen_t tolen) { + RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen)); } -inline int os::socket_shutdown(int fd, int howto){ +inline int os::socket_shutdown(int fd, int howto) { return ::shutdown(fd, howto); } -inline int os::bind(int fd, struct sockaddr *him, int len){ +inline int os::bind(int fd, struct sockaddr* him, socklen_t len) { return ::bind(fd, him, len); } -inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){ - return ::getsockname(fd, him, (socklen_t *)len); +inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) { + return ::getsockname(fd, him, len); } -inline int os::get_host_name(char* name, int namelen){ +inline int os::get_host_name(char* name, int namelen) { return ::gethostname(name, namelen); } -inline struct hostent* os::get_host_by_name(char* name) { +inline struct hostent* os::get_host_by_name(char* name) { return ::gethostbyname(name); } + inline int os::get_sock_opt(int fd, int level, int optname, - char *optval, int* optlen){ - return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen); + char *optval, socklen_t* optlen) { + return ::getsockopt(fd, level, optname, optval, optlen); } inline int os::set_sock_opt(int fd, int level, int optname, - const char *optval, int optlen){ + const char* optval, socklen_t optlen) { return ::setsockopt(fd, level, optname, optval, optlen); } #endif // OS_BSD_VM_OS_BSD_INLINE_HPP diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/linux/vm/jvm_linux.h --- a/hotspot/src/os/linux/vm/jvm_linux.h Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/linux/vm/jvm_linux.h Wed Jul 05 17:58:30 2017 +0200 @@ -33,7 +33,6 @@ // All local includes have been commented out. */ - #ifndef JVM_MD_H #define JVM_MD_H @@ -44,6 +43,7 @@ #include /* For DIR */ #include /* For MAXPATHLEN */ +#include /* For socklen_t */ #include /* For F_OK, R_OK, W_OK */ #define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} @@ -95,8 +95,4 @@ #endif /* JVM_MD_H */ -// Reconciliation History -// jvm_solaris.h 1.6 99/06/22 16:38:47 -// End - #endif // OS_LINUX_VM_JVM_LINUX_H diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -127,7 +127,6 @@ // for timer info max values which include all bits #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) -#define SEC_IN_NANOSECS 1000000000LL #define LARGEPAGES_BIT (1 << 6) //////////////////////////////////////////////////////////////////////////////// @@ -3259,8 +3258,6 @@ // generates a SIGUSRx signal. Note that SIGUSR1 can interfere with // SIGSEGV, see 4355769. -const int NANOSECS_PER_MILLISECS = 1000000; - int os::sleep(Thread* thread, jlong millis, bool interruptible) { assert(thread == Thread::current(), "thread consistency check"); @@ -3283,7 +3280,7 @@ // not a guarantee() because JVM should not abort on kernel/glibc bugs assert(!Linux::supports_monotonic_clock(), "time moving backwards"); } else { - millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS; + millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC; } if(millis <= 0) { @@ -3322,7 +3319,7 @@ // not a guarantee() because JVM should not abort on kernel/glibc bugs assert(!Linux::supports_monotonic_clock(), "time moving backwards"); } else { - millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS; + millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC; } if(millis <= 0) break ; @@ -3924,7 +3921,7 @@ int rc = os::Linux::clock_gettime(clockid, &tp); assert(rc == 0, "clock_gettime is expected to return 0 code"); - return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec; + return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec; } ///// @@ -5165,9 +5162,6 @@ * is no need to track notifications. */ - -#define NANOSECS_PER_SEC 1000000000 -#define NANOSECS_PER_MILLISEC 1000000 #define MAX_SECS 100000000 /* * This code is common to linux and solaris and will be moved to a diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/linux/vm/os_linux.inline.hpp --- a/hotspot/src/os/linux/vm/os_linux.inline.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -202,15 +202,15 @@ return ::socket(domain, type, protocol); } -inline int os::recv(int fd, char *buf, int nBytes, int flags) { - RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags)); +inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) { + RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags)); } -inline int os::send(int fd, char *buf, int nBytes, int flags) { - RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags)); +inline int os::send(int fd, char* buf, size_t nBytes, uint flags) { + RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); } -inline int os::raw_send(int fd, char *buf, int nBytes, int flags) { +inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { return os::send(fd, buf, nBytes, flags); } @@ -250,57 +250,53 @@ return ::listen(fd, count); } -inline int os::connect(int fd, struct sockaddr *him, int len) { +inline int os::connect(int fd, struct sockaddr* him, socklen_t len) { RESTARTABLE_RETURN_INT(::connect(fd, him, len)); } -inline int os::accept(int fd, struct sockaddr *him, int *len) { - // This cast is from int to unsigned int on linux. Since we - // only pass the parameter "len" around the vm and don't try to - // fetch it's value, this cast is safe for now. The java.net group - // may need and want to change this interface someday if socklen_t goes - // to 64 bits on some platform that we support. - // Linux doc says this can't return EINTR, unlike accept() on Solaris - - return ::accept(fd, him, (socklen_t *)len); +inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) { + // Linux doc says this can't return EINTR, unlike accept() on Solaris. + // But see attachListener_linux.cpp, LinuxAttachListener::dequeue(). + return (int)::accept(fd, him, len); } -inline int os::recvfrom(int fd, char *buf, int nBytes, int flags, - sockaddr *from, int *fromlen) { - RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen)); +inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags, + sockaddr* from, socklen_t* fromlen) { + RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen)); } -inline int os::sendto(int fd, char *buf, int len, int flags, - struct sockaddr *to, int tolen) { - RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen)); +inline int os::sendto(int fd, char* buf, size_t len, uint flags, + struct sockaddr* to, socklen_t tolen) { + RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen)); } -inline int os::socket_shutdown(int fd, int howto){ +inline int os::socket_shutdown(int fd, int howto) { return ::shutdown(fd, howto); } -inline int os::bind(int fd, struct sockaddr *him, int len){ +inline int os::bind(int fd, struct sockaddr* him, socklen_t len) { return ::bind(fd, him, len); } -inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){ - return ::getsockname(fd, him, (socklen_t *)len); +inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) { + return ::getsockname(fd, him, len); } -inline int os::get_host_name(char* name, int namelen){ +inline int os::get_host_name(char* name, int namelen) { return ::gethostname(name, namelen); } -inline struct hostent* os::get_host_by_name(char* name) { +inline struct hostent* os::get_host_by_name(char* name) { return ::gethostbyname(name); } + inline int os::get_sock_opt(int fd, int level, int optname, - char *optval, int* optlen){ - return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen); + char* optval, socklen_t* optlen) { + return ::getsockopt(fd, level, optname, optval, optlen); } inline int os::set_sock_opt(int fd, int level, int optname, - const char *optval, int optlen){ + const char* optval, socklen_t optlen) { return ::setsockopt(fd, level, optname, optval, optlen); } #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/solaris/vm/jvm_solaris.h --- a/hotspot/src/os/solaris/vm/jvm_solaris.h Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/solaris/vm/jvm_solaris.h Wed Jul 05 17:58:30 2017 +0200 @@ -33,7 +33,6 @@ // All local includes have been commented out. */ - #ifndef JVM_MD_H #define JVM_MD_H @@ -44,6 +43,7 @@ #include /* For DIR */ #include /* For MAXPATHLEN */ +#include /* For socklen_t */ #include /* For F_OK, R_OK, W_OK */ #include /* for intptr_t types (64 Bit cleanliness) */ @@ -82,7 +82,6 @@ #define JVM_O_EXCL O_EXCL #define JVM_O_CREAT O_CREAT - /* Signal definitions */ #define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */ diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/solaris/vm/os_solaris.cpp --- a/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -1674,7 +1674,6 @@ } -const int NANOSECS_PER_MILLISECS = 1000000; // gethrtime can move backwards if read from one cpu and then a different cpu // getTimeNanos is guaranteed to not move backward on Solaris // local spinloop created as faster for a CAS on an int than @@ -1803,7 +1802,7 @@ // getTimeMillis guaranteed to not move backwards on Solaris jlong getTimeMillis() { jlong nanotime = getTimeNanos(); - return (jlong)(nanotime / NANOSECS_PER_MILLISECS); + return (jlong)(nanotime / NANOSECS_PER_MILLISEC); } // Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis @@ -6064,10 +6063,7 @@ * is no need to track notifications. */ -#define NANOSECS_PER_SEC 1000000000 -#define NANOSECS_PER_MILLISEC 1000000 #define MAX_SECS 100000000 - /* * This code is common to linux and solaris and will be moved to a * common place in dolphin. @@ -6363,17 +6359,16 @@ RESTARTABLE_RETURN_INT(::close(fd)); } -int os::recv(int fd, char *buf, int nBytes, int flags) { - INTERRUPTIBLE_RETURN_INT(::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); -} - - -int os::send(int fd, char *buf, int nBytes, int flags) { - INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); -} - -int os::raw_send(int fd, char *buf, int nBytes, int flags) { - RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); +int os::recv(int fd, char* buf, size_t nBytes, uint flags) { + INTERRUPTIBLE_RETURN_INT((int)::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); +} + +int os::send(int fd, char* buf, size_t nBytes, uint flags) { + INTERRUPTIBLE_RETURN_INT((int)::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); +} + +int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { + RESTARTABLE_RETURN_INT((int)::send(fd, buf, nBytes, flags)); } // As both poll and select can be interrupted by signals, we have to be @@ -6408,19 +6403,19 @@ } } -int os::connect(int fd, struct sockaddr *him, int len) { +int os::connect(int fd, struct sockaddr *him, socklen_t len) { int _result; - INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result, + INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result,\ os::Solaris::clear_interrupted); // Depending on when thread interruption is reset, _result could be // one of two values when errno == EINTR if (((_result == OS_INTRPT) || (_result == OS_ERR)) - && (errno == EINTR)) { + && (errno == EINTR)) { /* restarting a connect() changes its errno semantics */ - INTERRUPTIBLE(::connect(fd, him, len), _result, - os::Solaris::clear_interrupted); + INTERRUPTIBLE(::connect(fd, him, len), _result,\ + os::Solaris::clear_interrupted); /* undo these changes */ if (_result == OS_ERR) { if (errno == EALREADY) { @@ -6434,43 +6429,38 @@ return _result; } -int os::accept(int fd, struct sockaddr *him, int *len) { - if (fd < 0) - return OS_ERR; - INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him,\ - (socklen_t*) len), os::Solaris::clear_interrupted); - } - -int os::recvfrom(int fd, char *buf, int nBytes, int flags, - sockaddr *from, int *fromlen) { - //%%note jvm_r11 - INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes,\ - flags, from, fromlen), os::Solaris::clear_interrupted); -} - -int os::sendto(int fd, char *buf, int len, int flags, - struct sockaddr *to, int tolen) { - //%%note jvm_r11 - INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags,\ - to, tolen), os::Solaris::clear_interrupted); +int os::accept(int fd, struct sockaddr* him, socklen_t* len) { + if (fd < 0) { + return OS_ERR; + } + INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him, len),\ + os::Solaris::clear_interrupted); +} + +int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags, + sockaddr* from, socklen_t* fromlen) { + INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen),\ + os::Solaris::clear_interrupted); +} + +int os::sendto(int fd, char* buf, size_t len, uint flags, + struct sockaddr* to, socklen_t tolen) { + INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen),\ + os::Solaris::clear_interrupted); } int os::socket_available(int fd, jint *pbytes) { - if (fd < 0) - return OS_OK; - - int ret; - - RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); - - //%% note ioctl can return 0 when successful, JVM_SocketAvailable - // is expected to return 0 on failure and 1 on success to the jdk. - - return (ret == OS_ERR) ? 0 : 1; -} - - -int os::bind(int fd, struct sockaddr *him, int len) { + if (fd < 0) { + return OS_OK; + } + int ret; + RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); + // note: ioctl can return 0 when successful, JVM_SocketAvailable + // is expected to return 0 on failure and 1 on success to the jdk. + return (ret == OS_ERR) ? 0 : 1; +} + +int os::bind(int fd, struct sockaddr* him, socklen_t len) { INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\ - os::Solaris::clear_interrupted); -} + os::Solaris::clear_interrupted); +} diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/solaris/vm/os_solaris.inline.hpp --- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -243,24 +243,25 @@ return ::shutdown(fd, howto); } -inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){ - return ::getsockname(fd, him, (socklen_t*) len); +inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len){ + return ::getsockname(fd, him, len); } inline int os::get_host_name(char* name, int namelen){ return ::gethostname(name, namelen); } -inline struct hostent* os::get_host_by_name(char* name) { +inline struct hostent* os::get_host_by_name(char* name) { return ::gethostbyname(name); } + inline int os::get_sock_opt(int fd, int level, int optname, - char *optval, int* optlen){ - return ::getsockopt(fd, level, optname, optval, (socklen_t*) optlen); + char* optval, socklen_t* optlen) { + return ::getsockopt(fd, level, optname, optval, optlen); } inline int os::set_sock_opt(int fd, int level, int optname, - const char *optval, int optlen){ + const char *optval, socklen_t optlen) { return ::setsockopt(fd, level, optname, optval, optlen); } #endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/windows/vm/jvm_windows.h --- a/hotspot/src/os/windows/vm/jvm_windows.h Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/windows/vm/jvm_windows.h Wed Jul 05 17:58:30 2017 +0200 @@ -22,6 +22,9 @@ * */ +#ifndef OS_WINDOWS_VM_JVM_WINDOWS_H +#define OS_WINDOWS_VM_JVM_WINDOWS_H + #ifndef _JAVASOFT_JVM_MD_H_ #define _JAVASOFT_JVM_MD_H_ @@ -54,9 +57,9 @@ #include #endif - +#include -#include +typedef unsigned int socklen_t; // #include "jni.h" @@ -129,3 +132,5 @@ #define SHUTDOWN2_SIGNAL SIGTERM #endif /* !_JAVASOFT_JVM_MD_H_ */ + +#endif // OS_WINDOWS_VM_JVM_WINDOWS_H diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -821,17 +821,15 @@ } } -#define NANOS_PER_SEC CONST64(1000000000) -#define NANOS_PER_MILLISEC 1000000 jlong os::javaTimeNanos() { if (!has_performance_count) { - return javaTimeMillis() * NANOS_PER_MILLISEC; // the best we can do. + return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do. } else { LARGE_INTEGER current_count; QueryPerformanceCounter(¤t_count); double current = as_long(current_count); double freq = performance_frequency; - jlong time = (jlong)((current/freq) * NANOS_PER_SEC); + jlong time = (jlong)((current/freq) * NANOSECS_PER_SEC); return time; } } @@ -847,15 +845,15 @@ info_ptr->may_skip_forward = true; } else { jlong freq = performance_frequency; - if (freq < NANOS_PER_SEC) { + if (freq < NANOSECS_PER_SEC) { // the performance counter is 64 bits and we will // be multiplying it -- so no wrap in 64 bits info_ptr->max_value = ALL_64_BITS; - } else if (freq > NANOS_PER_SEC) { + } else if (freq > NANOSECS_PER_SEC) { // use the max value the counter can reach to // determine the max value which could be returned julong max_counter = (julong)ALL_64_BITS; - info_ptr->max_value = (jlong)(max_counter / (freq / NANOS_PER_SEC)); + info_ptr->max_value = (jlong)(max_counter / (freq / NANOSECS_PER_SEC)); } else { // the performance counter is 64 bits and we will // be using it directly -- so no wrap in 64 bits @@ -4851,7 +4849,7 @@ ::mutexUnlock(&sockFnTableMutex); } -struct hostent* os::get_host_by_name(char* name) { +struct hostent* os::get_host_by_name(char* name) { if (!sock_initialized) { initSock(); } @@ -4882,39 +4880,39 @@ return 0; } -int os::connect(int fd, struct sockaddr *him, int len) { +int os::connect(int fd, struct sockaddr* him, socklen_t len) { ShouldNotReachHere(); return 0; } -int os::accept(int fd, struct sockaddr *him, int *len) { +int os::accept(int fd, struct sockaddr* him, socklen_t* len) { ShouldNotReachHere(); return 0; } -int os::sendto(int fd, char *buf, int len, int flags, - struct sockaddr *to, int tolen) { +int os::sendto(int fd, char* buf, size_t len, uint flags, + struct sockaddr* to, socklen_t tolen) { ShouldNotReachHere(); return 0; } -int os::recvfrom(int fd, char *buf, int nBytes, int flags, - sockaddr *from, int *fromlen) { +int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags, + sockaddr* from, socklen_t* fromlen) { ShouldNotReachHere(); return 0; } -int os::recv(int fd, char *buf, int nBytes, int flags) { +int os::recv(int fd, char* buf, size_t nBytes, uint flags) { ShouldNotReachHere(); return 0; } -int os::send(int fd, char *buf, int nBytes, int flags) { +int os::send(int fd, char* buf, size_t nBytes, uint flags) { ShouldNotReachHere(); return 0; } -int os::raw_send(int fd, char *buf, int nBytes, int flags) { +int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { ShouldNotReachHere(); return 0; } @@ -4934,24 +4932,24 @@ return 0; } -int os::bind(int fd, struct sockaddr *him, int len) { +int os::bind(int fd, struct sockaddr* him, socklen_t len) { ShouldNotReachHere(); return 0; } -int os::get_sock_name(int fd, struct sockaddr *him, int *len) { +int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) { ShouldNotReachHere(); return 0; } int os::get_sock_opt(int fd, int level, int optname, - char *optval, int* optlen) { + char* optval, socklen_t* optlen) { ShouldNotReachHere(); return 0; } int os::set_sock_opt(int fd, int level, int optname, - const char *optval, int optlen) { + const char* optval, socklen_t optlen) { ShouldNotReachHere(); return 0; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -336,12 +336,6 @@ unallocated_block() : end()); } - // This is needed because the default implementation uses block_start() - // which can;t be used at certain times (for example phase 3 of mark-sweep). - // A better fix is to change the assertions in phase 3 of mark-sweep to - // use is_in_reserved(), but that is deferred since the is_in() assertions - // are buried through several layers of callers and are used elsewhere - // as well. bool is_in(const void* p) const { return used_region().contains(p); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -1117,12 +1117,9 @@ // Calculates the number of active workers for a concurrent // phase. -int ConcurrentMark::calc_parallel_marking_threads() { - - size_t n_conc_workers; - if (!G1CollectedHeap::use_parallel_gc_threads()) { - n_conc_workers = 1; - } else { +size_t ConcurrentMark::calc_parallel_marking_threads() { + if (G1CollectedHeap::use_parallel_gc_threads()) { + size_t n_conc_workers = 0; if (!UseDynamicNumberOfGCThreads || (!FLAG_IS_DEFAULT(ConcGCThreads) && !ForceDynamicNumberOfGCThreads)) { @@ -1137,9 +1134,13 @@ // Don't scale down "n_conc_workers" by scale_parallel_threads() because // that scaling has already gone into "_max_parallel_marking_threads". } + assert(n_conc_workers > 0, "Always need at least 1"); + return n_conc_workers; } - assert(n_conc_workers > 0, "Always need at least 1"); - return (int) MAX2(n_conc_workers, (size_t) 1); + // If we are not running with any parallel GC threads we will not + // have spawned any marking threads either. Hence the number of + // concurrent workers should be 0. + return 0; } void ConcurrentMark::markFromRoots() { @@ -1151,24 +1152,24 @@ // stop-the-world GC happens even as we mark in this generation. _restart_for_overflow = false; - - // Parallel task terminator is set in "set_phase()". force_overflow_conc()->init(); // _g1h has _n_par_threads - _parallel_marking_threads = calc_parallel_marking_threads(); assert(parallel_marking_threads() <= max_parallel_marking_threads(), "Maximum number of marking threads exceeded"); - _parallel_workers->set_active_workers((int)_parallel_marking_threads); - // Don't set _n_par_threads because it affects MT in proceess_strong_roots() - // and the decisions on that MT processing is made elsewhere. - - assert( _parallel_workers->active_workers() > 0, "Should have been set"); - set_phase(_parallel_workers->active_workers(), true /* concurrent */); + + size_t active_workers = MAX2((size_t) 1, parallel_marking_threads()); + + // Parallel task terminator is set in "set_phase()" + set_phase(active_workers, true /* concurrent */); CMConcurrentMarkingTask markingTask(this, cmThread()); if (parallel_marking_threads() > 0) { + _parallel_workers->set_active_workers((int)active_workers); + // Don't set _n_par_threads because it affects MT in proceess_strong_roots() + // and the decisions on that MT processing is made elsewhere. + assert(_parallel_workers->active_workers() > 0, "Should have been set"); _parallel_workers->run_task(&markingTask); } else { markingTask.work(0); @@ -1765,8 +1766,7 @@ HeapRegionRemSet::reset_for_cleanup_tasks(); - g1h->set_par_threads(); - size_t n_workers = g1h->n_par_threads(); + size_t n_workers; // Do counting once more with the world stopped for good measure. G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), @@ -1776,8 +1776,10 @@ HeapRegion::InitialClaimValue), "sanity check"); + g1h->set_par_threads(); + n_workers = g1h->n_par_threads(); assert(g1h->n_par_threads() == (int) n_workers, - "Should not have been reset"); + "Should not have been reset"); g1h->workers()->run_task(&g1_par_count_task); // Done with the parallel phase so reset to 0. g1h->set_par_threads(0); @@ -1786,6 +1788,7 @@ HeapRegion::FinalCountClaimValue), "sanity check"); } else { + n_workers = 1; g1_par_count_task.work(0); } @@ -1851,7 +1854,6 @@ (note_end_end - note_end_start)*1000.0); } - // call below, since it affects the metric by which we sort the heap // regions. if (G1ScrubRemSets) { @@ -2329,9 +2331,9 @@ } } - CMRemarkTask(ConcurrentMark* cm) : + CMRemarkTask(ConcurrentMark* cm, int active_workers) : AbstractGangTask("Par Remark"), _cm(cm) { - _cm->terminator()->reset_for_reuse(cm->_g1h->workers()->active_workers()); + _cm->terminator()->reset_for_reuse(active_workers); } }; @@ -2357,7 +2359,7 @@ // constructor and pass values of the active workers // through the gang in the task. - CMRemarkTask remarkTask(this); + CMRemarkTask remarkTask(this, active_workers); g1h->set_par_threads(active_workers); g1h->workers()->run_task(&remarkTask); g1h->set_par_threads(0); @@ -2367,7 +2369,7 @@ int active_workers = 1; set_phase(active_workers, false /* concurrent */); - CMRemarkTask remarkTask(this); + CMRemarkTask remarkTask(this, active_workers); // We will start all available threads, even if we decide that the // active_workers will be fewer. The extra ones will just bail out // immediately. @@ -3123,13 +3125,12 @@ } double start = os::elapsedTime(); - int n_workers = g1h->workers()->total_workers(); - G1ParCompleteMarkInCSetTask complete_mark_task(g1h, this); assert(g1h->check_cset_heap_region_claim_values(HeapRegion::InitialClaimValue), "sanity"); if (G1CollectedHeap::use_parallel_gc_threads()) { + int n_workers = g1h->workers()->active_workers(); g1h->set_par_threads(n_workers); g1h->workers()->run_task(&complete_mark_task); g1h->set_par_threads(0); diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -718,7 +718,7 @@ size_t scale_parallel_threads(size_t n_par_threads); // Calculates the number of GC threads to be used in a concurrent phase. - int calc_parallel_marking_threads(); + size_t calc_parallel_marking_threads(); // The following three are interaction between CM and // G1CollectedHeap diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -1294,7 +1294,7 @@ g1_policy()->stop_incremental_cset_building(); tear_down_region_sets(false /* free_list_only */); - g1_policy()->set_full_young_gcs(true); + g1_policy()->set_gcs_are_young(true); // See the comments in g1CollectedHeap.hpp and // G1CollectedHeap::ref_processing_init() about @@ -1842,7 +1842,9 @@ _full_collections_completed(0), _in_cset_fast_test(NULL), _in_cset_fast_test_base(NULL), - _dirty_cards_region_list(NULL) { + _dirty_cards_region_list(NULL), + _worker_cset_start_region(NULL), + _worker_cset_start_region_time_stamp(NULL) { _g1h = this; // To catch bugs. if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) { vm_exit_during_initialization("Failed necessary allocation."); @@ -1863,12 +1865,17 @@ } _rem_set_iterator = iter_arr; + _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues); + _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues); + for (int i = 0; i < n_queues; i++) { RefToScanQueue* q = new RefToScanQueue(); q->initialize(); _task_queues->register_queue(i, q); } + clear_cset_start_regions(); + guarantee(_task_queues != NULL, "task_queues allocation failure."); } @@ -2411,8 +2418,11 @@ } bool G1CollectedHeap::is_in(const void* p) const { - HeapRegion* hr = _hrs.addr_to_region((HeapWord*) p); - if (hr != NULL) { + if (_g1_committed.contains(p)) { + // Given that we know that p is in the committed space, + // heap_region_containing_raw() should successfully + // return the containing region. + HeapRegion* hr = heap_region_containing_raw(p); return hr->is_in(p); } else { return _perm_gen->as_gen()->is_in(p); @@ -2684,25 +2694,80 @@ } #endif // ASSERT -// We want the parallel threads to start their collection -// set iteration at different collection set regions to -// avoid contention. -// If we have: -// n collection set regions -// p threads -// Then thread t will start at region t * floor (n/p) - +// Clear the cached CSet starting regions and (more importantly) +// the time stamps. Called when we reset the GC time stamp. +void G1CollectedHeap::clear_cset_start_regions() { + assert(_worker_cset_start_region != NULL, "sanity"); + assert(_worker_cset_start_region_time_stamp != NULL, "sanity"); + + int n_queues = MAX2((int)ParallelGCThreads, 1); + for (int i = 0; i < n_queues; i++) { + _worker_cset_start_region[i] = NULL; + _worker_cset_start_region_time_stamp[i] = 0; + } +} + +// Given the id of a worker, obtain or calculate a suitable +// starting region for iterating over the current collection set. HeapRegion* G1CollectedHeap::start_cset_region_for_worker(int worker_i) { - HeapRegion* result = g1_policy()->collection_set(); + assert(get_gc_time_stamp() > 0, "should have been updated by now"); + + HeapRegion* result = NULL; + unsigned gc_time_stamp = get_gc_time_stamp(); + + if (_worker_cset_start_region_time_stamp[worker_i] == gc_time_stamp) { + // Cached starting region for current worker was set + // during the current pause - so it's valid. + // Note: the cached starting heap region may be NULL + // (when the collection set is empty). + result = _worker_cset_start_region[worker_i]; + assert(result == NULL || result->in_collection_set(), "sanity"); + return result; + } + + // The cached entry was not valid so let's calculate + // a suitable starting heap region for this worker. + + // We want the parallel threads to start their collection + // set iteration at different collection set regions to + // avoid contention. + // If we have: + // n collection set regions + // p threads + // Then thread t will start at region floor ((t * n) / p) + + result = g1_policy()->collection_set(); if (G1CollectedHeap::use_parallel_gc_threads()) { size_t cs_size = g1_policy()->cset_region_length(); - int n_workers = workers()->total_workers(); - size_t cs_spans = cs_size / n_workers; - size_t ind = cs_spans * worker_i; - for (size_t i = 0; i < ind; i++) { + int active_workers = workers()->active_workers(); + assert(UseDynamicNumberOfGCThreads || + active_workers == workers()->total_workers(), + "Unless dynamic should use total workers"); + + size_t end_ind = (cs_size * worker_i) / active_workers; + size_t start_ind = 0; + + if (worker_i > 0 && + _worker_cset_start_region_time_stamp[worker_i - 1] == gc_time_stamp) { + // Previous workers starting region is valid + // so let's iterate from there + start_ind = (cs_size * (worker_i - 1)) / active_workers; + result = _worker_cset_start_region[worker_i - 1]; + } + + for (size_t i = start_ind; i < end_ind; i++) { result = result->next_in_collection_set(); } } + + // Note: the calculated starting heap region may be NULL + // (when the collection set is empty). + assert(result == NULL || result->in_collection_set(), "sanity"); + assert(_worker_cset_start_region_time_stamp[worker_i] != gc_time_stamp, + "should be updated only once per pause"); + _worker_cset_start_region[worker_i] = result; + OrderAccess::storestore(); + _worker_cset_start_region_time_stamp[worker_i] = gc_time_stamp; return result; } @@ -3461,20 +3526,19 @@ // for the duration of this pause. g1_policy()->decide_on_conc_mark_initiation(); - // We do not allow initial-mark to be piggy-backed on a - // partially-young GC. + // We do not allow initial-mark to be piggy-backed on a mixed GC. assert(!g1_policy()->during_initial_mark_pause() || - g1_policy()->full_young_gcs(), "sanity"); - - // We also do not allow partially-young GCs during marking. - assert(!mark_in_progress() || g1_policy()->full_young_gcs(), "sanity"); + g1_policy()->gcs_are_young(), "sanity"); + + // We also do not allow mixed GCs during marking. + assert(!mark_in_progress() || g1_policy()->gcs_are_young(), "sanity"); char verbose_str[128]; sprintf(verbose_str, "GC pause "); - if (g1_policy()->full_young_gcs()) { + if (g1_policy()->gcs_are_young()) { strcat(verbose_str, "(young)"); } else { - strcat(verbose_str, "(partial)"); + strcat(verbose_str, "(mixed)"); } if (g1_policy()->during_initial_mark_pause()) { strcat(verbose_str, " (initial-mark)"); @@ -3723,8 +3787,9 @@ double end_time_sec = os::elapsedTime(); double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; g1_policy()->record_pause_time_ms(pause_time_ms); - int active_gc_threads = workers()->active_workers(); - g1_policy()->record_collection_pause_end(active_gc_threads); + int active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? + workers()->active_workers() : 1); + g1_policy()->record_collection_pause_end(active_workers); MemoryService::track_memory_usage(); @@ -5248,8 +5313,10 @@ int active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? workers()->active_workers() : 1); - assert(active_workers == workers()->active_workers(), - "Need to reset active_workers"); + assert(!G1CollectedHeap::use_parallel_gc_threads() || + active_workers == workers()->active_workers(), + "Need to reset active_workers"); + set_par_threads(active_workers); G1ParPreserveCMReferentsTask keep_cm_referents(this, active_workers, _task_queues); @@ -5387,13 +5454,13 @@ assert(UseDynamicNumberOfGCThreads || n_workers == workers()->total_workers(), "If not dynamic should be using all the workers"); + workers()->set_active_workers(n_workers); set_par_threads(n_workers); } else { assert(n_par_threads() == 0, "Should be the original non-parallel value"); n_workers = 1; } - workers()->set_active_workers(n_workers); G1ParTask g1_par_task(this, _task_queues); @@ -5415,6 +5482,7 @@ workers()->run_task(&g1_par_task); } else { StrongRootsScope srs(this); + g1_par_task.set_for_termination(n_workers); g1_par_task.work(0); } @@ -5663,8 +5731,8 @@ // Iterate over the dirty cards region list. G1ParCleanupCTTask cleanup_task(ct_bs, this); - if (ParallelGCThreads > 0) { - set_par_threads(workers()->total_workers()); + if (G1CollectedHeap::use_parallel_gc_threads()) { + set_par_threads(); workers()->run_task(&cleanup_task); set_par_threads(0); } else { @@ -6072,8 +6140,9 @@ void G1CollectedHeap::set_par_threads() { // Don't change the number of workers. Use the value previously set // in the workgroup. + assert(G1CollectedHeap::use_parallel_gc_threads(), "shouldn't be here otherwise"); int n_workers = workers()->active_workers(); - assert(UseDynamicNumberOfGCThreads || + assert(UseDynamicNumberOfGCThreads || n_workers == workers()->total_workers(), "Otherwise should be using the total number of workers"); if (n_workers == 0) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -943,6 +943,16 @@ // discovery. G1CMIsAliveClosure _is_alive_closure_cm; + // Cache used by G1CollectedHeap::start_cset_region_for_worker(). + HeapRegion** _worker_cset_start_region; + + // Time stamp to validate the regions recorded in the cache + // used by G1CollectedHeap::start_cset_region_for_worker(). + // The heap region entry for a given worker is valid iff + // the associated time stamp value matches the current value + // of G1CollectedHeap::_gc_time_stamp. + unsigned int* _worker_cset_start_region_time_stamp; + enum G1H_process_strong_roots_tasks { G1H_PS_mark_stack_oops_do, G1H_PS_refProcessor_oops_do, @@ -1030,6 +1040,9 @@ void reset_gc_time_stamp() { _gc_time_stamp = 0; OrderAccess::fence(); + // Clear the cached CSet starting regions and time stamps. + // Their validity is dependent on the GC timestamp. + clear_cset_start_regions(); } void increment_gc_time_stamp() { @@ -1196,7 +1209,7 @@ HumongousRegionSet* humongous_proxy_set, bool par); - // Returns "TRUE" iff "p" points into the allocated area of the heap. + // Returns "TRUE" iff "p" points into the committed areas of the heap. virtual bool is_in(const void* p) const; // Return "TRUE" iff the given object address is within the collection @@ -1300,9 +1313,12 @@ bool check_cset_heap_region_claim_values(jint claim_value); #endif // ASSERT - // Given the id of a worker, calculate a suitable - // starting region for iterating over the current - // collection set. + // Clear the cached cset start regions and (more importantly) + // the time stamps. Called when we reset the GC time stamp. + void clear_cset_start_regions(); + + // Given the id of a worker, obtain or calculate a suitable + // starting region for iterating over the current collection set. HeapRegion* start_cset_region_for_worker(int worker_i); // Iterate over the regions (if any) in the current collection set. diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -50,7 +50,7 @@ }; // all the same -static double fully_young_cards_per_entry_ratio_defaults[] = { +static double young_cards_per_entry_ratio_defaults[] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; @@ -168,11 +168,10 @@ _pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)), _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), - _fully_young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), - _partially_young_cards_per_entry_ratio_seq( - new TruncatedSeq(TruncatedSeqLength)), + _young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), + _mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), - _partially_young_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _mixed_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)), _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)), _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)), @@ -185,9 +184,9 @@ _pause_time_target_ms((double) MaxGCPauseMillis), - _full_young_gcs(true), - _full_young_pause_num(0), - _partial_young_pause_num(0), + _gcs_are_young(true), + _young_pause_num(0), + _mixed_pause_num(0), _during_marking(false), _in_marking_window(false), @@ -198,7 +197,8 @@ _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)), - _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_prev_end_times_for_all_gcs_sec( + new TruncatedSeq(NumPrevPausesForHeuristics)), _recent_avg_pause_time_ratio(0.0), @@ -206,8 +206,9 @@ _initiate_conc_mark_if_possible(false), _during_initial_mark_pause(false), - _should_revert_to_full_young_gcs(false), - _last_full_young_gc(false), + _should_revert_to_young_gcs(false), + _last_young_gc(false), + _last_gc_was_young(false), _eden_bytes_before_gc(0), _survivor_bytes_before_gc(0), @@ -308,8 +309,8 @@ _pending_card_diff_seq->add(0.0); _rs_length_diff_seq->add(rs_length_diff_defaults[index]); _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]); - _fully_young_cards_per_entry_ratio_seq->add( - fully_young_cards_per_entry_ratio_defaults[index]); + _young_cards_per_entry_ratio_seq->add( + young_cards_per_entry_ratio_defaults[index]); _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]); _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]); _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]); @@ -606,7 +607,7 @@ size_t young_list_target_length = 0; if (adaptive_young_list_length()) { - if (full_young_gcs()) { + if (gcs_are_young()) { young_list_target_length = calculate_young_list_target_length(rs_lengths, base_min_length, @@ -619,10 +620,10 @@ // possible to maximize how many old regions we can add to it. } } else { - if (full_young_gcs()) { + if (gcs_are_young()) { young_list_target_length = _young_list_fixed_length; } else { - // A bit arbitrary: during partially-young GCs we allocate half + // A bit arbitrary: during mixed GCs we allocate half // the young regions to try to add old regions to the CSet. young_list_target_length = _young_list_fixed_length / 2; // We choose to accept that we might go under the desired min @@ -655,7 +656,7 @@ size_t desired_min_length, size_t desired_max_length) { assert(adaptive_young_list_length(), "pre-condition"); - assert(full_young_gcs(), "only call this for fully-young GCs"); + assert(gcs_are_young(), "only call this for young GCs"); // In case some edge-condition makes the desired max length too small... if (desired_max_length <= desired_min_length) { @@ -858,12 +859,11 @@ _g1->clear_full_collection(); - // "Nuke" the heuristics that control the fully/partially young GC - // transitions and make sure we start with fully young GCs after the - // Full GC. - set_full_young_gcs(true); - _last_full_young_gc = false; - _should_revert_to_full_young_gcs = false; + // "Nuke" the heuristics that control the young/mixed GC + // transitions and make sure we start with young GCs after the Full GC. + set_gcs_are_young(true); + _last_young_gc = false; + _should_revert_to_young_gcs = false; clear_initiate_conc_mark_if_possible(); clear_during_initial_mark_pause(); _known_garbage_bytes = 0; @@ -892,7 +892,7 @@ if (PrintGCDetails) { gclog_or_tty->stamp(PrintGCTimeStamps); gclog_or_tty->print("[GC pause"); - gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial"); + gclog_or_tty->print(" (%s)", gcs_are_young() ? "young" : "mixed"); } // We only need to do this here as the policy will only be applied @@ -951,7 +951,7 @@ // the evacuation pause if marking is in progress. _cur_satb_drain_time_ms = 0.0; - _last_young_gc_full = false; + _last_gc_was_young = false; // do that for any other surv rate groups _short_lived_surv_rate_group->stop_adding_regions(); @@ -988,8 +988,8 @@ } void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { - _should_revert_to_full_young_gcs = false; - _last_full_young_gc = true; + _should_revert_to_young_gcs = false; + _last_young_gc = true; _in_marking_window = false; } @@ -1153,7 +1153,7 @@ size_t marking_initiating_used_threshold = (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; - if (!_g1->mark_in_progress() && !_last_full_young_gc) { + if (!_g1->mark_in_progress() && !_last_young_gc) { assert(!last_pause_included_initial_mark, "invariant"); if (cur_used_bytes > marking_initiating_used_threshold) { if (cur_used_bytes > _prev_collection_pause_used_at_end_bytes) { @@ -1458,57 +1458,57 @@ new_in_marking_window_im = true; } - if (_last_full_young_gc) { + if (_last_young_gc) { if (!last_pause_included_initial_mark) { - ergo_verbose2(ErgoPartiallyYoungGCs, - "start partially-young GCs", + ergo_verbose2(ErgoMixedGCs, + "start mixed GCs", ergo_format_byte_perc("known garbage"), _known_garbage_bytes, _known_garbage_ratio * 100.0); - set_full_young_gcs(false); + set_gcs_are_young(false); } else { - ergo_verbose0(ErgoPartiallyYoungGCs, - "do not start partially-young GCs", + ergo_verbose0(ErgoMixedGCs, + "do not start mixed GCs", ergo_format_reason("concurrent cycle is about to start")); } - _last_full_young_gc = false; + _last_young_gc = false; } - if ( !_last_young_gc_full ) { - if (_should_revert_to_full_young_gcs) { - ergo_verbose2(ErgoPartiallyYoungGCs, - "end partially-young GCs", - ergo_format_reason("partially-young GCs end requested") + if (!_last_gc_was_young) { + if (_should_revert_to_young_gcs) { + ergo_verbose2(ErgoMixedGCs, + "end mixed GCs", + ergo_format_reason("mixed GCs end requested") ergo_format_byte_perc("known garbage"), _known_garbage_bytes, _known_garbage_ratio * 100.0); - set_full_young_gcs(true); + set_gcs_are_young(true); } else if (_known_garbage_ratio < 0.05) { - ergo_verbose3(ErgoPartiallyYoungGCs, - "end partially-young GCs", + ergo_verbose3(ErgoMixedGCs, + "end mixed GCs", ergo_format_reason("known garbage percent lower than threshold") ergo_format_byte_perc("known garbage") ergo_format_perc("threshold"), _known_garbage_bytes, _known_garbage_ratio * 100.0, 0.05 * 100.0); - set_full_young_gcs(true); + set_gcs_are_young(true); } else if (adaptive_young_list_length() && (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) { - ergo_verbose5(ErgoPartiallyYoungGCs, - "end partially-young GCs", + ergo_verbose5(ErgoMixedGCs, + "end mixed GCs", ergo_format_reason("current GC efficiency lower than " - "predicted fully-young GC efficiency") + "predicted young GC efficiency") ergo_format_double("GC efficiency factor") ergo_format_double("current GC efficiency") - ergo_format_double("predicted fully-young GC efficiency") + ergo_format_double("predicted young GC efficiency") ergo_format_byte_perc("known garbage"), get_gc_eff_factor(), cur_efficiency, predict_young_gc_eff(), _known_garbage_bytes, _known_garbage_ratio * 100.0); - set_full_young_gcs(true); + set_gcs_are_young(true); } } - _should_revert_to_full_young_gcs = false; - - if (_last_young_gc_full && !_during_marking) { + _should_revert_to_young_gcs = false; + + if (_last_gc_was_young && !_during_marking) { _young_gc_eff_seq->add(cur_efficiency); } @@ -1534,19 +1534,21 @@ double cost_per_entry_ms = 0.0; if (cards_scanned > 10) { cost_per_entry_ms = scan_rs_time / (double) cards_scanned; - if (_last_young_gc_full) + if (_last_gc_was_young) { _cost_per_entry_ms_seq->add(cost_per_entry_ms); - else - _partially_young_cost_per_entry_ms_seq->add(cost_per_entry_ms); + } else { + _mixed_cost_per_entry_ms_seq->add(cost_per_entry_ms); + } } if (_max_rs_lengths > 0) { double cards_per_entry_ratio = (double) cards_scanned / (double) _max_rs_lengths; - if (_last_young_gc_full) - _fully_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); - else - _partially_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); + if (_last_gc_was_young) { + _young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); + } else { + _mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); + } } // It turns out that, sometimes, _max_rs_lengths can get smaller @@ -1563,10 +1565,11 @@ double cost_per_byte_ms = 0.0; if (copied_bytes > 0) { cost_per_byte_ms = obj_copy_time / (double) copied_bytes; - if (_in_marking_window) + if (_in_marking_window) { _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); - else + } else { _cost_per_byte_ms_seq->add(cost_per_byte_ms); + } } double all_other_time_ms = pause_time_ms - @@ -1722,10 +1725,11 @@ size_t rs_lengths = g1h->young_list()->sampled_rs_lengths() + predict_rs_length_diff(); size_t card_num; - if (full_young_gcs()) + if (gcs_are_young()) { card_num = predict_young_card_num(rs_lengths); - else + } else { card_num = predict_non_young_card_num(rs_lengths); + } size_t young_byte_size = young_num * HeapRegion::GrainBytes; double accum_yg_surv_rate = _short_lived_surv_rate_group->accum_surv_rate(adjustment); @@ -1745,10 +1749,11 @@ G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) { size_t rs_length = predict_rs_length_diff(); size_t card_num; - if (full_young_gcs()) + if (gcs_are_young()) { card_num = predict_young_card_num(rs_length); - else + } else { card_num = predict_non_young_card_num(rs_length); + } return predict_base_elapsed_time_ms(pending_cards, card_num); } @@ -1766,10 +1771,11 @@ bool young) { size_t rs_length = hr->rem_set()->occupied(); size_t card_num; - if (full_young_gcs()) + if (gcs_are_young()) { card_num = predict_young_card_num(rs_length); - else + } else { card_num = predict_non_young_card_num(rs_length); + } size_t bytes_to_copy = predict_bytes_to_copy(hr); double region_elapsed_time_ms = @@ -1817,14 +1823,14 @@ // I don't think we need to do this when in young GC mode since // marking will be initiated next time we hit the soft limit anyway... if (predicted_time_ms > _expensive_region_limit_ms) { - ergo_verbose2(ErgoPartiallyYoungGCs, - "request partially-young GCs end", + ergo_verbose2(ErgoMixedGCs, + "request mixed GCs end", ergo_format_reason("predicted region time higher than threshold") ergo_format_ms("predicted region time") ergo_format_ms("threshold"), predicted_time_ms, _expensive_region_limit_ms); - // no point in doing another partial one - _should_revert_to_full_young_gcs = true; + // no point in doing another mixed GC + _should_revert_to_young_gcs = true; } } @@ -2033,8 +2039,8 @@ print_summary_sd(0, "Total", _all_pause_times_ms); gclog_or_tty->print_cr(""); gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(" Full Young GC Pauses: %8d", _full_young_pause_num); - gclog_or_tty->print_cr(" Partial Young GC Pauses: %8d", _partial_young_pause_num); + gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num); + gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num); gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("EVACUATION PAUSES"); @@ -2188,11 +2194,11 @@ // initiate a new cycle. set_during_initial_mark_pause(); - // We do not allow non-full young GCs during marking. - if (!full_young_gcs()) { - set_full_young_gcs(true); - ergo_verbose0(ErgoPartiallyYoungGCs, - "end partially-young GCs", + // We do not allow mixed GCs during marking. + if (!gcs_are_young()) { + set_gcs_are_young(true); + ergo_verbose0(ErgoMixedGCs, + "end mixed GCs", ergo_format_reason("concurrent cycle is about to start")); } @@ -2623,12 +2629,12 @@ double young_start_time_sec = os::elapsedTime(); _collection_set_bytes_used_before = 0; - _last_young_gc_full = full_young_gcs() ? true : false; - - if (_last_young_gc_full) { - ++_full_young_pause_num; + _last_gc_was_young = gcs_are_young() ? true : false; + + if (_last_gc_was_young) { + ++_young_pause_num; } else { - ++_partial_young_pause_num; + ++_mixed_pause_num; } // The young list is laid with the survivor regions from the previous @@ -2675,7 +2681,7 @@ // We are doing young collections so reset this. non_young_start_time_sec = young_end_time_sec; - if (!full_young_gcs()) { + if (!gcs_are_young()) { bool should_continue = true; NumberSeq seq; double avg_prediction = 100000000000000000.0; // something very large @@ -2732,14 +2738,14 @@ } while (should_continue); if (!adaptive_young_list_length() && - cset_region_length() < _young_list_fixed_length) { + cset_region_length() < _young_list_fixed_length) { ergo_verbose2(ErgoCSetConstruction, - "request partially-young GCs end", + "request mixed GCs end", ergo_format_reason("CSet length lower than target") ergo_format_region("CSet") ergo_format_region("young target"), cset_region_length(), _young_list_fixed_length); - _should_revert_to_full_young_gcs = true; + _should_revert_to_young_gcs = true; } ergo_verbose2(ErgoCSetConstruction | ErgoHigh, diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -164,8 +164,8 @@ // times for a given worker thread. double* _par_last_gc_worker_other_times_ms; - // indicates whether we are in full young or partially young GC mode - bool _full_young_gcs; + // indicates whether we are in young or mixed GC mode + bool _gcs_are_young; // if true, then it tries to dynamically adjust the length of the // young list @@ -178,10 +178,10 @@ // locker is active. This should be >= _young_list_target_length; size_t _young_list_max_length; - bool _last_young_gc_full; + bool _last_gc_was_young; - unsigned _full_young_pause_num; - unsigned _partial_young_pause_num; + unsigned _young_pause_num; + unsigned _mixed_pause_num; bool _during_marking; bool _in_marking_window; @@ -211,10 +211,10 @@ TruncatedSeq* _pending_card_diff_seq; TruncatedSeq* _rs_length_diff_seq; TruncatedSeq* _cost_per_card_ms_seq; - TruncatedSeq* _fully_young_cards_per_entry_ratio_seq; - TruncatedSeq* _partially_young_cards_per_entry_ratio_seq; + TruncatedSeq* _young_cards_per_entry_ratio_seq; + TruncatedSeq* _mixed_cards_per_entry_ratio_seq; TruncatedSeq* _cost_per_entry_ms_seq; - TruncatedSeq* _partially_young_cost_per_entry_ms_seq; + TruncatedSeq* _mixed_cost_per_entry_ms_seq; TruncatedSeq* _cost_per_byte_ms_seq; TruncatedSeq* _constant_other_time_ms_seq; TruncatedSeq* _young_other_cost_per_region_ms_seq; @@ -322,20 +322,22 @@ size_t predict_pending_card_diff() { double prediction = get_new_neg_prediction(_pending_card_diff_seq); - if (prediction < 0.00001) + if (prediction < 0.00001) { return 0; - else + } else { return (size_t) prediction; + } } size_t predict_pending_cards() { size_t max_pending_card_num = _g1->max_pending_card_num(); size_t diff = predict_pending_card_diff(); size_t prediction; - if (diff > max_pending_card_num) + if (diff > max_pending_card_num) { prediction = max_pending_card_num; - else + } else { prediction = max_pending_card_num - diff; + } return prediction; } @@ -356,57 +358,62 @@ return (double) pending_cards * predict_cost_per_card_ms(); } - double predict_fully_young_cards_per_entry_ratio() { - return get_new_prediction(_fully_young_cards_per_entry_ratio_seq); + double predict_young_cards_per_entry_ratio() { + return get_new_prediction(_young_cards_per_entry_ratio_seq); } - double predict_partially_young_cards_per_entry_ratio() { - if (_partially_young_cards_per_entry_ratio_seq->num() < 2) - return predict_fully_young_cards_per_entry_ratio(); - else - return get_new_prediction(_partially_young_cards_per_entry_ratio_seq); + double predict_mixed_cards_per_entry_ratio() { + if (_mixed_cards_per_entry_ratio_seq->num() < 2) { + return predict_young_cards_per_entry_ratio(); + } else { + return get_new_prediction(_mixed_cards_per_entry_ratio_seq); + } } size_t predict_young_card_num(size_t rs_length) { return (size_t) ((double) rs_length * - predict_fully_young_cards_per_entry_ratio()); + predict_young_cards_per_entry_ratio()); } size_t predict_non_young_card_num(size_t rs_length) { return (size_t) ((double) rs_length * - predict_partially_young_cards_per_entry_ratio()); + predict_mixed_cards_per_entry_ratio()); } double predict_rs_scan_time_ms(size_t card_num) { - if (full_young_gcs()) + if (gcs_are_young()) { return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq); - else - return predict_partially_young_rs_scan_time_ms(card_num); + } else { + return predict_mixed_rs_scan_time_ms(card_num); + } } - double predict_partially_young_rs_scan_time_ms(size_t card_num) { - if (_partially_young_cost_per_entry_ms_seq->num() < 3) + double predict_mixed_rs_scan_time_ms(size_t card_num) { + if (_mixed_cost_per_entry_ms_seq->num() < 3) { return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq); - else - return (double) card_num * - get_new_prediction(_partially_young_cost_per_entry_ms_seq); + } else { + return (double) (card_num * + get_new_prediction(_mixed_cost_per_entry_ms_seq)); + } } double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) { - if (_cost_per_byte_ms_during_cm_seq->num() < 3) - return 1.1 * (double) bytes_to_copy * - get_new_prediction(_cost_per_byte_ms_seq); - else + if (_cost_per_byte_ms_during_cm_seq->num() < 3) { + return (1.1 * (double) bytes_to_copy) * + get_new_prediction(_cost_per_byte_ms_seq); + } else { return (double) bytes_to_copy * - get_new_prediction(_cost_per_byte_ms_during_cm_seq); + get_new_prediction(_cost_per_byte_ms_during_cm_seq); + } } double predict_object_copy_time_ms(size_t bytes_to_copy) { - if (_in_marking_window && !_in_marking_window_im) + if (_in_marking_window && !_in_marking_window_im) { return predict_object_copy_time_ms_during_cm(bytes_to_copy); - else + } else { return (double) bytes_to_copy * - get_new_prediction(_cost_per_byte_ms_seq); + get_new_prediction(_cost_per_byte_ms_seq); + } } double predict_constant_other_time_ms() { @@ -414,15 +421,13 @@ } double predict_young_other_time_ms(size_t young_num) { - return - (double) young_num * - get_new_prediction(_young_other_cost_per_region_ms_seq); + return (double) young_num * + get_new_prediction(_young_other_cost_per_region_ms_seq); } double predict_non_young_other_time_ms(size_t non_young_num) { - return - (double) non_young_num * - get_new_prediction(_non_young_other_cost_per_region_ms_seq); + return (double) non_young_num * + get_new_prediction(_non_young_other_cost_per_region_ms_seq); } void check_if_region_is_too_expensive(double predicted_time_ms); @@ -456,7 +461,7 @@ double predict_survivor_regions_evac_time(); void cset_regions_freed() { - bool propagate = _last_young_gc_full && !_in_marking_window; + bool propagate = _last_gc_was_young && !_in_marking_window; _short_lived_surv_rate_group->all_surviving_words_recorded(propagate); _survivor_surv_rate_group->all_surviving_words_recorded(propagate); // also call it on any more surv rate groups @@ -628,8 +633,8 @@ // initial-mark work. volatile bool _during_initial_mark_pause; - bool _should_revert_to_full_young_gcs; - bool _last_full_young_gc; + bool _should_revert_to_young_gcs; + bool _last_young_gc; // This set of variables tracks the collector efficiency, in order to // determine whether we should initiate a new marking. @@ -985,11 +990,11 @@ return _young_list_max_length; } - bool full_young_gcs() { - return _full_young_gcs; + bool gcs_are_young() { + return _gcs_are_young; } - void set_full_young_gcs(bool full_young_gcs) { - _full_young_gcs = full_young_gcs; + void set_gcs_are_young(bool gcs_are_young) { + _gcs_are_young = gcs_are_young; } bool adaptive_young_list_length() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -52,14 +52,13 @@ const char* G1ErgoVerbose::to_string(int tag) { ErgoHeuristic n = extract_heuristic(tag); switch (n) { - case ErgoHeapSizing: return "Heap Sizing"; - case ErgoCSetConstruction: return "CSet Construction"; - case ErgoConcCycles: return "Concurrent Cycles"; - case ErgoPartiallyYoungGCs: return "Partially-Young GCs"; + case ErgoHeapSizing: return "Heap Sizing"; + case ErgoCSetConstruction: return "CSet Construction"; + case ErgoConcCycles: return "Concurrent Cycles"; + case ErgoMixedGCs: return "Mixed GCs"; default: ShouldNotReachHere(); // Keep the Windows compiler happy return NULL; } } - diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -69,7 +69,7 @@ ErgoHeapSizing = 0, ErgoCSetConstruction, ErgoConcCycles, - ErgoPartiallyYoungGCs, + ErgoMixedGCs, ErgoHeuristicNum } ErgoHeuristic; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -119,7 +119,7 @@ G1CollectedHeap* _g1h; // jstat performance counters - // incremental collections both fully and partially young + // incremental collections both young and mixed CollectorCounters* _incremental_collection_counters; // full stop-the-world collections CollectorCounters* _full_collection_counters; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -672,15 +672,20 @@ } jlong PSMarkSweep::millis_since_last_gc() { - jlong ret_val = os::javaTimeMillis() - _time_of_last_gc; + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; + jlong ret_val = now - _time_of_last_gc; // XXX See note in genCollectedHeap::millis_since_last_gc(). if (ret_val < 0) { - NOT_PRODUCT(warning("time warp: %d", ret_val);) + NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);) return 0; } return ret_val; } void PSMarkSweep::reset_millis_since_last_gc() { - _time_of_last_gc = os::javaTimeMillis(); + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + _time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -3398,17 +3398,22 @@ } jlong PSParallelCompact::millis_since_last_gc() { - jlong ret_val = os::javaTimeMillis() - _time_of_last_gc; + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; + jlong ret_val = now - _time_of_last_gc; // XXX See note in genCollectedHeap::millis_since_last_gc(). if (ret_val < 0) { - NOT_PRODUCT(warning("time warp: %d", ret_val);) + NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);) return 0; } return ret_val; } void PSParallelCompact::reset_millis_since_last_gc() { - _time_of_last_gc = os::javaTimeMillis(); + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + _time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; } ParMarkBitMap::IterationStatus MoveAndUpdateClosure::copy_until_full() diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_interface/collectedHeap.cpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -471,3 +471,26 @@ return mirror; } + +/////////////// Unit tests /////////////// + +#ifndef PRODUCT +void CollectedHeap::test_is_in() { + CollectedHeap* heap = Universe::heap(); + + // Test that NULL is not in the heap. + assert(!heap->is_in(NULL), "NULL is unexpectedly in the heap"); + + // Test that a pointer to before the heap start is reported as outside the heap. + assert(heap->_reserved.start() >= (void*)MinObjAlignment, "sanity"); + void* before_heap = (void*)((intptr_t)heap->_reserved.start() - MinObjAlignment); + assert(!heap->is_in(before_heap), + err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap)); + + // Test that a pointer to after the heap end is reported as outside the heap. + assert(heap->_reserved.end() <= (void*)(uintptr_t(-1) - (uint)MinObjAlignment), "sanity"); + void* after_heap = (void*)((intptr_t)heap->_reserved.end() + MinObjAlignment); + assert(!heap->is_in(after_heap), + err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap)); +} +#endif diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/gc_interface/collectedHeap.hpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -217,8 +217,8 @@ return p == NULL || is_in_reserved(p); } - // Returns "TRUE" if "p" points to the head of an allocated object in the - // heap. Since this method can be expensive in general, we restrict its + // Returns "TRUE" iff "p" points into the committed areas of the heap. + // Since this method can be expensive in general, we restrict its // use to assertion checking only. virtual bool is_in(const void* p) const = 0; @@ -648,6 +648,10 @@ // reduce the occurrence of ParallelGCThreads to uses where the // actual number may be germane. static bool use_parallel_gc_threads() { return ParallelGCThreads > 0; } + + /////////////// Unit tests /////////////// + + NOT_PRODUCT(static void test_is_in();) }; // Class to set and reset the GC cause for a CollectedHeap. diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/memory/genCollectedHeap.cpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -957,7 +957,7 @@ return result; } -// Returns "TRUE" iff "p" points into the allocated area of the heap. +// Returns "TRUE" iff "p" points into the committed areas of the heap. bool GenCollectedHeap::is_in(const void* p) const { #ifndef ASSERT guarantee(VerifyBeforeGC || @@ -1460,26 +1460,22 @@ }; jlong GenCollectedHeap::millis_since_last_gc() { - jlong now = os::javaTimeMillis(); + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; GenTimeOfLastGCClosure tolgc_cl(now); // iterate over generations getting the oldest // time that a generation was collected generation_iterate(&tolgc_cl, false); tolgc_cl.do_generation(perm_gen()); - // XXX Despite the assert above, since javaTimeMillis() - // doesnot guarantee monotonically increasing return - // values (note, i didn't say "strictly monotonic"), - // we need to guard against getting back a time - // later than now. This should be fixed by basing - // on someting like gethrtime() which guarantees - // monotonicity. Note that cond_wait() is susceptible - // to a similar problem, because its interface is - // based on absolute time in the form of the - // system time's notion of UCT. See also 4506635 - // for yet another problem of similar nature. XXX + + // javaTimeNanos() is guaranteed to be monotonically non-decreasing + // provided the underlying platform provides such a time source + // (and it is bug free). So we still have to guard against getting + // back a time later than 'now'. jlong retVal = now - tolgc_cl.time(); if (retVal < 0) { - NOT_PRODUCT(warning("time warp: %d", retVal);) + NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);) return 0; } return retVal; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/memory/genCollectedHeap.hpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -198,7 +198,7 @@ // Mostly used for testing purposes. Caller does not hold the Heap_lock on entry. void collect(GCCause::Cause cause, int max_level); - // Returns "TRUE" iff "p" points into the allocated area of the heap. + // Returns "TRUE" iff "p" points into the committed areas of the heap. // The methods is_in(), is_in_closed_subset() and is_in_youngest() may // be expensive to compute in general, so, to prevent // their inadvertent use in product jvm's, we restrict their use to diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/memory/generation.hpp --- a/hotspot/src/share/vm/memory/generation.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/memory/generation.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -220,7 +220,7 @@ MemRegion prev_used_region() const { return _prev_used_region; } virtual void save_used_region() { _prev_used_region = used_region(); } - // Returns "TRUE" iff "p" points into an allocated object in the generation. + // Returns "TRUE" iff "p" points into the committed areas in the generation. // For some kinds of generations, this may be an expensive operation. // To avoid performance problems stemming from its inadvertent use in // product jvm's, we restrict its use to assertion checking or @@ -413,10 +413,13 @@ // Time (in ms) when we were last collected or now if a collection is // in progress. virtual jlong time_of_last_gc(jlong now) { - // XXX See note in genCollectedHeap::millis_since_last_gc() + // Both _time_of_last_gc and now are set using a time source + // that guarantees monotonically non-decreasing values provided + // the underlying platform provides such a source. So we still + // have to guard against non-monotonicity. NOT_PRODUCT( if (now < _time_of_last_gc) { - warning("time warp: %d to %d", _time_of_last_gc, now); + warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now); } ) return _time_of_last_gc; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/memory/referenceProcessor.cpp --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -43,7 +43,9 @@ } void ReferenceProcessor::init_statics() { - jlong now = os::javaTimeMillis(); + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; // Initialize the soft ref timestamp clock. _soft_ref_timestamp_clock = now; @@ -151,7 +153,10 @@ void ReferenceProcessor::update_soft_ref_master_clock() { // Update (advance) the soft ref master clock field. This must be done // after processing the soft ref list. - jlong now = os::javaTimeMillis(); + + // We need a monotonically non-deccreasing time in ms but + // os::javaTimeMillis() does not guarantee monotonicity. + jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; jlong soft_ref_clock = java_lang_ref_SoftReference::clock(); assert(soft_ref_clock == _soft_ref_timestamp_clock, "soft ref clocks out of sync"); @@ -161,10 +166,11 @@ _soft_ref_timestamp_clock, now); } ) - // In product mode, protect ourselves from system time being adjusted - // externally and going backward; see note in the implementation of - // GenCollectedHeap::time_since_last_gc() for the right way to fix - // this uniformly throughout the VM; see bug-id 4741166. XXX + // The values of now and _soft_ref_timestamp_clock are set using + // javaTimeNanos(), which is guaranteed to be monotonically + // non-decreasing provided the underlying platform provides such + // a time source (and it is bug free). + // In product mode, however, protect ourselves from non-monotonicty. if (now > _soft_ref_timestamp_clock) { _soft_ref_timestamp_clock = now; java_lang_ref_SoftReference::set_clock(now); diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/memory/space.cpp --- a/hotspot/src/share/vm/memory/space.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/memory/space.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -304,11 +304,6 @@ CompactibleSpace::clear(mangle_space); } -bool Space::is_in(const void* p) const { - HeapWord* b = block_start_const(p); - return b != NULL && block_is_obj(b); -} - bool ContiguousSpace::is_in(const void* p) const { return _bottom <= p && p < _top; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/memory/space.hpp --- a/hotspot/src/share/vm/memory/space.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/memory/space.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -187,7 +187,7 @@ // expensive operation. To prevent performance problems // on account of its inadvertent use in product jvm's, // we restrict its use to assertion checks only. - virtual bool is_in(const void* p) const; + virtual bool is_in(const void* p) const = 0; // Returns true iff the given reserved memory of the space contains the // given address. diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/oops/arrayOop.cpp --- a/hotspot/src/share/vm/oops/arrayOop.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/oops/arrayOop.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -38,9 +38,7 @@ return (julong)(size_t)bytes == bytes; } -bool arrayOopDesc::test_max_array_length() { - tty->print_cr("test_max_array_length"); - +void arrayOopDesc::test_max_array_length() { assert(check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array"); assert(check_max_length_overflow(T_CHAR), "size_t overflow for char array"); assert(check_max_length_overflow(T_FLOAT), "size_t overflow for float array"); @@ -54,8 +52,6 @@ assert(check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array"); // T_VOID and T_ADDRESS are not supported by max_array_length() - - return true; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/oops/arrayOop.hpp --- a/hotspot/src/share/vm/oops/arrayOop.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/oops/arrayOop.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -128,7 +128,7 @@ #ifndef PRODUCT static bool check_max_length_overflow(BasicType type); static int32_t old_max_array_length(BasicType type); - static bool test_max_array_length(); + static void test_max_array_length(); #endif }; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/prims/jni.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -5037,16 +5037,25 @@ #ifndef PRODUCT +#include "gc_interface/collectedHeap.hpp" #include "utilities/quickSort.hpp" +#define run_unit_test(unit_test_function_call) \ + tty->print_cr("Running test: " #unit_test_function_call); \ + unit_test_function_call + void execute_internal_vm_tests() { if (ExecuteInternalVMTests) { - assert(QuickSort::test_quick_sort(), "test_quick_sort failed"); - assert(arrayOopDesc::test_max_array_length(), "test_max_array_length failed"); + tty->print_cr("Running internal VM tests"); + run_unit_test(arrayOopDesc::test_max_array_length()); + run_unit_test(CollectedHeap::test_is_in()); + run_unit_test(QuickSort::test_quick_sort()); tty->print_cr("All internal VM tests passed"); } } +#undef run_unit_test + #endif #ifndef USDT2 diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/prims/jvm.cpp --- a/hotspot/src/share/vm/prims/jvm.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/prims/jvm.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -3515,14 +3515,14 @@ JVM_LEAF(jint, JVM_Recv(jint fd, char *buf, jint nBytes, jint flags)) JVMWrapper2("JVM_Recv (0x%x)", fd); //%note jvm_r6 - return os::recv(fd, buf, nBytes, flags); + return os::recv(fd, buf, (size_t)nBytes, (uint)flags); JVM_END JVM_LEAF(jint, JVM_Send(jint fd, char *buf, jint nBytes, jint flags)) JVMWrapper2("JVM_Send (0x%x)", fd); //%note jvm_r6 - return os::send(fd, buf, nBytes, flags); + return os::send(fd, buf, (size_t)nBytes, (uint)flags); JVM_END @@ -3543,42 +3543,51 @@ JVM_LEAF(jint, JVM_Connect(jint fd, struct sockaddr *him, jint len)) JVMWrapper2("JVM_Connect (0x%x)", fd); //%note jvm_r6 - return os::connect(fd, him, len); + return os::connect(fd, him, (socklen_t)len); JVM_END JVM_LEAF(jint, JVM_Bind(jint fd, struct sockaddr *him, jint len)) JVMWrapper2("JVM_Bind (0x%x)", fd); //%note jvm_r6 - return os::bind(fd, him, len); + return os::bind(fd, him, (socklen_t)len); JVM_END JVM_LEAF(jint, JVM_Accept(jint fd, struct sockaddr *him, jint *len)) JVMWrapper2("JVM_Accept (0x%x)", fd); //%note jvm_r6 - return os::accept(fd, him, (int *)len); + socklen_t socklen = (socklen_t)(*len); + jint result = os::accept(fd, him, &socklen); + *len = (jint)socklen; + return result; JVM_END JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen)) JVMWrapper2("JVM_RecvFrom (0x%x)", fd); //%note jvm_r6 - return os::recvfrom(fd, buf, nBytes, flags, from, fromlen); + socklen_t socklen = (socklen_t)(*fromlen); + jint result = os::recvfrom(fd, buf, (size_t)nBytes, (uint)flags, from, &socklen); + *fromlen = (int)socklen; + return result; JVM_END JVM_LEAF(jint, JVM_GetSockName(jint fd, struct sockaddr *him, int *len)) JVMWrapper2("JVM_GetSockName (0x%x)", fd); //%note jvm_r6 - return os::get_sock_name(fd, him, len); + socklen_t socklen = (socklen_t)(*len); + jint result = os::get_sock_name(fd, him, &socklen); + *len = (int)socklen; + return result; JVM_END JVM_LEAF(jint, JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen)) JVMWrapper2("JVM_SendTo (0x%x)", fd); //%note jvm_r6 - return os::sendto(fd, buf, len, flags, to, tolen); + return os::sendto(fd, buf, (size_t)len, (uint)flags, to, (socklen_t)tolen); JVM_END @@ -3592,21 +3601,26 @@ JVM_LEAF(jint, JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen)) JVMWrapper2("JVM_GetSockOpt (0x%x)", fd); //%note jvm_r6 - return os::get_sock_opt(fd, level, optname, optval, optlen); + socklen_t socklen = (socklen_t)(*optlen); + jint result = os::get_sock_opt(fd, level, optname, optval, &socklen); + *optlen = (int)socklen; + return result; JVM_END JVM_LEAF(jint, JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen)) JVMWrapper2("JVM_GetSockOpt (0x%x)", fd); //%note jvm_r6 - return os::set_sock_opt(fd, level, optname, optval, optlen); + return os::set_sock_opt(fd, level, optname, optval, (socklen_t)optlen); JVM_END + JVM_LEAF(int, JVM_GetHostName(char* name, int namelen)) JVMWrapper("JVM_GetHostName"); return os::get_host_name(name, namelen); JVM_END + // Library support /////////////////////////////////////////////////////////////////////////// JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name)) @@ -3647,6 +3661,7 @@ return os::dll_lookup(handle, name); JVM_END + // Floating point support //////////////////////////////////////////////////////////////////// JVM_LEAF(jboolean, JVM_IsNaN(jdouble a)) @@ -3655,7 +3670,6 @@ JVM_END - // JNI version /////////////////////////////////////////////////////////////////////////////// JVM_LEAF(jboolean, JVM_IsSupportedJNIVersion(jint version)) diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -43,7 +43,7 @@ #ifdef TARGET_ARCH_ppc # include "bytes_ppc.hpp" #endif -// FIXME: add Deprecated, LVT, LVTT attributes +// FIXME: add Deprecated, LVTT attributes // FIXME: fix Synthetic attribute // FIXME: per Serguei, add error return handling for constantPoolOopDesc::copy_cpool_bytes() @@ -136,8 +136,9 @@ constMethodHandle const_method(thread(), method->constMethod()); u2 line_num_cnt = 0; int stackmap_len = 0; + int local_variable_table_length = 0; - // compute number and length of attributes -- FIXME: for now no LVT + // compute number and length of attributes int attr_count = 0; int attr_size = 0; if (const_method->has_linenumber_table()) { @@ -170,6 +171,25 @@ attr_size += 2 + 4 + stackmap_len; } } + if (method->has_localvariable_table()) { + local_variable_table_length = method->localvariable_table_length(); + ++attr_count; + if (local_variable_table_length != 0) { + // Compute the size of the local variable table attribute (VM stores raw): + // LocalVariableTable_attribute { + // u2 attribute_name_index; + // u4 attribute_length; + // u2 local_variable_table_length; + // { + // u2 start_pc; + // u2 length; + // u2 name_index; + // u2 descriptor_index; + // u2 index; + // } + attr_size += 2 + 4 + 2 + local_variable_table_length * (2 + 2 + 2 + 2 + 2); + } + } typeArrayHandle exception_table(thread(), const_method->exception_table()); int exception_table_length = exception_table->length(); @@ -203,8 +223,9 @@ if (stackmap_len != 0) { write_stackmap_table_attribute(method, stackmap_len); } - - // FIXME: write LVT attribute + if (local_variable_table_length != 0) { + write_local_variable_table_attribute(method, local_variable_table_length); + } } // Write Exceptions attribute @@ -371,6 +392,36 @@ } } +// Write LineNumberTable attribute +// JVMSpec| LocalVariableTable_attribute { +// JVMSpec| u2 attribute_name_index; +// JVMSpec| u4 attribute_length; +// JVMSpec| u2 local_variable_table_length; +// JVMSpec| { u2 start_pc; +// JVMSpec| u2 length; +// JVMSpec| u2 name_index; +// JVMSpec| u2 descriptor_index; +// JVMSpec| u2 index; +// JVMSpec| } local_variable_table[local_variable_table_length]; +// JVMSpec| } +void JvmtiClassFileReconstituter::write_local_variable_table_attribute(methodHandle method, u2 num_entries) { + write_attribute_name_index("LocalVariableTable"); + write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2)); + write_u2(num_entries); + + assert(method->localvariable_table_length() == num_entries, "just checking"); + + LocalVariableTableElement *elem = method->localvariable_table_start(); + for (int j=0; jlocalvariable_table_length(); j++) { + write_u2(elem->start_bci); + write_u2(elem->length); + write_u2(elem->name_cp_index); + write_u2(elem->descriptor_cp_index); + write_u2(elem->slot); + elem++; + } +} + // Write stack map table attribute // JSR-202| StackMapTable_attribute { // JSR-202| u2 attribute_name_index; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -119,6 +119,7 @@ void write_source_debug_extension_attribute(); u2 line_number_table_entries(methodHandle method); void write_line_number_table_attribute(methodHandle method, u2 num_entries); + void write_local_variable_table_attribute(methodHandle method, u2 num_entries); void write_stackmap_table_attribute(methodHandle method, int stackmap_table_len); u2 inner_classes_attribute_length(); void write_inner_classes_attribute(int length); diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/runtime/globals.cpp --- a/hotspot/src/share/vm/runtime/globals.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/runtime/globals.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -82,16 +82,19 @@ } bool Flag::is_writeable() const { - return (strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0); + return strcmp(kind, "{manageable}") == 0 || + strcmp(kind, "{product rw}") == 0 || + is_writeable_ext(); } -// All flags except "manageable" are assumed internal flags. +// All flags except "manageable" are assumed to be internal flags. // Long term, we need to define a mechanism to specify which flags // are external/stable and change this function accordingly. bool Flag::is_external() const { - return (strcmp(kind, "{manageable}") == 0); + return strcmp(kind, "{manageable}") == 0 || is_external_ext(); } + // Length of format string (e.g. "%.1234s") for printing ccstr below #define FORMAT_BUFFER_LEN 16 diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -245,6 +245,8 @@ bool is_unlocker_ext() const; bool is_unlocked_ext() const; + bool is_writeable_ext() const; + bool is_external_ext() const; void print_on(outputStream* st, bool withComments = false ); void print_as_flag(outputStream* st); diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/runtime/globals_ext.hpp --- a/hotspot/src/share/vm/runtime/globals_ext.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/runtime/globals_ext.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -53,4 +53,12 @@ return true; } +inline bool Flag::is_writeable_ext() const { + return false; +} + +inline bool Flag::is_external_ext() const { + return false; +} + #endif // SHARE_VM_RUNTIME_GLOBALS_EXT_HPP diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/runtime/os.hpp --- a/hotspot/src/share/vm/runtime/os.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/runtime/os.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -584,28 +584,28 @@ static int socket(int domain, int type, int protocol); static int socket_close(int fd); static int socket_shutdown(int fd, int howto); - static int recv(int fd, char *buf, int nBytes, int flags); - static int send(int fd, char *buf, int nBytes, int flags); - static int raw_send(int fd, char *buf, int nBytes, int flags); + static int recv(int fd, char* buf, size_t nBytes, uint flags); + static int send(int fd, char* buf, size_t nBytes, uint flags); + static int raw_send(int fd, char* buf, size_t nBytes, uint flags); static int timeout(int fd, long timeout); static int listen(int fd, int count); - static int connect(int fd, struct sockaddr *him, int len); - static int bind(int fd, struct sockaddr *him, int len); - static int accept(int fd, struct sockaddr *him, int *len); - static int recvfrom(int fd, char *buf, int nbytes, int flags, - struct sockaddr *from, int *fromlen); - static int get_sock_name(int fd, struct sockaddr *him, int *len); - static int sendto(int fd, char *buf, int len, int flags, - struct sockaddr *to, int tolen); - static int socket_available(int fd, jint *pbytes); + static int connect(int fd, struct sockaddr* him, socklen_t len); + static int bind(int fd, struct sockaddr* him, socklen_t len); + static int accept(int fd, struct sockaddr* him, socklen_t* len); + static int recvfrom(int fd, char* buf, size_t nbytes, uint flags, + struct sockaddr* from, socklen_t* fromlen); + static int get_sock_name(int fd, struct sockaddr* him, socklen_t* len); + static int sendto(int fd, char* buf, size_t len, uint flags, + struct sockaddr* to, socklen_t tolen); + static int socket_available(int fd, jint* pbytes); static int get_sock_opt(int fd, int level, int optname, - char *optval, int* optlen); + char* optval, socklen_t* optlen); static int set_sock_opt(int fd, int level, int optname, - const char *optval, int optlen); + const char* optval, socklen_t optlen); static int get_host_name(char* name, int namelen); - static struct hostent* get_host_by_name(char* name); + static struct hostent* get_host_by_name(char* name); // Printing 64 bit integers static const char* jlong_format_specifier(); @@ -715,7 +715,6 @@ # include "os_bsd_zero.hpp" #endif - // debugging support (mostly used by debug.cpp but also fatal error handler) static bool find(address pc, outputStream* st = tty); // OS specific function to make sense out of an address diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/services/management.cpp --- a/hotspot/src/share/vm/services/management.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/services/management.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" +#include "runtime/globals.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/javaCalls.hpp" diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/utilities/globalDefinitions.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -175,6 +175,9 @@ const int MICROUNITS = 1000000; // micro units per base unit const int NANOUNITS = 1000000000; // nano units per base unit +const jlong NANOSECS_PER_SEC = CONST64(1000000000); +const jint NANOSECS_PER_MILLISEC = 1000000; + inline const char* proper_unit_for_byte_size(size_t s) { if (s >= 10*M) { return "M"; diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/utilities/ostream.cpp --- a/hotspot/src/share/vm/utilities/ostream.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/utilities/ostream.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -1021,7 +1021,7 @@ void networkStream::flush() { if (size() != 0) { - int result = os::raw_send(_socket, (char *)base(), (int)size(), 0); + int result = os::raw_send(_socket, (char *)base(), size(), 0); assert(result != -1, "connection error"); assert(result == (int)size(), "didn't send enough data"); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/utilities/quickSort.cpp --- a/hotspot/src/share/vm/utilities/quickSort.cpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/utilities/quickSort.cpp Wed Jul 05 17:58:30 2017 +0200 @@ -93,8 +93,7 @@ return compare_arrays(arrayToSort, expectedResult, length); } -bool QuickSort::test_quick_sort() { - tty->print_cr("test_quick_sort"); +void QuickSort::test_quick_sort() { { int* test_array = NULL; int* expected_array = NULL; @@ -214,7 +213,6 @@ delete[] test_array; delete[] expected_array; } - return true; } #endif diff -r 8e546b2b9dd0 -r 0d73629f3a8d hotspot/src/share/vm/utilities/quickSort.hpp --- a/hotspot/src/share/vm/utilities/quickSort.hpp Fri Dec 23 16:39:22 2011 -0800 +++ b/hotspot/src/share/vm/utilities/quickSort.hpp Wed Jul 05 17:58:30 2017 +0200 @@ -130,7 +130,7 @@ static void print_array(const char* prefix, int* array, int length); static bool compare_arrays(int* actual, int* expected, int length); template static bool sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent = false); - static bool test_quick_sort(); + static void test_quick_sort(); #endif }; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jaxp/.hgtags --- a/jaxp/.hgtags Fri Dec 23 16:39:22 2011 -0800 +++ b/jaxp/.hgtags Wed Jul 05 17:58:30 2017 +0200 @@ -139,3 +139,4 @@ 804f666d6d44e33caac12ad8da3d2780ac44ef72 jdk8-b15 09eb517404b059607aca30cdd1af83ffc57eafeb jdk8-b17 09eb517404b059607aca30cdd1af83ffc57eafeb jdk8-b16 +ebec6a7e8d4e481d205a2109ddeea8121d76db7f jdk8-b18 diff -r 8e546b2b9dd0 -r 0d73629f3a8d jaxp/build.xml --- a/jaxp/build.xml Fri Dec 23 16:39:22 2011 -0800 +++ b/jaxp/build.xml Wed Jul 05 17:58:30 2017 +0200 @@ -43,14 +43,6 @@ Run 'make help' for help using the Makefile. - - - - - - - - diff -r 8e546b2b9dd0 -r 0d73629f3a8d jaxp/make/jprt.properties --- a/jaxp/make/jprt.properties Fri Dec 23 16:39:22 2011 -0800 +++ b/jaxp/make/jprt.properties Wed Jul 05 17:58:30 2017 +0200 @@ -25,21 +25,21 @@ # Properties for jprt -# The release to build +# Locked down to jdk8 jprt.tools.default.release=jdk8 # The different build flavors we want, we override here so we just get these 2 jprt.build.flavors=product,fastdebug # Standard list of jprt build targets for this source tree -jprt.build.targets= \ - solaris_sparc_5.10-{product|fastdebug}, \ - solaris_sparcv9_5.10-{product|fastdebug}, \ - solaris_i586_5.10-{product|fastdebug}, \ - solaris_x64_5.10-{product|fastdebug}, \ - linux_i586_2.6-{product|fastdebug}, \ - linux_x64_2.6-{product|fastdebug}, \ - windows_i586_5.1-{product|fastdebug}, \ +jprt.build.targets= \ + solaris_sparc_5.10-{product|fastdebug}, \ + solaris_sparcv9_5.10-{product|fastdebug}, \ + solaris_i586_5.10-{product|fastdebug}, \ + solaris_x64_5.10-{product|fastdebug}, \ + linux_i586_2.6-{product|fastdebug}, \ + linux_x64_2.6-{product|fastdebug}, \ + windows_i586_5.1-{product|fastdebug}, \ windows_x64_5.2-{product|fastdebug} # Directories to be excluded from the source bundles diff -r 8e546b2b9dd0 -r 0d73629f3a8d jaxws/.hgtags --- a/jaxws/.hgtags Fri Dec 23 16:39:22 2011 -0800 +++ b/jaxws/.hgtags Wed Jul 05 17:58:30 2017 +0200 @@ -139,3 +139,4 @@ c9ab96ff23d52d85d5dcce1f9c0fd7a3de418c74 jdk8-b15 3d45ab79643d5b4cc7e050ae2d9c08b4d89d665e jdk8-b17 3d45ab79643d5b4cc7e050ae2d9c08b4d89d665e jdk8-b16 +54928c8850f5498670dd43d6c9299f36de1a6746 jdk8-b18 diff -r 8e546b2b9dd0 -r 0d73629f3a8d jaxws/build.xml --- a/jaxws/build.xml Fri Dec 23 16:39:22 2011 -0800 +++ b/jaxws/build.xml Wed Jul 05 17:58:30 2017 +0200 @@ -43,14 +43,6 @@ Run 'make help' for help using the Makefile. - - - - - - - - diff -r 8e546b2b9dd0 -r 0d73629f3a8d jaxws/make/jprt.properties --- a/jaxws/make/jprt.properties Fri Dec 23 16:39:22 2011 -0800 +++ b/jaxws/make/jprt.properties Wed Jul 05 17:58:30 2017 +0200 @@ -25,21 +25,21 @@ # Properties for jprt -# The release to build +# Locked down to jdk8 jprt.tools.default.release=jdk8 # The different build flavors we want, we override here so we just get these 2 jprt.build.flavors=product,fastdebug # Standard list of jprt build targets for this source tree -jprt.build.targets= \ - solaris_sparc_5.10-{product|fastdebug}, \ - solaris_sparcv9_5.10-{product|fastdebug}, \ - solaris_i586_5.10-{product|fastdebug}, \ - solaris_x64_5.10-{product|fastdebug}, \ - linux_i586_2.6-{product|fastdebug}, \ - linux_x64_2.6-{product|fastdebug}, \ - windows_i586_5.1-{product|fastdebug}, \ +jprt.build.targets= \ + solaris_sparc_5.10-{product|fastdebug}, \ + solaris_sparcv9_5.10-{product|fastdebug}, \ + solaris_i586_5.10-{product|fastdebug}, \ + solaris_x64_5.10-{product|fastdebug}, \ + linux_i586_2.6-{product|fastdebug}, \ + linux_x64_2.6-{product|fastdebug}, \ + windows_i586_5.1-{product|fastdebug}, \ windows_x64_5.2-{product|fastdebug} # Directories to be excluded from the source bundles diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/.hgtags --- a/jdk/.hgtags Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/.hgtags Wed Jul 05 17:58:30 2017 +0200 @@ -139,3 +139,4 @@ 3c248d0e2c486624cc0d7aba1e4df45ae5774ff7 jdk8-b15 b71d1acfae5240d8c1359443cd02b5ddb587231c jdk8-b17 929597c6e777f742ad252660045ebaa4a3ea4772 jdk8-b16 +334bd51fb3f321cd6777416ae7bafac71a84140a jdk8-b18 diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/make/common/Rules.gmk --- a/jdk/make/common/Rules.gmk Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/make/common/Rules.gmk Wed Jul 05 17:58:30 2017 +0200 @@ -239,7 +239,7 @@ $(CAT) $<.filtered; \ $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \ $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \ - $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \ + $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered && \ $(ECHO) "# javac finished"; \ fi @$(java-vm-cleanup) diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/make/jprt.properties --- a/jdk/make/jprt.properties Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/make/jprt.properties Wed Jul 05 17:58:30 2017 +0200 @@ -25,15 +25,15 @@ # Properties for jprt -# Release to build for +# Locked down to jdk8 jprt.tools.default.release=jdk8 # The different build flavors we want, we override here so we just get these 2 jprt.build.flavors=product,fastdebug # Standard list of jprt build targets for this source tree -jprt.build.targets= \ - solaris_sparc_5.10-{product|fastdebug}, \ +jprt.build.targets= \ + solaris_sparc_5.10-{product|fastdebug}, \ solaris_sparcv9_5.10-{product|fastdebug}, \ solaris_i586_5.10-{product|fastdebug}, \ solaris_x64_5.10-{product|fastdebug}, \ @@ -45,247 +45,59 @@ # User can select the test set with jprt submit "-testset name" option jprt.my.test.set=${jprt.test.set} -# Standard vm test target +# Test target list (no fastdebug & limited c2 testing) +jprt.my.test.target.set= \ + solaris_sparc_5.10-product-c1-TESTNAME, \ + solaris_sparcv9_5.10-product-c2-TESTNAME, \ + solaris_i586_5.10-product-c1-TESTNAME, \ + solaris_x64_5.10-product-c2-TESTNAME, \ + linux_i586_2.6-product-{c1|c2}-TESTNAME, \ + linux_x64_2.6-product-c2-TESTNAME, \ + windows_i586_5.1-product-c1-TESTNAME, \ + windows_x64_5.2-product-c2-TESTNAME + +# Default vm test targets (testset=default) jprt.vm.default.test.targets= \ - solaris_sparc_5.10-product-c1-jvm98, \ - solaris_sparcv9_5.10-product-c2-jvm98, \ - solaris_i586_5.10-product-c1-jvm98, \ - solaris_x64_5.10-product-c2-jvm98, \ - linux_i586_2.6-product-{c1|c2}-jvm98, \ - linux_x64_2.6-product-c2-jvm98, \ - windows_i586_5.1-product-c1-jvm98, \ - windows_x64_5.2-product-c2-jvm98 + ${jprt.my.test.target.set:TESTNAME=jvm98} -# Select vm testlist to use (allow for testset to be empty too) -jprt.vm.all.test.targets=${jprt.vm.default.test.targets} -jprt.vm..test.targets=${jprt.vm.default.test.targets} -jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets} - -# Default jdk test targets in test/Makefile (no fastdebug & limited c2) +# Default jdk test targets (testset=default) jprt.make.rule.default.test.targets= \ - \ - solaris_sparc_5.10-product-c1-jdk_beans1, \ - solaris_sparcv9_5.10-product-c2-jdk_beans1, \ - solaris_i586_5.10-product-c1-jdk_beans1, \ - solaris_x64_5.10-product-c2-jdk_beans1, \ - linux_i586_2.6-product-{c1|c2}-jdk_beans1, \ - linux_x64_2.6-product-c2-jdk_beans1, \ - windows_i586_5.1-product-c1-jdk_beans1, \ - windows_x64_5.2-product-c2-jdk_beans1, \ - \ - solaris_sparc_5.10-product-c1-jdk_io, \ - solaris_sparcv9_5.10-product-c2-jdk_io, \ - solaris_i586_5.10-product-c1-jdk_io, \ - solaris_x64_5.10-product-c2-jdk_io, \ - linux_i586_2.6-product-{c1|c2}-jdk_io, \ - linux_x64_2.6-product-c2-jdk_io, \ - windows_i586_5.1-product-c1-jdk_io, \ - windows_x64_5.2-product-c2-jdk_io, \ - \ - solaris_sparc_5.10-product-c1-jdk_lang, \ - solaris_sparcv9_5.10-product-c2-jdk_lang, \ - solaris_i586_5.10-product-c1-jdk_lang, \ - solaris_x64_5.10-product-c2-jdk_lang, \ - linux_i586_2.6-product-{c1|c2}-jdk_lang, \ - linux_x64_2.6-product-c2-jdk_lang, \ - windows_i586_5.1-product-c1-jdk_lang, \ - windows_x64_5.2-product-c2-jdk_lang, \ - \ - solaris_sparc_5.10-product-c1-jdk_math, \ - solaris_sparcv9_5.10-product-c2-jdk_math, \ - solaris_i586_5.10-product-c1-jdk_math, \ - solaris_x64_5.10-product-c2-jdk_math, \ - linux_i586_2.6-product-{c1|c2}-jdk_math, \ - linux_x64_2.6-product-c2-jdk_math, \ - windows_i586_5.1-product-c1-jdk_math, \ - windows_x64_5.2-product-c2-jdk_math, \ - \ - solaris_sparc_5.10-product-c1-jdk_misc, \ - solaris_sparcv9_5.10-product-c2-jdk_misc, \ - solaris_i586_5.10-product-c1-jdk_misc, \ - solaris_x64_5.10-product-c2-jdk_misc, \ - linux_i586_2.6-product-{c1|c2}-jdk_misc, \ - linux_x64_2.6-product-c2-jdk_misc, \ - windows_i586_5.1-product-c1-jdk_misc, \ - windows_x64_5.2-product-c2-jdk_misc, \ - \ - solaris_sparc_5.10-product-c1-jdk_net, \ - solaris_sparcv9_5.10-product-c2-jdk_net, \ - solaris_i586_5.10-product-c1-jdk_net, \ - solaris_x64_5.10-product-c2-jdk_net, \ - linux_i586_2.6-product-{c1|c2}-jdk_net, \ - linux_x64_2.6-product-c2-jdk_net, \ - windows_i586_5.1-product-c1-jdk_net, \ - windows_x64_5.2-product-c2-jdk_net, \ - \ - solaris_sparc_5.10-product-c1-jdk_nio1, \ - solaris_sparcv9_5.10-product-c2-jdk_nio1, \ - solaris_i586_5.10-product-c1-jdk_nio1, \ - solaris_x64_5.10-product-c2-jdk_nio1, \ - linux_i586_2.6-product-{c1|c2}-jdk_nio1, \ - linux_x64_2.6-product-c2-jdk_nio1, \ - windows_i586_5.1-product-c1-jdk_nio1, \ - windows_x64_5.2-product-c2-jdk_nio1, \ - \ - solaris_sparc_5.10-product-c1-jdk_nio2, \ - solaris_sparcv9_5.10-product-c2-jdk_nio2, \ - solaris_i586_5.10-product-c1-jdk_nio2, \ - solaris_x64_5.10-product-c2-jdk_nio2, \ - linux_i586_2.6-product-{c1|c2}-jdk_nio2, \ - linux_x64_2.6-product-c2-jdk_nio2, \ - windows_i586_5.1-product-c1-jdk_nio2, \ - windows_x64_5.2-product-c2-jdk_nio2, \ - \ - solaris_sparc_5.10-product-c1-jdk_nio3, \ - solaris_sparcv9_5.10-product-c2-jdk_nio3, \ - solaris_i586_5.10-product-c1-jdk_nio3, \ - solaris_x64_5.10-product-c2-jdk_nio3, \ - linux_i586_2.6-product-{c1|c2}-jdk_nio3, \ - linux_x64_2.6-product-c2-jdk_nio3, \ - windows_i586_5.1-product-c1-jdk_nio3, \ - windows_x64_5.2-product-c2-jdk_nio3, \ - \ - solaris_sparc_5.10-product-c1-jdk_security1, \ - solaris_sparcv9_5.10-product-c2-jdk_security1, \ - solaris_i586_5.10-product-c1-jdk_security1, \ - solaris_x64_5.10-product-c2-jdk_security1, \ - linux_i586_2.6-product-{c1|c2}-jdk_security1, \ - linux_x64_2.6-product-c2-jdk_security1, \ - windows_i586_5.1-product-c1-jdk_security1, \ - windows_x64_5.2-product-c2-jdk_security1, \ - \ - solaris_sparc_5.10-product-c1-jdk_text, \ - solaris_sparcv9_5.10-product-c2-jdk_text, \ - solaris_i586_5.10-product-c1-jdk_text, \ - solaris_x64_5.10-product-c2-jdk_text, \ - linux_i586_2.6-product-{c1|c2}-jdk_text, \ - linux_x64_2.6-product-c2-jdk_text, \ - windows_i586_5.1-product-c1-jdk_text, \ - windows_x64_5.2-product-c2-jdk_text, \ - \ - solaris_sparc_5.10-product-c1-jdk_tools1, \ - solaris_sparcv9_5.10-product-c2-jdk_tools1, \ - solaris_i586_5.10-product-c1-jdk_tools1, \ - solaris_x64_5.10-product-c2-jdk_tools1, \ - linux_i586_2.6-product-{c1|c2}-jdk_tools1, \ - linux_x64_2.6-product-c2-jdk_tools1, \ - windows_i586_5.1-product-c1-jdk_tools1, \ - windows_x64_5.2-product-c2-jdk_tools1, \ - \ - solaris_sparc_5.10-product-c1-jdk_util, \ - solaris_sparcv9_5.10-product-c2-jdk_util, \ - solaris_i586_5.10-product-c1-jdk_util, \ - solaris_x64_5.10-product-c2-jdk_util, \ - linux_i586_2.6-product-{c1|c2}-jdk_util, \ - linux_x64_2.6-product-c2-jdk_util, \ - windows_i586_5.1-product-c1-jdk_util, \ - windows_x64_5.2-product-c2-jdk_util + ${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_io}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_lang}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_math}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_misc}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_net}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_security1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_text}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_util} -# All jdk test targets in test/Makefile (still no fastdebug & limited c2) +# All vm test targets (testset=all) +jprt.vm.all.test.targets= \ + ${jprt.vm.default.test.targets}, \ + ${jprt.my.test.target.set:TESTNAME=runThese}, \ + ${jprt.my.test.target.set:TESTNAME=jbb_default} + +# All jdk test targets (testset=all) jprt.make.rule.all.test.targets= \ - \ - ${jprt.make.rule.default.test.targets}, \ - \ - solaris_sparc_5.10-product-c1-jdk_awt, \ - solaris_sparcv9_5.10-product-c2-jdk_awt, \ - solaris_i586_5.10-product-c1-jdk_awt, \ - solaris_x64_5.10-product-c2-jdk_awt, \ - linux_i586_2.6-product-{c1|c2}-jdk_awt, \ - linux_x64_2.6-product-c2-jdk_awt, \ - windows_i586_5.1-product-c1-jdk_awt, \ - windows_x64_5.2-product-c2-jdk_awt, \ - \ - solaris_sparc_5.10-product-c1-jdk_beans2, \ - solaris_sparcv9_5.10-product-c2-jdk_beans2, \ - solaris_i586_5.10-product-c1-jdk_beans2, \ - solaris_x64_5.10-product-c2-jdk_beans2, \ - linux_i586_2.6-product-{c1|c2}-jdk_beans2, \ - linux_x64_2.6-product-c2-jdk_beans2, \ - windows_i586_5.1-product-c1-jdk_beans2, \ - windows_x64_5.2-product-c2-jdk_beans2, \ - \ - solaris_sparc_5.10-product-c1-jdk_beans3, \ - solaris_sparcv9_5.10-product-c2-jdk_beans3, \ - solaris_i586_5.10-product-c1-jdk_beans3, \ - solaris_x64_5.10-product-c2-jdk_beans3, \ - linux_i586_2.6-product-{c1|c2}-jdk_beans3, \ - linux_x64_2.6-product-c2-jdk_beans3, \ - windows_i586_5.1-product-c1-jdk_beans3, \ - windows_x64_5.2-product-c2-jdk_beans3, \ - \ - solaris_sparc_5.10-product-c1-jdk_management1, \ - solaris_sparcv9_5.10-product-c2-jdk_management1, \ - solaris_i586_5.10-product-c1-jdk_management1, \ - solaris_x64_5.10-product-c2-jdk_management1, \ - linux_i586_2.6-product-{c1|c2}-jdk_management1, \ - linux_x64_2.6-product-c2-jdk_management1, \ - windows_i586_5.1-product-c1-jdk_management1, \ - windows_x64_5.2-product-c2-jdk_management1, \ - \ - solaris_sparc_5.10-product-c1-jdk_management2, \ - solaris_sparcv9_5.10-product-c2-jdk_management2, \ - solaris_i586_5.10-product-c1-jdk_management2, \ - solaris_x64_5.10-product-c2-jdk_management2, \ - linux_i586_2.6-product-{c1|c2}-jdk_management2, \ - linux_x64_2.6-product-c2-jdk_management2, \ - windows_i586_5.1-product-c1-jdk_management2, \ - windows_x64_5.2-product-c2-jdk_management2, \ - \ - solaris_sparc_5.10-product-c1-jdk_rmi, \ - solaris_sparcv9_5.10-product-c2-jdk_rmi, \ - solaris_i586_5.10-product-c1-jdk_rmi, \ - solaris_x64_5.10-product-c2-jdk_rmi, \ - linux_i586_2.6-product-{c1|c2}-jdk_rmi, \ - linux_x64_2.6-product-c2-jdk_rmi, \ - windows_i586_5.1-product-c1-jdk_rmi, \ - windows_x64_5.2-product-c2-jdk_rmi, \ - \ - solaris_sparc_5.10-product-c1-jdk_security2, \ - solaris_sparcv9_5.10-product-c2-jdk_security2, \ - solaris_i586_5.10-product-c1-jdk_security2, \ - solaris_x64_5.10-product-c2-jdk_security2, \ - linux_i586_2.6-product-{c1|c2}-jdk_security2, \ - linux_x64_2.6-product-c2-jdk_security2, \ - windows_i586_5.1-product-c1-jdk_security2, \ - windows_x64_5.2-product-c2-jdk_security2, \ - \ - solaris_sparc_5.10-product-c1-jdk_security3, \ - solaris_sparcv9_5.10-product-c2-jdk_security3, \ - solaris_i586_5.10-product-c1-jdk_security3, \ - solaris_x64_5.10-product-c2-jdk_security3, \ - linux_i586_2.6-product-{c1|c2}-jdk_security3, \ - linux_x64_2.6-product-c2-jdk_security3, \ - windows_i586_5.1-product-c1-jdk_security3, \ - windows_x64_5.2-product-c2-jdk_security3, \ - \ - solaris_sparc_5.10-product-c1-jdk_sound, \ - solaris_sparcv9_5.10-product-c2-jdk_sound, \ - solaris_i586_5.10-product-c1-jdk_sound, \ - solaris_x64_5.10-product-c2-jdk_sound, \ - linux_i586_2.6-product-{c1|c2}-jdk_sound, \ - linux_x64_2.6-product-c2-jdk_sound, \ - windows_i586_5.1-product-c1-jdk_sound, \ - windows_x64_5.2-product-c2-jdk_sound, \ - \ - solaris_sparc_5.10-product-c1-jdk_swing, \ - solaris_sparcv9_5.10-product-c2-jdk_swing, \ - solaris_i586_5.10-product-c1-jdk_swing, \ - solaris_x64_5.10-product-c2-jdk_swing, \ - linux_i586_2.6-product-{c1|c2}-jdk_swing, \ - linux_x64_2.6-product-c2-jdk_swing, \ - windows_i586_5.1-product-c1-jdk_swing, \ - windows_x64_5.2-product-c2-jdk_swing, \ - \ - solaris_sparc_5.10-product-c1-jdk_tools2, \ - solaris_sparcv9_5.10-product-c2-jdk_tools2, \ - solaris_i586_5.10-product-c1-jdk_tools2, \ - solaris_x64_5.10-product-c2-jdk_tools2, \ - linux_i586_2.6-product-{c1|c2}-jdk_tools2, \ - linux_x64_2.6-product-c2-jdk_tools2, \ - windows_i586_5.1-product-c1-jdk_tools2, \ - windows_x64_5.2-product-c2-jdk_tools2 + ${jprt.make.rule.default.test.targets}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_awt}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_management1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_management2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_security2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_security3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_sound}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_swing}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_tools2} -# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken) +# JCK test targets in test/Makefile (no windows) jprt.my.jck.test.target.set= \ solaris_sparc_5.10-product-c1-JCK7TESTRULE, \ solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \ @@ -301,8 +113,10 @@ ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler} # Select list to use (allow for testset to be empty too) -jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} -jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} +jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} +jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} +jprt.vm..test.targets=${jprt.vm.default.test.targets} +jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets} # Directories to be excluded from the source bundles jprt.bundle.exclude.src.dirs=build dist webrev diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java --- a/jdk/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,7 +35,7 @@ } String javaType() { - return "List"; + return "List"; } public void genJavaWrite(PrintWriter writer, int depth, diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/make/tools/src/build/tools/jdwpgen/OutNode.java --- a/jdk/make/tools/src/build/tools/jdwpgen/OutNode.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/make/tools/src/build/tools/jdwpgen/OutNode.java Wed Jul 05 17:58:30 2017 +0200 @@ -89,7 +89,7 @@ if (Main.genDebug) { indent(writer, depth+1); writer.println( - "if ((vm.traceFlags & vm.TRACE_SENDS) != 0) {"); + "if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {"); indent(writer, depth+2); writer.print( "vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") "); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/java/swing/Painter.java --- a/jdk/src/share/classes/com/sun/java/swing/Painter.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/java/swing/Painter.java Wed Jul 05 17:58:30 2017 +0200 @@ -29,5 +29,5 @@ * * @deprecated Use {@link javax.swing.Painter} instead. */ -public interface Painter extends javax.swing.Painter { +public interface Painter extends javax.swing.Painter { } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/AbsentInformationException.java --- a/jdk/src/share/classes/com/sun/jdi/AbsentInformationException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/AbsentInformationException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ */ public class AbsentInformationException extends Exception { + private static final long serialVersionUID = 4988939309582416373L; public AbsentInformationException() { super(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java --- a/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java Wed Jul 05 17:58:30 2017 +0200 @@ -69,6 +69,7 @@ */ public class ClassNotLoadedException extends Exception { + private static final long serialVersionUID = -6242978768444298722L; private String className; public ClassNotLoadedException(String className) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/ClassNotPreparedException.java --- a/jdk/src/share/classes/com/sun/jdi/ClassNotPreparedException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/ClassNotPreparedException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * @since 1.3 */ public class ClassNotPreparedException extends RuntimeException { + private static final long serialVersionUID = -6120698967144079642L; public ClassNotPreparedException() { super(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java --- a/jdk/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,6 +34,7 @@ */ public class IncompatibleThreadStateException extends Exception { + private static final long serialVersionUID = 6199174323414551389L; public IncompatibleThreadStateException() { super(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java --- a/jdk/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,6 +35,7 @@ * @since 1.3 */ public class InconsistentDebugInfoException extends RuntimeException { + private static final long serialVersionUID = 7964236415376861808L; public InconsistentDebugInfoException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InternalException.java --- a/jdk/src/share/classes/com/sun/jdi/InternalException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InternalException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * @since 1.3 */ public class InternalException extends RuntimeException { + private static final long serialVersionUID = -9171606393104480607L; private int errorCode; public InternalException() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java --- a/jdk/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,6 +36,7 @@ */ @Deprecated public class InvalidCodeIndexException extends RuntimeException { + private static final long serialVersionUID = 7416010225133747805L; public InvalidCodeIndexException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InvalidLineNumberException.java --- a/jdk/src/share/classes/com/sun/jdi/InvalidLineNumberException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InvalidLineNumberException.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,6 +36,7 @@ */ @Deprecated public class InvalidLineNumberException extends RuntimeException { + private static final long serialVersionUID = 4048709912372692875L; public InvalidLineNumberException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InvalidStackFrameException.java --- a/jdk/src/share/classes/com/sun/jdi/InvalidStackFrameException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InvalidStackFrameException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * @since 1.3 */ public class InvalidStackFrameException extends RuntimeException { + private static final long serialVersionUID = -1919378296505827922L; public InvalidStackFrameException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InvalidTypeException.java --- a/jdk/src/share/classes/com/sun/jdi/InvalidTypeException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InvalidTypeException.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,6 +34,7 @@ */ public class InvalidTypeException extends Exception { + private static final long serialVersionUID = 2256667231949650806L; public InvalidTypeException() { super(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/InvocationException.java --- a/jdk/src/share/classes/com/sun/jdi/InvocationException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/InvocationException.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,6 +34,7 @@ */ public class InvocationException extends Exception { + private static final long serialVersionUID = 6066780907971918568L; ObjectReference exception; public InvocationException(ObjectReference exception) diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/JDIPermission.java --- a/jdk/src/share/classes/com/sun/jdi/JDIPermission.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/JDIPermission.java Wed Jul 05 17:58:30 2017 +0200 @@ -79,7 +79,7 @@ */ public final class JDIPermission extends java.security.BasicPermission { - + private static final long serialVersionUID = -6988461416938786271L; /** * The JDIPermission class represents access rights to the * VirtualMachineManager diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/NativeMethodException.java --- a/jdk/src/share/classes/com/sun/jdi/NativeMethodException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/NativeMethodException.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,6 +34,7 @@ */ public class NativeMethodException extends RuntimeException { + private static final long serialVersionUID = 3924951669039469992L; public NativeMethodException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/ObjectCollectedException.java --- a/jdk/src/share/classes/com/sun/jdi/ObjectCollectedException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/ObjectCollectedException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * @since 1.3 */ public class ObjectCollectedException extends RuntimeException { + private static final long serialVersionUID = -1928428056197269588L; public ObjectCollectedException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java --- a/jdk/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * @since 1.5 */ public class VMCannotBeModifiedException extends UnsupportedOperationException { + private static final long serialVersionUID = -4063879815130164009L; public VMCannotBeModifiedException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/VMDisconnectedException.java --- a/jdk/src/share/classes/com/sun/jdi/VMDisconnectedException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/VMDisconnectedException.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,6 +35,7 @@ */ public class VMDisconnectedException extends RuntimeException { + private static final long serialVersionUID = 2892975269768351637L; public VMDisconnectedException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/VMMismatchException.java --- a/jdk/src/share/classes/com/sun/jdi/VMMismatchException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/VMMismatchException.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,6 +34,7 @@ * @since 1.3 */ public class VMMismatchException extends RuntimeException { + private static final long serialVersionUID = 289169358790459564L; public VMMismatchException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java --- a/jdk/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * @since 1.3 */ public class VMOutOfMemoryException extends RuntimeException { + private static final long serialVersionUID = 71504228548910686L; public VMOutOfMemoryException() { super(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java --- a/jdk/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java Wed Jul 05 17:58:30 2017 +0200 @@ -38,6 +38,7 @@ */ public class IllegalConnectorArgumentsException extends Exception { + private static final long serialVersionUID = -3042212603611350941L; List names; /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java --- a/jdk/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java Wed Jul 05 17:58:30 2017 +0200 @@ -55,7 +55,7 @@ * @since 1.5 */ public class TransportTimeoutException extends java.io.IOException { - + private static final long serialVersionUID = 4107035242623365074L; /** * Constructs a TransportTimeoutException with no detail * message. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/connect/VMStartException.java --- a/jdk/src/share/classes/com/sun/jdi/connect/VMStartException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/connect/VMStartException.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,6 +36,7 @@ */ public class VMStartException extends Exception { + private static final long serialVersionUID = 6408644824640801020L; Process process; public VMStartException(Process process) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java --- a/jdk/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java Wed Jul 05 17:58:30 2017 +0200 @@ -46,7 +46,7 @@ * @since 1.5 */ public class ClosedConnectionException extends java.io.IOException { - + private static final long serialVersionUID = 3877032124297204774L; /** * Constructs a ClosedConnectionException with no detail * message. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java --- a/jdk/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ */ public class DuplicateRequestException extends RuntimeException { + private static final long serialVersionUID = -3719784920313411060L; public DuplicateRequestException() { super(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java --- a/jdk/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,6 +36,7 @@ * @since 1.3 */ public class InvalidRequestStateException extends RuntimeException { + private static final long serialVersionUID = -3774632428543322148L; public InvalidRequestStateException() { super(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -70,8 +70,8 @@ } public Value getValue(int index) { - List list = getValues(index, 1); - return (Value)list.get(0); + List list = getValues(index, 1); + return list.get(0); } public List getValues() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -61,7 +61,7 @@ return findType(componentSignature()); } - void addVisibleMethods(Map map) { + void addVisibleMethods(Map map) { // arrays don't have methods } @@ -83,10 +83,10 @@ if (PacketStream.isObjectTag(tag)) { // It's a reference type JNITypeParser parser = new JNITypeParser(componentSignature()); - List list = vm.classesByName(parser.typeName()); - Iterator iter = list.iterator(); + List list = vm.classesByName(parser.typeName()); + Iterator iter = list.iterator(); while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); + ReferenceType type = iter.next(); ClassLoaderReference cl = type.classLoader(); if ((cl == null)? (classLoader() == null) : diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -78,7 +78,7 @@ } public int intValue() { - return(int)((value)?1:0); + return (value)?1:0; } public long longValue() { @@ -90,7 +90,7 @@ } public double doubleValue() { - return(double)((value)?1.0:0.0); + return (value)?1.0:0.0; } public String toString() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/CharValueImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/CharValueImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/CharValueImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -75,7 +75,7 @@ } public char charValue() { - return(char)value; + return value; } public short shortValue() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -80,7 +80,7 @@ classes = Collections.unmodifiableList(classes); if (local != null) { local.visibleClasses = classes; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching visible classes (count = " + classes.size() + ")"); @@ -95,9 +95,9 @@ Type findType(String signature) throws ClassNotLoadedException { List types = visibleClasses(); - Iterator iter = types.iterator(); + Iterator iter = types.iterator(); while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); + ReferenceType type = iter.next(); if (type.signature().equals(signature)) { return type; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -76,7 +76,7 @@ List immediate = interfaces(); list.addAll(interfaces()); - Iterator iter = immediate.iterator(); + Iterator iter = immediate.iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); interfaze.addSuperinterfaces(list); @@ -389,7 +389,7 @@ * overwrite them in the hash table */ - Iterator iter = interfaces().iterator(); + Iterator iter = interfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); interfaze.addVisibleMethods(methodMap); @@ -411,7 +411,7 @@ return true; } else { List interfaces = interfaces(); - Iterator iter = interfaces.iterator(); + Iterator iter = interfaces.iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); if (interfaze.isAssignableTo(type)) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -192,7 +192,7 @@ return super.codeIndexToLineInfo(stratum, codeIndex); } - Iterator iter = lineLocations.iterator(); + Iterator iter = lineLocations.iterator(); /* * Treat code before the beginning of the first line table * entry as part of the first line. javac will generate @@ -221,9 +221,9 @@ List variables = getVariables(); List retList = new ArrayList(2); - Iterator iter = variables.iterator(); + Iterator iter = variables.iterator(); while(iter.hasNext()) { - LocalVariable variable = (LocalVariable)iter.next(); + LocalVariable variable = iter.next(); if (variable.name().equals(name)) { retList.add(variable); } @@ -235,9 +235,9 @@ List variables = getVariables(); List retList = new ArrayList(variables.size()); - Iterator iter = variables.iterator(); + Iterator iter = variables.iterator(); while(iter.hasNext()) { - LocalVariable variable = (LocalVariable)iter.next(); + LocalVariable variable = iter.next(); if (variable.isArgument()) { retList.add(variable); } @@ -291,7 +291,7 @@ SDE.LineStratum lastLineStratum = null; SDE.Stratum baseStratum = declaringType.stratum(SDE.BASE_STRATUM_NAME); - Iterator it = getBaseLocations().lineLocations.iterator(); + Iterator it = getBaseLocations().lineLocations.iterator(); while(it.hasNext()) { LocationImpl loc = (LocationImpl)it.next(); int baseLineNumber = loc.lineNumber(baseStratum); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ConnectorImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,9 +47,9 @@ public Map defaultArguments() { Map defaults = new java.util.LinkedHashMap(); - Collection values = defaultArguments.values(); + Collection values = defaultArguments.values(); - Iterator iter = values.iterator(); + Iterator iter = values.iterator(); while (iter.hasNext()) { ArgumentImpl argument = (ArgumentImpl)iter.next(); defaults.put(argument.name(), (Argument)argument.clone()); @@ -96,7 +96,7 @@ mustSpecify, list)); } - ArgumentImpl argument(String name, Map arguments) + ArgumentImpl argument(String name, Map arguments) throws IllegalConnectorArgumentsException { ArgumentImpl argument = (ArgumentImpl)arguments.get(name); @@ -130,7 +130,7 @@ public String toString() { String string = name() + " (defaults: "; - Iterator iter = defaultArguments().values().iterator(); + Iterator iter = defaultArguments().values().iterator(); boolean first = true; while (iter.hasNext()) { ArgumentImpl argument = (ArgumentImpl)iter.next(); @@ -222,7 +222,7 @@ class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.BooleanArgument { - + private static final long serialVersionUID = 1624542968639361316L; BooleanArgumentImpl(String name, String label, String description, boolean value, boolean mustSpecify) { @@ -277,7 +277,7 @@ class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.IntegerArgument { - + private static final long serialVersionUID = 763286081923797770L; private final int min; private final int max; @@ -378,7 +378,7 @@ class StringArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.StringArgument { - + private static final long serialVersionUID = 7500484902692107464L; StringArgumentImpl(String name, String label, String description, String value, boolean mustSpecify) { @@ -396,7 +396,7 @@ class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl implements Connector.SelectedArgument { - + private static final long serialVersionUID = -5689584530908382517L; private final List choices; SelectedArgumentImpl(String name, String label, String description, diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -101,7 +101,7 @@ } public double doubleValue() { - return(double)value; + return value; } byte checkedByteValue() throws InvalidTypeException { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -43,7 +43,7 @@ class EventRequestManagerImpl extends MirrorImpl implements EventRequestManager { - List[] requestLists; + List[] requestLists; private static int methodExitEventCmd = 0; static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) { @@ -91,7 +91,7 @@ * access/modification should be protected by synchronizing on * the enclosing instance of EventRequestImpl. */ - List filters = new ArrayList(); + List filters = new ArrayList<>(); boolean isEnabled = false; boolean deleted = false; @@ -195,7 +195,6 @@ */ synchronized void set() { JDWP.EventRequest.Set.Modifier[] mods = - (JDWP.EventRequest.Set.Modifier[]) filters.toArray( new JDWP.EventRequest.Set.Modifier[filters.size()]); try { @@ -582,10 +581,10 @@ /* * Make sure this isn't a duplicate */ - List requests = stepRequests(); - Iterator iter = requests.iterator(); + List requests = stepRequests(); + Iterator iter = requests.iterator(); while (iter.hasNext()) { - StepRequest request = (StepRequest)iter.next(); + StepRequest request = iter.next(); if ((request != this) && request.isEnabled() && request.thread().equals(thread)) { @@ -735,7 +734,7 @@ } requestLists = new List[highest+1]; for (int i=0; i <= highest; i++) { - requestLists[i] = new ArrayList(); + requestLists[i] = new ArrayList<>(); } } @@ -852,7 +851,7 @@ public void deleteEventRequests(List eventRequests) { validateMirrors(eventRequests); // copy the eventRequests to avoid ConcurrentModificationException - Iterator iter = (new ArrayList(eventRequests)).iterator(); + Iterator iter = (new ArrayList<>(eventRequests)).iterator(); while (iter.hasNext()) { ((EventRequestImpl)iter.next()).delete(); } @@ -869,76 +868,76 @@ } public List stepRequests() { - return unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP); + return (List)unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP); } public List classPrepareRequests() { - return unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE); + return (List)unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE); } public List classUnloadRequests() { - return unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD); + return (List)unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD); } public List threadStartRequests() { - return unmodifiableRequestList(JDWP.EventKind.THREAD_START); + return (List)unmodifiableRequestList(JDWP.EventKind.THREAD_START); } public List threadDeathRequests() { - return unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH); + return (List)unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH); } public List exceptionRequests() { - return unmodifiableRequestList(JDWP.EventKind.EXCEPTION); + return (List)unmodifiableRequestList(JDWP.EventKind.EXCEPTION); } public List breakpointRequests() { - return unmodifiableRequestList(JDWP.EventKind.BREAKPOINT); + return (List)unmodifiableRequestList(JDWP.EventKind.BREAKPOINT); } public List accessWatchpointRequests() { - return unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS); + return (List)unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS); } public List modificationWatchpointRequests() { - return unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION); + return (List)unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION); } public List methodEntryRequests() { - return unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY); + return (List)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY); } public List methodExitRequests() { - return unmodifiableRequestList( + return (List)unmodifiableRequestList( EventRequestManagerImpl.methodExitEventCmd); } public List monitorContendedEnterRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER); } public List monitorContendedEnteredRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED); } public List monitorWaitRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT); } public List monitorWaitedRequests() { - return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED); + return (List)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED); } public List vmDeathRequests() { - return unmodifiableRequestList(JDWP.EventKind.VM_DEATH); + return (List)unmodifiableRequestList(JDWP.EventKind.VM_DEATH); } - List unmodifiableRequestList(int eventCmd) { + List unmodifiableRequestList(int eventCmd) { return Collections.unmodifiableList(requestList(eventCmd)); } EventRequest request(int eventCmd, int requestId) { - List rl = requestList(eventCmd); + List rl = requestList(eventCmd); for (int i = rl.size() - 1; i >= 0; i--) { EventRequestImpl er = (EventRequestImpl)rl.get(i); if (er.id == requestId) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/EventSetImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/EventSetImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/EventSetImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,7 +47,7 @@ * that is on the queues are all for client requests. */ public class EventSetImpl extends ArrayList implements EventSet { - + private static final long serialVersionUID = -4857338819787924570L; private VirtualMachineImpl vm; // we implement Mirror private Packet pkt; private byte suspendPolicy; @@ -607,7 +607,7 @@ PacketStream ps = new PacketStream(vm, pkt); JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps); suspendPolicy = compEvt.suspendPolicy; - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { switch(suspendPolicy) { case JDWP.SuspendPolicy.ALL: vm.printTrace("EventSet: SUSPEND_ALL"); @@ -626,7 +626,7 @@ ThreadReference fix6485605 = null; for (int i = 0; i < compEvt.events.length; i++) { EventImpl evt = createEvent(compEvt.events[i]); - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { try { vm.printTrace("Event: " + evt); } catch (VMDisconnectedException ee) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/FloatValueImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -97,7 +97,7 @@ } public float floatValue() { - return(float)value; + return value; } public double doubleValue() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java --- a/jdk/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java Wed Jul 05 17:58:30 2017 +0200 @@ -105,7 +105,7 @@ /** * Attach to a target VM using the specified address and Connector arguments. */ - public VirtualMachine attach(String address, Map args) + public VirtualMachine attach(String address, Map args) throws IOException, IllegalConnectorArgumentsException { String ts = argument(ARG_TIMEOUT, args).value(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -83,7 +83,7 @@ } public int intValue() { - return(int)value; + return value; } public long longValue() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -128,9 +128,9 @@ * list being built. */ List immediate = new ArrayList(superinterfaces()); - Iterator iter = immediate.iterator(); + Iterator iter = immediate.iterator(); while (iter.hasNext()) { - InterfaceType interfaze = (InterfaceType)iter.next(); + InterfaceType interfaze = iter.next(); if (list.contains(interfaze)) { iter.remove(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java --- a/jdk/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/InternalEventHandler.java Wed Jul 05 17:58:30 2017 +0200 @@ -59,7 +59,7 @@ ClassUnloadEvent cuEvent = (ClassUnloadEvent)event; vm.removeReferenceType(cuEvent.classSignature()); - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { vm.printTrace("Handled Unload Event for " + cuEvent.classSignature()); } @@ -68,7 +68,7 @@ ((ReferenceTypeImpl)cpEvent.referenceType()) .markPrepared(); - if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) { vm.printTrace("Handled Prepare Event for " + cpEvent.referenceType().name()); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/JDWPException.java --- a/jdk/src/share/classes/com/sun/tools/jdi/JDWPException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/JDWPException.java Wed Jul 05 17:58:30 2017 +0200 @@ -27,7 +27,7 @@ import com.sun.jdi.*; class JDWPException extends Exception { - + private static final long serialVersionUID = -6321344442751299874L; short errorCode; JDWPException(short errorCode) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java --- a/jdk/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java Fri Dec 23 16:39:22 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,904 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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.tools.jdi; - -import java.io.*; -import java.util.*; - -/** - * Hash table based implementation of the Map interface. This implementation - * provides all of the optional Map operations, and permits null values and - * the null key. (HashMap is roughly equivalent to Hashtable, except that it - * is unsynchronized and permits nulls.) In addition, elements in the map are - * ordered and doubly linked together. - *

- * This implementation provides constant-time performance for the basic - * operations (get and put), assuming the the hash function disperses the - * elements properly among the buckets. Iteration over Collection views - * requires time proportional to its size (the number of key-value mappings) - * and returns elements in the order they are linked. In a HashMap the - * iteration would require time proportional to the capacity of the map - * plus the map size. - *

- * An instance of LinkedHashMap has two parameters that affect its efficiency: - * its capacity and its load factor. The load factor should be - * between 0.0 and 1.0. When the number of mappings in the LinkedHashMap exceeds - * the product of the load factor and the current capacity, the capacity is - * increased by calling the rehash method which requires time proportional - * to the number of key-value mappings in the map. Larger load factors - * use memory more efficiently, at the expense of larger expected time per - * lookup. - *

- * If many mappings are to be stored in a LinkedHashMap, creating it with a - * sufficiently large capacity will allow the mappings to be stored more - * efficiently than letting it perform automatic rehashing as needed to grow - * the table. - *

- * Note that this implementation is not synchronized. If - * multiple threads access a LinkedHashMap concurrently, and at least one of the - * threads modifies the LinkedHashMap structurally, it must be - * synchronized externally. (A structural modification is any operation that - * adds or deletes one or more mappings; merely changing the value associated - * with a key that is already contained in the Table is not a structural - * modification.) This is typically accomplished by synchronizing on some - * object that naturally encapsulates the LinkedHashMap. If no such object - * exists, the LinkedHashMap should be "wrapped" using the - * Collections.synchronizedSet method. This is best done at creation time, to - * prevent accidental unsynchronized access to the LinkedHashMap: - *

- *      Map m = Collections.synchronizedMap(new LinkedHashMap(...));
- * 
- *

- * The Iterators returned by the iterator methods of the Collections returned - * by all of LinkedHashMap's "collection view methods" are fail-fast: - * if the LinkedHashMap is structurally modified at any time after the Iterator - * is created, in any way except through the Iterator's own remove or add - * methods, the Iterator will throw a ConcurrentModificationException. Thus, - * in the face of concurrent modification, the Iterator fails quickly and - * cleanly, rather than risking arbitrary, non-deterministic behavior at an - * undetermined time in the future. - * - * @author Josh Bloch - * @author Arthur van Hoff - * @author Zhenghua Li - * @see Object#hashCode() - * @see java.util.Collection - * @see java.util.Map - * @see java.util.TreeMap - * @see java.util.Hashtable - * @see java.util.HashMap - */ - -import java.io.Serializable; - -public class LinkedHashMap extends AbstractMap implements Map, Serializable { - /** - * The hash table data. - */ - private transient Entry table[]; - - /** - * The head of the double linked list. - */ - private transient Entry header; - - /** - * The total number of mappings in the hash table. - */ - private transient int count; - - /** - * Rehashes the table when count exceeds this threshold. - */ - private int threshold; - - /** - * The load factor for the LinkedHashMap. - */ - private float loadFactor; - - /** - * The number of times this LinkedHashMap has been structurally modified - * Structural modifications are those that change the number of mappings in - * the LinkedHashMap or otherwise modify its internal structure (e.g., - * rehash). This field is used to make iterators on Collection-views of - * the LinkedHashMap fail-fast. (See ConcurrentModificationException). - */ - private transient int modCount = 0; - - /** - * Constructs a new, empty LinkedHashMap with the specified initial - * capacity and the specified load factor. - * - * @param initialCapacity the initial capacity of the LinkedHashMap. - * @param loadFactor a number between 0.0 and 1.0. - * @exception IllegalArgumentException if the initial capacity is less - * than or equal to zero, or if the load factor is less than - * or equal to zero. - */ - public LinkedHashMap(int initialCapacity, float loadFactor) { - if (initialCapacity < 0) - throw new IllegalArgumentException("Illegal Initial Capacity: "+ - initialCapacity); - if ((loadFactor > 1) || (loadFactor <= 0)) - throw new IllegalArgumentException("Illegal Load factor: "+ - loadFactor); - if (initialCapacity==0) - initialCapacity = 1; - this.loadFactor = loadFactor; - table = new Entry[initialCapacity]; - threshold = (int)(initialCapacity * loadFactor); - header = new Entry(-1, null, null, null); - header.before = header.after = header; - } - - /** - * Constructs a new, empty LinkedHashMap with the specified initial capacity - * and default load factor. - * - * @param initialCapacity the initial capacity of the LinkedHashMap. - */ - public LinkedHashMap(int initialCapacity) { - this(initialCapacity, 0.75f); - } - - /** - * Constructs a new, empty LinkedHashMap with a default capacity and load - * factor. - */ - public LinkedHashMap() { - this(101, 0.75f); - } - - /** - * Constructs a new LinkedHashMap with the same mappings as the given - * Map. The LinkedHashMap is created with a capacity of thrice the number - * of mappings in the given Map or 11 (whichever is greater), and a - * default load factor. - */ - public LinkedHashMap(Map t) { - this(Math.max(3*t.size(), 11), 0.75f); - putAll(t); - } - - /** - * Returns the number of key-value mappings in this Map. - */ - public int size() { - return count; - } - - /** - * Returns true if this Map contains no key-value mappings. - */ - public boolean isEmpty() { - return count == 0; - } - - /** - * Returns true if this LinkedHashMap maps one or more keys to the specified - * value. - * - * @param value value whose presence in this Map is to be tested. - */ - public boolean containsValue(Object value) { - if (value==null) { - for (Entry e = header.after; e != header; e = e.after) - if (e.value==null) - return true; - } else { - for (Entry e = header.after; e != header; e = e.after) - if (value.equals(e.value)) - return true; - } - return false; - } - - /** - * Returns true if this LinkedHashMap contains a mapping for the specified - * key. - * - * @param key key whose presence in this Map is to be tested. - */ - public boolean containsKey(Object key) { - Entry tab[] = table; - if (key != null) { - int hash = key.hashCode(); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (Entry e = tab[index]; e != null; e = e.next) - if (e.hash==hash && e.key.equals(key)) - return true; - } else { - for (Entry e = tab[0]; e != null; e = e.next) - if (e.key==null) - return true; - } - - return false; - } - - /** - * Returns the value to which this LinkedHashMap maps the specified key. - * Returns null if the LinkedHashMap contains no mapping for this key. - * A return value of null does not necessarily indicate that the - * LinkedHashMap contains no mapping for the key; it's also possible that - * the LinkedHashMap explicitly maps the key to null. The containsKey - * operation may be used to distinguish these two cases. - * - * @param key key whose associated value is to be returned. - */ - public Object get(Object key) { - Entry e = getEntry(key); - return e==null ? null : e.value; - } - - /** - * Returns the entry associated with the specified key in the LinkedHashMap. - * Returns null if the LinkedHashMap contains no mapping for this key. - */ - private Entry getEntry(Object key) { - Entry tab[] = table; - - if (key != null) { - int hash = key.hashCode(); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (Entry e = tab[index]; e != null; e = e.next) - if ((e.hash == hash) && e.key.equals(key)) - return e; - } else { - for (Entry e = tab[0]; e != null; e = e.next) - if (e.key==null) - return e; - } - - return null; - } - - /** - * Rehashes the contents of the LinkedHashMap into a LinkedHashMap with a - * larger capacity. This method is called automatically when the - * number of keys in the LinkedHashMap exceeds this LinkedHashMap's capacity - * and load factor. - */ - private void rehash() { - int oldCapacity = table.length; - Entry oldMap[] = table; - - int newCapacity = oldCapacity * 2 + 1; - Entry newMap[] = new Entry[newCapacity]; - - modCount++; - threshold = (int)(newCapacity * loadFactor); - table = newMap; - - for (Entry e = header.after; e != header; e = e.after) { - int index = (e.hash & 0x7FFFFFFF) % newCapacity; - e.next = newMap[index]; - newMap[index] = e; - } - } - - /** - * Remove an entry from the linked list. - */ - private void listRemove(Entry entry) { - if (entry == null) { - return; - } - entry.before.after = entry.after; - entry.after.before = entry.before; - } - - /** - * Add the specified entry before the specified existing entry to - * the linked list. - */ - private void listAddBefore(Entry entry, Entry existEntry) { - entry.after = existEntry; - entry.before = existEntry.before; - entry.before.after = entry; - entry.after.before = entry; - } - - /** - * Returns the position of the mapping for the specified key - * in the ordered map. - * - * @param key the specified key. - * @return index of the key mapping. - */ - public int indexOf(Object key) { - int i = 0; - if (key == null) { - for (Entry e = header.after; e != header; e = e.after, i++) - if (e.key == null) - return i; - } else { - for (Entry e = header.after; e != header; e = e.after, i++) - if(key.equals(e.key)) - return i; - } - return -1; - } - - /** - * Associates the specified value with the specified key in this - * LinkedHashMap. If the LinkedHashMap previously contained a mapping for - * this key, the old value is replaced and the position of this mapping - * entry in the double linked list remains the same. Otherwise, a new - * mapping entry is created and inserted into the list before the specified - * existing mapping entry. The method returns the previous value associated - * with the specified key, or null if there was no mapping for key. A null - * return can also indicate that the LinkedHashMap previously associated - * null with the specified key. - */ - private Object putAhead(Object key, Object value, Entry existEntry) { - // Makes sure the key is not already in the LinkedHashMap. - Entry tab[] = table; - int hash = 0; - int index = 0; - - if (key != null) { - hash = key.hashCode(); - index = (hash & 0x7FFFFFFF) % tab.length; - for (Entry e = tab[index] ; e != null ; e = e.next) { - if ((e.hash == hash) && e.key.equals(key)) { - Object old = e.value; - e.value = value; - return old; - } - } - } else { - for (Entry e = tab[0] ; e != null ; e = e.next) { - if (e.key == null) { - Object old = e.value; - e.value = value; - return old; - } - } - } - - modCount++; - if (count >= threshold) { - // Rehash the table if the threshold is exceeded - rehash(); - tab = table; - index = (hash & 0x7FFFFFFF) % tab.length; - } - - // Creates the new entry. - Entry e = new Entry(hash, key, value, tab[index]); - tab[index] = e; - listAddBefore(e, existEntry); - count++; - return null; - } - - /** - * Associates the specified value with the specified key in this - * LinkedHashMap and position the mapping at the specified index. - * If the LinkedHashMap previously contained a mapping for this key, - * the old value is replaced and the position of this mapping entry - * in the double linked list remains the same. Otherwise, a new mapping - * entry is created and inserted into the list at the specified - * position. - * - * @param index the position to put the key-value mapping. - * @param key key with which the specified value is to be associated. - * @param value value to be associated with the specified key. - * @return previous value associated with specified key, or null if there - * was no mapping for key. A null return can also indicate that - * the LinkedHashMap previously associated null with the specified - * key. - */ - public Object put(int index, Object key, Object value) { - if (index < 0 || index > count) - throw new IndexOutOfBoundsException(); - Entry e = header.after; - if (index == count) - return putAhead(key, value, header); //fast approach for append - else { - for (int i = 0; i < index; i++) - e = e.after; - return putAhead(key, value, e); - } - } - - - /** - * Associates the specified value with the specified key in this - * LinkedHashMap. If the LinkedHashMap previously contained a mapping for - * this key, the old value is replaced. The mapping entry is also appended - * to the end of the ordered linked list. - * - * @param key key with which the specified value is to be associated. - * @param value value to be associated with the specified key. - * @return previous value associated with specified key, or null if there - * was no mapping for key. A null return can also indicate that - * the LinkedHashMap previously associated null with the specified - * key. - */ - public Object put(Object key, Object value) { - return putAhead(key, value, header); - } - - /** - * Removes the mapping for this key from this LinkedHashMap if present. - * The mapping would also be removed from the double linked list. - * - * @param key key whose mapping is to be removed from the Map. - * @return previous value associated with specified key, or null if there - * was no mapping for key. A null return can also indicate that - * the LinkedHashMap previously associated null with the specified - * key. - */ - public Object remove(Object key) { - Entry tab[] = table; - - if (key != null) { - int hash = key.hashCode(); - int index = (hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index], prev = null; e != null; - prev = e, e = e.next) { - if ((e.hash == hash) && e.key.equals(key)) { - modCount++; - if (prev != null) - prev.next = e.next; - else - tab[index] = e.next; - - count--; - Object oldValue = e.value; - e.value = null; - - listRemove(e); - return oldValue; - } - } - } else { - for (Entry e = tab[0], prev = null; e != null; - prev = e, e = e.next) { - if (e.key == null) { - modCount++; - if (prev != null) - prev.next = e.next; - else - tab[0] = e.next; - - count--; - Object oldValue = e.value; - e.value = null; - - listRemove(e); - return oldValue; - } - } - } - - return null; - } - - /** - * Copies all of the mappings from the specified Map to this LinkedHashMap - * These mappings will replace any mappings that this LinkedHashMap had for - * any of the keys currently in the specified Map. - * - * @param t Mappings to be stored in this Map. - */ - public void putAll(Map t) { - Iterator i = t.entrySet().iterator(); - while (i.hasNext()) { - Map.Entry e = (Map.Entry) i.next(); - put(e.getKey(), e.getValue()); - } - } - - /** - * Removes all mappings from this LinkedHashMap. - */ - public void clear() { - Entry tab[] = table; - modCount++; - for (int index = tab.length; --index >= 0; ) - tab[index] = null; - count = 0; - header.before = header.after = header; - } - - /** - * Returns a shallow copy of this LinkedHashMap. The keys and values - * themselves are not cloned. - */ - public Object clone() { - return new LinkedHashMap(this); - } - - // Views - - private transient Set keySet = null; - private transient Set entries = null; - private transient Collection values = null; - - /** - * Returns a Set view of the keys contained in this LinkedHashMap. The Set - * is backed by the LinkedHashMap, so changes to the LinkedHashMap are - * reflected in the Set, and vice-versa. The Set supports element removal, - * which removes the corresponding mapping from the LinkedHashMap, via the - * Iterator.remove, Set.remove, removeAll retainAll, and clear operations. - * It does not support the add or addAll operations. - */ - public Set keySet() { - if (keySet == null) { - keySet = new AbstractSet() { - public Iterator iterator() { - return new HashIterator(KEYS); - } - public int size() { - return count; - } - public boolean contains(Object o) { - return containsKey(o); - } - public boolean remove(Object o) { - return LinkedHashMap.this.remove(o) != null; - } - public void clear() { - LinkedHashMap.this.clear(); - } - }; - } - return keySet; - } - - /** - * Returns a Collection view of the values contained in this LinkedHashMap. - * The Collection is backed by the LinkedHashMap, so changes to the - * LinkedHashMap are reflected in the Collection, and vice-versa. The - * Collection supports element removal, which removes the corresponding - * mapping from the LinkedHashMap, via the Iterator.remove, - * Collection.remove, removeAll, retainAll and clear operations. It does - * not support the add or addAll operations. - */ - public Collection values() { - if (values==null) { - values = new AbstractCollection() { - public Iterator iterator() { - return new HashIterator(VALUES); - } - public int size() { - return count; - } - public boolean contains(Object o) { - return containsValue(o); - } - public void clear() { - LinkedHashMap.this.clear(); - } - }; - } - return values; - } - - /** - * Returns a Collection view of the mappings contained in this - * LinkedHashMap. Each element in the returned collection is a Map.Entry. - * The Collection is backed by the LinkedHashMap, so changes to the - * LinkedHashMap are reflected in the Collection, and vice-versa. The - * Collection supports element removal, which removes the corresponding - * mapping from the LinkedHashMap, via the Iterator.remove, - * Collection.remove, removeAll, retainAll and clear operations. It does - * not support the add or addAll operations. - * - * @see java.util.Map.Entry - */ - public Set entrySet() { - if (entries==null) { - entries = new AbstractSet() { - public Iterator iterator() { - return new HashIterator(ENTRIES); - } - - public boolean contains(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - Object key = entry.getKey(); - Entry tab[] = table; - int hash = (key==null ? 0 : key.hashCode()); - int index = (hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index]; e != null; e = e.next) - if (e.hash==hash && e.equals(entry)) - return true; - return false; - } - - public boolean remove(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry entry = (Map.Entry)o; - Object key = entry.getKey(); - Entry tab[] = table; - int hash = (key==null ? 0 : key.hashCode()); - int index = (hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index], prev = null; e != null; - prev = e, e = e.next) { - if (e.hash==hash && e.equals(entry)) { - modCount++; - if (prev != null) - prev.next = e.next; - else - tab[index] = e.next; - - count--; - e.value = null; - listRemove(e); - return true; - } - } - return false; - } - - public int size() { - return count; - } - - public void clear() { - LinkedHashMap.this.clear(); - } - }; - } - - return entries; - } - - /** - * Compares the specified Object with this Map for equality. - * Returns true if the given object is also a LinkedHashMap and the two - * Maps represent the same mappings in the same order. More formally, - * two Maps t1 and t2 represent the same mappings - * if t1.keySet().equals(t2.keySet()) and for every - * key k in t1.keySet(), - * (t1.get(k)==null ? t2.get(k)==null : t1.get(k).equals(t2.get(k))) - * . - *

- * This implementation first checks if the specified Object is this Map; - * if so it returns true. Then, it checks if the specified Object is - * a Map whose size is identical to the size of this Set; if not, it - * it returns false. If so, it iterates over this Map and the specified - * Map's entrySet() Collection, and checks that the specified Map contains - * each mapping that this Map contains at the same position. If the - * specified Map fails to contain such a mapping in the right order, false - * is returned. If the iteration completes, true is returned. - * - * @param o Object to be compared for equality with this Map. - * @return true if the specified Object is equal to this Map. - * - */ - public boolean equals(Object o) { - if (o == this) - return true; - - if (!(o instanceof LinkedHashMap)) - return false; - LinkedHashMap t = (LinkedHashMap) o; - if (t.size() != size()) - return false; - - Iterator i1 = entrySet().iterator(); - Iterator i2 = t.entrySet().iterator(); - - while (i1.hasNext()) { - Entry e1 = (Entry) i1.next(); - Entry e2 = (Entry) i2.next(); - - Object key1 = e1.getKey(); - Object value1 = e1.getValue(); - Object key2 = e2.getKey(); - Object value2 = e2.getValue(); - - if ((key1 == null ? key2 == null : key1.equals(key2)) && - (value1 == null ? value2 == null : value1.equals(value2))) { - continue; - } else { - return false; - } - } - return true; - } - - /** - * LinkedHashMap collision list entry. - */ - private static class Entry implements Map.Entry { - int hash; - Object key; - Object value; - Entry next; - - // These fields comprise the doubly linked list that is used for - // iteration. - Entry before, after; - - Entry(int hash, Object key, Object value, Entry next) { - this.hash = hash; - this.key = key; - this.value = value; - this.next = next; - } - - // Map.Entry Ops - - public Object getKey() { - return key; - } - - public Object getValue() { - return value; - } - - public Object setValue(Object value) { - Object oldValue = this.value; - this.value = value; - return oldValue; - } - - public boolean equals(Object o) { - if (!(o instanceof Map.Entry)) - return false; - Map.Entry e = (Map.Entry)o; - - return (key==null ? e.getKey()==null : key.equals(e.getKey())) && - (value==null ? e.getValue()==null : value.equals(e.getValue())); - } - - public int hashCode() { - return hash ^ (value==null ? 0 : value.hashCode()); - } - - public String toString() { - return key+"="+value; - } - } - - // Types of Iterators - private static final int KEYS = 0; - private static final int VALUES = 1; - private static final int ENTRIES = 2; - - private class HashIterator implements Iterator { - private Entry[] table = LinkedHashMap.this.table; - private Entry entry = null; - private Entry lastReturned = null; - private int type; - - /** - * The modCount value that the iterator believes that the backing - * List should have. If this expectation is violated, the iterator - * has detected concurrent modification. - */ - private int expectedModCount = modCount; - - HashIterator(int type) { - this.type = type; - this.entry = LinkedHashMap.this.header.after; - } - - public boolean hasNext() { - return entry != header; - } - - public Object next() { - if (modCount != expectedModCount) - throw new ConcurrentModificationException(); - if (entry == LinkedHashMap.this.header) - throw new NoSuchElementException(); - - Entry e = lastReturned = entry; - entry = e.after; - return type == KEYS ? e.key : (type == VALUES ? e.value : e); - } - - public void remove() { - if (lastReturned == null) - throw new IllegalStateException(); - if (modCount != expectedModCount) - throw new ConcurrentModificationException(); - - Entry[] tab = LinkedHashMap.this.table; - int index = (lastReturned.hash & 0x7FFFFFFF) % tab.length; - - for (Entry e = tab[index], prev = null; e != null; - prev = e, e = e.next) { - if (e == lastReturned) { - modCount++; - expectedModCount++; - if (prev == null) - tab[index] = e.next; - else - prev.next = e.next; - count--; - listRemove(e); - lastReturned = null; - return; - } - } - throw new ConcurrentModificationException(); - } - } - - /** - * Save the state of the LinkedHashMap to a stream (i.e., serialize it). - * The objects will be written out in the order they are linked - * in the list. - */ - private void writeObject(java.io.ObjectOutputStream s) - throws IOException - { - // Write out the threshold, loadfactor, and any hidden stuff - s.defaultWriteObject(); - - // Write out number of buckets - s.writeInt(table.length); - - // Write out size (number of Mappings) - s.writeInt(count); - - // Write out keys and values (alternating) - for (Entry e = header.after; e != header; e = e.after) { - s.writeObject(e.key); - s.writeObject(e.value); - } - } - - /** - * Reconstitute the LinkedHashMap from a stream (i.e., deserialize it). - */ - private void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException - { - // Read in the threshold, loadfactor, and any hidden stuff - s.defaultReadObject(); - - // Read in number of buckets and allocate the bucket array; - int numBuckets = s.readInt(); - table = new Entry[numBuckets]; - header = new Entry(-1, null, null, null); - header.before = header; - header.after = header; - - // Read in size (number of Mappings) - int size = s.readInt(); - - // Read the keys and values, and put the mappings in the LinkedHashMap - for (int i=0; i signatures = parser.argumentSignatures(); if (signatures.size() != argSize) { throw new IllegalArgumentException("Invalid argument count: expected " + diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/MirrorImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/MirrorImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/MirrorImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -83,8 +83,8 @@ * Throw NullPointerException on null mirrors. * Throw VMMismatchException on wrong VM. */ - void validateMirrors(Collection mirrors) { - Iterator iter = mirrors.iterator(); + void validateMirrors(Collection mirrors) { + Iterator iter = mirrors.iterator(); while (iter.hasNext()) { MirrorImpl mirror = (MirrorImpl)iter.next(); if (!vm.equals(mirror.vm)) { @@ -96,8 +96,8 @@ * Allow null mirrors. * Throw VMMismatchException on wrong VM. */ - void validateMirrorsOrNulls(Collection mirrors) { - Iterator iter = mirrors.iterator(); + void validateMirrorsOrNulls(Collection mirrors) { + Iterator iter = mirrors.iterator(); while (iter.hasNext()) { MirrorImpl mirror = (MirrorImpl)iter.next(); if ((mirror != null) && !vm.equals(mirror.vm)) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -110,7 +110,7 @@ public boolean vmNotSuspended(VMAction action) { // make sure that cache and listener management are synchronized synchronized (vm.state()) { - if (cache != null && (vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if (cache != null && (vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("Clearing temporary cache for " + description()); } disableCache(); @@ -163,8 +163,8 @@ public Value getValue(Field sig) { List list = new ArrayList(1); list.add(sig); - Map map = getValues(list); - return(Value)map.get(sig); + Map map = getValues(list); + return map.get(sig); } public Map getValues(List theFields) { @@ -487,7 +487,7 @@ info = JDWP.ObjectReference.MonitorInfo.process(vm, this); if (local != null) { local.monitorInfo = info; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("ObjectReference " + uniqueID() + " temporarily caching monitor info"); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java Wed Jul 05 17:58:30 2017 +0200 @@ -127,7 +127,7 @@ } else { if (lib.equals("dt_shmem")) { try { - Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); + Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); ts = (TransportService)c.newInstance(); } catch (Exception x) { } } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java --- a/jdk/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java Wed Jul 05 17:58:30 2017 +0200 @@ -53,7 +53,7 @@ super(); try { - Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); + Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); transportService = (TransportService)c.newInstance(); transport = new Transport() { public String name() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -99,7 +99,7 @@ // Fetch all methods for the class, check performance impact // Needs no synchronization now, since methods() returns // unmodifiable local data - Iterator it = methods().iterator(); + Iterator it = methods().iterator(); while (it.hasNext()) { MethodImpl method = (MethodImpl)it.next(); if (method.ref() == ref) { @@ -113,7 +113,7 @@ // Fetch all fields for the class, check performance impact // Needs no synchronization now, since fields() returns // unmodifiable local data - Iterator it = fields().iterator(); + Iteratorit = fields().iterator(); while (it.hasNext()) { FieldImpl field = (FieldImpl)it.next(); if (field.ref() == ref) { @@ -385,7 +385,7 @@ /* Add inherited, visible fields */ List types = inheritedTypes(); - Iterator iter = types.iterator(); + Iterator iter = types.iterator(); while (iter.hasNext()) { /* * TO DO: Be defensive and check for cyclic interface inheritance @@ -419,7 +419,7 @@ /* Add inherited fields */ List types = inheritedTypes(); - Iterator iter = types.iterator(); + Iterator iter = types.iterator(); while (iter.hasNext()) { ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); type.addAllFields(fieldList, typeSet); @@ -434,13 +434,10 @@ } public Field fieldByName(String fieldName) { - java.util.List searchList; - Field f; - - searchList = visibleFields(); + List searchList = visibleFields(); for (int i=0; i nestedTypes() { - List all = vm.allClasses(); + List all = vm.allClasses(); List nested = new ArrayList(); String outername = name(); int outerlen = outername.length(); - Iterator iter = all.iterator(); + Iterator iter = all.iterator(); while (iter.hasNext()) { - ReferenceType refType = (ReferenceType)iter.next(); + ReferenceType refType = iter.next(); String name = refType.name(); int len = name.length(); /* The separator is historically '$' but could also be '#' */ @@ -598,8 +595,8 @@ public Value getValue(Field sig) { List list = new ArrayList(1); list.add(sig); - Map map = getValues(list); - return(Value)map.get(sig); + Map map = getValues(list); + return map.get(sig); } @@ -847,7 +844,7 @@ SDE.Stratum stratum = stratum(stratumID); List list = new ArrayList(); // location list - for (Iterator iter = methods().iterator(); iter.hasNext(); ) { + for (Iterator iter = methods().iterator(); iter.hasNext(); ) { MethodImpl method = (MethodImpl)iter.next(); try { list.addAll( @@ -887,7 +884,7 @@ List list = new ArrayList(); - Iterator iter = methods.iterator(); + Iterator iter = methods.iterator(); while(iter.hasNext()) { MethodImpl method = (MethodImpl)iter.next(); // eliminate native and abstract to eliminate diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ShortValueImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -79,7 +79,7 @@ } public short shortValue() { - return(short)value; + return value; } public int intValue() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java --- a/jdk/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Wed Jul 05 17:58:30 2017 +0200 @@ -64,7 +64,7 @@ * transport or the socket transport */ try { - Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); + Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); transportService = (TransportService)c.newInstance(); transport = new Transport() { public String name() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java --- a/jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java Wed Jul 05 17:58:30 2017 +0200 @@ -178,7 +178,7 @@ // Closing a queue causes a VMDisconnectEvent to // be put onto the queue. synchronized(eventQueues) { - Iterator iter = eventQueues.iterator(); + Iterator iter = eventQueues.iterator(); while (iter.hasNext()) { ((EventQueueImpl)iter.next()).close(); } @@ -187,9 +187,9 @@ // indirectly throw VMDisconnectedException to // command requesters. synchronized(waitingQueue) { - Iterator iter = waitingQueue.values().iterator(); + Iterator iter = waitingQueue.values().iterator(); while (iter.hasNext()) { - Packet packet = (Packet)iter.next(); + Packet packet = iter.next(); synchronized(packet) { packet.notify(); } @@ -252,7 +252,7 @@ void notifyDequeueEventSet() { int maxQueueSize = 0; synchronized(eventQueues) { - Iterator iter = eventQueues.iterator(); + Iterator iter = eventQueues.iterator(); while (iter.hasNext()) { EventQueueImpl queue = (EventQueueImpl)iter.next(); maxQueueSize = Math.max(maxQueueSize, queue.size()); @@ -265,7 +265,7 @@ int maxQueueSize = 0; synchronized(eventQueues) { - Iterator iter = eventQueues.iterator(); + Iterator iter = eventQueues.iterator(); while (iter.hasNext()) { EventQueueImpl queue = (EventQueueImpl)iter.next(); queue.enqueue(eventSet); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ThreadAction.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadAction.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadAction.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,7 @@ * with JDI events. */ class ThreadAction extends EventObject { + private static final long serialVersionUID = 5690763191100515283L; // Event ids /*static final int THREAD_SUSPENDED = 1;*/ static final int THREAD_RESUMABLE = 2; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -118,7 +118,7 @@ .process(vm, this); if (local != null) { local.kids = kids; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching children "); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -240,7 +240,7 @@ public void stop(ObjectReference throwable) throws InvalidTypeException { validateMirror(throwable); // Verify that the given object is a Throwable instance - List list = vm.classesByName("java.lang.Throwable"); + List list = vm.classesByName("java.lang.Throwable"); ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0); if ((throwable == null) || !throwableClass.isAssignableFrom(throwable)) { @@ -296,10 +296,10 @@ try { StackFrame frame = frame(0); Location location = frame.location(); - List requests = vm.eventRequestManager().breakpointRequests(); - Iterator iter = requests.iterator(); + List requests = vm.eventRequestManager().breakpointRequests(); + Iterator iter = requests.iterator(); while (iter.hasNext()) { - BreakpointRequest request = (BreakpointRequest)iter.next(); + BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } @@ -352,8 +352,8 @@ } public StackFrame frame(int index) throws IncompatibleThreadStateException { - List list = privateFrames(index, 1); - return (StackFrame)list.get(0); + List list = privateFrames(index, 1); + return list.get(0); } /** @@ -447,7 +447,7 @@ snapshot.ownedMonitors = Arrays.asList( (ObjectReference[])JDWP.ThreadReference.OwnedMonitors. process(vm, this).owned); - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching owned monitors"+ " (count = " + snapshot.ownedMonitors.size() + ")"); @@ -475,7 +475,7 @@ process(vm, this).monitor; snapshot.triedCurrentContended = true; if ((snapshot.contendedMonitor != null) && - ((vm.traceFlags & vm.TRACE_OBJREFS) != 0)) { + ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0)) { vm.printTrace(description() + " temporarily caching contended monitor"+ " (id = " + snapshot.contendedMonitor.uniqueID() + ")"); @@ -509,7 +509,7 @@ snapshot.ownedMonitorsInfo.add(mon); } - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace(description() + " temporarily caching owned monitors"+ " (count = " + snapshot.ownedMonitorsInfo.size() + ")"); @@ -601,9 +601,9 @@ void removeListener(ThreadListener listener) { synchronized (vm.state()) { - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); + WeakReference ref = iter.next(); if (listener.equals(ref.get())) { iter.remove(); break; @@ -619,10 +619,10 @@ */ private void processThreadAction(ThreadAction action) { synchronized (vm.state()) { - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); - ThreadListener listener = (ThreadListener)ref.get(); + WeakReference ref = iter.next(); + ThreadListener listener = ref.get(); if (listener != null) { switch (action.id()) { case ThreadAction.THREAD_RESUMABLE: diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/VMAction.java --- a/jdk/src/share/classes/com/sun/tools/jdi/VMAction.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/VMAction.java Wed Jul 05 17:58:30 2017 +0200 @@ -33,6 +33,8 @@ * with JDI events. */ class VMAction extends EventObject { + private static final long serialVersionUID = -1701944679310296090L; + // Event ids static final int VM_SUSPENDED = 1; static final int VM_NOT_SUSPENDED = 2; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/VMState.java --- a/jdk/src/share/classes/com/sun/tools/jdi/VMState.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/VMState.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,7 +34,7 @@ private final VirtualMachineImpl vm; // Listeners - private final List listeners = new ArrayList(); // synchronized (this) + private final List> listeners = new ArrayList>(); // synchronized (this) private boolean notifyingListeners = false; // synchronized (this) /* @@ -129,7 +129,7 @@ */ synchronized void thaw(ThreadReference resumingThread) { if (cache != null) { - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("Clearing VM suspended cache"); } disableCache(); @@ -142,10 +142,10 @@ // Prevent recursion notifyingListeners = true; - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); - VMListener listener = (VMListener)ref.get(); + WeakReference ref = iter.next(); + VMListener listener = ref.get(); if (listener != null) { boolean keep = true; switch (action.id()) { @@ -178,9 +178,9 @@ } synchronized void removeListener(VMListener listener) { - Iterator iter = listeners.iterator(); + Iterator> iter = listeners.iterator(); while (iter.hasNext()) { - WeakReference ref = (WeakReference)iter.next(); + WeakReference ref = iter.next(); if (listener.equals(ref.get())) { iter.remove(); break; @@ -202,7 +202,7 @@ process(vm).threads); if (local != null) { local.threads = threads; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace("Caching all threads (count = " + threads.size() + ") while VM suspended"); } @@ -229,7 +229,7 @@ process(vm).groups); if (local != null) { local.groups = groups; - if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { + if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) { vm.printTrace( "Caching top level thread groups (count = " + groups.size() + ") while VM suspended"); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java --- a/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -300,9 +300,9 @@ if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } - Iterator it = classToBytes.entrySet().iterator(); + Iterator it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { - Map.Entry entry = (Map.Entry)it.next(); + Map.Entry entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses @@ -801,7 +801,7 @@ * we can't differentiate here, we first remove all * matching classes from our cache... */ - Iterator iter = typesBySignature.iterator(); + Iterator iter = typesBySignature.iterator(); int matches = 0; while (iter.hasNext()) { ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); @@ -833,7 +833,7 @@ if (typesByID == null) { return new ArrayList(0); } - Iterator iter = typesBySignature.iterator(); + Iterator iter = typesBySignature.iterator(); List list = new ArrayList(); while (iter.hasNext()) { ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); @@ -1041,10 +1041,10 @@ } Type findBootType(String signature) throws ClassNotLoadedException { - List types = allClasses(); - Iterator iter = types.iterator(); + List types = allClasses(); + Iterator iter = types.iterator(); while (iter.hasNext()) { - ReferenceType type = (ReferenceType)iter.next(); + ReferenceType type = iter.next(); if ((type.classLoader() == null) && (type.signature().equals(signature))) { return type; @@ -1227,7 +1227,7 @@ } private void processQueue() { - Reference ref; + Reference ref; //if ((traceFlags & TRACE_OBJREFS) != 0) { // printTrace("Checking for softly reachable objects"); //} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/awt/AWTEvent.java --- a/jdk/src/share/classes/java/awt/AWTEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/awt/AWTEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -278,9 +278,9 @@ private static synchronized Field get_InputEvent_CanAccessSystemClipboard() { if (inputEvent_CanAccessSystemClipboard_Field == null) { inputEvent_CanAccessSystemClipboard_Field = - (Field)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Field run() { Field field = null; try { field = InputEvent.class. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/awt/AWTEventMulticaster.java --- a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java Wed Jul 05 17:58:30 2017 +0200 @@ -953,7 +953,7 @@ * AWTEventMulticaster. Additionally, only listeners of type listenerType * are counted. Method modified to fix bug 4513402. -bchristi */ - private static int getListenerCount(EventListener l, Class listenerType) { + private static int getListenerCount(EventListener l, Class listenerType) { if (l instanceof AWTEventMulticaster) { AWTEventMulticaster mc = (AWTEventMulticaster)l; return getListenerCount(mc.a, listenerType) + @@ -1017,6 +1017,7 @@ * * @since 1.4 */ + @SuppressWarnings("unchecked") public static T[] getListeners(EventListener l, Class listenerType) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/awt/Component.java --- a/jdk/src/share/classes/java/awt/Component.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/awt/Component.java Wed Jul 05 17:58:30 2017 +0200 @@ -382,7 +382,7 @@ * @serial * @see #add */ - Vector popups; + Vector popups; /** * A component's name. @@ -441,7 +441,7 @@ * @see #getFocusTraversalKeys * @since 1.4 */ - Set[] focusTraversalKeys; + Set[] focusTraversalKeys; private static final String[] focusTraversalKeyPropertyNames = { "forwardFocusTraversalKeys", @@ -598,12 +598,12 @@ initIDs(); } - String s = (String) java.security.AccessController.doPrivileged( - new GetPropertyAction("awt.image.incrementaldraw")); + String s = java.security.AccessController.doPrivileged( + new GetPropertyAction("awt.image.incrementaldraw")); isInc = (s == null || s.equals("true")); - s = (String) java.security.AccessController.doPrivileged( - new GetPropertyAction("awt.image.redrawrate")); + s = java.security.AccessController.doPrivileged( + new GetPropertyAction("awt.image.redrawrate")); incRate = (s != null) ? Integer.parseInt(s) : 100; } @@ -986,6 +986,7 @@ appContext = AppContext.getAppContext(); } + @SuppressWarnings({"rawtypes", "unchecked"}) void initializeFocusTraversalKeys() { focusTraversalKeys = new Set[3]; } @@ -1369,13 +1370,13 @@ throw new HeadlessException(); } - PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - return MouseInfo.getPointerInfo(); - } - } - ); + PointerInfo pi = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public PointerInfo run() { + return MouseInfo.getPointerInfo(); + } + } + ); synchronized (getTreeLock()) { Component inTheSameWindow = findUnderMouseInWindow(pi); @@ -2334,7 +2335,7 @@ peer.setBounds(nativeX, nativeY, width, height, op); } - + @SuppressWarnings("deprecation") private void notifyNewBounds(boolean resized, boolean moved) { if (componentListener != null || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0 @@ -4690,6 +4691,7 @@ dispatchEventImpl(e); } + @SuppressWarnings("deprecation") void dispatchEventImpl(AWTEvent e) { int id = e.getID(); @@ -5242,7 +5244,7 @@ * @since 1.4 */ public synchronized ComponentListener[] getComponentListeners() { - return (ComponentListener[]) (getListeners(ComponentListener.class)); + return getListeners(ComponentListener.class); } /** @@ -5311,7 +5313,7 @@ * @since 1.4 */ public synchronized FocusListener[] getFocusListeners() { - return (FocusListener[]) (getListeners(FocusListener.class)); + return getListeners(FocusListener.class); } /** @@ -5402,7 +5404,7 @@ * @since 1.4 */ public synchronized HierarchyListener[] getHierarchyListeners() { - return (HierarchyListener[])(getListeners(HierarchyListener.class)); + return getListeners(HierarchyListener.class); } /** @@ -5564,8 +5566,7 @@ * @since 1.4 */ public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners() { - return (HierarchyBoundsListener[]) - (getListeners(HierarchyBoundsListener.class)); + return getListeners(HierarchyBoundsListener.class); } /* @@ -5644,7 +5645,7 @@ * @since 1.4 */ public synchronized KeyListener[] getKeyListeners() { - return (KeyListener[]) (getListeners(KeyListener.class)); + return getListeners(KeyListener.class); } /** @@ -5713,7 +5714,7 @@ * @since 1.4 */ public synchronized MouseListener[] getMouseListeners() { - return (MouseListener[]) (getListeners(MouseListener.class)); + return getListeners(MouseListener.class); } /** @@ -5782,7 +5783,7 @@ * @since 1.4 */ public synchronized MouseMotionListener[] getMouseMotionListeners() { - return (MouseMotionListener[]) (getListeners(MouseMotionListener.class)); + return getListeners(MouseMotionListener.class); } /** @@ -5855,7 +5856,7 @@ * @since 1.4 */ public synchronized MouseWheelListener[] getMouseWheelListeners() { - return (MouseWheelListener[]) (getListeners(MouseWheelListener.class)); + return getListeners(MouseWheelListener.class); } /** @@ -5922,7 +5923,7 @@ * @since 1.4 */ public synchronized InputMethodListener[] getInputMethodListeners() { - return (InputMethodListener[]) (getListeners(InputMethodListener.class)); + return getListeners(InputMethodListener.class); } /** @@ -5967,6 +5968,7 @@ * * @since 1.3 */ + @SuppressWarnings("unchecked") public T[] getListeners(Class listenerType) { EventListener l = null; if (listenerType == ComponentListener.class) { @@ -6909,7 +6911,7 @@ int npopups = (popups != null? popups.size() : 0); for (int i = 0 ; i < npopups ; i++) { - PopupMenu popup = (PopupMenu)popups.elementAt(i); + PopupMenu popup = popups.elementAt(i); popup.addNotify(); } @@ -6979,7 +6981,7 @@ int npopups = (popups != null? popups.size() : 0); for (int i = 0 ; i < npopups ; i++) { - PopupMenu popup = (PopupMenu)popups.elementAt(i); + PopupMenu popup = popups.elementAt(i); popup.removeNotify(); } // If there is any input context for this component, notify @@ -7238,7 +7240,7 @@ // would erroneously generate an IllegalArgumentException for // DOWN_CYCLE_TRAVERSAL_KEY. final void setFocusTraversalKeys_NoIDCheck(int id, Set keystrokes) { - Set oldKeys; + Set oldKeys; synchronized (this) { if (focusTraversalKeys == null) { @@ -7246,20 +7248,12 @@ } if (keystrokes != null) { - for (Iterator iter = keystrokes.iterator(); iter.hasNext(); ) { - Object obj = iter.next(); - - if (obj == null) { + for (AWTKeyStroke keystroke : keystrokes ) { + + if (keystroke == null) { throw new IllegalArgumentException("cannot set null focus traversal key"); } - // Fix for 6195828: - //According to javadoc this method should throw IAE instead of ClassCastException - if (!(obj instanceof AWTKeyStroke)) { - throw new IllegalArgumentException("object is expected to be AWTKeyStroke"); - } - AWTKeyStroke keystroke = (AWTKeyStroke)obj; - if (keystroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED) { throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events"); } @@ -7279,16 +7273,16 @@ oldKeys = focusTraversalKeys[id]; focusTraversalKeys[id] = (keystrokes != null) - ? Collections.unmodifiableSet(new HashSet(keystrokes)) + ? Collections.unmodifiableSet(new HashSet(keystrokes)) : null; } firePropertyChange(focusTraversalKeyPropertyNames[id], oldKeys, keystrokes); } - final Set getFocusTraversalKeys_NoIDCheck(int id) { + final Set getFocusTraversalKeys_NoIDCheck(int id) { // Okay to return Set directly because it is an unmodifiable view - Set keystrokes = (focusTraversalKeys != null) + Set keystrokes = (focusTraversalKeys != null) ? focusTraversalKeys[id] : null; @@ -7686,7 +7680,7 @@ } Window window = getContainingWindow(); - if (window == null || !((Window)window).isFocusableWindow()) { + if (window == null || !window.isFocusableWindow()) { if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("Component doesn't have toplevel"); } @@ -8025,7 +8019,7 @@ popup.parent.remove(popup); } if (popups == null) { - popups = new Vector(); + popups = new Vector(); } popups.addElement(popup); popup.parent = this; @@ -8044,6 +8038,7 @@ * @see #add(PopupMenu) * @since JDK1.1 */ + @SuppressWarnings("unchecked") public void remove(MenuComponent popup) { synchronized (getTreeLock()) { if (popups == null) { @@ -8556,26 +8551,26 @@ // // Swing classes MUST be loaded by the bootstrap class loader, // otherwise we don't consider them. - for (Class klass = Component.this.getClass(); klass != null; + for (Class klass = Component.this.getClass(); klass != null; klass = klass.getSuperclass()) { if (klass.getPackage() == swingPackage && klass.getClassLoader() == null) { - final Class swingClass = klass; + final Class swingClass = klass; // Find the first override of the compWriteObjectNotify method - Method[] methods = (Method[])AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return swingClass.getDeclaredMethods(); - } - }); + Method[] methods = AccessController.doPrivileged( + new PrivilegedAction() { + public Method[] run() { + return swingClass.getDeclaredMethods(); + } + }); for (int counter = methods.length - 1; counter >= 0; counter--) { final Method method = methods[counter]; if (method.getName().equals("compWriteObjectNotify")){ // We found it, use doPrivileged to make it accessible // to use. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { method.setAccessible(true); return null; } @@ -8804,7 +8799,7 @@ if (popups != null) { int npopups = popups.size(); for (int i = 0 ; i < npopups ; i++) { - PopupMenu popup = (PopupMenu)popups.elementAt(i); + PopupMenu popup = popups.elementAt(i); popup.parent = this; } } @@ -9658,7 +9653,7 @@ if (obj == null) return false; if (className == null) return false; - Class cls = obj.getClass(); + Class cls = obj.getClass(); while (cls != null) { if (cls.getName().equals(className)) { return true; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/awt/Font.java --- a/jdk/src/share/classes/java/awt/Font.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/awt/Font.java Wed Jul 05 17:58:30 2017 +0200 @@ -254,7 +254,7 @@ * @serial * @see #getAttributes() */ - private Hashtable fRequestedAttributes; + private Hashtable fRequestedAttributes; /* * Constants to be used for logical font family names. @@ -446,6 +446,7 @@ // We implement this functionality in a package-private method // to insure that it cannot be overridden by client subclasses. // DO NOT INVOKE CLIENT CODE ON THIS THREAD! + @SuppressWarnings("deprecation") final FontPeer getPeer_NoClientCode() { if(peer == null) { Toolkit tk = Toolkit.getDefaultToolkit(); @@ -907,11 +908,11 @@ break; } if (tracker != null) { - if (totalSize+bytesRead > tracker.MAX_FILE_SIZE) { + if (totalSize+bytesRead > CreatedFontTracker.MAX_FILE_SIZE) { throw new IOException("File too big."); } if (totalSize+tracker.getNumBytes() > - tracker.MAX_TOTAL_BYTES) + CreatedFontTracker.MAX_TOTAL_BYTES) { throw new IOException("Total files too big."); } @@ -2126,11 +2127,11 @@ return false; // REMIND always safe, but prevents caller optimize } - private transient SoftReference flmref; + private transient SoftReference flmref; private FontLineMetrics defaultLineMetrics(FontRenderContext frc) { FontLineMetrics flm = null; if (flmref == null - || (flm = (FontLineMetrics)flmref.get()) == null + || (flm = flmref.get()) == null || !flm.frc.equals(frc)) { /* The device transform in the frc is not used in obtaining line @@ -2194,7 +2195,7 @@ ssOffset, italicAngle); flm = new FontLineMetrics(0, cm, frc); - flmref = new SoftReference(flm); + flmref = new SoftReference(flm); } return (FontLineMetrics)flm.clone(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/awt/Toolkit.java --- a/jdk/src/share/classes/java/awt/Toolkit.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/awt/Toolkit.java Wed Jul 05 17:58:30 2017 +0200 @@ -706,9 +706,9 @@ final Properties properties = new Properties(); - atNames = (String)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + atNames = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { // Try loading the per-user accessibility properties file. try { @@ -798,7 +798,7 @@ while (parser.hasMoreTokens()) { atName = parser.nextToken(); try { - Class clazz; + Class clazz; if (cl != null) { clazz = cl.loadClass(atName); } else { @@ -860,8 +860,8 @@ java.lang.Compiler.disable(); java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + new java.security.PrivilegedAction() { + public Void run() { String nm = null; Class cls = null; try { @@ -1653,8 +1653,8 @@ static { java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + new java.security.PrivilegedAction() { + public Void run() { try { resources = ResourceBundle.getBundle("sun.awt.resources.awt", @@ -1984,7 +1984,7 @@ private int[] calls = new int[LONG_BITS]; private static volatile long enabledOnToolkitMask; private AWTEventListener eventListener = null; - private WeakHashMap listener2SelectiveListener = new WeakHashMap(); + private WeakHashMap listener2SelectiveListener = new WeakHashMap<>(); /* * Extracts a "pure" AWTEventListener from a AWTEventListenerProxy, @@ -2051,7 +2051,7 @@ } synchronized (this) { SelectiveAWTEventListener selectiveListener = - (SelectiveAWTEventListener)listener2SelectiveListener.get(localL); + listener2SelectiveListener.get(localL); if (selectiveListener == null) { // Create a new selectiveListener. @@ -2121,7 +2121,7 @@ synchronized (this) { SelectiveAWTEventListener selectiveListener = - (SelectiveAWTEventListener)listener2SelectiveListener.get(localL); + listener2SelectiveListener.get(localL); if (selectiveListener != null) { listener2SelectiveListener.remove(localL); @@ -2244,7 +2244,7 @@ synchronized (this) { EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class); - java.util.List list = new ArrayList(la.length); + java.util.List list = new ArrayList<>(la.length); for (int i = 0; i < la.length; i++) { SelectiveAWTEventListener sael = (SelectiveAWTEventListener)la[i]; @@ -2254,7 +2254,7 @@ sael.getListener())); } } - return (AWTEventListener[])list.toArray(new AWTEventListener[0]); + return list.toArray(new AWTEventListener[0]); } } @@ -2457,7 +2457,9 @@ } } + @SuppressWarnings("serial") private static class DesktopPropertyChangeSupport extends PropertyChangeSupport { + private static final StringBuilder PROP_CHANGE_SUPPORT_KEY = new StringBuilder("desktop property change support key"); private final Object source; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/awt/image/ColorModel.java --- a/jdk/src/share/classes/java/awt/image/ColorModel.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/awt/image/ColorModel.java Wed Jul 05 17:58:30 2017 +0200 @@ -357,7 +357,7 @@ this.transparency = transparency; } - nBits = (int[]) bits.clone(); + nBits = bits.clone(); this.pixel_bits = pixel_bits; if (pixel_bits <= 0) { throw new IllegalArgumentException("Number of pixel bits must "+ @@ -474,7 +474,7 @@ */ public int[] getComponentSize() { if (nBits != null) { - return (int[]) nBits.clone(); + return nBits.clone(); } return null; @@ -1692,10 +1692,10 @@ static short[] s8Tol16 = null; // 8-bit non-linear sRGB to 16-bit linear LUT // Maps to hold LUTs for grayscale conversions - static Map g8Tos8Map = null; // 8-bit gray values to 8-bit sRGB values - static Map lg16Toog8Map = null; // 16-bit linear to 8-bit "other" gray - static Map g16Tos8Map = null; // 16-bit gray values to 8-bit sRGB values - static Map lg16Toog16Map = null; // 16-bit linear to 16-bit "other" gray + static Map g8Tos8Map = null; // 8-bit gray values to 8-bit sRGB values + static Map lg16Toog8Map = null; // 16-bit linear to 8-bit "other" gray + static Map g16Tos8Map = null; // 16-bit gray values to 8-bit sRGB values + static Map lg16Toog16Map = null; // 16-bit linear to 16-bit "other" gray static boolean isLinearRGBspace(ColorSpace cs) { // Note: CMM.LINEAR_RGBspace will be null if the linear @@ -1799,7 +1799,7 @@ return getLinearRGB8TosRGB8LUT(); } if (g8Tos8Map != null) { - byte[] g8Tos8LUT = (byte []) g8Tos8Map.get(grayCS); + byte[] g8Tos8LUT = g8Tos8Map.get(grayCS); if (g8Tos8LUT != null) { return g8Tos8LUT; } @@ -1827,7 +1827,7 @@ g8Tos8LUT[i] = tmp[j]; } if (g8Tos8Map == null) { - g8Tos8Map = Collections.synchronizedMap(new WeakHashMap(2)); + g8Tos8Map = Collections.synchronizedMap(new WeakHashMap(2)); } g8Tos8Map.put(grayCS, g8Tos8LUT); return g8Tos8LUT; @@ -1840,7 +1840,7 @@ */ static byte[] getLinearGray16ToOtherGray8LUT(ICC_ColorSpace grayCS) { if (lg16Toog8Map != null) { - byte[] lg16Toog8LUT = (byte []) lg16Toog8Map.get(grayCS); + byte[] lg16Toog8LUT = lg16Toog8Map.get(grayCS); if (lg16Toog8LUT != null) { return lg16Toog8LUT; } @@ -1866,7 +1866,7 @@ (byte) (((float) (tmp[i] & 0xffff)) * (1.0f /257.0f) + 0.5f); } if (lg16Toog8Map == null) { - lg16Toog8Map = Collections.synchronizedMap(new WeakHashMap(2)); + lg16Toog8Map = Collections.synchronizedMap(new WeakHashMap(2)); } lg16Toog8Map.put(grayCS, lg16Toog8LUT); return lg16Toog8LUT; @@ -1884,7 +1884,7 @@ return getLinearRGB16TosRGB8LUT(); } if (g16Tos8Map != null) { - byte[] g16Tos8LUT = (byte []) g16Tos8Map.get(grayCS); + byte[] g16Tos8LUT = g16Tos8Map.get(grayCS); if (g16Tos8LUT != null) { return g16Tos8LUT; } @@ -1916,7 +1916,7 @@ (byte) (((float) (tmp[j] & 0xffff)) * (1.0f /257.0f) + 0.5f); } if (g16Tos8Map == null) { - g16Tos8Map = Collections.synchronizedMap(new WeakHashMap(2)); + g16Tos8Map = Collections.synchronizedMap(new WeakHashMap(2)); } g16Tos8Map.put(grayCS, g16Tos8LUT); return g16Tos8LUT; @@ -1929,7 +1929,7 @@ */ static short[] getLinearGray16ToOtherGray16LUT(ICC_ColorSpace grayCS) { if (lg16Toog16Map != null) { - short[] lg16Toog16LUT = (short []) lg16Toog16Map.get(grayCS); + short[] lg16Toog16LUT = lg16Toog16Map.get(grayCS); if (lg16Toog16LUT != null) { return lg16Toog16LUT; } @@ -1950,7 +1950,7 @@ transformList); short[] lg16Toog16LUT = t.colorConvert(tmp, null); if (lg16Toog16Map == null) { - lg16Toog16Map = Collections.synchronizedMap(new WeakHashMap(2)); + lg16Toog16Map = Collections.synchronizedMap(new WeakHashMap(2)); } lg16Toog16Map.put(grayCS, lg16Toog16LUT); return lg16Toog16LUT; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/beans/PropertyDescriptor.java diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Boolean.java --- a/jdk/src/share/classes/java/lang/Boolean.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Boolean.java Wed Jul 05 17:58:30 2017 +0200 @@ -60,7 +60,8 @@ * * @since JDK1.1 */ - public static final Class TYPE = Class.getPrimitiveClass("boolean"); + @SuppressWarnings("unchecked") + public static final Class TYPE = (Class) Class.getPrimitiveClass("boolean"); /** * The value of the Boolean. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Byte.java --- a/jdk/src/share/classes/java/lang/Byte.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Byte.java Wed Jul 05 17:58:30 2017 +0200 @@ -59,6 +59,7 @@ * The {@code Class} instance representing the primitive type * {@code byte}. */ + @SuppressWarnings("unchecked") public static final Class TYPE = (Class) Class.getPrimitiveClass("byte"); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Character.java --- a/jdk/src/share/classes/java/lang/Character.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Character.java Wed Jul 05 17:58:30 2017 +0200 @@ -172,7 +172,7 @@ * @since 1.1 */ @SuppressWarnings("unchecked") - public static final Class TYPE = Class.getPrimitiveClass("char"); + public static final Class TYPE = (Class) Class.getPrimitiveClass("char"); /* * Normative general types diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/CharacterName.java --- a/jdk/src/share/classes/java/lang/CharacterName.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/CharacterName.java Wed Jul 05 17:58:30 2017 +0200 @@ -101,6 +101,8 @@ if (lookup[cp>>8] == null || (off = lookup[cp>>8][cp&0xff]) == 0) return null; - return new String(strPool, 0, off >>> 8, off & 0xff); // ASCII + @SuppressWarnings("deprecation") + String result = new String(strPool, 0, off >>> 8, off & 0xff); // ASCII + return result; } } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Class.java --- a/jdk/src/share/classes/java/lang/Class.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Class.java Wed Jul 05 17:58:30 2017 +0200 @@ -631,6 +631,7 @@ * The Java™ Virtual Machine Specification * @since 1.5 */ + @SuppressWarnings("unchecked") public TypeVariable>[] getTypeParameters() { if (getGenericSignature() != null) return (TypeVariable>[])getGenericInfo().getTypeParameters(); @@ -1303,7 +1304,7 @@ return java.security.AccessController.doPrivileged( new java.security.PrivilegedAction[]>() { - public Class[] run() { + public Class[] run() { List> list = new ArrayList<>(); Class currentClass = Class.this; while (currentClass != null) { @@ -1315,7 +1316,7 @@ } currentClass = currentClass.getSuperclass(); } - return list.toArray(new Class[0]); + return list.toArray(new Class[0]); } }); } @@ -2150,7 +2151,7 @@ * Return the Virtual Machine's Class object for the named * primitive type. */ - static native Class getPrimitiveClass(String name); + static native Class getPrimitiveClass(String name); /* @@ -2395,7 +2396,9 @@ } // No cached value available; request value from VM if (isInterface()) { - res = new Constructor[0]; + @SuppressWarnings("unchecked") + Constructor[] temporaryRes = (Constructor[]) new Constructor[0]; + res = temporaryRes; } else { res = getDeclaredConstructors0(publicOnly); } @@ -2951,7 +2954,9 @@ return null; } }); - enumConstants = (T[])values.invoke(null); + @SuppressWarnings("unchecked") + T[] temporaryConstants = (T[])values.invoke(null); + enumConstants = temporaryConstants; } // These can happen when users concoct enum-like classes // that don't comply with the enum spec. @@ -2996,6 +3001,7 @@ * * @since 1.5 */ + @SuppressWarnings("unchecked") public T cast(Object obj) { if (obj != null && !isInstance(obj)) throw new ClassCastException(cannotCastMsg(obj)); @@ -3026,6 +3032,7 @@ * the class itself). * @since 1.5 */ + @SuppressWarnings("unchecked") public Class asSubclass(Class clazz) { if (clazz.isAssignableFrom(this)) return (Class) this; @@ -3037,6 +3044,7 @@ * @throws NullPointerException {@inheritDoc} * @since 1.5 */ + @SuppressWarnings("unchecked") public A getAnnotation(Class annotationClass) { if (annotationClass == null) throw new NullPointerException(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/ClassLoader.java --- a/jdk/src/share/classes/java/lang/ClassLoader.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/ClassLoader.java Wed Jul 05 17:58:30 2017 +0200 @@ -1167,7 +1167,8 @@ * @since 1.2 */ public Enumeration getResources(String name) throws IOException { - Enumeration[] tmp = new Enumeration[2]; + @SuppressWarnings("unchecked") + Enumeration[] tmp = (Enumeration[]) new Enumeration[2]; if (parent != null) { tmp[0] = parent.getResources(name); } else { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java --- a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Wed Jul 05 17:58:30 2017 +0200 @@ -92,15 +92,15 @@ }; // A hash table that contains the above entries - static Hashtable entryTable = new Hashtable(); + static Hashtable> entryTable = new Hashtable<>(); static { // create hashtable from the entry for (int i = 0; i < entry.length; i ++) { Entry cur = entry[i]; Integer cp = new Integer(cur.getCodePoint()); - HashSet set = (HashSet)entryTable.get(cp); + HashSet set = entryTable.get(cp); if (set == null) { - set = new HashSet(); + set = new HashSet(); } set.add(cur); entryTable.put(cp, set); @@ -151,13 +151,13 @@ } private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) { - HashSet set = (HashSet)entryTable.get(new Integer(src.codePointAt(index))); + HashSet set = entryTable.get(new Integer(src.codePointAt(index))); if (set != null) { - Iterator iter = set.iterator(); + Iterator iter = set.iterator(); String currentLang = locale.getLanguage(); while (iter.hasNext()) { - Entry entry = (Entry)iter.next(); + Entry entry = iter.next(); String conditionLang= entry.getLanguage(); if (((conditionLang == null) || (conditionLang.equals(currentLang))) && isConditionMet(src, index, locale, entry.getCondition())) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Double.java --- a/jdk/src/share/classes/java/lang/Double.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Double.java Wed Jul 05 17:58:30 2017 +0200 @@ -128,6 +128,7 @@ * * @since JDK1.1 */ + @SuppressWarnings("unchecked") public static final Class TYPE = (Class) Class.getPrimitiveClass("double"); /** @@ -715,7 +716,7 @@ * @return the {@code double} value represented by this object */ public double doubleValue() { - return (double)value; + return value; } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/EnumConstantNotPresentException.java --- a/jdk/src/share/classes/java/lang/EnumConstantNotPresentException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/EnumConstantNotPresentException.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,6 +36,7 @@ * @see java.lang.reflect.AnnotatedElement * @since 1.5 */ +@SuppressWarnings("rawtypes") /* rawtypes are part of the public api */ public class EnumConstantNotPresentException extends RuntimeException { private static final long serialVersionUID = -6046998521960521108L; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Float.java --- a/jdk/src/share/classes/java/lang/Float.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Float.java Wed Jul 05 17:58:30 2017 +0200 @@ -126,7 +126,8 @@ * * @since JDK1.1 */ - public static final Class TYPE = Class.getPrimitiveClass("float"); + @SuppressWarnings("unchecked") + public static final Class TYPE = (Class) Class.getPrimitiveClass("float"); /** * Returns a string representation of the {@code float} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Integer.java --- a/jdk/src/share/classes/java/lang/Integer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Integer.java Wed Jul 05 17:58:30 2017 +0200 @@ -68,6 +68,7 @@ * * @since JDK1.1 */ + @SuppressWarnings("unchecked") public static final Class TYPE = (Class) Class.getPrimitiveClass("int"); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Long.java --- a/jdk/src/share/classes/java/lang/Long.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Long.java Wed Jul 05 17:58:30 2017 +0200 @@ -66,6 +66,7 @@ * * @since JDK1.1 */ + @SuppressWarnings("unchecked") public static final Class TYPE = (Class) Class.getPrimitiveClass("long"); /** @@ -734,7 +735,7 @@ * {@code long} value. */ public long longValue() { - return (long)value; + return value; } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Short.java --- a/jdk/src/share/classes/java/lang/Short.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Short.java Wed Jul 05 17:58:30 2017 +0200 @@ -58,6 +58,7 @@ * The {@code Class} instance representing the primitive type * {@code short}. */ + @SuppressWarnings("unchecked") public static final Class TYPE = (Class) Class.getPrimitiveClass("short"); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/System.java --- a/jdk/src/share/classes/java/lang/System.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/System.java Wed Jul 05 17:58:30 2017 +0200 @@ -1032,7 +1032,7 @@ */ @Deprecated public static void runFinalizersOnExit(boolean value) { - Runtime.getRuntime().runFinalizersOnExit(value); + Runtime.runFinalizersOnExit(value); } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/ThreadLocal.java --- a/jdk/src/share/classes/java/lang/ThreadLocal.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/ThreadLocal.java Wed Jul 05 17:58:30 2017 +0200 @@ -144,8 +144,11 @@ ThreadLocalMap map = getMap(t); if (map != null) { ThreadLocalMap.Entry e = map.getEntry(this); - if (e != null) - return (T)e.value; + if (e != null) { + @SuppressWarnings("unchecked") + T result = (T)e.value; + return result; + } } return setInitialValue(); } @@ -268,11 +271,11 @@ * entry can be expunged from table. Such entries are referred to * as "stale entries" in the code that follows. */ - static class Entry extends WeakReference { + static class Entry extends WeakReference> { /** The value associated with this ThreadLocal. */ Object value; - Entry(ThreadLocal k, Object v) { + Entry(ThreadLocal k, Object v) { super(k); value = v; } @@ -325,7 +328,7 @@ * ThreadLocalMaps are constructed lazily, so we only create * one when we have at least one entry to put in it. */ - ThreadLocalMap(ThreadLocal firstKey, Object firstValue) { + ThreadLocalMap(ThreadLocal firstKey, Object firstValue) { table = new Entry[INITIAL_CAPACITY]; int i = firstKey.threadLocalHashCode & (INITIAL_CAPACITY - 1); table[i] = new Entry(firstKey, firstValue); @@ -348,7 +351,8 @@ for (int j = 0; j < len; j++) { Entry e = parentTable[j]; if (e != null) { - ThreadLocal key = e.get(); + @SuppressWarnings("unchecked") + ThreadLocal key = (ThreadLocal) e.get(); if (key != null) { Object value = key.childValue(e.value); Entry c = new Entry(key, value); @@ -372,7 +376,7 @@ * @param key the thread local object * @return the entry associated with key, or null if no such */ - private Entry getEntry(ThreadLocal key) { + private Entry getEntry(ThreadLocal key) { int i = key.threadLocalHashCode & (table.length - 1); Entry e = table[i]; if (e != null && e.get() == key) @@ -390,12 +394,12 @@ * @param e the entry at table[i] * @return the entry associated with key, or null if no such */ - private Entry getEntryAfterMiss(ThreadLocal key, int i, Entry e) { + private Entry getEntryAfterMiss(ThreadLocal key, int i, Entry e) { Entry[] tab = table; int len = tab.length; while (e != null) { - ThreadLocal k = e.get(); + ThreadLocal k = e.get(); if (k == key) return e; if (k == null) @@ -413,7 +417,7 @@ * @param key the thread local object * @param value the value to be set */ - private void set(ThreadLocal key, Object value) { + private void set(ThreadLocal key, Object value) { // We don't use a fast path as with get() because it is at // least as common to use set() to create new entries as @@ -427,7 +431,7 @@ for (Entry e = tab[i]; e != null; e = tab[i = nextIndex(i, len)]) { - ThreadLocal k = e.get(); + ThreadLocal k = e.get(); if (k == key) { e.value = value; @@ -449,7 +453,7 @@ /** * Remove the entry for key. */ - private void remove(ThreadLocal key) { + private void remove(ThreadLocal key) { Entry[] tab = table; int len = tab.length; int i = key.threadLocalHashCode & (len-1); @@ -479,7 +483,7 @@ * @param staleSlot index of the first stale entry encountered while * searching for key. */ - private void replaceStaleEntry(ThreadLocal key, Object value, + private void replaceStaleEntry(ThreadLocal key, Object value, int staleSlot) { Entry[] tab = table; int len = tab.length; @@ -501,7 +505,7 @@ for (int i = nextIndex(staleSlot, len); (e = tab[i]) != null; i = nextIndex(i, len)) { - ThreadLocal k = e.get(); + ThreadLocal k = e.get(); // If we find key, then we need to swap it // with the stale entry to maintain hash table order. @@ -563,7 +567,7 @@ for (i = nextIndex(staleSlot, len); (e = tab[i]) != null; i = nextIndex(i, len)) { - ThreadLocal k = e.get(); + ThreadLocal k = e.get(); if (k == null) { e.value = null; tab[i] = null; @@ -650,7 +654,7 @@ for (int j = 0; j < oldLen; ++j) { Entry e = oldTab[j]; if (e != null) { - ThreadLocal k = e.get(); + ThreadLocal k = e.get(); if (k == null) { e.value = null; // Help the GC } else { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/lang/Void.java --- a/jdk/src/share/classes/java/lang/Void.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/lang/Void.java Wed Jul 05 17:58:30 2017 +0200 @@ -40,7 +40,8 @@ * The {@code Class} object representing the pseudo-type corresponding to * the keyword {@code void}. */ - public static final Class TYPE = Class.getPrimitiveClass("void"); + @SuppressWarnings("unchecked") + public static final Class TYPE = (Class) Class.getPrimitiveClass("void"); /* * The Void class cannot be instantiated. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/net/HttpCookie.java --- a/jdk/src/share/classes/java/net/HttpCookie.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/net/HttpCookie.java Wed Jul 05 17:58:30 2017 +0200 @@ -72,6 +72,10 @@ private boolean httpOnly; // HttpOnly ... i.e. not accessible to scripts private int version = 1; // Version=1 ... RFC 2965 style + // The original header this cookie was consructed from, if it was + // constructed by parsing a header, otherwise null. + private final String header; + // Hold the creation time (in seconds) of the http cookie for later // expiration calculation private final long whenCreated; @@ -128,6 +132,10 @@ * @see #setVersion */ public HttpCookie(String name, String value) { + this(name, value, null /*header*/); + } + + private HttpCookie(String name, String value, String header) { name = name.trim(); if (name.length() == 0 || !isToken(name) || isReserved(name)) { throw new IllegalArgumentException("Illegal cookie name"); @@ -140,6 +148,7 @@ whenCreated = System.currentTimeMillis(); portlist = null; + this.header = header; } /** @@ -163,6 +172,15 @@ * if the header string is {@code null} */ public static List parse(String header) { + return parse(header, false); + } + + // Private version of parse() that will store the original header used to + // create the cookie, in the cookie itself. This can be useful for filtering + // Set-Cookie[2] headers, using the internal parsing logic defined in this + // class. + private static List parse(String header, boolean retainHeader) { + int version = guessCookieVersion(header); // if header start with set-cookie or set-cookie2, strip it off @@ -178,7 +196,7 @@ // so the parse logic is slightly different if (version == 0) { // Netscape draft cookie - HttpCookie cookie = parseInternal(header); + HttpCookie cookie = parseInternal(header, retainHeader); cookie.setVersion(0); cookies.add(cookie); } else { @@ -187,7 +205,7 @@ // it'll separate them with comma List cookieStrings = splitMultiCookies(header); for (String cookieStr : cookieStrings) { - HttpCookie cookie = parseInternal(cookieStr); + HttpCookie cookie = parseInternal(cookieStr, retainHeader); cookie.setVersion(1); cookies.add(cookie); } @@ -804,7 +822,8 @@ * @throws IllegalArgumentException * if header string violates the cookie specification */ - private static HttpCookie parseInternal(String header) + private static HttpCookie parseInternal(String header, + boolean retainHeader) { HttpCookie cookie = null; String namevaluePair = null; @@ -819,7 +838,13 @@ if (index != -1) { String name = namevaluePair.substring(0, index).trim(); String value = namevaluePair.substring(index + 1).trim(); - cookie = new HttpCookie(name, stripOffSurroundingQuote(value)); + if (retainHeader) + cookie = new HttpCookie(name, + stripOffSurroundingQuote(value), + header); + else + cookie = new HttpCookie(name, + stripOffSurroundingQuote(value)); } else { // no "=" in name-value pair; it's an error throw new IllegalArgumentException("Invalid cookie name-value pair"); @@ -972,6 +997,28 @@ } } + static { + sun.misc.SharedSecrets.setJavaNetHttpCookieAccess( + new sun.misc.JavaNetHttpCookieAccess() { + public List parse(String header) { + return HttpCookie.parse(header, true); + } + + public String header(HttpCookie cookie) { + return cookie.header; + } + } + ); + } + + /* + * Returns the original header this cookie was consructed from, if it was + * constructed by parsing a header, otherwise null. + */ + private String header() { + return header; + } + /* * Constructs a string representation of this cookie. The string format is * as Netscape spec, but without leading "Cookie:" token. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java --- a/jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java Wed Jul 05 17:58:30 2017 +0200 @@ -373,11 +373,13 @@ { if (options.length > 0) { for (OpenOption opt: options) { - if (opt != StandardOpenOption.READ) + // All OpenOption values except for APPEND and WRITE are allowed + if (opt == StandardOpenOption.APPEND || + opt == StandardOpenOption.WRITE) throw new UnsupportedOperationException("'" + opt + "' not allowed"); } } - return Channels.newInputStream(Files.newByteChannel(path)); + return Channels.newInputStream(Files.newByteChannel(path, options)); } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/Locale.java --- a/jdk/src/share/classes/java/util/Locale.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/Locale.java Wed Jul 05 17:58:30 2017 +0200 @@ -737,10 +737,6 @@ */ public static Locale getDefault() { // do not synchronize this method - see 4071298 - // it's OK if more than one default locale happens to be created - if (defaultLocale == null) { - initDefault(); - } return defaultLocale; } @@ -762,16 +758,23 @@ */ public static Locale getDefault(Locale.Category category) { // do not synchronize this method - see 4071298 - // it's OK if more than one default locale happens to be created switch (category) { case DISPLAY: if (defaultDisplayLocale == null) { - initDefault(category); + synchronized(Locale.class) { + if (defaultDisplayLocale == null) { + defaultDisplayLocale = initDefault(category); + } + } } return defaultDisplayLocale; case FORMAT: if (defaultFormatLocale == null) { - initDefault(category); + synchronized(Locale.class) { + if (defaultFormatLocale == null) { + defaultFormatLocale = initDefault(category); + } + } } return defaultFormatLocale; default: @@ -780,7 +783,7 @@ return getDefault(); } - private static void initDefault() { + private static Locale initDefault() { String language, region, script, country, variant; language = AccessController.doPrivileged( new GetPropertyAction("user.language", "en")); @@ -806,16 +809,12 @@ variant = AccessController.doPrivileged( new GetPropertyAction("user.variant", "")); } - defaultLocale = getInstance(language, script, country, variant, null); + + return getInstance(language, script, country, variant, null); } - private static void initDefault(Locale.Category category) { - // make sure defaultLocale is initialized - if (defaultLocale == null) { - initDefault(); - } - - Locale defaultCategoryLocale = getInstance( + private static Locale initDefault(Locale.Category category) { + return getInstance( AccessController.doPrivileged( new GetPropertyAction(category.languageKey, defaultLocale.getLanguage())), AccessController.doPrivileged( @@ -825,15 +824,6 @@ AccessController.doPrivileged( new GetPropertyAction(category.variantKey, defaultLocale.getVariant())), null); - - switch (category) { - case DISPLAY: - defaultDisplayLocale = defaultCategoryLocale; - break; - case FORMAT: - defaultFormatLocale = defaultCategoryLocale; - break; - } } /** @@ -1916,9 +1906,9 @@ */ private transient volatile int hashCodeValue = 0; - private static Locale defaultLocale = null; - private static Locale defaultDisplayLocale = null; - private static Locale defaultFormatLocale = null; + private volatile static Locale defaultLocale = initDefault(); + private volatile static Locale defaultDisplayLocale = null; + private volatile static Locale defaultFormatLocale = null; /** * Return an array of the display names of the variant. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java --- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java Wed Jul 05 17:58:30 2017 +0200 @@ -131,8 +131,9 @@ /** * Returns item at index i. */ + @SuppressWarnings("unchecked") final E itemAt(int i) { - return this.cast(items[i]); + return (E) items[i]; } /** @@ -162,7 +163,8 @@ */ private E extract() { final Object[] items = this.items; - E x = this.cast(items[takeIndex]); + @SuppressWarnings("unchecked") + E x = (E) items[takeIndex]; items[takeIndex] = null; takeIndex = inc(takeIndex); --count; @@ -647,7 +649,9 @@ int n = 0; int max = count; while (n < max) { - c.add(this.cast(items[i])); + @SuppressWarnings("unchecked") + E x = (E) items[i]; + c.add(x); items[i] = null; i = inc(i); ++n; @@ -684,7 +688,9 @@ int n = 0; int max = (maxElements < count) ? maxElements : count; while (n < max) { - c.add(this.cast(items[i])); + @SuppressWarnings("unchecked") + E x = (E) items[i]; + c.add(x); items[i] = null; i = inc(i); ++n; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Wed Jul 05 17:58:30 2017 +0200 @@ -37,9 +37,6 @@ import java.util.concurrent.locks.*; import java.util.*; import java.io.Serializable; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; /** * A hash table supporting full concurrency of retrievals and @@ -228,7 +225,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = HashEntry.class; + Class k = HashEntry.class; nextOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("next")); } catch (Exception e) { @@ -433,7 +430,7 @@ int newCapacity = oldCapacity << 1; threshold = (int)(newCapacity * loadFactor); HashEntry[] newTable = - (HashEntry[]) new HashEntry[newCapacity]; + (HashEntry[]) new HashEntry[newCapacity]; int sizeMask = newCapacity - 1; for (int i = 0; i < oldCapacity ; i++) { HashEntry e = oldTable[i]; @@ -677,7 +674,7 @@ int cap = proto.table.length; float lf = proto.loadFactor; int threshold = (int)(cap * lf); - HashEntry[] tab = (HashEntry[])new HashEntry[cap]; + HashEntry[] tab = (HashEntry[])new HashEntry[cap]; if ((seg = (Segment)UNSAFE.getObjectVolatile(ss, u)) == null) { // recheck Segment s = new Segment(lf, threshold, tab); @@ -694,7 +691,7 @@ // Hash-based segment and entry accesses /** - * Get the segment for the given hash + * Gets the segment for the given hash code. */ @SuppressWarnings("unchecked") private Segment segmentForHash(int h) { @@ -703,7 +700,7 @@ } /** - * Gets the table entry for the given segment and hash + * Gets the table entry for the given segment and hash code. */ @SuppressWarnings("unchecked") static final HashEntry entryForHash(Segment seg, int h) { @@ -758,8 +755,8 @@ // create segments and segments[0] Segment s0 = new Segment(loadFactor, (int)(cap * loadFactor), - (HashEntry[])new HashEntry[cap]); - Segment[] ss = (Segment[])new Segment[ssize]; + (HashEntry[])new HashEntry[cap]); + Segment[] ss = (Segment[])new Segment[ssize]; UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0] this.segments = ss; } @@ -916,6 +913,7 @@ * * @throws NullPointerException if the specified key is null */ + @SuppressWarnings("unchecked") public V get(Object key) { Segment s; // manually integrate access methods to reduce overhead HashEntry[] tab; @@ -1026,7 +1024,7 @@ * full compatibility with class {@link java.util.Hashtable}, * which supported this method prior to introduction of the * Java Collections framework. - + * * @param value a value to search for * @return true if and only if some key maps to the * value argument in this table as @@ -1262,7 +1260,7 @@ } /** - * Set nextEntry to first node of next non-empty table + * Sets nextEntry to first node of next non-empty table * (in backwards order, to simplify checks). */ final void advance() { @@ -1326,12 +1324,14 @@ final class WriteThroughEntry extends AbstractMap.SimpleEntry { + static final long serialVersionUID = 7249069246763182397L; + WriteThroughEntry(K k, V v) { super(k,v); } /** - * Set our entry's value and write through to the map. The + * Sets our entry's value and writes through to the map. The * value to return is somewhat arbitrary here. Since a * WriteThroughEntry does not necessarily track asynchronous * changes, the most recent "previous" value could be @@ -1427,15 +1427,16 @@ /* ---------------- Serialization Support -------------- */ /** - * Save the state of the ConcurrentHashMap instance to a - * stream (i.e., serialize it). + * Saves the state of the ConcurrentHashMap instance to a + * stream (i.e., serializes it). * @param s the stream * @serialData * the key (Object) and value (Object) * for each key-value mapping, followed by a null pair. * The key-value mappings are emitted in no particular order. */ - private void writeObject(java.io.ObjectOutputStream s) throws IOException { + private void writeObject(java.io.ObjectOutputStream s) + throws java.io.IOException { // force all segments for serialization compatibility for (int k = 0; k < segments.length; ++k) ensureSegment(k); @@ -1463,13 +1464,13 @@ } /** - * Reconstitute the ConcurrentHashMap instance from a - * stream (i.e., deserialize it). + * Reconstitutes the ConcurrentHashMap instance from a + * stream (i.e., deserializes it). * @param s the stream */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException { + throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); // Re-initialize segments to be minimally sized, and let grow. @@ -1479,7 +1480,7 @@ Segment seg = segments[k]; if (seg != null) { seg.threshold = (int)(cap * seg.loadFactor); - seg.table = (HashEntry[]) new HashEntry[cap]; + seg.table = (HashEntry[]) new HashEntry[cap]; } } @@ -1504,8 +1505,8 @@ int ss, ts; try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class tc = HashEntry[].class; - Class sc = Segment[].class; + Class tc = HashEntry[].class; + Class sc = Segment[].class; TBASE = UNSAFE.arrayBaseOffset(tc); SBASE = UNSAFE.arrayBaseOffset(sc); ts = UNSAFE.arrayIndexScale(tc); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Wed Jul 05 17:58:30 2017 +0200 @@ -335,7 +335,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Node.class; + Class k = Node.class; prevOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("prev")); itemOffset = UNSAFE.objectFieldOffset @@ -1457,7 +1457,7 @@ NEXT_TERMINATOR.prev = NEXT_TERMINATOR; try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = ConcurrentLinkedDeque.class; + Class k = ConcurrentLinkedDeque.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); tailOffset = UNSAFE.objectFieldOffset diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Wed Jul 05 17:58:30 2017 +0200 @@ -208,7 +208,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Node.class; + Class k = Node.class; itemOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("item")); nextOffset = UNSAFE.objectFieldOffset @@ -823,7 +823,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = ConcurrentLinkedQueue.class; + Class k = ConcurrentLinkedQueue.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); tailOffset = UNSAFE.objectFieldOffset diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,7 +35,6 @@ package java.util.concurrent; import java.util.*; -import java.util.concurrent.atomic.*; /** * A scalable concurrent {@link ConcurrentNavigableMap} implementation. @@ -90,6 +89,7 @@ * @param the type of mapped values * @since 1.6 */ +@SuppressWarnings("unchecked") public class ConcurrentSkipListMap extends AbstractMap implements ConcurrentNavigableMap, Cloneable, @@ -352,11 +352,11 @@ private transient int randomSeed; /** Lazily initialized key set */ - private transient KeySet keySet; + private transient KeySet keySet; /** Lazily initialized entry set */ - private transient EntrySet entrySet; + private transient EntrySet entrySet; /** Lazily initialized values collection */ - private transient Values values; + private transient Values values; /** Lazily initialized descending key set */ private transient ConcurrentNavigableMap descendingMap; @@ -517,7 +517,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Node.class; + Class k = Node.class; valueOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("value")); nextOffset = UNSAFE.objectFieldOffset @@ -597,7 +597,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Index.class; + Class k = Index.class; rightOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("right")); } catch (Exception e) { @@ -933,7 +933,7 @@ * direction. */ level = max + 1; - Index[] idxs = (Index[])new Index[level+1]; + Index[] idxs = (Index[])new Index[level+1]; Index idx = null; for (int i = 1; i <= level; ++i) idxs[i] = idx = new Index(z, idx, null); @@ -1436,16 +1436,16 @@ * @return a shallow copy of this map */ public ConcurrentSkipListMap clone() { - ConcurrentSkipListMap clone = null; try { - clone = (ConcurrentSkipListMap) super.clone(); + @SuppressWarnings("unchecked") + ConcurrentSkipListMap clone = + (ConcurrentSkipListMap) super.clone(); + clone.initialize(); + clone.buildFromSorted(this); + return clone; } catch (CloneNotSupportedException e) { throw new InternalError(); } - - clone.initialize(); - clone.buildFromSorted(this); - return clone; } /** @@ -1507,7 +1507,7 @@ /* ---------------- Serialization -------------- */ /** - * Save the state of this map to a stream. + * Saves the state of this map to a stream (that is, serializes it). * * @serialData The key (Object) and value (Object) for each * key-value mapping represented by the map, followed by @@ -1532,7 +1532,9 @@ } /** - * Reconstitute the map from a stream. + * Reconstitutes the map from a stream (that is, deserializes it). + * + * @param s the stream */ private void readObject(final java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { @@ -1755,13 +1757,13 @@ * @return a navigable set view of the keys in this map */ public NavigableSet keySet() { - KeySet ks = keySet; - return (ks != null) ? ks : (keySet = new KeySet(this)); + KeySet ks = keySet; + return (ks != null) ? ks : (keySet = new KeySet(this)); } public NavigableSet navigableKeySet() { - KeySet ks = keySet; - return (ks != null) ? ks : (keySet = new KeySet(this)); + KeySet ks = keySet; + return (ks != null) ? ks : (keySet = new KeySet(this)); } /** @@ -1783,8 +1785,8 @@ * reflect any modifications subsequent to construction. */ public Collection values() { - Values vs = values; - return (vs != null) ? vs : (values = new Values(this)); + Values vs = values; + return (vs != null) ? vs : (values = new Values(this)); } /** @@ -1812,8 +1814,8 @@ * sorted in ascending key order */ public Set> entrySet() { - EntrySet es = entrySet; - return (es != null) ? es : (entrySet = new EntrySet(this)); + EntrySet es = entrySet; + return (es != null) ? es : (entrySet = new EntrySet(this)); } public ConcurrentNavigableMap descendingMap() { @@ -2304,8 +2306,8 @@ static final class KeySet extends AbstractSet implements NavigableSet { - private final ConcurrentNavigableMap m; - KeySet(ConcurrentNavigableMap map) { m = map; } + private final ConcurrentNavigableMap m; + KeySet(ConcurrentNavigableMap map) { m = map; } public int size() { return m.size(); } public boolean isEmpty() { return m.isEmpty(); } public boolean contains(Object o) { return m.containsKey(o); } @@ -2319,11 +2321,11 @@ public E first() { return m.firstKey(); } public E last() { return m.lastKey(); } public E pollFirst() { - Map.Entry e = m.pollFirstEntry(); + Map.Entry e = m.pollFirstEntry(); return (e == null) ? null : e.getKey(); } public E pollLast() { - Map.Entry e = m.pollLastEntry(); + Map.Entry e = m.pollLastEntry(); return (e == null) ? null : e.getKey(); } public Iterator iterator() { @@ -2374,20 +2376,20 @@ return tailSet(fromElement, true); } public NavigableSet descendingSet() { - return new KeySet(m.descendingMap()); + return new KeySet(m.descendingMap()); } } static final class Values extends AbstractCollection { - private final ConcurrentNavigableMap m; - Values(ConcurrentNavigableMap map) { + private final ConcurrentNavigableMap m; + Values(ConcurrentNavigableMap map) { m = map; } public Iterator iterator() { if (m instanceof ConcurrentSkipListMap) - return ((ConcurrentSkipListMap)m).valueIterator(); + return ((ConcurrentSkipListMap)m).valueIterator(); else - return ((SubMap)m).valueIterator(); + return ((SubMap)m).valueIterator(); } public boolean isEmpty() { return m.isEmpty(); @@ -2421,14 +2423,14 @@ public boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; - Map.Entry e = (Map.Entry)o; + Map.Entry e = (Map.Entry)o; V1 v = m.get(e.getKey()); return v != null && v.equals(e.getValue()); } public boolean remove(Object o) { if (!(o instanceof Map.Entry)) return false; - Map.Entry e = (Map.Entry)o; + Map.Entry e = (Map.Entry)o; return m.remove(e.getKey(), e.getValue()); } @@ -2568,9 +2570,9 @@ if (lo == null) return m.findFirst(); else if (loInclusive) - return m.findNear(lo, m.GT|m.EQ); + return m.findNear(lo, GT|EQ); else - return m.findNear(lo, m.GT); + return m.findNear(lo, GT); } /** @@ -2581,9 +2583,9 @@ if (hi == null) return m.findLast(); else if (hiInclusive) - return m.findNear(hi, m.LT|m.EQ); + return m.findNear(hi, LT|EQ); else - return m.findNear(hi, m.LT); + return m.findNear(hi, LT); } /** @@ -2665,15 +2667,15 @@ */ private Map.Entry getNearEntry(K key, int rel) { if (isDescending) { // adjust relation for direction - if ((rel & m.LT) == 0) - rel |= m.LT; + if ((rel & LT) == 0) + rel |= LT; else - rel &= ~m.LT; + rel &= ~LT; } if (tooLow(key)) - return ((rel & m.LT) != 0) ? null : lowestEntry(); + return ((rel & LT) != 0) ? null : lowestEntry(); if (tooHigh(key)) - return ((rel & m.LT) != 0) ? highestEntry() : null; + return ((rel & LT) != 0) ? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) @@ -2688,13 +2690,13 @@ // Almost the same as getNearEntry, except for keys private K getNearKey(K key, int rel) { if (isDescending) { // adjust relation for direction - if ((rel & m.LT) == 0) - rel |= m.LT; + if ((rel & LT) == 0) + rel |= LT; else - rel &= ~m.LT; + rel &= ~LT; } if (tooLow(key)) { - if ((rel & m.LT) == 0) { + if ((rel & LT) == 0) { ConcurrentSkipListMap.Node n = loNode(); if (isBeforeEnd(n)) return n.key; @@ -2702,7 +2704,7 @@ return null; } if (tooHigh(key)) { - if ((rel & m.LT) != 0) { + if ((rel & LT) != 0) { ConcurrentSkipListMap.Node n = hiNode(); if (n != null) { K last = n.key; @@ -2734,7 +2736,7 @@ public V get(Object key) { if (key == null) throw new NullPointerException(); K k = (K)key; - return ((!inBounds(k)) ? null : m.get(k)); + return (!inBounds(k)) ? null : m.get(k); } public V put(K key, V value) { @@ -2901,35 +2903,35 @@ /* ---------------- Relational methods -------------- */ public Map.Entry ceilingEntry(K key) { - return getNearEntry(key, (m.GT|m.EQ)); + return getNearEntry(key, GT|EQ); } public K ceilingKey(K key) { - return getNearKey(key, (m.GT|m.EQ)); + return getNearKey(key, GT|EQ); } public Map.Entry lowerEntry(K key) { - return getNearEntry(key, (m.LT)); + return getNearEntry(key, LT); } public K lowerKey(K key) { - return getNearKey(key, (m.LT)); + return getNearKey(key, LT); } public Map.Entry floorEntry(K key) { - return getNearEntry(key, (m.LT|m.EQ)); + return getNearEntry(key, LT|EQ); } public K floorKey(K key) { - return getNearKey(key, (m.LT|m.EQ)); + return getNearKey(key, LT|EQ); } public Map.Entry higherEntry(K key) { - return getNearEntry(key, (m.GT)); + return getNearEntry(key, GT); } public K higherKey(K key) { - return getNearKey(key, (m.GT)); + return getNearKey(key, GT); } public K firstKey() { @@ -2960,22 +2962,22 @@ public NavigableSet keySet() { KeySet ks = keySetView; - return (ks != null) ? ks : (keySetView = new KeySet(this)); + return (ks != null) ? ks : (keySetView = new KeySet(this)); } public NavigableSet navigableKeySet() { KeySet ks = keySetView; - return (ks != null) ? ks : (keySetView = new KeySet(this)); + return (ks != null) ? ks : (keySetView = new KeySet(this)); } public Collection values() { Collection vs = valuesView; - return (vs != null) ? vs : (valuesView = new Values(this)); + return (vs != null) ? vs : (valuesView = new Values(this)); } public Set> entrySet() { Set> es = entrySetView; - return (es != null) ? es : (entrySetView = new EntrySet(this)); + return (es != null) ? es : (entrySetView = new EntrySet(this)); } public NavigableSet descendingKeySet() { @@ -3109,7 +3111,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = ConcurrentSkipListMap.class; + Class k = ConcurrentSkipListMap.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,7 +35,6 @@ package java.util.concurrent; import java.util.*; -import sun.misc.Unsafe; /** * A scalable concurrent {@link NavigableSet} implementation based on @@ -158,15 +157,15 @@ * @return a shallow copy of this set */ public ConcurrentSkipListSet clone() { - ConcurrentSkipListSet clone = null; try { - clone = (ConcurrentSkipListSet) super.clone(); - clone.setMap(new ConcurrentSkipListMap(m)); + @SuppressWarnings("unchecked") + ConcurrentSkipListSet clone = + (ConcurrentSkipListSet) super.clone(); + clone.setMap(new ConcurrentSkipListMap(m)); + return clone; } catch (CloneNotSupportedException e) { throw new InternalError(); } - - return clone; } /* ---------------- Set operations -------------- */ @@ -322,8 +321,8 @@ public boolean removeAll(Collection c) { // Override AbstractSet version to avoid unnecessary call to size() boolean modified = false; - for (Iterator i = c.iterator(); i.hasNext(); ) - if (remove(i.next())) + for (Object e : c) + if (remove(e)) modified = true; return modified; } @@ -468,7 +467,7 @@ * @return a reverse order view of this set */ public NavigableSet descendingSet() { - return new ConcurrentSkipListSet(m.descendingMap()); + return new ConcurrentSkipListSet(m.descendingMap()); } // Support for resetting map in clone @@ -481,7 +480,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = ConcurrentSkipListSet.class; + Class k = ConcurrentSkipListSet.class; mapOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("m")); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java --- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,7 +36,6 @@ package java.util.concurrent; import java.util.*; import java.util.concurrent.locks.*; -import sun.misc.Unsafe; /** * A thread-safe variant of {@link java.util.ArrayList} in which all mutative @@ -281,9 +280,11 @@ */ public Object clone() { try { - CopyOnWriteArrayList c = (CopyOnWriteArrayList)(super.clone()); - c.resetLock(); - return c; + @SuppressWarnings("unchecked") + CopyOnWriteArrayList clone = + (CopyOnWriteArrayList) super.clone(); + clone.resetLock(); + return clone; } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(); @@ -1330,7 +1331,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = CopyOnWriteArrayList.class; + Class k = CopyOnWriteArrayList.class; lockOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("lock")); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/DelayQueue.java --- a/jdk/src/share/classes/java/util/concurrent/DelayQueue.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/DelayQueue.java Wed Jul 05 17:58:30 2017 +0200 @@ -531,7 +531,7 @@ // not just a .equals element. lock.lock(); try { - for (Iterator it = q.iterator(); it.hasNext(); ) { + for (Iterator it = q.iterator(); it.hasNext(); ) { if (it.next() == x) { it.remove(); return; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/Exchanger.java --- a/jdk/src/share/classes/java/util/concurrent/Exchanger.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/Exchanger.java Wed Jul 05 17:58:30 2017 +0200 @@ -279,6 +279,7 @@ * into hole. This class cannot be parameterized as "V" because * of the use of non-V CANCEL sentinels. */ + @SuppressWarnings("serial") private static final class Node extends AtomicReference { /** The element offered by the Thread creating this node. */ public final Object item; @@ -303,6 +304,7 @@ * would improve throughput more than enough to outweigh using * extra space. */ + @SuppressWarnings("serial") private static final class Slot extends AtomicReference { // Improve likelihood of isolation on <= 64 byte cache lines long q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, qa, qb, qc, qd, qe; @@ -616,13 +618,14 @@ * @throws InterruptedException if the current thread was * interrupted while waiting */ + @SuppressWarnings("unchecked") public V exchange(V x) throws InterruptedException { if (!Thread.interrupted()) { - Object v = doExchange((x == null) ? NULL_ITEM : x, false, 0); - if (v == NULL_ITEM) + Object o = doExchange((x == null) ? NULL_ITEM : x, false, 0); + if (o == NULL_ITEM) return null; - if (v != CANCEL) - return (V)v; + if (o != CANCEL) + return (V)o; Thread.interrupted(); // Clear interrupt status on IE throw } throw new InterruptedException(); @@ -670,15 +673,16 @@ * @throws TimeoutException if the specified waiting time elapses * before another thread enters the exchange */ + @SuppressWarnings("unchecked") public V exchange(V x, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!Thread.interrupted()) { - Object v = doExchange((x == null) ? NULL_ITEM : x, + Object o = doExchange((x == null) ? NULL_ITEM : x, true, unit.toNanos(timeout)); - if (v == NULL_ITEM) + if (o == NULL_ITEM) return null; - if (v != CANCEL) - return (V)v; + if (o != CANCEL) + return (V)o; if (!Thread.interrupted()) throw new TimeoutException(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java Wed Jul 05 17:58:30 2017 +0200 @@ -2150,7 +2150,7 @@ int s; try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = ForkJoinPool.class; + Class k = ForkJoinPool.class; ctlOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("ctl")); stealCountOffset = UNSAFE.objectFieldOffset @@ -2163,7 +2163,7 @@ (k.getDeclaredField("scanGuard")); nextWorkerNumberOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("nextWorkerNumber")); - Class a = ForkJoinTask[].class; + Class a = ForkJoinTask[].class; ABASE = UNSAFE.arrayBaseOffset(a); s = UNSAFE.arrayIndexScale(a); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java Wed Jul 05 17:58:30 2017 +0200 @@ -520,7 +520,7 @@ if (e == null || (ex = e.ex) == null) return null; if (e.thrower != Thread.currentThread().getId()) { - Class ec = ex.getClass(); + Class ec = ex.getClass(); try { Constructor noArgCtor = null; Constructor[] cs = ec.getConstructors();// public ctors only diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java Wed Jul 05 17:58:30 2017 +0200 @@ -192,7 +192,7 @@ /** * The work-stealing queue array. Size must be a power of two. - * Initialized when started (as oposed to when constructed), to + * Initialized when started (as opposed to when constructed), to * improve memory locality. */ ForkJoinTask[] queue; @@ -360,7 +360,7 @@ */ protected void onStart() { queue = new ForkJoinTask[INITIAL_QUEUE_CAPACITY]; - int r = pool.workerSeedGenerator.nextInt(); + int r = ForkJoinPool.workerSeedGenerator.nextInt(); seed = (r == 0) ? 1 : r; // must be nonzero } @@ -846,7 +846,7 @@ (b = v.queueBase) != v.queueTop && (q = v.queue) != null && (i = (q.length - 1) & b) >= 0 && - q[i] == t) { + q[i] == t) { long u = (i << ASHIFT) + ABASE; if (v.queueBase == b && UNSAFE.compareAndSwapObject(q, u, t, null)) { @@ -984,7 +984,7 @@ int s; try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class a = ForkJoinTask[].class; + Class a = ForkJoinTask[].class; ABASE = UNSAFE.arrayBaseOffset(a); s = UNSAFE.arrayIndexScale(a); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java --- a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Wed Jul 05 17:58:30 2017 +0200 @@ -330,8 +330,8 @@ * of less-contended queues. During spins threads check their * interrupt status and generate a thread-local random number * to decide to occasionally perform a Thread.yield. While - * yield has underdefined specs, we assume that might it help, - * and will not hurt in limiting impact of spinning on busy + * yield has underdefined specs, we assume that it might help, + * and will not hurt, in limiting impact of spinning on busy * systems. We also use smaller (1/2) spins for nodes that are * not known to be front but whose predecessors have not * blocked -- these "chained" spins avoid artifacts of @@ -542,7 +542,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Node.class; + Class k = Node.class; itemOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("item")); nextOffset = UNSAFE.objectFieldOffset @@ -627,7 +627,7 @@ break; // unless slack < 2 } LockSupport.unpark(p.waiter); - return this.cast(item); + return LinkedTransferQueue.cast(item); } } Node n = p.next; @@ -705,7 +705,7 @@ if (item != e) { // matched // assert item != s; s.forgetContents(); // avoid garbage - return this.cast(item); + return LinkedTransferQueue.cast(item); } if ((w.isInterrupted() || (timed && nanos <= 0)) && s.casItem(e, s)) { // cancel @@ -786,7 +786,7 @@ Object item = p.item; if (p.isData) { if (item != null && item != p) - return this.cast(item); + return LinkedTransferQueue.cast(item); } else if (item == null) return null; @@ -1008,7 +1008,6 @@ return false; } - /** * Creates an initially empty {@code LinkedTransferQueue}. */ @@ -1045,7 +1044,8 @@ * return {@code false}. * * @return {@code true} (as specified by - * {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer}) + * {@link java.util.concurrent.BlockingQueue#offer(Object,long,TimeUnit) + * BlockingQueue.offer}) * @throws NullPointerException if the specified element is null */ public boolean offer(E e, long timeout, TimeUnit unit) { @@ -1162,8 +1162,7 @@ if (c == this) throw new IllegalArgumentException(); int n = 0; - E e; - while ( (e = poll()) != null) { + for (E e; (e = poll()) != null;) { c.add(e); ++n; } @@ -1180,8 +1179,7 @@ if (c == this) throw new IllegalArgumentException(); int n = 0; - E e; - while (n < maxElements && (e = poll()) != null) { + for (E e; n < maxElements && (e = poll()) != null;) { c.add(e); ++n; } @@ -1288,7 +1286,8 @@ * {@code LinkedTransferQueue} is not capacity constrained. * * @return {@code Integer.MAX_VALUE} (as specified by - * {@link BlockingQueue#remainingCapacity()}) + * {@link java.util.concurrent.BlockingQueue#remainingCapacity() + * BlockingQueue.remainingCapacity}) */ public int remainingCapacity() { return Integer.MAX_VALUE; @@ -1320,7 +1319,8 @@ throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); for (;;) { - @SuppressWarnings("unchecked") E item = (E) s.readObject(); + @SuppressWarnings("unchecked") + E item = (E) s.readObject(); if (item == null) break; else @@ -1337,7 +1337,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = LinkedTransferQueue.class; + Class k = LinkedTransferQueue.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); tailOffset = UNSAFE.objectFieldOffset diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/Phaser.java --- a/jdk/src/share/classes/java/util/concurrent/Phaser.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/Phaser.java Wed Jul 05 17:58:30 2017 +0200 @@ -1142,7 +1142,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = Phaser.class; + Class k = Phaser.class; stateOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("state")); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java --- a/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java Wed Jul 05 17:58:30 2017 +0200 @@ -94,6 +94,7 @@ * @author Doug Lea * @param the type of elements held in this collection */ +@SuppressWarnings("unchecked") public class PriorityBlockingQueue extends AbstractQueue implements BlockingQueue, java.io.Serializable { private static final long serialVersionUID = 5595510919245408276L; @@ -168,7 +169,7 @@ * to maintain compatibility with previous versions * of this class. Non-null only during serialization/deserialization. */ - private PriorityQueue q; + private PriorityQueue q; /** * Creates a {@code PriorityBlockingQueue} with the default @@ -968,7 +969,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = PriorityBlockingQueue.class; + Class k = PriorityBlockingQueue.class; allocationSpinLockOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("allocationSpinLock")); } catch (Exception e) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java --- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,8 +34,10 @@ */ package java.util.concurrent; -import java.util.concurrent.atomic.*; -import java.util.concurrent.locks.*; +import static java.util.concurrent.TimeUnit.NANOSECONDS; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; import java.util.*; /** @@ -166,7 +168,7 @@ * Sequence number to break scheduling ties, and in turn to * guarantee FIFO order among tied entries. */ - private static final AtomicLong sequencer = new AtomicLong(0); + private static final AtomicLong sequencer = new AtomicLong(); /** * Returns current nanosecond time. @@ -231,7 +233,7 @@ } public long getDelay(TimeUnit unit) { - return unit.convert(time - now(), TimeUnit.NANOSECONDS); + return unit.convert(time - now(), NANOSECONDS); } public int compareTo(Delayed other) { @@ -249,8 +251,8 @@ else return 1; } - long d = (getDelay(TimeUnit.NANOSECONDS) - - other.getDelay(TimeUnit.NANOSECONDS)); + long d = (getDelay(NANOSECONDS) - + other.getDelay(NANOSECONDS)); return (d == 0) ? 0 : ((d < 0) ? -1 : 1); } @@ -424,7 +426,7 @@ * @throws IllegalArgumentException if {@code corePoolSize < 0} */ public ScheduledThreadPoolExecutor(int corePoolSize) { - super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS, + super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS, new DelayedWorkQueue()); } @@ -441,7 +443,7 @@ */ public ScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory) { - super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS, + super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS, new DelayedWorkQueue(), threadFactory); } @@ -458,7 +460,7 @@ */ public ScheduledThreadPoolExecutor(int corePoolSize, RejectedExecutionHandler handler) { - super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS, + super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS, new DelayedWorkQueue(), handler); } @@ -479,7 +481,7 @@ public ScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) { - super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS, + super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS, new DelayedWorkQueue(), threadFactory, handler); } @@ -508,7 +510,7 @@ private long overflowFree(long delay) { Delayed head = (Delayed) super.getQueue().peek(); if (head != null) { - long headDelay = head.getDelay(TimeUnit.NANOSECONDS); + long headDelay = head.getDelay(NANOSECONDS); if (headDelay < 0 && (delay - headDelay < 0)) delay = Long.MAX_VALUE + headDelay; } @@ -616,7 +618,7 @@ * @throws NullPointerException {@inheritDoc} */ public void execute(Runnable command) { - schedule(command, 0, TimeUnit.NANOSECONDS); + schedule(command, 0, NANOSECONDS); } // Override AbstractExecutorService methods @@ -626,7 +628,7 @@ * @throws NullPointerException {@inheritDoc} */ public Future submit(Runnable task) { - return schedule(task, 0, TimeUnit.NANOSECONDS); + return schedule(task, 0, NANOSECONDS); } /** @@ -634,8 +636,7 @@ * @throws NullPointerException {@inheritDoc} */ public Future submit(Runnable task, T result) { - return schedule(Executors.callable(task, result), - 0, TimeUnit.NANOSECONDS); + return schedule(Executors.callable(task, result), 0, NANOSECONDS); } /** @@ -643,7 +644,7 @@ * @throws NullPointerException {@inheritDoc} */ public Future submit(Callable task) { - return schedule(task, 0, TimeUnit.NANOSECONDS); + return schedule(task, 0, NANOSECONDS); } /** @@ -831,8 +832,8 @@ */ private static final int INITIAL_CAPACITY = 16; - private RunnableScheduledFuture[] queue = - new RunnableScheduledFuture[INITIAL_CAPACITY]; + private RunnableScheduledFuture[] queue = + new RunnableScheduledFuture[INITIAL_CAPACITY]; private final ReentrantLock lock = new ReentrantLock(); private int size = 0; @@ -863,7 +864,7 @@ /** * Set f's heapIndex if it is a ScheduledFutureTask. */ - private void setIndex(RunnableScheduledFuture f, int idx) { + private void setIndex(RunnableScheduledFuture f, int idx) { if (f instanceof ScheduledFutureTask) ((ScheduledFutureTask)f).heapIndex = idx; } @@ -872,10 +873,10 @@ * Sift element added at bottom up to its heap-ordered spot. * Call only when holding lock. */ - private void siftUp(int k, RunnableScheduledFuture key) { + private void siftUp(int k, RunnableScheduledFuture key) { while (k > 0) { int parent = (k - 1) >>> 1; - RunnableScheduledFuture e = queue[parent]; + RunnableScheduledFuture e = queue[parent]; if (key.compareTo(e) >= 0) break; queue[k] = e; @@ -890,11 +891,11 @@ * Sift element added at top down to its heap-ordered spot. * Call only when holding lock. */ - private void siftDown(int k, RunnableScheduledFuture key) { + private void siftDown(int k, RunnableScheduledFuture key) { int half = size >>> 1; while (k < half) { int child = (k << 1) + 1; - RunnableScheduledFuture c = queue[child]; + RunnableScheduledFuture c = queue[child]; int right = child + 1; if (right < size && c.compareTo(queue[right]) > 0) c = queue[child = right]; @@ -959,7 +960,7 @@ setIndex(queue[i], -1); int s = --size; - RunnableScheduledFuture replacement = queue[s]; + RunnableScheduledFuture replacement = queue[s]; queue[s] = null; if (s != i) { siftDown(i, replacement); @@ -990,7 +991,7 @@ return Integer.MAX_VALUE; } - public RunnableScheduledFuture peek() { + public RunnableScheduledFuture peek() { final ReentrantLock lock = this.lock; lock.lock(); try { @@ -1003,7 +1004,7 @@ public boolean offer(Runnable x) { if (x == null) throw new NullPointerException(); - RunnableScheduledFuture e = (RunnableScheduledFuture)x; + RunnableScheduledFuture e = (RunnableScheduledFuture)x; final ReentrantLock lock = this.lock; lock.lock(); try { @@ -1045,9 +1046,9 @@ * holding lock. * @param f the task to remove and return */ - private RunnableScheduledFuture finishPoll(RunnableScheduledFuture f) { + private RunnableScheduledFuture finishPoll(RunnableScheduledFuture f) { int s = --size; - RunnableScheduledFuture x = queue[s]; + RunnableScheduledFuture x = queue[s]; queue[s] = null; if (s != 0) siftDown(0, x); @@ -1055,12 +1056,12 @@ return f; } - public RunnableScheduledFuture poll() { + public RunnableScheduledFuture poll() { final ReentrantLock lock = this.lock; lock.lock(); try { - RunnableScheduledFuture first = queue[0]; - if (first == null || first.getDelay(TimeUnit.NANOSECONDS) > 0) + RunnableScheduledFuture first = queue[0]; + if (first == null || first.getDelay(NANOSECONDS) > 0) return null; else return finishPoll(first); @@ -1069,16 +1070,16 @@ } } - public RunnableScheduledFuture take() throws InterruptedException { + public RunnableScheduledFuture take() throws InterruptedException { final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { for (;;) { - RunnableScheduledFuture first = queue[0]; + RunnableScheduledFuture first = queue[0]; if (first == null) available.await(); else { - long delay = first.getDelay(TimeUnit.NANOSECONDS); + long delay = first.getDelay(NANOSECONDS); if (delay <= 0) return finishPoll(first); else if (leader != null) @@ -1102,21 +1103,21 @@ } } - public RunnableScheduledFuture poll(long timeout, TimeUnit unit) + public RunnableScheduledFuture poll(long timeout, TimeUnit unit) throws InterruptedException { long nanos = unit.toNanos(timeout); final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { for (;;) { - RunnableScheduledFuture first = queue[0]; + RunnableScheduledFuture first = queue[0]; if (first == null) { if (nanos <= 0) return null; else nanos = available.awaitNanos(nanos); } else { - long delay = first.getDelay(TimeUnit.NANOSECONDS); + long delay = first.getDelay(NANOSECONDS); if (delay <= 0) return finishPoll(first); if (nanos <= 0) @@ -1148,7 +1149,7 @@ lock.lock(); try { for (int i = 0; i < size; i++) { - RunnableScheduledFuture t = queue[i]; + RunnableScheduledFuture t = queue[i]; if (t != null) { queue[i] = null; setIndex(t, -1); @@ -1164,9 +1165,10 @@ * Return and remove first element only if it is expired. * Used only by drainTo. Call only when holding lock. */ - private RunnableScheduledFuture pollExpired() { - RunnableScheduledFuture first = queue[0]; - if (first == null || first.getDelay(TimeUnit.NANOSECONDS) > 0) + private RunnableScheduledFuture pollExpired() { + // assert lock.isHeldByCurrentThread(); + RunnableScheduledFuture first = queue[0]; + if (first == null || first.getDelay(NANOSECONDS) > 0) return null; return finishPoll(first); } @@ -1179,7 +1181,7 @@ final ReentrantLock lock = this.lock; lock.lock(); try { - RunnableScheduledFuture first; + RunnableScheduledFuture first; int n = 0; while ((first = pollExpired()) != null) { c.add(first); @@ -1201,7 +1203,7 @@ final ReentrantLock lock = this.lock; lock.lock(); try { - RunnableScheduledFuture first; + RunnableScheduledFuture first; int n = 0; while (n < maxElements && (first = pollExpired()) != null) { c.add(first); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java --- a/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,7 +36,6 @@ package java.util.concurrent; import java.util.concurrent.locks.*; -import java.util.concurrent.atomic.*; import java.util.*; /** @@ -163,7 +162,7 @@ /** * Shared internal API for dual stacks and queues. */ - abstract static class Transferer { + abstract static class Transferer { /** * Performs a put or take. * @@ -177,7 +176,7 @@ * the caller can distinguish which of these occurred * by checking Thread.interrupted. */ - abstract Object transfer(Object e, boolean timed, long nanos); + abstract E transfer(E e, boolean timed, long nanos); } /** The number of CPUs, for spin control */ @@ -206,7 +205,7 @@ static final long spinForTimeoutThreshold = 1000L; /** Dual stack */ - static final class TransferStack extends Transferer { + static final class TransferStack extends Transferer { /* * This extends Scherer-Scott dual stack algorithm, differing, * among other ways, by using "covering" nodes rather than @@ -286,7 +285,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = SNode.class; + Class k = SNode.class; matchOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("match")); nextOffset = UNSAFE.objectFieldOffset @@ -322,7 +321,8 @@ /** * Puts or takes an item. */ - Object transfer(Object e, boolean timed, long nanos) { + @SuppressWarnings("unchecked") + E transfer(E e, boolean timed, long nanos) { /* * Basic algorithm is to loop trying one of three actions: * @@ -363,7 +363,7 @@ } if ((h = head) != null && h.next == s) casHead(h, s.next); // help s's fulfiller - return (mode == REQUEST) ? m.item : s.item; + return (E) ((mode == REQUEST) ? m.item : s.item); } } else if (!isFulfilling(h.mode)) { // try to fulfill if (h.isCancelled()) // already cancelled @@ -379,7 +379,7 @@ SNode mn = m.next; if (m.tryMatch(s)) { casHead(s, mn); // pop both s and m - return (mode == REQUEST) ? m.item : s.item; + return (E) ((mode == REQUEST) ? m.item : s.item); } else // lost match s.casNext(m, mn); // help unlink } @@ -513,7 +513,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = TransferStack.class; + Class k = TransferStack.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); } catch (Exception e) { @@ -523,7 +523,7 @@ } /** Dual Queue */ - static final class TransferQueue extends Transferer { + static final class TransferQueue extends Transferer { /* * This extends Scherer-Scott dual queue algorithm, differing, * among other ways, by using modes within nodes rather than @@ -583,7 +583,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = QNode.class; + Class k = QNode.class; itemOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("item")); nextOffset = UNSAFE.objectFieldOffset @@ -640,7 +640,8 @@ /** * Puts or takes an item. */ - Object transfer(Object e, boolean timed, long nanos) { + @SuppressWarnings("unchecked") + E transfer(E e, boolean timed, long nanos) { /* Basic algorithm is to loop trying to take either of * two actions: * @@ -703,7 +704,7 @@ s.item = s; s.waiter = null; } - return (x != null) ? x : e; + return (x != null) ? (E)x : e; } else { // complementary-mode QNode m = h.next; // node to fulfill @@ -720,7 +721,7 @@ advanceHead(h, m); // successfully fulfilled LockSupport.unpark(m.waiter); - return (x != null) ? x : e; + return (x != null) ? (E)x : e; } } } @@ -734,7 +735,7 @@ * @param nanos timeout value * @return matched item, or s if cancelled */ - Object awaitFulfill(QNode s, Object e, boolean timed, long nanos) { + Object awaitFulfill(QNode s, E e, boolean timed, long nanos) { /* Same idea as TransferStack.awaitFulfill */ long lastTime = timed ? System.nanoTime() : 0; Thread w = Thread.currentThread(); @@ -827,7 +828,7 @@ static { try { UNSAFE = sun.misc.Unsafe.getUnsafe(); - Class k = TransferQueue.class; + Class k = TransferQueue.class; headOffset = UNSAFE.objectFieldOffset (k.getDeclaredField("head")); tailOffset = UNSAFE.objectFieldOffset @@ -847,7 +848,7 @@ * isn't a noticeable performance penalty for using volatile * instead of final here. */ - private transient volatile Transferer transferer; + private transient volatile Transferer transferer; /** * Creates a SynchronousQueue with nonfair access policy. @@ -863,7 +864,7 @@ * access; otherwise the order is unspecified. */ public SynchronousQueue(boolean fair) { - transferer = fair ? new TransferQueue() : new TransferStack(); + transferer = fair ? new TransferQueue() : new TransferStack(); } /** @@ -922,9 +923,9 @@ * @throws InterruptedException {@inheritDoc} */ public E take() throws InterruptedException { - Object e = transferer.transfer(null, false, 0); + E e = transferer.transfer(null, false, 0); if (e != null) - return (E)e; + return e; Thread.interrupted(); throw new InterruptedException(); } @@ -939,9 +940,9 @@ * @throws InterruptedException {@inheritDoc} */ public E poll(long timeout, TimeUnit unit) throws InterruptedException { - Object e = transferer.transfer(null, true, unit.toNanos(timeout)); + E e = transferer.transfer(null, true, unit.toNanos(timeout)); if (e != null || !Thread.interrupted()) - return (E)e; + return e; throw new InterruptedException(); } @@ -953,7 +954,7 @@ * element is available. */ public E poll() { - return (E)transferer.transfer(null, true, 0); + return transferer.transfer(null, true, 0); } /** @@ -1065,8 +1066,19 @@ * * @return an empty iterator */ + @SuppressWarnings("unchecked") public Iterator iterator() { - return Collections.emptyIterator(); + return (Iterator) EmptyIterator.EMPTY_ITERATOR; + } + + // Replicated from a previous version of Collections + private static class EmptyIterator implements Iterator { + static final EmptyIterator EMPTY_ITERATOR + = new EmptyIterator(); + + public boolean hasNext() { return false; } + public E next() { throw new NoSuchElementException(); } + public void remove() { throw new IllegalStateException(); } } /** @@ -1103,8 +1115,7 @@ if (c == this) throw new IllegalArgumentException(); int n = 0; - E e; - while ( (e = poll()) != null) { + for (E e; (e = poll()) != null;) { c.add(e); ++n; } @@ -1123,8 +1134,7 @@ if (c == this) throw new IllegalArgumentException(); int n = 0; - E e; - while (n < maxElements && (e = poll()) != null) { + for (E e; n < maxElements && (e = poll()) != null;) { c.add(e); ++n; } @@ -1139,6 +1149,7 @@ * object is ever serialized or deserialized. */ + @SuppressWarnings("serial") static class WaitQueue implements java.io.Serializable { } static class LifoWaitQueue extends WaitQueue { private static final long serialVersionUID = -3633113410248163686L; @@ -1151,7 +1162,7 @@ private WaitQueue waitingConsumers; /** - * Save the state to a stream (that is, serialize it). + * Saves the state to a stream (that is, serializes it). * * @param s the stream */ @@ -1175,9 +1186,9 @@ throws java.io.IOException, ClassNotFoundException { s.defaultReadObject(); if (waitingProducers instanceof FifoWaitQueue) - transferer = new TransferQueue(); + transferer = new TransferQueue(); else - transferer = new TransferStack(); + transferer = new TransferStack(); } // Unsafe mechanics diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/jar/JarFile.java --- a/jdk/src/share/classes/java/util/jar/JarFile.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/jar/JarFile.java Wed Jul 05 17:58:30 2017 +0200 @@ -183,7 +183,7 @@ } else { man = new Manifest(super.getInputStream(manEntry)); } - manRef = new SoftReference(man); + manRef = new SoftReference<>(man); } } return man; @@ -233,13 +233,13 @@ * Returns an enumeration of the zip file entries. */ public Enumeration entries() { - final Enumeration enum_ = super.entries(); + final Enumeration enum_ = super.entries(); return new Enumeration() { public boolean hasMoreElements() { return enum_.hasMoreElements(); } public JarFileEntry nextElement() { - ZipEntry ze = (ZipEntry)enum_.nextElement(); + ZipEntry ze = enum_.nextElement(); return new JarFileEntry(ze); } }; @@ -608,7 +608,7 @@ } // screen out entries which are never signed - final Enumeration enum_ = super.entries(); + final Enumeration enum_ = super.entries(); return new Enumeration() { ZipEntry entry; @@ -618,7 +618,7 @@ return true; } while (enum_.hasMoreElements()) { - ZipEntry ze = (ZipEntry) enum_.nextElement(); + ZipEntry ze = enum_.nextElement(); if (JarVerifier.isSigningRelated(ze.getName())) { continue; } @@ -649,7 +649,7 @@ * JAR file has no signed content. Is there a non-signing * code source? */ - Enumeration unsigned = unsignedEntryNames(); + Enumeration unsigned = unsignedEntryNames(); if (unsigned.hasMoreElements()) { return new CodeSource[]{JarVerifier.getUnsignedCS(url)}; } else { @@ -658,7 +658,7 @@ } private Enumeration unsignedEntryNames() { - final Enumeration entries = entries(); + final Enumeration entries = entries(); return new Enumeration() { String name; @@ -673,7 +673,7 @@ } while (entries.hasMoreElements()) { String value; - ZipEntry e = (ZipEntry) entries.nextElement(); + ZipEntry e = entries.nextElement(); value = e.getName(); if (e.isDirectory() || JarVerifier.isSigningRelated(value)) { continue; @@ -726,11 +726,11 @@ } } - List getManifestDigests() { + List getManifestDigests() { ensureInitialization(); if (jv != null) { return jv.getManifestDigests(); } - return new ArrayList(); + return new ArrayList(); } } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/jar/Manifest.java --- a/jdk/src/share/classes/java/util/jar/Manifest.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/jar/Manifest.java Wed Jul 05 17:58:30 2017 +0200 @@ -51,7 +51,7 @@ private Attributes attr = new Attributes(); // manifest entries - private Map entries = new HashMap(); + private Map entries = new HashMap<>(); /** * Constructs a new, empty Manifest. @@ -148,11 +148,11 @@ // Write out the main attributes for the manifest attr.writeMain(dos); // Now write out the pre-entry attributes - Iterator it = entries.entrySet().iterator(); + Iterator> it = entries.entrySet().iterator(); while (it.hasNext()) { - Map.Entry e = (Map.Entry)it.next(); + Map.Entry e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); - String value = (String)e.getKey(); + String value = e.getKey(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); @@ -161,7 +161,7 @@ buffer.append("\r\n"); make72Safe(buffer); dos.writeBytes(buffer.toString()); - ((Attributes)e.getValue()).write(dos); + e.getValue().write(dos); } dos.flush(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/logging/LogManager.java --- a/jdk/src/share/classes/java/util/logging/LogManager.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/logging/LogManager.java Wed Jul 05 17:58:30 2017 +0200 @@ -179,10 +179,10 @@ cname = System.getProperty("java.util.logging.manager"); if (cname != null) { try { - Class clz = ClassLoader.getSystemClassLoader().loadClass(cname); + Class clz = ClassLoader.getSystemClassLoader().loadClass(cname); manager = (LogManager) clz.newInstance(); } catch (ClassNotFoundException ex) { - Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname); + Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname); manager = (LogManager) clz.newInstance(); } } @@ -200,8 +200,8 @@ // Adding the global Logger. Doing so in the Logger. // would deadlock with the LogManager.. - Logger.global.setLogManager(manager); - manager.addLogger(Logger.global); + Logger.getGlobal().setLogManager(manager); + manager.addLogger(Logger.getGlobal()); // We don't call readConfiguration() here, as we may be running // very early in the JVM startup sequence. Instead readConfiguration @@ -415,8 +415,8 @@ for (int i = 0; i < names.length; i++) { String word = names[i]; try { - Class clz = ClassLoader.getSystemClassLoader().loadClass(word); - Handler hdl = (Handler) clz.newInstance(); + Class clz = ClassLoader.getSystemClassLoader().loadClass(word); + Handler hdl = (Handler) clz.newInstance(); try { // Check if there is a property defining the // this handler's level. @@ -782,11 +782,11 @@ // responsibility to initialize the logging configuration, by // calling readConfiguration(InputStream) with a suitable stream. try { - Class clz = ClassLoader.getSystemClassLoader().loadClass(cname); + Class clz = ClassLoader.getSystemClassLoader().loadClass(cname); clz.newInstance(); return; } catch (ClassNotFoundException ex) { - Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname); + Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname); clz.newInstance(); return; } @@ -837,9 +837,9 @@ // the global handlers, if they haven't been initialized yet. initializedGlobalHandlers = true; } - Enumeration enum_ = getLoggerNames(); + Enumeration enum_ = getLoggerNames(); while (enum_.hasMoreElements()) { - String name = (String)enum_.nextElement(); + String name = enum_.nextElement(); resetLogger(name); } } @@ -926,7 +926,7 @@ for (int i = 0; i < names.length; i++) { String word = names[i]; try { - Class clz = ClassLoader.getSystemClassLoader().loadClass(word); + Class clz = ClassLoader.getSystemClassLoader().loadClass(word); clz.newInstance(); } catch (Exception ex) { System.err.println("Can't load config class \"" + word + "\""); @@ -1024,7 +1024,7 @@ String val = getProperty(name); try { if (val != null) { - Class clz = ClassLoader.getSystemClassLoader().loadClass(val); + Class clz = ClassLoader.getSystemClassLoader().loadClass(val); return (Filter) clz.newInstance(); } } catch (Exception ex) { @@ -1045,7 +1045,7 @@ String val = getProperty(name); try { if (val != null) { - Class clz = ClassLoader.getSystemClassLoader().loadClass(val); + Class clz = ClassLoader.getSystemClassLoader().loadClass(val); return (Formatter) clz.newInstance(); } } catch (Exception ex) { @@ -1163,7 +1163,7 @@ // Private method to be called when the configuration has // changed to apply any level settings to any pre-existing loggers. synchronized private void setLevelsOnExistingLoggers() { - Enumeration enum_ = props.propertyNames(); + Enumeration enum_ = props.propertyNames(); while (enum_.hasMoreElements()) { String key = (String)enum_.nextElement(); if (!key.endsWith(".level")) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/prefs/Preferences.java --- a/jdk/src/share/classes/java/util/prefs/Preferences.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/prefs/Preferences.java Wed Jul 05 17:58:30 2017 +0200 @@ -413,7 +413,7 @@ * @throws IllegalArgumentException if the package has node preferences * node associated with it. */ - private static String nodeName(Class c) { + private static String nodeName(Class c) { if (c.isArray()) throw new IllegalArgumentException( "Arrays have no associated preferences node."); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/prefs/XmlSupport.java --- a/jdk/src/share/classes/java/util/prefs/XmlSupport.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/prefs/XmlSupport.java Wed Jul 05 17:58:30 2017 +0200 @@ -106,7 +106,7 @@ xmlRoot.setAttribute("type", (p.isUserNode() ? "user" : "system")); // Get bottom-up list of nodes from p to root, excluding root - List ancestors = new ArrayList(); + List ancestors = new ArrayList<>(); for (Preferences kid = p, dad = kid.parent(); dad != null; kid = dad, dad = kid.parent()) { @@ -116,7 +116,7 @@ for (int i=ancestors.size()-1; i >= 0; i--) { e.appendChild(doc.createElement("map")); e = (Element) e.appendChild(doc.createElement("node")); - e.setAttribute("name", ((Preferences)ancestors.get(i)).name()); + e.setAttribute("name", ancestors.get(i).name()); } putPreferencesInXml(e, doc, p, subTree); @@ -339,17 +339,17 @@ * @throws IOException if writing to the specified output stream * results in an IOException. */ - static void exportMap(OutputStream os, Map map) throws IOException { + static void exportMap(OutputStream os, Map map) throws IOException { Document doc = createPrefsDoc("map"); Element xmlMap = doc.getDocumentElement( ) ; xmlMap.setAttribute("MAP_XML_VERSION", MAP_XML_VERSION); - for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) { - Map.Entry e = (Map.Entry) i.next(); + for (Iterator> i = map.entrySet().iterator(); i.hasNext(); ) { + Map.Entry e = i.next(); Element xe = (Element) xmlMap.appendChild(doc.createElement("entry")); - xe.setAttribute("key", (String) e.getKey()); - xe.setAttribute("value", (String) e.getValue()); + xe.setAttribute("key", e.getKey()); + xe.setAttribute("value", e.getValue()); } writeDoc(doc, os); @@ -368,7 +368,7 @@ * @throws InvalidPreferencesFormatException Data on input stream does not * constitute a valid XML document with the mandated document type. */ - static void importMap(InputStream is, Map m) + static void importMap(InputStream is, Map m) throws IOException, InvalidPreferencesFormatException { try { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/regex/Pattern.java --- a/jdk/src/share/classes/java/util/regex/Pattern.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/regex/Pattern.java Wed Jul 05 17:58:30 2017 +0200 @@ -1583,13 +1583,26 @@ return; int j = i; i += 2; - int[] newtemp = new int[j + 2*(pLen-i) + 2]; + int[] newtemp = new int[j + 3*(pLen-i) + 2]; System.arraycopy(temp, 0, newtemp, 0, j); boolean inQuote = true; + boolean beginQuote = true; while (i < pLen) { int c = temp[i++]; - if (! ASCII.isAscii(c) || ASCII.isAlnum(c)) { + if (!ASCII.isAscii(c) || ASCII.isAlpha(c)) { + newtemp[j++] = c; + } else if (ASCII.isDigit(c)) { + if (beginQuote) { + /* + * A unicode escape \[0xu] could be before this quote, + * and we don't want this numeric char to processed as + * part of the escape. + */ + newtemp[j++] = '\\'; + newtemp[j++] = 'x'; + newtemp[j++] = '3'; + } newtemp[j++] = c; } else if (c != '\\') { if (inQuote) newtemp[j++] = '\\'; @@ -1606,12 +1619,16 @@ if (temp[i] == 'Q') { i++; inQuote = true; + beginQuote = true; + continue; } else { newtemp[j++] = c; if (i != pLen) newtemp[j++] = temp[i++]; } } + + beginQuote = false; } patternLength = j; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/java/util/zip/ZipEntry.java --- a/jdk/src/share/classes/java/util/zip/ZipEntry.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/java/util/zip/ZipEntry.java Wed Jul 05 17:58:30 2017 +0200 @@ -281,6 +281,7 @@ * Converts DOS time to Java time (number of milliseconds since epoch). */ private static long dosToJavaTime(long dtime) { + @SuppressWarnings("deprecation") // Use of date constructor. Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80), (int)(((dtime >> 21) & 0x0f) - 1), (int)((dtime >> 16) & 0x1f), @@ -293,6 +294,7 @@ /* * Converts Java time to DOS time. */ + @SuppressWarnings("deprecation") // Use of date methods private static long javaToDosTime(long time) { Date d = new Date(time); int year = d.getYear() + 1900; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/script/ScriptException.java --- a/jdk/src/share/classes/javax/script/ScriptException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/script/ScriptException.java Wed Jul 05 17:58:30 2017 +0200 @@ -36,6 +36,8 @@ */ public class ScriptException extends Exception { + private static final long serialVersionUID = 8265071037049225001L; + private String fileName; private int lineNumber; private int columnNumber; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/AbstractButton.java --- a/jdk/src/share/classes/javax/swing/AbstractButton.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/AbstractButton.java Wed Jul 05 17:58:30 2017 +0200 @@ -1349,6 +1349,7 @@ return new ButtonActionPropertyChangeListener(this, a); } + @SuppressWarnings("serial") private static class ButtonActionPropertyChangeListener extends ActionPropertyChangeListener { ButtonActionPropertyChangeListener(AbstractButton b, Action a) { @@ -1976,6 +1977,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class ButtonChangeListener implements ChangeListener, Serializable { // NOTE: This class is NOT used, instead the functionality has // been moved to Handler. @@ -2320,6 +2322,7 @@ // // Listeners that are added to model // + @SuppressWarnings("serial") class Handler implements ActionListener, ChangeListener, ItemListener, Serializable { // @@ -2472,7 +2475,7 @@ // the members of the button group. int len = group.getButtonCount(); Object [] target = new Object[len]; - Enumeration elem = group.getElements(); + Enumeration elem = group.getElements(); for (int i = 0; i < len; i++) { if (elem.hasMoreElements()) { target[i] = elem.nextElement(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/ActionMap.java --- a/jdk/src/share/classes/javax/swing/ActionMap.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/ActionMap.java Wed Jul 05 17:58:30 2017 +0200 @@ -55,6 +55,7 @@ * @author Scott Violet * @since 1.3 */ +@SuppressWarnings("serial") public class ActionMap implements Serializable { /** Handles the mapping between Action name and Action. */ private transient ArrayTable arrayTable; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/ActionPropertyChangeListener.java --- a/jdk/src/share/classes/javax/swing/ActionPropertyChangeListener.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/ActionPropertyChangeListener.java Wed Jul 05 17:58:30 2017 +0200 @@ -101,9 +101,9 @@ // Check to see whether any old buttons have // been enqueued for GC. If so, look up their // PCL instance and remove it from its Action. - OwnedWeakReference r; + OwnedWeakReference r; while ((r = (OwnedWeakReference)queue.poll()) != null) { - ActionPropertyChangeListener oldPCL = r.getOwner(); + ActionPropertyChangeListener oldPCL = r.getOwner(); Action oldAction = oldPCL.getAction(); if (oldAction!=null) { oldAction.removePropertyChangeListener(oldPCL); @@ -142,15 +142,15 @@ private static class OwnedWeakReference extends WeakReference { - private ActionPropertyChangeListener owner; + private ActionPropertyChangeListener owner; OwnedWeakReference(U target, ReferenceQueue queue, - ActionPropertyChangeListener owner) { + ActionPropertyChangeListener owner) { super(target, queue); this.owner = owner; } - public ActionPropertyChangeListener getOwner() { + public ActionPropertyChangeListener getOwner() { return owner; } } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/AncestorNotifier.java --- a/jdk/src/share/classes/javax/swing/AncestorNotifier.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/AncestorNotifier.java Wed Jul 05 17:58:30 2017 +0200 @@ -42,6 +42,7 @@ * @author Dave Moore */ +@SuppressWarnings("serial") class AncestorNotifier implements ComponentListener, PropertyChangeListener, Serializable { Component firstInvisibleAncestor; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/ArrayTable.java --- a/jdk/src/share/classes/javax/swing/ArrayTable.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/ArrayTable.java Wed Jul 05 17:58:30 2017 +0200 @@ -133,7 +133,7 @@ if ((size==ARRAY_BOUNDARY) && isArray()) { grow(); } - ((Hashtable)table).put(key, value); + ((Hashtable)table).put(key, value); } } } @@ -259,8 +259,8 @@ newArrayTable.put(array[i], array[i+1]); } } else { - Hashtable tmp = (Hashtable)table; - Enumeration keys = tmp.keys(); + Hashtable tmp = (Hashtable)table; + Enumeration keys = tmp.keys(); while (keys.hasMoreElements()) { Object o = keys.nextElement(); newArrayTable.put(o,tmp.get(o)); @@ -289,8 +289,8 @@ keys[index] = array[i]; } } else { - Hashtable tmp = (Hashtable)table; - Enumeration enum_ = tmp.keys(); + Hashtable tmp = (Hashtable)table; + Enumeration enum_ = tmp.keys(); int counter = tmp.size(); if (keys == null) { keys = new Object[counter]; @@ -326,9 +326,9 @@ * Shrinks the storage from a hashtable to an array. */ private void shrink() { - Hashtable tmp = (Hashtable)table; + Hashtable tmp = (Hashtable)table; Object[] array = new Object[tmp.size()*2]; - Enumeration keys = tmp.keys(); + Enumeration keys = tmp.keys(); int j = 0; while (keys.hasMoreElements()) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/Box.java --- a/jdk/src/share/classes/javax/swing/Box.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/Box.java Wed Jul 05 17:58:30 2017 +0200 @@ -76,6 +76,7 @@ * * @author Timothy Prinzing */ +@SuppressWarnings("serial") public class Box extends JComponent implements Accessible { /** @@ -301,6 +302,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") public static class Filler extends JComponent implements Accessible { /** @@ -380,6 +382,7 @@ * This class implements accessibility support for the * Box.Filler class. */ + @SuppressWarnings("serial") protected class AccessibleBoxFiller extends AccessibleAWTComponent { // AccessibleContext methods // @@ -420,6 +423,7 @@ * This class implements accessibility support for the * Box class. */ + @SuppressWarnings("serial") protected class AccessibleBox extends AccessibleAWTContainer { // AccessibleContext methods // diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/BoxLayout.java --- a/jdk/src/share/classes/javax/swing/BoxLayout.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/BoxLayout.java Wed Jul 05 17:58:30 2017 +0200 @@ -135,6 +135,7 @@ * * @author Timothy Prinzing */ +@SuppressWarnings("serial") public class BoxLayout implements LayoutManager2, Serializable { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/ButtonGroup.java --- a/jdk/src/share/classes/javax/swing/ButtonGroup.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/ButtonGroup.java Wed Jul 05 17:58:30 2017 +0200 @@ -65,6 +65,7 @@ * * @author Jeff Dinkins */ +@SuppressWarnings("serial") public class ButtonGroup implements Serializable { // the list of buttons participating in this group diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/ComponentInputMap.java --- a/jdk/src/share/classes/javax/swing/ComponentInputMap.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/ComponentInputMap.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,6 +35,7 @@ * @author Scott Violet * @since 1.3 */ +@SuppressWarnings("serial") public class ComponentInputMap extends InputMap { /** Component binding is created for. */ private JComponent component; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/InputMap.java --- a/jdk/src/share/classes/javax/swing/InputMap.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/InputMap.java Wed Jul 05 17:58:30 2017 +0200 @@ -52,6 +52,7 @@ * @author Scott Violet * @since 1.3 */ +@SuppressWarnings("serial") public class InputMap implements Serializable { /** Handles the mapping between KeyStroke and Action name. */ private transient ArrayTable arrayTable; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JButton.java --- a/jdk/src/share/classes/javax/swing/JButton.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JButton.java Wed Jul 05 17:58:30 2017 +0200 @@ -75,6 +75,7 @@ * * @author Jeff Dinkins */ +@SuppressWarnings("serial") public class JButton extends AbstractButton implements Accessible { /** @@ -307,6 +308,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJButton extends AccessibleAbstractButton { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JComponent.java --- a/jdk/src/share/classes/javax/swing/JComponent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JComponent.java Wed Jul 05 17:58:30 2017 +0200 @@ -2109,7 +2109,8 @@ private void registerWithKeyboardManager(boolean onlyIfNew) { InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false); KeyStroke[] strokes; - Hashtable registered = (Hashtable)getClientProperty + Hashtable registered = + (Hashtable)getClientProperty (WHEN_IN_FOCUSED_WINDOW_BINDINGS); if (inputMap != null) { @@ -2161,14 +2162,15 @@ * WHEN_IN_FOCUSED_WINDOW KeyStroke bindings. */ private void unregisterWithKeyboardManager() { - Hashtable registered = (Hashtable)getClientProperty + Hashtable registered = + (Hashtable)getClientProperty (WHEN_IN_FOCUSED_WINDOW_BINDINGS); if (registered != null && registered.size() > 0) { - Enumeration keys = registered.keys(); + Enumeration keys = registered.keys(); while (keys.hasMoreElements()) { - KeyStroke ks = (KeyStroke)keys.nextElement(); + KeyStroke ks = keys.nextElement(); unregisterWithKeyboardManager(ks); } } @@ -3469,6 +3471,7 @@ } } + @SuppressWarnings("serial") static class KeyboardState implements Serializable { private static final Object keyCodesKey = JComponent.KeyboardState.class; @@ -4125,13 +4128,13 @@ if (!getFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET)) { super.setFocusTraversalKeys(KeyboardFocusManager. FORWARD_TRAVERSAL_KEYS, - (Set)value); + (Set)value); } } else if (propertyName == "focusTraversalKeysBackward") { if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) { super.setFocusTraversalKeys(KeyboardFocusManager. BACKWARD_TRAVERSAL_KEYS, - (Set)value); + (Set)value); } } else { throw new IllegalArgumentException("property \""+ @@ -4188,6 +4191,7 @@ * * @return true if this component is lightweight */ + @SuppressWarnings("deprecation") public static boolean isLightweightComponent(Component c) { return c.getPeer() instanceof LightweightPeer; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JLabel.java --- a/jdk/src/share/classes/javax/swing/JLabel.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JLabel.java Wed Jul 05 17:58:30 2017 +0200 @@ -104,6 +104,7 @@ * * @author Hans Muller */ +@SuppressWarnings("serial") public class JLabel extends JComponent implements SwingConstants, Accessible { /** @@ -1067,6 +1068,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJLabel extends AccessibleJComponent implements AccessibleText, AccessibleExtendedComponent { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JLayeredPane.java --- a/jdk/src/share/classes/javax/swing/JLayeredPane.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java Wed Jul 05 17:58:30 2017 +0200 @@ -154,6 +154,7 @@ * * @author David Kloba */ +@SuppressWarnings("serial") public class JLayeredPane extends JComponent implements Accessible { /// Watch the values in getObjectForLayer() /** Convenience object defining the Default layer. Equivalent to new Integer(0).*/ @@ -256,7 +257,7 @@ */ public void removeAll() { Component[] children = getComponents(); - Hashtable cToL = getComponentToLayer(); + Hashtable cToL = getComponentToLayer(); for (int counter = children.length - 1; counter >= 0; counter--) { Component c = children[counter]; if (c != null && !(c instanceof JComponent)) { @@ -768,6 +769,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJLayeredPane extends AccessibleJComponent { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JMenu.java --- a/jdk/src/share/classes/javax/swing/JMenu.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JMenu.java Wed Jul 05 17:58:30 2017 +0200 @@ -109,6 +109,7 @@ * @see JMenuBar * @see JPopupMenu */ +@SuppressWarnings("serial") public class JMenu extends JMenuItem implements Accessible,MenuElement { /** @@ -134,13 +135,6 @@ */ private MenuEvent menuEvent = null; - /* Registry of listeners created for Action-JMenuItem - * linkage. This is needed so that references can - * be cleaned up at remove time to allow garbage collection - * Default is null. - */ - private static Hashtable listenerRegistry = null; - /* * Used by the look and feel (L&F) code to handle * implementation specific menu behaviors. @@ -1111,6 +1105,7 @@ void configureAcceleratorFromAction(Action a) { } + @SuppressWarnings("serial") class MenuChangeListener implements ChangeListener, Serializable { boolean isSelected = false; public void stateChanged(ChangeEvent e) { @@ -1158,6 +1153,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class WinListener extends WindowAdapter implements Serializable { JPopupMenu popupMenu; /** @@ -1394,6 +1390,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJMenu extends AccessibleJMenuItem implements AccessibleSelection { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JMenuBar.java --- a/jdk/src/share/classes/javax/swing/JMenuBar.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JMenuBar.java Wed Jul 05 17:58:30 2017 +0200 @@ -82,6 +82,7 @@ * @see JPopupMenu * @see JMenuItem */ +@SuppressWarnings("serial") public class JMenuBar extends JComponent implements Accessible,MenuElement { /** @@ -498,6 +499,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJMenuBar extends AccessibleJComponent implements AccessibleSelection { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JMenuItem.java --- a/jdk/src/share/classes/javax/swing/JMenuItem.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JMenuItem.java Wed Jul 05 17:58:30 2017 +0200 @@ -87,6 +87,7 @@ * @see JCheckBoxMenuItem * @see JRadioButtonMenuItem */ +@SuppressWarnings("serial") public class JMenuItem extends AbstractButton implements Accessible,MenuElement { /** @@ -829,6 +830,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJMenuItem extends AccessibleAbstractButton implements ChangeListener { private boolean isArmed = false; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JPopupMenu.java --- a/jdk/src/share/classes/javax/swing/JPopupMenu.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java Wed Jul 05 17:58:30 2017 +0200 @@ -81,6 +81,7 @@ * @author David Karlton * @author Arnaud Weber */ +@SuppressWarnings("serial") public class JPopupMenu extends JComponent implements Accessible,MenuElement { /** @@ -1200,6 +1201,7 @@ * Java Accessibility API appropriate to popup menu user-interface * elements. */ + @SuppressWarnings("serial") protected class AccessibleJPopupMenu extends AccessibleJComponent implements PropertyChangeListener { @@ -1268,7 +1270,7 @@ private void fireActiveDescendant() { if (JPopupMenu.this instanceof BasicComboPopup) { // get the popup list - JList popupList = ((BasicComboPopup)JPopupMenu.this).getList(); + JList popupList = ((BasicComboPopup)JPopupMenu.this).getList(); if (popupList == null) { return; } @@ -1335,7 +1337,7 @@ throws IOException, ClassNotFoundException { s.defaultReadObject(); - Vector values = (Vector)s.readObject(); + Vector values = (Vector)s.readObject(); int indexCounter = 0; int maxCounter = values.size(); @@ -1519,6 +1521,7 @@ /** * A popup menu-specific separator. */ + @SuppressWarnings("serial") static public class Separator extends JSeparator { public Separator( ) diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JRootPane.java --- a/jdk/src/share/classes/javax/swing/JRootPane.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JRootPane.java Wed Jul 05 17:58:30 2017 +0200 @@ -199,6 +199,7 @@ * @author David Kloba */ /// PENDING(klobad) Who should be opaque in this component? +@SuppressWarnings("serial") public class JRootPane extends JComponent implements Accessible { private static final String uiClassID = "RootPaneUI"; @@ -834,6 +835,7 @@ } } + @SuppressWarnings("serial") static class DefaultAction extends AbstractAction { JButton owner; JRootPane root; @@ -900,6 +902,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class RootLayout implements LayoutManager2, Serializable { /** @@ -1065,6 +1068,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJRootPane extends AccessibleJComponent { /** * Get the role of this object. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JSeparator.java --- a/jdk/src/share/classes/javax/swing/JSeparator.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JSeparator.java Wed Jul 05 17:58:30 2017 +0200 @@ -71,6 +71,7 @@ * @author Georges Saab * @author Jeff Shapiro */ +@SuppressWarnings("serial") public class JSeparator extends JComponent implements SwingConstants, Accessible { /** @@ -279,6 +280,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJSeparator extends AccessibleJComponent { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JToolTip.java --- a/jdk/src/share/classes/javax/swing/JToolTip.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JToolTip.java Wed Jul 05 17:58:30 2017 +0200 @@ -66,6 +66,7 @@ * @author Dave Moore * @author Rich Shiavi */ +@SuppressWarnings("serial") public class JToolTip extends JComponent implements Accessible { /** * @see #getUIClassID @@ -251,6 +252,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJToolTip extends AccessibleJComponent { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JTree.java --- a/jdk/src/share/classes/javax/swing/JTree.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JTree.java Wed Jul 05 17:58:30 2017 +0200 @@ -142,6 +142,7 @@ * @author Ray Ryan * @author Scott Violet */ +@SuppressWarnings("serial") public class JTree extends JComponent implements Scrollable, Accessible { /** @@ -421,6 +422,7 @@ */ private int expandRow = -1; + @SuppressWarnings("serial") private class TreeTimer extends Timer { public TreeTimer() { super(2000, null); @@ -3077,7 +3079,7 @@ expandedStack = new Stack>(); - Vector values = (Vector)s.readObject(); + Vector values = (Vector)s.readObject(); int indexCounter = 0; int maxCounter = values.size(); @@ -3159,7 +3161,7 @@ */ private void unarchiveExpandedState(Object state) { if(state instanceof Vector) { - Vector paths = (Vector)state; + Vector paths = (Vector)state; for(int counter = paths.size() - 1; counter >= 0; counter--) { Boolean eState = (Boolean)paths.elementAt(counter--); @@ -3240,6 +3242,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected static class EmptySelectionModel extends DefaultTreeSelectionModel { @@ -3361,6 +3364,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class TreeSelectionRedirector implements Serializable, TreeSelectionListener { @@ -3661,7 +3665,7 @@ { if(toRemove != null) { while(toRemove.hasMoreElements()) { - Enumeration descendants = getDescendantToggledPaths + Enumeration descendants = getDescendantToggledPaths (toRemove.nextElement()); if(descendants != null) { @@ -3861,6 +3865,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") public static class DynamicUtilTreeNode extends DefaultMutableTreeNode { /** * Does the this JTree have children? @@ -3882,7 +3887,7 @@ public static void createChildren(DefaultMutableTreeNode parent, Object children) { if(children instanceof Vector) { - Vector childVector = (Vector)children; + Vector childVector = (Vector)children; for(int counter = 0, maxCounter = childVector.size(); counter < maxCounter; counter++) @@ -3891,8 +3896,8 @@ childVector.elementAt(counter))); } else if(children instanceof Hashtable) { - Hashtable childHT = (Hashtable)children; - Enumeration keys = childHT.keys(); + Hashtable childHT = (Hashtable)children; + Enumeration keys = childHT.keys(); Object aKey; while(keys.hasMoreElements()) { @@ -4092,6 +4097,7 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. */ + @SuppressWarnings("serial") protected class AccessibleJTree extends AccessibleJComponent implements AccessibleSelection, TreeSelectionListener, TreeModelListener, TreeExpansionListener { @@ -5242,6 +5248,7 @@ } } + @SuppressWarnings("deprecation") public boolean isFocusTraversable() { AccessibleContext ac = getCurrentAccessibleContext(); if (ac instanceof AccessibleComponent) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/JWindow.java --- a/jdk/src/share/classes/javax/swing/JWindow.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/JWindow.java Wed Jul 05 17:58:30 2017 +0200 @@ -89,6 +89,7 @@ * * @author David Kloba */ +@SuppressWarnings("serial") public class JWindow extends Window implements Accessible, RootPaneContainer, TransferHandler.HasGetTransferHandler @@ -663,6 +664,7 @@ * Java Accessibility API appropriate to window user-interface * elements. */ + @SuppressWarnings("serial") protected class AccessibleJWindow extends AccessibleAWTWindow { // everything is in the new parent, AccessibleAWTWindow } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/MenuSelectionManager.java --- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Wed Jul 05 17:58:30 2017 +0200 @@ -213,7 +213,7 @@ MenuElement menuElement; MenuElement subElements[]; MenuElement path[]; - Vector tmp; + Vector tmp; int selectionSize; p = event.getPoint(); @@ -242,7 +242,7 @@ screenX = p.x; screenY = p.y; - tmp = (Vector)selection.clone(); + tmp = (Vector)selection.clone(); selectionSize = tmp.size(); boolean success = false; for (i=selectionSize - 1;i >= 0 && success == false; i--) { @@ -377,7 +377,7 @@ int cWidth,cHeight; MenuElement menuElement; MenuElement subElements[]; - Vector tmp; + Vector tmp; int selectionSize; SwingUtilities.convertPointToScreen(p,source); @@ -385,7 +385,7 @@ screenX = p.x; screenY = p.y; - tmp = (Vector)selection.clone(); + tmp = (Vector)selection.clone(); selectionSize = tmp.size(); for(i=selectionSize - 1 ; i >= 0 ; i--) { menuElement = (MenuElement) tmp.elementAt(i); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/Popup.java --- a/jdk/src/share/classes/javax/swing/Popup.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/Popup.java Wed Jul 05 17:58:30 2017 +0200 @@ -98,6 +98,8 @@ * Makes the Popup visible. If the Popup is * currently visible, this has no effect. */ + + @SuppressWarnings("deprecation") public void show() { Component component = getComponent(); @@ -114,6 +116,8 @@ * on a disposed Popup, indeterminate * behavior will result. */ + + @SuppressWarnings("deprecation") public void hide() { Component component = getComponent(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/RepaintManager.java --- a/jdk/src/share/classes/javax/swing/RepaintManager.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/RepaintManager.java Wed Jul 05 17:58:30 2017 +0200 @@ -744,7 +744,6 @@ int localBoundsY = 0; int localBoundsH; int localBoundsW; - Enumeration keys; roots = new ArrayList(count); @@ -1073,9 +1072,9 @@ } } // Clear out the VolatileImages - Iterator gcs = volatileMap.keySet().iterator(); + Iterator gcs = volatileMap.keySet().iterator(); while (gcs.hasNext()) { - GraphicsConfiguration gc = (GraphicsConfiguration)gcs.next(); + GraphicsConfiguration gc = gcs.next(); VolatileImage image = volatileMap.get(gc); if (image.getWidth() > width || image.getHeight() > height) { image.flush(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/Timer.java --- a/jdk/src/share/classes/javax/swing/Timer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/Timer.java Wed Jul 05 17:58:30 2017 +0200 @@ -146,6 +146,7 @@ * * @author Dave Moore */ +@SuppressWarnings("serial") public class Timer implements Serializable { /* diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/border/AbstractBorder.java --- a/jdk/src/share/classes/javax/swing/border/AbstractBorder.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/border/AbstractBorder.java Wed Jul 05 17:58:30 2017 +0200 @@ -46,6 +46,7 @@ * * @author David Kloba */ +@SuppressWarnings("serial") public abstract class AbstractBorder implements Border, Serializable { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/border/CompoundBorder.java --- a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Wed Jul 05 17:58:30 2017 +0200 @@ -54,6 +54,7 @@ * * @author David Kloba */ +@SuppressWarnings("serial") public class CompoundBorder extends AbstractBorder { protected Border outsideBorder; protected Border insideBorder; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/border/EmptyBorder.java --- a/jdk/src/share/classes/javax/swing/border/EmptyBorder.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/border/EmptyBorder.java Wed Jul 05 17:58:30 2017 +0200 @@ -46,6 +46,7 @@ * * @author David Kloba */ +@SuppressWarnings("serial") public class EmptyBorder extends AbstractBorder implements Serializable { protected int left, right, top, bottom; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/border/MatteBorder.java --- a/jdk/src/share/classes/javax/swing/border/MatteBorder.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/border/MatteBorder.java Wed Jul 05 17:58:30 2017 +0200 @@ -46,6 +46,7 @@ * * @author Amy Fowler */ +@SuppressWarnings("serial") public class MatteBorder extends EmptyBorder { protected Color color; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/border/TitledBorder.java --- a/jdk/src/share/classes/javax/swing/border/TitledBorder.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/border/TitledBorder.java Wed Jul 05 17:58:30 2017 +0200 @@ -67,6 +67,7 @@ * @author David Kloba * @author Amy Fowler */ +@SuppressWarnings("serial") public class TitledBorder extends AbstractBorder { protected String title; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/AncestorEvent.java --- a/jdk/src/share/classes/javax/swing/event/AncestorEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/AncestorEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -43,6 +43,7 @@ * * @author Dave Moore */ +@SuppressWarnings("serial") public class AncestorEvent extends AWTEvent { /** * An ancestor-component was added to the hierarchy of diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/ChangeEvent.java --- a/jdk/src/share/classes/javax/swing/event/ChangeEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/ChangeEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -42,6 +42,7 @@ * * @author Jeff Dinkins */ +@SuppressWarnings("serial") public class ChangeEvent extends EventObject { /** * Constructs a ChangeEvent object. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/EventListenerList.java --- a/jdk/src/share/classes/javax/swing/event/EventListenerList.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/EventListenerList.java Wed Jul 05 17:58:30 2017 +0200 @@ -96,6 +96,7 @@ * @author Hans Muller * @author James Gosling */ +@SuppressWarnings("serial") public class EventListenerList implements Serializable { /* A null array to be shared by all empty listener lists*/ private final static Object[] NULL_ARRAY = new Object[0]; @@ -250,7 +251,7 @@ // Save the non-null event listeners: for (int i = 0; i < lList.length; i+=2) { - Class t = (Class)lList[i]; + Class t = (Class)lList[i]; EventListener l = (EventListener)lList[i+1]; if ((l!=null) && (l instanceof Serializable)) { s.writeObject(t.getName()); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/ListDataEvent.java --- a/jdk/src/share/classes/javax/swing/event/ListDataEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/ListDataEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -42,6 +42,7 @@ * * @author Hans Muller */ +@SuppressWarnings("serial") public class ListDataEvent extends EventObject { /** Identifies one or more changes in the lists contents. */ diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/MenuDragMouseEvent.java --- a/jdk/src/share/classes/javax/swing/event/MenuDragMouseEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/MenuDragMouseEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,6 +47,7 @@ * * @author Georges Saab */ +@SuppressWarnings("serial") public class MenuDragMouseEvent extends MouseEvent { private MenuElement path[]; private MenuSelectionManager manager; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/MenuEvent.java --- a/jdk/src/share/classes/javax/swing/event/MenuEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/MenuEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -44,6 +44,7 @@ * @author Georges Saab * @author David Karlton */ +@SuppressWarnings("serial") public class MenuEvent extends EventObject { /** * Constructs a MenuEvent object. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/MenuKeyEvent.java --- a/jdk/src/share/classes/javax/swing/event/MenuKeyEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/MenuKeyEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,6 +47,7 @@ * * @author Georges Saab */ +@SuppressWarnings("serial") public class MenuKeyEvent extends KeyEvent { private MenuElement path[]; private MenuSelectionManager manager; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java --- a/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/event/PopupMenuEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -41,6 +41,7 @@ * * @author Arnaud Weber */ +@SuppressWarnings("serial") public class PopupMenuEvent extends EventObject { /** * Constructs a PopupMenuEvent object. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/plaf/ComponentUI.java --- a/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java Wed Jul 05 17:58:30 2017 +0200 @@ -244,6 +244,7 @@ * @see javax.swing.JComponent#contains * @see java.awt.Component#contains */ + @SuppressWarnings("deprecation") public boolean contains(JComponent c, int x, int y) { return c.inside(x, y); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/text/BadLocationException.java --- a/jdk/src/share/classes/javax/swing/text/BadLocationException.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/text/BadLocationException.java Wed Jul 05 17:58:30 2017 +0200 @@ -39,6 +39,7 @@ * * @author Timothy Prinzing */ +@SuppressWarnings("serial") public class BadLocationException extends Exception { /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java --- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Wed Jul 05 17:58:30 2017 +0200 @@ -61,6 +61,7 @@ * * @author Scott Violet */ +@SuppressWarnings("serial") public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeSelectionModel { /** Property name for selectionMode. */ @@ -1073,7 +1074,7 @@ * @deprecated As of JDK version 1.7 */ @Deprecated - protected void notifyPathChange(Vector changedPaths, + protected void notifyPathChange(Vector changedPaths, TreePath oldLeadSelection) { int cPathCount = changedPaths.size(); boolean[] newness = new boolean[cPathCount]; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/NodeSetData.java --- a/jdk/src/share/classes/javax/xml/crypto/NodeSetData.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/NodeSetData.java Wed Jul 05 17:58:30 2017 +0200 @@ -52,5 +52,6 @@ * @return an Iterator over the nodes in this * NodeSetData in document order */ + @SuppressWarnings("rawtypes") Iterator iterator(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java --- a/jdk/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,13 +47,13 @@ */ public class DOMCryptoContext implements XMLCryptoContext { - private HashMap nsMap = new HashMap(); - private HashMap idMap = new HashMap(); - private HashMap objMap = new HashMap(); + private HashMap nsMap = new HashMap<>(); + private HashMap idMap = new HashMap<>(); + private HashMap objMap = new HashMap<>(); private String baseURI; private KeySelector ks; private URIDereferencer dereferencer; - private HashMap propMap = new HashMap(); + private HashMap propMap = new HashMap<>(); private String defaultPrefix; /** @@ -73,7 +73,7 @@ if (namespaceURI == null) { throw new NullPointerException("namespaceURI cannot be null"); } - String prefix = (String) nsMap.get(namespaceURI); + String prefix = nsMap.get(namespaceURI); return (prefix != null ? prefix : defaultPrefix); } @@ -87,7 +87,7 @@ if (namespaceURI == null) { throw new NullPointerException("namespaceURI is null"); } - return (String) nsMap.put(namespaceURI, prefix); + return nsMap.put(namespaceURI, prefix); } public String getDefaultNamespacePrefix() { @@ -170,7 +170,7 @@ if (idValue == null) { throw new NullPointerException("idValue is null"); } - return (Element) idMap.get(idValue); + return idMap.get(idValue); } /** @@ -219,6 +219,7 @@ * * @return a read-only iterator over the set of mappings */ + @SuppressWarnings("rawtypes") public Iterator iterator() { return Collections.unmodifiableMap(idMap).entrySet().iterator(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/Manifest.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/Manifest.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/Manifest.java Wed Jul 05 17:58:30 2017 +0200 @@ -86,5 +86,6 @@ * * @return an unmodifiable list of one or more References */ + @SuppressWarnings("rawtypes") List getReferences(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/Reference.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/Reference.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/Reference.java Wed Jul 05 17:58:30 2017 +0200 @@ -85,6 +85,7 @@ * @return an unmodifiable list of Transforms * (may be empty but never null) */ + @SuppressWarnings("rawtypes") List getTransforms(); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java Wed Jul 05 17:58:30 2017 +0200 @@ -87,5 +87,6 @@ * @return an unmodifiable list of one or more * SignaturePropertys */ + @SuppressWarnings("rawtypes") List getProperties(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java Wed Jul 05 17:58:30 2017 +0200 @@ -91,5 +91,6 @@ * * @return an unmodifiable list of one or more XMLStructures */ + @SuppressWarnings("rawtypes") List getContent(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/SignedInfo.java Wed Jul 05 17:58:30 2017 +0200 @@ -80,6 +80,7 @@ * * @return an unmodifiable list of one or more {@link Reference}s */ + @SuppressWarnings("rawtypes") List getReferences(); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/TransformService.java Wed Jul 05 17:58:30 2017 +0200 @@ -157,9 +157,9 @@ if (mechanismType.equals("DOM")) { dom = true; } - List services = GetInstance.getServices("TransformService", algorithm); - for (Iterator t = services.iterator(); t.hasNext(); ) { - Service s = (Service)t.next(); + List services = GetInstance.getServices("TransformService", algorithm); + for (Iterator t = services.iterator(); t.hasNext(); ) { + Service s = t.next(); String value = s.getAttribute("MechanismType"); if ((value == null && dom) || (value != null && value.equals(mechanismType))) { @@ -277,7 +277,7 @@ + " mechanism not available"); } - private static class MechanismMapEntry implements Map.Entry { + private static class MechanismMapEntry implements Map.Entry { private final String mechanism; private final String algorithm; private final String key; @@ -290,19 +290,19 @@ if (!(o instanceof Map.Entry)) { return false; } - Map.Entry e = (Map.Entry) o; + Map.Entry e = (Map.Entry) o; return (getKey()==null ? e.getKey()==null : getKey().equals(e.getKey())) && (getValue()==null ? e.getValue()==null : getValue().equals(e.getValue())); } - public Object getKey() { + public String getKey() { return key; } - public Object getValue() { + public String getValue() { return mechanism; } - public Object setValue(Object value) { + public String setValue(String value) { throw new UnsupportedOperationException(); } public int hashCode() { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/XMLObject.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLObject.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLObject.java Wed Jul 05 17:58:30 2017 +0200 @@ -100,6 +100,7 @@ * @return an unmodifiable list of XMLStructures (may be empty * but never null) */ + @SuppressWarnings("rawtypes") List getContent(); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignature.java Wed Jul 05 17:58:30 2017 +0200 @@ -136,6 +136,7 @@ * @return an unmodifiable list of XMLObjects (may be empty * but never null) */ + @SuppressWarnings("rawtypes") List getObjects(); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Wed Jul 05 17:58:30 2017 +0200 @@ -365,6 +365,7 @@ * @throws ClassCastException if any of the objects are not of * type XMLObject */ + @SuppressWarnings("rawtypes") public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, List objects, String id, String signatureValueId); @@ -398,6 +399,7 @@ * compliant * @throws NullPointerException if dm is null */ + @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, List transforms, String type, String id); @@ -428,6 +430,7 @@ * @throws NullPointerException if dm or * digestValue is null */ + @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, List transforms, String type, String id, byte[] digestValue); @@ -470,6 +473,7 @@ * appliedTransforms or result is * null */ + @SuppressWarnings("rawtypes") public abstract Reference newReference(String uri, DigestMethod dm, List appliedTransforms, Data result, List transforms, String type, String id); @@ -489,6 +493,7 @@ * @throws NullPointerException if any of the parameters * are null */ + @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, List references); @@ -507,6 +512,7 @@ * @throws NullPointerException if cm, sm, or * references are null */ + @SuppressWarnings("rawtypes") public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, List references, String id); @@ -524,6 +530,7 @@ * @throws ClassCastException if content contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract XMLObject newXMLObject(List content, String id, String mimeType, String encoding); @@ -540,6 +547,7 @@ * @throws ClassCastException if references contains any * entries that are not of type {@link Reference} */ + @SuppressWarnings("rawtypes") public abstract Manifest newManifest(List references); /** @@ -556,6 +564,7 @@ * @throws ClassCastException if references contains any * entries that are not of type {@link Reference} */ + @SuppressWarnings("rawtypes") public abstract Manifest newManifest(List references, String id); /** @@ -574,6 +583,7 @@ * @throws ClassCastException if content contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract SignatureProperty newSignatureProperty (List content, String target, String id); @@ -592,6 +602,7 @@ * @throws ClassCastException if properties contains any * entries that are not of type {@link SignatureProperty} */ + @SuppressWarnings("rawtypes") public abstract SignatureProperties newSignatureProperties (List properties, String id); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java Wed Jul 05 17:58:30 2017 +0200 @@ -94,6 +94,7 @@ * in this KeyInfo. Never returns null or an * empty list. */ + @SuppressWarnings("rawtypes") List getContent(); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Wed Jul 05 17:58:30 2017 +0200 @@ -305,6 +305,7 @@ * @throws ClassCastException if content contains any entries * that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract KeyInfo newKeyInfo(List content); /** @@ -324,6 +325,7 @@ * @throws ClassCastException if content contains any entries * that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract KeyInfo newKeyInfo(List content, String id); /** @@ -385,6 +387,7 @@ * @throws ClassCastException if other contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other); @@ -408,6 +411,7 @@ * @throws ClassCastException if other contains any * entries that are not of type {@link XMLStructure} */ + @SuppressWarnings("rawtypes") public abstract PGPData newPGPData(byte[] keyPacket, List other); /** @@ -439,6 +443,7 @@ * @throws ClassCastException if transforms contains any * entries that are not of type {@link Transform} */ + @SuppressWarnings("rawtypes") public abstract RetrievalMethod newRetrievalMethod(String uri, String type, List transforms); @@ -464,6 +469,7 @@ * @throws ClassCastException if content contains any entries * that are not of one of the valid types mentioned above */ + @SuppressWarnings("rawtypes") public abstract X509Data newX509Data(List content); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java Wed Jul 05 17:58:30 2017 +0200 @@ -112,5 +112,6 @@ * @return an unmodifiable list of XMLStructures (may be * empty, but never null) */ + @SuppressWarnings("rawtypes") List getExternalElements(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java Wed Jul 05 17:58:30 2017 +0200 @@ -80,6 +80,7 @@ * @return an unmodifiable list of Transform objects (may be * empty but never null). */ + @SuppressWarnings("rawtypes") List getTransforms(); /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java Wed Jul 05 17:58:30 2017 +0200 @@ -109,5 +109,6 @@ * @return an unmodifiable list of the content in this X509Data * (never null or empty) */ + @SuppressWarnings("rawtypes") List getContent(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java Wed Jul 05 17:58:30 2017 +0200 @@ -59,7 +59,7 @@ */ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec { - private List preList; + private List preList; /** * Indicates the default namespace ("#default"). @@ -71,7 +71,7 @@ * list. */ public ExcC14NParameterSpec() { - preList = Collections.EMPTY_LIST; + preList = Collections.emptyList(); } /** @@ -86,17 +86,22 @@ * @throws ClassCastException if any of the entries in the list are not * of type String */ + @SuppressWarnings("rawtypes") public ExcC14NParameterSpec(List prefixList) { if (prefixList == null) { throw new NullPointerException("prefixList cannot be null"); } - this.preList = new ArrayList(prefixList); - for (int i = 0, size = preList.size(); i < size; i++) { - if (!(preList.get(i) instanceof String)) { + List copy = new ArrayList<>((List)prefixList); + for (int i = 0, size = copy.size(); i < size; i++) { + if (!(copy.get(i) instanceof String)) { throw new ClassCastException("not a String"); } } - preList = Collections.unmodifiableList(preList); + + @SuppressWarnings("unchecked") + List temp = (List)copy; + + preList = Collections.unmodifiableList(temp); } /** @@ -109,6 +114,7 @@ * @return the inclusive namespace prefix list (may be empty but never * null) */ + @SuppressWarnings("rawtypes") public List getPrefixList() { return preList; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java Wed Jul 05 17:58:30 2017 +0200 @@ -46,7 +46,7 @@ */ public final class XPathFilter2ParameterSpec implements TransformParameterSpec { - private final List xPathList; + private final List xPathList; /** * Creates an XPathFilter2ParameterSpec. @@ -59,11 +59,12 @@ * @throws NullPointerException if xPathList is * null */ + @SuppressWarnings("rawtypes") public XPathFilter2ParameterSpec(List xPathList) { if (xPathList == null) { throw new NullPointerException("xPathList cannot be null"); } - List xPathListCopy = new ArrayList(xPathList); + List xPathListCopy = new ArrayList<>((List)xPathList); if (xPathListCopy.isEmpty()) { throw new IllegalArgumentException("xPathList cannot be empty"); } @@ -74,7 +75,11 @@ ("xPathList["+i+"] is not a valid type"); } } - this.xPathList = Collections.unmodifiableList(xPathListCopy); + + @SuppressWarnings("unchecked") + List temp = (List)xPathListCopy; + + this.xPathList = Collections.unmodifiableList(temp); } /** @@ -86,6 +91,7 @@ * @return a List of XPathType objects * (never null or empty) */ + @SuppressWarnings("rawtypes") public List getXPathList() { return xPathList; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java Wed Jul 05 17:58:30 2017 +0200 @@ -52,7 +52,7 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec { private String xPath; - private Map nsMap; + private Map nsMap; /** * Creates an XPathFilterParameterSpec with the specified @@ -66,7 +66,7 @@ throw new NullPointerException(); } this.xPath = xPath; - this.nsMap = Collections.EMPTY_MAP; + this.nsMap = Collections.emptyMap(); } /** @@ -83,21 +83,26 @@ * @throws ClassCastException if any of the map's keys or entries are not * of type String */ + @SuppressWarnings("rawtypes") public XPathFilterParameterSpec(String xPath, Map namespaceMap) { if (xPath == null || namespaceMap == null) { throw new NullPointerException(); } this.xPath = xPath; - nsMap = new HashMap(namespaceMap); - Iterator entries = nsMap.entrySet().iterator(); + Map copy = new HashMap<>((Map)namespaceMap); + Iterator> entries = copy.entrySet().iterator(); while (entries.hasNext()) { - Map.Entry me = (Map.Entry) entries.next(); + Map.Entry me = entries.next(); if (!(me.getKey() instanceof String) || !(me.getValue() instanceof String)) { throw new ClassCastException("not a String"); } } - nsMap = Collections.unmodifiableMap(nsMap); + + @SuppressWarnings("unchecked") + Map temp = (Map)copy; + + nsMap = Collections.unmodifiableMap(temp); } /** @@ -120,6 +125,7 @@ * @return a Map of namespace prefixes to namespace URIs (may * be empty, but never null) */ + @SuppressWarnings("rawtypes") public Map getNamespaceMap() { return nsMap; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java --- a/jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java Wed Jul 05 17:58:30 2017 +0200 @@ -106,7 +106,7 @@ private final String expression; private final Filter filter; - private Map nsMap; + private Map nsMap; /** * Creates an XPathType instance with the specified XPath @@ -127,7 +127,7 @@ } this.expression = expression; this.filter = filter; - this.nsMap = Collections.EMPTY_MAP; + this.nsMap = Collections.emptyMap(); } /** @@ -147,21 +147,26 @@ * @throws ClassCastException if any of the map's keys or entries are * not of type String */ + @SuppressWarnings("rawtypes") public XPathType(String expression, Filter filter, Map namespaceMap) { this(expression, filter); if (namespaceMap == null) { throw new NullPointerException("namespaceMap cannot be null"); } - nsMap = new HashMap(namespaceMap); - Iterator entries = nsMap.entrySet().iterator(); + Map copy = new HashMap<>((Map)namespaceMap); + Iterator> entries = copy.entrySet().iterator(); while (entries.hasNext()) { - Map.Entry me = (Map.Entry) entries.next(); + Map.Entry me = entries.next(); if (!(me.getKey() instanceof String) || !(me.getValue() instanceof String)) { throw new ClassCastException("not a String"); } } - nsMap = Collections.unmodifiableMap(nsMap); + + @SuppressWarnings("unchecked") + Map temp = (Map)copy; + + nsMap = Collections.unmodifiableMap(temp); } /** @@ -193,6 +198,7 @@ * @return a Map of namespace prefixes to namespace URIs * (may be empty, but never null) */ + @SuppressWarnings("rawtypes") public Map getNamespaceMap() { return nsMap; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/AWTAutoShutdown.java --- a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java Wed Jul 05 17:58:30 2017 +0200 @@ -26,10 +26,13 @@ package sun.awt; import java.awt.AWTEvent; + import java.util.Collections; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.Map; +import java.util.Set; + import sun.util.logging.PlatformLogger; /** @@ -81,7 +84,7 @@ * new event to appear in their event queue. * Access is synchronized on the main lock object. */ - private final HashSet busyThreadSet = new HashSet(7); + private final Set busyThreadSet = new HashSet<>(7); /** * Indicates whether the toolkit thread is waiting for a new native @@ -93,7 +96,7 @@ * This is a map between components and their peers. * we should work with in under activationLock&mainLock lock. */ - private final Map peerMap = new IdentityHashMap(); + private final Map peerMap = new IdentityHashMap<>(); /** * References the alive non-daemon thread that is currently used @@ -319,8 +322,10 @@ } } + @SuppressWarnings("serial") static AWTEvent getShutdownEvent() { - return new AWTEvent(getInstance(), 0) {}; + return new AWTEvent(getInstance(), 0) { + }; } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/AppContext.java --- a/jdk/src/share/classes/sun/awt/AppContext.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/AppContext.java Wed Jul 05 17:58:30 2017 +0200 @@ -171,7 +171,7 @@ * HashMap's potentially risky methods, such as clear(), elements(), * putAll(), etc. */ - private final HashMap table = new HashMap(); + private final Map table = new HashMap<>(); private final ThreadGroup threadGroup; @@ -198,8 +198,8 @@ // On the main Thread, we get the ThreadGroup, make a corresponding // AppContext, and instantiate the Java EventQueue. This way, legacy // code is unaffected by the move to multiple AppContext ability. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup(); ThreadGroup parentThreadGroup = currentThreadGroup.getParent(); @@ -210,7 +210,7 @@ } mainAppContext = new AppContext(currentThreadGroup); numAppContexts = 1; - return mainAppContext; + return null; } }); } @@ -342,6 +342,16 @@ return appContext; } + /** + * Returns the main ("system") AppContext. + * + * @return the main AppContext + * @since 1.8 + */ + final static AppContext getMainAppContext() { + return mainAppContext; + } + private long DISPOSAL_TIMEOUT = 5000; // Default to 5-second timeout // for disposal of all Frames // (we wait for this time twice, @@ -399,8 +409,8 @@ log.finer("exception occured while disposing app context", t); } } - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { if (!GraphicsEnvironment.isHeadless() && SystemTray.isSupported()) { SystemTray systemTray = SystemTray.getSystemTray(); @@ -523,7 +533,7 @@ } } - static final class CreateThreadAction implements PrivilegedAction { + static final class CreateThreadAction implements PrivilegedAction { private final AppContext appContext; private final Runnable runnable; @@ -532,7 +542,7 @@ runnable = r; } - public Object run() { + public Thread run() { Thread t = new Thread(appContext.getThreadGroup(), runnable); t.setContextClassLoader(appContext.getContextClassLoader()); t.setPriority(Thread.NORM_PRIORITY + 1); @@ -552,8 +562,8 @@ if (appContext != AppContext.getAppContext()) { // Create a thread that belongs to the thread group associated // with the AppContext and invokes EventQueue.postEvent. - PrivilegedAction action = new CreateThreadAction(appContext, r); - Thread thread = (Thread)AccessController.doPrivileged(action); + PrivilegedAction action = new CreateThreadAction(appContext, r); + Thread thread = AccessController.doPrivileged(action); thread.start(); } else { r.run(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/CausedFocusEvent.java --- a/jdk/src/share/classes/sun/awt/CausedFocusEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/CausedFocusEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,6 +35,7 @@ * CausedFocusEvent class or implicitly, by calling appropriate requestFocusXXX method with "cause" * parameter. The default cause is UNKNOWN. */ +@SuppressWarnings("serial") public class CausedFocusEvent extends FocusEvent { public enum Cause { UNKNOWN, diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/DebugSettings.java --- a/jdk/src/share/classes/sun/awt/DebugSettings.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/DebugSettings.java Wed Jul 05 17:58:30 2017 +0200 @@ -87,9 +87,9 @@ }; /* global instance of the settings object */ - private static DebugSettings instance = null; + private static DebugSettings instance = null; - private Properties props = new Properties(); + private Properties props = new Properties(); static void init() { if (instance != null) { @@ -102,12 +102,13 @@ } private DebugSettings() { - new java.security.PrivilegedAction() { - public Object run() { - loadProperties(); - return null; - } - }.run(); + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Void run() { + loadProperties(); + return null; + } + }); } /* @@ -117,15 +118,14 @@ private synchronized void loadProperties() { // setup initial properties java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() - { - public Object run() { - loadDefaultProperties(); - loadFileProperties(); - loadSystemProperties(); - return null; - } - }); + new java.security.PrivilegedAction() { + public Void run() { + loadDefaultProperties(); + loadFileProperties(); + loadSystemProperties(); + return null; + } + }); // echo the initial property settings to stdout if (log.isLoggable(PlatformLogger.FINE)) { @@ -134,12 +134,9 @@ } public String toString() { - Enumeration enum_ = props.propertyNames(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); PrintStream pout = new PrintStream(bout); - - while (enum_.hasMoreElements()) { - String key = (String)enum_.nextElement(); + for (String key : props.stringPropertyNames()) { String value = props.getProperty(key, ""); pout.println(key + " = " + value); } @@ -198,9 +195,7 @@ private void loadSystemProperties() { // override file properties with system properties Properties sysProps = System.getProperties(); - Enumeration enum_ = sysProps.propertyNames(); - while ( enum_.hasMoreElements() ) { - String key = (String)enum_.nextElement(); + for (String key : sysProps.stringPropertyNames()) { String value = sysProps.getProperty(key,""); // copy any "awtdebug" properties over if ( key.startsWith(PREFIX) ) { @@ -244,17 +239,14 @@ return value; } - public synchronized Enumeration getPropertyNames() { - Vector propNames = new Vector(); - Enumeration enum_ = props.propertyNames(); - + private synchronized List getPropertyNames() { + List propNames = new LinkedList<>(); // remove global prefix from property names - while ( enum_.hasMoreElements() ) { - String propName = (String)enum_.nextElement(); + for (String propName : props.stringPropertyNames()) { propName = propName.substring(PREFIX.length()+1); - propNames.addElement(propName); + propNames.add(propName); } - return propNames.elements(); + return propNames; } private void println(Object object) { @@ -279,13 +271,11 @@ // // Filter out file/line ctrace properties from debug settings // - Vector traces = new Vector(); - Enumeration enum_ = getPropertyNames(); + List traces = new LinkedList<>(); - while ( enum_.hasMoreElements() ) { - String key = (String)enum_.nextElement(); - if ( key.startsWith(PROP_CTRACE) && key.length() > PROP_CTRACE_LEN ) { - traces.addElement(key); + for (String key : getPropertyNames()) { + if (key.startsWith(PROP_CTRACE) && key.length() > PROP_CTRACE_LEN) { + traces.add(key); } } @@ -295,15 +285,12 @@ // // Setup the trace points // - Enumeration enumTraces = traces.elements(); - - while ( enumTraces.hasMoreElements() ) { - String key = (String)enumTraces.nextElement(); - String trace = key.substring(PROP_CTRACE_LEN+1); + for (String key : traces) { + String trace = key.substring(PROP_CTRACE_LEN+1); String filespec; String linespec; - int delim= trace.indexOf('@'); - boolean enabled; + int delim= trace.indexOf('@'); + boolean enabled; // parse out the filename and linenumber from the property name filespec = delim != -1 ? trace.substring(0, delim) : trace; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/EmbeddedFrame.java --- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java Wed Jul 05 17:58:30 2017 +0200 @@ -180,6 +180,7 @@ * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we * add listeners in show() and remove them in hide(). */ + @SuppressWarnings("deprecation") public void show() { if (appletKFM != null) { addTraversingOutListeners(appletKFM); @@ -193,6 +194,7 @@ * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we * add listeners in show() and remove them in hide(). */ + @SuppressWarnings("deprecation") public void hide() { if (appletKFM != null) { removeTraversingOutListeners(appletKFM); @@ -212,8 +214,8 @@ // belongs to. That's why we can't use public methods to find current focus cycle // root. Instead, we access KFM's private field directly. if (currentCycleRoot == null) { - currentCycleRoot = (Field)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + currentCycleRoot = AccessController.doPrivileged(new PrivilegedAction() { + public Field run() { try { Field unaccessibleRoot = KeyboardFocusManager.class. getDeclaredField("currentFocusCycleRoot"); @@ -257,7 +259,7 @@ } AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e); - Set toTest; + Set toTest; Component currentFocused = e.getComponent(); toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); @@ -357,6 +359,7 @@ return true; } + @SuppressWarnings("deprecation") public void addNotify() { synchronized (getTreeLock()) { if (getPeer() == null) { @@ -367,6 +370,7 @@ } // These three functions consitute RFE 4100710. Do not remove. + @SuppressWarnings("deprecation") public void setCursorAllowed(boolean isCursorAllowed) { this.isCursorAllowed = isCursorAllowed; getPeer().updateCursorImmediately(); @@ -380,27 +384,28 @@ : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } - protected void setPeer(final ComponentPeer p){ + @SuppressWarnings("deprecation") + protected void setPeer(final ComponentPeer p){ if (fieldPeer == null) { - fieldPeer = (Field)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - try { - Field lnkPeer = Component.class.getDeclaredField("peer"); - if (lnkPeer != null) { - lnkPeer.setAccessible(true); - } - return lnkPeer; - } catch (NoSuchFieldException e) { - assert false; - } catch (SecurityException e) { - assert false; + fieldPeer = AccessController.doPrivileged(new PrivilegedAction() { + public Field run() { + try { + Field lnkPeer = Component.class.getDeclaredField("peer"); + if (lnkPeer != null) { + lnkPeer.setAccessible(true); } - return null; - }//run - }); + return lnkPeer; + } catch (NoSuchFieldException e) { + assert false; + } catch (SecurityException e) { + assert false; + } + return null; + }//run + }); } try{ - if (fieldPeer !=null){ + if (fieldPeer != null){ fieldPeer.set(EmbeddedFrame.this, p); } } catch (IllegalAccessException e) { @@ -507,6 +512,7 @@ * @see #getBoundsPrivate * @since 1.5 */ + @SuppressWarnings("deprecation") protected void setBoundsPrivate(int x, int y, int width, int height) { final FramePeer peer = (FramePeer)getPeer(); if (peer != null) { @@ -538,6 +544,7 @@ * @see #setBoundsPrivate * @since 1.6 */ + @SuppressWarnings("deprecation") protected Rectangle getBoundsPrivate() { final FramePeer peer = (FramePeer)getPeer(); if (peer != null) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/EventListenerAggregate.java --- a/jdk/src/share/classes/sun/awt/EventListenerAggregate.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/EventListenerAggregate.java Wed Jul 05 17:58:30 2017 +0200 @@ -53,20 +53,15 @@ * @throws ClassCastException if listenerClass is not * assignable to java.util.EventListener */ - public EventListenerAggregate(Class listenerClass) { + public EventListenerAggregate(Class listenerClass) { if (listenerClass == null) { throw new NullPointerException("listener class is null"); } - if (!EventListener.class.isAssignableFrom(listenerClass)) { - throw new ClassCastException("listener class " + listenerClass + - " is not assignable to EventListener"); - } - listenerList = (EventListener[])Array.newInstance(listenerClass, 0); } - private Class getListenerClass() { + private Class getListenerClass() { return listenerList.getClass().getComponentType(); } @@ -80,7 +75,7 @@ * in the constructor */ public synchronized void add(EventListener listener) { - Class listenerClass = getListenerClass(); + Class listenerClass = getListenerClass(); if (!listenerClass.isInstance(listener)) { // null is not an instance of any class throw new ClassCastException("listener " + listener + " is not " + @@ -107,7 +102,7 @@ * in the constructor */ public synchronized boolean remove(EventListener listener) { - Class listenerClass = getListenerClass(); + Class listenerClass = getListenerClass(); if (!listenerClass.isInstance(listener)) { // null is not an instance of any class throw new ClassCastException("listener " + listener + " is not " + @@ -155,7 +150,7 @@ * array if there are no listeners) */ public synchronized EventListener[] getListenersCopy() { - return (listenerList.length == 0) ? listenerList : (EventListener[])listenerList.clone(); + return (listenerList.length == 0) ? listenerList : listenerList.clone(); } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/FocusingTextField.java --- a/jdk/src/share/classes/sun/awt/FocusingTextField.java Fri Dec 23 16:39:22 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.awt; - -import java.awt.*; - -/** - * FocusingTextField: a subclass of java.awt.TextField that handles moving the - * input focus from field to field, as when the user hits 'return.' - * - * @author Herb Jellinek - */ - -public class FocusingTextField extends TextField { - - /** The field to move to on 'return' - can be null. */ - TextField next; - - /** If true, select the contents of the field when it gets the focus. */ - boolean willSelect; - - /** - * Create a FocusingTextField. - * @param cols number of columns of text. - */ - public FocusingTextField(int cols) { - super("", cols); - } - - /** - * Create a FocusingTextField. - * @param cols number of columns of text. - * @param willSelect if true, will select all contents of field when - * focus is gained. - */ - public FocusingTextField(int cols, boolean willSelect) { - this(cols); - this.willSelect = willSelect; - } - - public void setWillSelect(boolean will) { - willSelect = will; - } - - public boolean getWillSelect() { - return willSelect; - } - - /** - * Call this to set the next field to receive the input focus. - * @param next the next TextField in order - can be null. - */ - public void setNextField(TextField next) { - this.next = next; - } - - /** - * We got the focus. If willSelect is true, select everything. - */ - public boolean gotFocus(Event e, Object arg) { - if (willSelect) { - select(0, getText().length()); - } - return true; - } - - /** - * We lost the focus. If willSelect is true, deselect everything. - */ - public boolean lostFocus(Event e, Object arg) { - if (willSelect) { - select(0, 0); - } - return true; - } - - /** - * Pass the focus to the next guy, if any. - */ - public void nextFocus() { - if (next != null) { - next.requestFocus(); - } - super.nextFocus(); - } -} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/HeadlessToolkit.java --- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java Wed Jul 05 17:58:30 2017 +0200 @@ -396,6 +396,7 @@ /* * Fonts */ + @SuppressWarnings("deprecation") public FontPeer getFontPeer(String name, int style) { if (componentFactory != null) { return componentFactory.getFontPeer(name, style); @@ -403,10 +404,12 @@ return null; } + @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font font) { return tk.getFontMetrics(font); } + @SuppressWarnings("deprecation") public String[] getFontList() { return tk.getFontList(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/HorizBagLayout.java --- a/jdk/src/share/classes/sun/awt/HorizBagLayout.java Fri Dec 23 16:39:22 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.awt; - -import java.awt.*; - -/** - * A horizontal 'bag' of Components. Allocates space for each Component - * from left to right. - * - * @author Herb Jellinek - */ -public class HorizBagLayout implements LayoutManager { - - int hgap; - - /** - * Constructs a new HorizBagLayout. - */ - public HorizBagLayout() { - this(0); - } - - /** - * Constructs a HorizBagLayout with the specified gaps. - * @param hgap the horizontal gap - */ - public HorizBagLayout(int hgap) { - this.hgap = hgap; - } - - /** - * Adds the specified named component to the layout. - * @param name the String name - * @param comp the component to be added - */ - public void addLayoutComponent(String name, Component comp) { - } - - /** - * Removes the specified component from the layout. - * @param comp the component to be removed - */ - public void removeLayoutComponent(Component comp) { - } - - /** - * Returns the minimum dimensions needed to lay out the components - * contained in the specified target container. - * @param target the Container on which to do the layout - * @see Container - * @see #preferredLayoutSize - */ - public Dimension minimumLayoutSize(Container target) { - Dimension dim = new Dimension(); - - for (int i = 0; i < target.countComponents(); i++) { - Component comp = target.getComponent(i); - if (comp.isVisible()) { - Dimension d = comp.minimumSize(); - dim.width += d.width + hgap; - dim.height = Math.max(d.height, dim.height); - } - } - - Insets insets = target.insets(); - dim.width += insets.left + insets.right; - dim.height += insets.top + insets.bottom; - - return dim; - } - - /** - * Returns the preferred dimensions for this layout given the components - * in the specified target container. - * @param target the component which needs to be laid out - * @see Container - * @see #minimumLayoutSize - */ - public Dimension preferredLayoutSize(Container target) { - Dimension dim = new Dimension(); - - for (int i = 0; i < target.countComponents(); i++) { - Component comp = target.getComponent(i); - if (comp.isVisible()) { - Dimension d = comp.preferredSize(); - dim.width += d.width + hgap; - dim.height = Math.max(dim.height, d.height); - } - } - - Insets insets = target.insets(); - dim.width += insets.left + insets.right; - dim.height += insets.top + insets.bottom; - - return dim; - } - - /** - * Lays out the specified container. This method will actually reshape the - * components in the specified target container in order to satisfy the - * constraints of the HorizBagLayout object. - * @param target the component being laid out - * @see Container - */ - public void layoutContainer(Container target) { - Insets insets = target.insets(); - int top = insets.top; - int bottom = target.size().height - insets.bottom; - int left = insets.left; - int right = target.size().width - insets.right; - - for (int i = 0; i < target.countComponents(); i++) { - Component comp = target.getComponent(i); - if (comp.isVisible()) { - int compWidth = comp.size().width; - comp.resize(compWidth, bottom - top); - Dimension d = comp.preferredSize(); - comp.reshape(left, top, d.width, bottom - top); - left += d.width + hgap; - } - } - } - - /** - * Returns the String representation of this HorizBagLayout's values. - */ - public String toString() { - return getClass().getName() + "[hgap=" + hgap + "]"; - } -} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java --- a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java Wed Jul 05 17:58:30 2017 +0200 @@ -80,6 +80,7 @@ * 1) accepts focus on click (in general) * 2) may be a focus owner (in particular) */ + @SuppressWarnings("deprecation") public static boolean shouldFocusOnClick(Component component) { boolean acceptFocusOnClick = false; @@ -110,6 +111,7 @@ /* * Posts proper lost/gain focus events to the event queue. */ + @SuppressWarnings("deprecation") public static boolean deliverFocus(Component lightweightChild, Component target, boolean temporary, @@ -119,7 +121,7 @@ Component currentFocusOwner) // provided by the descendant peers { if (lightweightChild == null) { - lightweightChild = (Component)target; + lightweightChild = target; } Component currentOwner = currentFocusOwner; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/ModalityEvent.java --- a/jdk/src/share/classes/sun/awt/ModalityEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/ModalityEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -30,6 +30,7 @@ /** * Event object describing changes in AWT modality */ +@SuppressWarnings("serial") public class ModalityEvent extends AWTEvent implements ActiveEvent { public static final int MODALITY_PUSHED = 1300; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/OrientableFlowLayout.java --- a/jdk/src/share/classes/sun/awt/OrientableFlowLayout.java Fri Dec 23 16:39:22 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -/* - * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package sun.awt; - -import java.awt.*; - -/** - * Extends the FlowLayout class to support both vertical and horizontal - * layout of components. Orientation can be changed dynamically after - * creation by calling either of the methods @method orientHorizontally or - * @method orientVertically. Separate values for alignment, vertical gap, - * and horizontal gap can be specified for horizontal and vertical - * orientation. - * - * @author Terry Cline - */ -public class OrientableFlowLayout extends FlowLayout { - /** - * The horizontal orientation constant. - */ - public static final int HORIZONTAL = 0; - - /** - * The vertical orientation constant. - */ - public static final int VERTICAL = 1; - - /** - * The top vertical alignment constant. - */ - public static final int TOP = 0; - - /** - * The bottom vertical alignment constant. - */ - public static final int BOTTOM = 2; // CENTER == 1 - - int orientation; - int vAlign; - int vHGap; - int vVGap; - - /** - * Constructs a new flow layout with a horizontal orientation and - * centered alignment. - */ - public OrientableFlowLayout() { - this(HORIZONTAL, CENTER, CENTER, 5, 5, 5, 5); - } - - /** - * Constructs a new flow layout with the specified orientation and - * a centered alignment. - * - * @param orientation the orientation, one of HORIZONTAL or VERTICAL. - */ - public OrientableFlowLayout(int orientation) { - this(orientation, CENTER, CENTER, 5, 5, 5, 5); - } - - /** - * Constructs a new flow layout with the specified orientation and - * alignment. - * - * @param orientation the orientation, one of HORIZONTAL or VERTICAL. - * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT. - * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM. - */ - public OrientableFlowLayout(int orientation, int hAlign, int vAlign) { - this(orientation, hAlign, vAlign, 5, 5, 5, 5); - } - - /** - * Constructs a new flow layout with the specified orientation, - * alignment, and gap values. - * - * @param orientation the orientation, one of HORIZONTAL or VERTICAL. - * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT. - * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM. - * @param hHGap the horizontal gap between components in HORIZONTAL. - * @param hVGap the vertical gap between components in HORIZONTAL. - * @param vHGap the horizontal gap between components in VERTICAL. - * @param vVGap the vertical gap between components in VERTICAL. - */ - public OrientableFlowLayout(int orientation, int hAlign, int vAlign, int hHGap, int hVGap, int vHGap, int vVGap) { - super(hAlign, hHGap, hVGap); - this.orientation = orientation; - this.vAlign = vAlign; - this.vHGap = vHGap; - this.vVGap = vVGap; - } - - /** - * Set the layout's current orientation to horizontal. - */ - public synchronized void orientHorizontally() { - orientation = HORIZONTAL; - } - - /** - * Set the layout's current orientation to vertical. - */ - public synchronized void orientVertically() { - orientation = VERTICAL; - } - - /** - * Returns the preferred dimensions for this layout given the - * components in the specified target container. - * - * @param target the component which needs to be laid out. - * @see Container - * @see FlowLayout - * @see #minimumLayoutSize - */ - public Dimension preferredLayoutSize(Container target) { - if (orientation == HORIZONTAL) { - return super.preferredLayoutSize(target); - } - else { - Dimension dim = new Dimension(0, 0); - - int n = target.countComponents(); - for (int i = 0; i < n; i++) { - Component c = target.getComponent(i); - if (c.isVisible()) { - Dimension cDim = c.preferredSize(); - dim.width = Math.max(dim.width, cDim.width); - if (i > 0) { - dim.height += vVGap; - } - dim.height += cDim.height; - } - } - - Insets insets = target.insets();; - dim.width += insets.left + insets.right + vHGap*2; - dim.height += insets.top + insets.bottom + vVGap*2; - - return dim; - } - } - - /** - * Returns the minimum dimensions needed to layout the components - * contained in the specified target container. - * - * @param target the component which needs to be laid out. - * @see #preferredLayoutSize. - */ - public Dimension minimumLayoutSize(Container target) { - if (orientation == HORIZONTAL) { - return super.minimumLayoutSize(target); - } - else { - Dimension dim = new Dimension(0, 0); - - int n = target.countComponents(); - for (int i = 0; i < n; i++) { - Component c = target.getComponent(i); - if (c.isVisible()) { - Dimension cDim = c.minimumSize(); - dim.width = Math.max(dim.width, cDim.width); - if (i > 0) { - dim.height += vVGap; - } - dim.height += cDim.height; - } - } - - Insets insets = target.insets(); - dim.width += insets.left + insets.right + vHGap*2; - dim.height += insets.top + insets.bottom + vVGap*2; - - return dim; - } - } - - /** - * Lays out the container. This method will reshape the - * components in the target to satisfy the constraints of the - * layout. - * - * @param target the specified component being laid out. - * @see Container. - */ - public void layoutContainer(Container target) { - if (orientation == HORIZONTAL) { - super.layoutContainer(target); - } - else { - Insets insets = target.insets(); - Dimension targetDim = target.size(); - int maxHeight = targetDim.height - (insets.top + insets.bottom + vVGap*2); - int x = insets.left + vHGap; - int y = 0; - int colWidth = 0; - int start = 0; - - int n = target.countComponents(); - for (int i = 0; i < n; i++) { - Component c = target.getComponent(i); - if (c.isVisible()) { - Dimension cDim = c.preferredSize(); - c.resize(cDim.width, cDim.height); - - if ((y == 0) || ((y + cDim.height) <= maxHeight)) { - if (y > 0) { - y += vVGap; - } - y += cDim.height; - colWidth = Math.max(colWidth, cDim.width); - } - else { - moveComponents(target, - x, - insets.top + vVGap, - colWidth, - maxHeight - y, - start, - i); - x += vHGap + colWidth; - y = cDim.width; - colWidth = cDim.width; - start = i; - } - } - } - - moveComponents(target, - x, - insets.top + vVGap, - colWidth, - maxHeight - y, - start, - n); - } - } - - /** - * Aligns the components vertically if there is any slack. - * - * @param target the container whose components need to be moved. - * @param x the x coordinate. - * @param y the y coordinate. - * @param width the width available. - * @param height the height available. - * @param colStart the beginning of the column. - * @param colEnd the end of the column. - */ - private void moveComponents(Container target, int x, int y, int width, int height, int colStart, int colEnd) { - switch (vAlign) { - case TOP: - break; - case CENTER: - y += height/2; - break; - case BOTTOM: - y += height; - } - - for (int i = colStart; i < colEnd; i++) { - Component c = target.getComponent(i); - Dimension cDim = c.size(); - if (c.isVisible()) { - c.move(x + (width - cDim.width)/2, y); - y += vVGap + cDim.height; - } - } - } - - /** - * Returns the String representation of this layout's values. - */ - public String toString() { - String str = ""; - switch (orientation) { - case HORIZONTAL: - str = "orientation=horizontal, "; - break; - case VERTICAL: - str = "orientation=vertical, "; - break; - } - - return getClass().getName() + "[" + str + super.toString() + "]"; - } -} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/PaintEventDispatcher.java --- a/jdk/src/share/classes/sun/awt/PaintEventDispatcher.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/PaintEventDispatcher.java Wed Jul 05 17:58:30 2017 +0200 @@ -77,7 +77,7 @@ public PaintEvent createPaintEvent(Component target, int x, int y, int w, int h) { - return new PaintEvent((Component)target, PaintEvent.PAINT, + return new PaintEvent(target, PaintEvent.PAINT, new Rectangle(x, y, w, h)); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/PeerEvent.java --- a/jdk/src/share/classes/sun/awt/PeerEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/PeerEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -27,7 +27,9 @@ import java.awt.event.InvocationEvent; +@SuppressWarnings("serial") public class PeerEvent extends InvocationEvent { + public static final long PRIORITY_EVENT = 0x01; public static final long ULTIMATE_PRIORITY_EVENT = 0x02; public static final long LOW_PRIORITY_EVENT = 0x04; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/SunDisplayChanger.java --- a/jdk/src/share/classes/sun/awt/SunDisplayChanger.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/SunDisplayChanger.java Wed Jul 05 17:58:30 2017 +0200 @@ -28,9 +28,10 @@ import java.awt.IllegalComponentStateException; import java.util.Collections; import java.util.Iterator; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.HashMap; import java.util.WeakHashMap; import sun.util.logging.PlatformLogger; @@ -54,12 +55,14 @@ * screen to another on a system equipped with multiple displays. */ public class SunDisplayChanger { + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.multiscreen.SunDisplayChanger"); - // Create a new synchronizedMap with initial capacity of one listener. + // Create a new synchronized map with initial capacity of one listener. // It is asserted that the most common case is to have one GraphicsDevice // and one top-level Window. - private Map listeners = Collections.synchronizedMap(new WeakHashMap(1)); + private Map listeners = + Collections.synchronizedMap(new WeakHashMap(1)); public SunDisplayChanger() {} @@ -113,18 +116,15 @@ // synchronization provides no protection against modifying the listener // list while in the middle of iterating over it. -bchristi 7/10/2001 - HashMap listClone; - Set cloneSet; + Set cloneSet; synchronized(listeners) { - listClone = new HashMap(listeners); + cloneSet = new HashSet(listeners.keySet()); } - cloneSet = listClone.keySet(); - Iterator itr = cloneSet.iterator(); + Iterator itr = cloneSet.iterator(); while (itr.hasNext()) { - DisplayChangedListener current = - (DisplayChangedListener) itr.next(); + DisplayChangedListener current = itr.next(); try { if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("displayChanged for listener: " + current); @@ -160,17 +160,14 @@ // synchronization provides no protection against modifying the listener // list while in the middle of iterating over it. -bchristi 7/10/2001 - HashMap listClone; - Set cloneSet; + Set cloneSet; synchronized (listeners) { - listClone = new HashMap(listeners); + cloneSet = new HashSet(listeners.keySet()); } - cloneSet = listClone.keySet(); - Iterator itr = cloneSet.iterator(); + Iterator itr = cloneSet.iterator(); while (itr.hasNext()) { - DisplayChangedListener current = - (DisplayChangedListener) itr.next(); + DisplayChangedListener current = itr.next(); try { if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("paletteChanged for listener: " + current); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/SunGraphicsCallback.java --- a/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/SunGraphicsCallback.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,6 +47,7 @@ g.clipRect(0, 0, bounds.width, bounds.height); } + @SuppressWarnings("deprecation") public final void runOneComponent(Component comp, Rectangle bounds, Graphics g, Shape clip, int weightFlags) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/SunToolkit.java --- a/jdk/src/share/classes/sun/awt/SunToolkit.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java Wed Jul 05 17:58:30 2017 +0200 @@ -101,30 +101,28 @@ */ public final static int MAX_BUTTONS_SUPPORTED = 20; - public SunToolkit() { - Runnable initEQ = new Runnable() { - public void run () { - EventQueue eventQueue; + private static void initEQ(AppContext appContext) { + EventQueue eventQueue; - String eqName = System.getProperty("AWT.EventQueueClass", - "java.awt.EventQueue"); + String eqName = System.getProperty("AWT.EventQueueClass", + "java.awt.EventQueue"); - try { - eventQueue = (EventQueue)Class.forName(eqName).newInstance(); - } catch (Exception e) { - e.printStackTrace(); - System.err.println("Failed loading " + eqName + ": " + e); - eventQueue = new EventQueue(); - } - AppContext appContext = AppContext.getAppContext(); - appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue); + try { + eventQueue = (EventQueue)Class.forName(eqName).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("Failed loading " + eqName + ": " + e); + eventQueue = new EventQueue(); + } + appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue); - PostEventQueue postEventQueue = new PostEventQueue(eventQueue); - appContext.put(POST_EVENT_QUEUE_KEY, postEventQueue); - } - }; + PostEventQueue postEventQueue = new PostEventQueue(eventQueue); + appContext.put(POST_EVENT_QUEUE_KEY, postEventQueue); + } - initEQ.run(); + public SunToolkit() { + // 7122796: Always create an EQ for the main AppContext + initEQ(AppContext.getMainAppContext()); } public boolean useBufferPerWindow() { @@ -197,6 +195,7 @@ public abstract boolean isTraySupported(); + @SuppressWarnings("deprecation") public abstract FontPeer getFontPeer(String name, int style); public abstract RobotPeer createRobot(Robot target, GraphicsDevice screen) @@ -288,24 +287,12 @@ // return correct values AppContext appContext = new AppContext(threadGroup); - EventQueue eventQueue; - String eqName = System.getProperty("AWT.EventQueueClass", - "java.awt.EventQueue"); - try { - eventQueue = (EventQueue)Class.forName(eqName).newInstance(); - } catch (Exception e) { - System.err.println("Failed loading " + eqName + ": " + e); - eventQueue = new EventQueue(); - } - appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue); - - PostEventQueue postEventQueue = new PostEventQueue(eventQueue); - appContext.put(POST_EVENT_QUEUE_KEY, postEventQueue); + initEQ(appContext); return appContext; } - public static Field getField(final Class klass, final String fieldName) { + public static Field getField(final Class klass, final String fieldName) { return AccessController.doPrivileged(new PrivilegedAction() { public Field run() { try { @@ -325,8 +312,8 @@ static void wakeupEventQueue(EventQueue q, boolean isShutdown){ if (wakeupMethod == null){ - wakeupMethod = (Method)AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ + wakeupMethod = AccessController.doPrivileged(new PrivilegedAction() { + public Method run() { try { Method method = EventQueue.class.getDeclaredMethod("wakeup",new Class [] {Boolean.TYPE} ); if (method != null) { @@ -386,8 +373,8 @@ // Maps from non-Component/MenuComponent to AppContext. // WeakHashMap - private static final Map appContextMap = - Collections.synchronizedMap(new WeakHashMap()); + private static final Map appContextMap = + Collections.synchronizedMap(new WeakHashMap()); /** * Sets the appContext field of target. If target is not a Component or @@ -437,7 +424,7 @@ if (context == null) { // target is not a Component/MenuComponent, try the // appContextMap. - context = (AppContext)appContextMap.get(target); + context = appContextMap.get(target); } return context; } @@ -519,9 +506,9 @@ private static FocusTraversalPolicy createLayoutPolicy() { FocusTraversalPolicy policy = null; try { - Class layoutPolicyClass = + Class layoutPolicyClass = Class.forName("javax.swing.LayoutFocusTraversalPolicy"); - policy = (FocusTraversalPolicy) layoutPolicyClass.newInstance(); + policy = (FocusTraversalPolicy)layoutPolicyClass.newInstance(); } catch (ClassNotFoundException e) { assert false; @@ -642,11 +629,13 @@ * Fixed 5064013: the InvocationEvent time should be equals * the time of the ActionEvent */ + @SuppressWarnings("serial") public static void executeOnEventHandlerThread(Object target, Runnable runnable, final long when) { - executeOnEventHandlerThread(new PeerEvent(target, runnable, PeerEvent.PRIORITY_EVENT){ - public long getWhen(){ + executeOnEventHandlerThread( + new PeerEvent(target, runnable, PeerEvent.PRIORITY_EVENT) { + public long getWhen() { return when; } }); @@ -727,10 +716,12 @@ protected abstract int getScreenWidth(); protected abstract int getScreenHeight(); + @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font font) { return FontDesignMetrics.getMetrics(font); } + @SuppressWarnings("deprecation") public String[] getFontList() { String[] hardwiredFontList = { Font.DIALOG, Font.SANS_SERIF, Font.SERIF, Font.MONOSPACED, @@ -1156,10 +1147,10 @@ public static Locale getStartupLocale() { if (startupLocale == null) { String language, region, country, variant; - language = (String) AccessController.doPrivileged( + language = AccessController.doPrivileged( new GetPropertyAction("user.language", "en")); // for compatibility, check for old user.region property - region = (String) AccessController.doPrivileged( + region = AccessController.doPrivileged( new GetPropertyAction("user.region")); if (region != null) { // region can be of form country, country_variant, or _variant @@ -1172,9 +1163,9 @@ variant = ""; } } else { - country = (String) AccessController.doPrivileged( + country = AccessController.doPrivileged( new GetPropertyAction("user.country", "")); - variant = (String) AccessController.doPrivileged( + variant = AccessController.doPrivileged( new GetPropertyAction("user.variant", "")); } startupLocale = new Locale(language, country, variant); @@ -1254,7 +1245,7 @@ * @return true, if XEmbed is needed, false otherwise */ public static boolean needsXEmbed() { - String noxembed = (String) AccessController. + String noxembed = AccessController. doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false")); if ("true".equals(noxembed)) { return false; @@ -1466,7 +1457,7 @@ || comp instanceof Window); } - public static Method getMethod(final Class clz, final String methodName, final Class[] params) { + public static Method getMethod(final Class clz, final String methodName, final Class[] params) { Method res = null; try { res = AccessController.doPrivileged(new PrivilegedExceptionAction() { @@ -1482,6 +1473,7 @@ return res; } + @SuppressWarnings("serial") public static class OperationTimedOut extends RuntimeException { public OperationTimedOut(String msg) { super(msg); @@ -1489,9 +1481,12 @@ public OperationTimedOut() { } } + + @SuppressWarnings("serial") public static class InfiniteLoop extends RuntimeException { } + @SuppressWarnings("serial") public static class IllegalThreadException extends RuntimeException { public IllegalThreadException(String msg) { super(msg); @@ -1648,6 +1643,7 @@ * Should return true if more processing is * necessary, false otherwise. */ + @SuppressWarnings("serial") protected final boolean waitForIdle(final long timeout) { flushPendingEvents(); boolean queueWasEmpty = isEQEmpty(); @@ -1831,7 +1827,7 @@ Toolkit tk = Toolkit.getDefaultToolkit(); if (tk instanceof SunToolkit) { systemAAFonts = - (String)AccessController.doPrivileged( + AccessController.doPrivileged( new GetPropertyAction("awt.useSystemAAFontSettings")); } if (systemAAFonts != null) { @@ -1898,7 +1894,7 @@ if (consumeNextKeyTypedMethod == null) { consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class, "consumeNextKeyTyped", - new Class[] {KeyEvent.class}); + new Class[] {KeyEvent.class}); } try { consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(), @@ -1930,8 +1926,8 @@ * Returns the value of the system property indicated by the specified key. */ public static String getSystemProperty(final String key) { - return (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + return AccessController.doPrivileged(new PrivilegedAction() { + public String run() { return System.getProperty(key); } }); @@ -1941,8 +1937,7 @@ * Returns the boolean value of the system property indicated by the specified key. */ protected static Boolean getBooleanSystemProperty(String key) { - return Boolean.valueOf(AccessController. - doPrivileged(new GetBooleanAction(key))); + return AccessController.doPrivileged(new GetBooleanAction(key)); } private static Boolean sunAwtDisableMixing = null; @@ -2015,7 +2010,7 @@ */ public static boolean isContainingTopLevelTranslucent(Component c) { Window w = getContainingWindow(c); - return w != null && ((Window)w).getOpacity() < 1.0f; + return w != null && w.getOpacity() < 1.0f; } /** @@ -2057,14 +2052,14 @@ return isInstanceOf(obj.getClass(), type); } - private static boolean isInstanceOf(Class cls, String type) { + private static boolean isInstanceOf(Class cls, String type) { if (cls == null) return false; if (cls.getName().equals(type)) { return true; } - for (Class c : cls.getInterfaces()) { + for (Class c : cls.getInterfaces()) { if (c.getName().equals(type)) { return true; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/UngrabEvent.java --- a/jdk/src/share/classes/sun/awt/UngrabEvent.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/UngrabEvent.java Wed Jul 05 17:58:30 2017 +0200 @@ -39,7 +39,9 @@ *

Notice that this event is not generated on mouse click inside of the window area. *

To listen for this event, install AWTEventListener with {@value sun.awt.SunToolkit#GRAB_EVENT_MASK} */ +@SuppressWarnings("serial") public class UngrabEvent extends AWTEvent { + private final static int UNGRAB_EVENT_ID = 1998; public UngrabEvent(Component source) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/VariableGridLayout.java --- a/jdk/src/share/classes/sun/awt/VariableGridLayout.java Fri Dec 23 16:39:22 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* - * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.awt; - -import java.awt.*; -import java.util.BitSet; - - -/** - * A layout manager for a container that lays out grids. Allows setting - * the relative sizes of rows and columns. - * - * @author Herb Jellinek - */ - - -public class VariableGridLayout extends GridLayout { - - BitSet rowsSet = new BitSet(); - double rowFractions[] = null; - - BitSet colsSet = new BitSet(); - double colFractions[] = null; - - int rows; - int cols; - int hgap; - int vgap; - - /** - * Creates a grid layout with the specified rows and specified columns. - * @param rows the rows - * @param cols the columns - */ - public VariableGridLayout(int rows, int cols) { - this(rows, cols, 0, 0); - - if (rows != 0) { - rowsSet = new BitSet(rows); - stdRowFractions(rows); - } - - if (cols != 0) { - colsSet = new BitSet(cols); - stdColFractions(cols); - } - } - - /** - * Creates a grid layout with the specified rows, columns, - * horizontal gap, and vertical gap. - * @param rows the rows - * @param cols the columns - * @param hgap the horizontal gap variable - * @param vgap the vertical gap variable - * @exception IllegalArgumentException If the rows and columns are invalid. - */ - public VariableGridLayout(int rows, int cols, int hgap, int vgap) { - super(rows, cols, hgap, vgap); - - this.rows = rows; - this.cols = cols; - this.hgap = hgap; - this.vgap = vgap; - - if (rows != 0) { - rowsSet = new BitSet(rows); - stdRowFractions(rows); - } - - if (cols != 0) { - colsSet = new BitSet(cols); - stdColFractions(cols); - } - } - - void stdRowFractions(int nrows) { - rowFractions = new double[nrows]; - for (int i = 0; i < nrows; i++) { - rowFractions[i] = 1.0 / nrows; - } - } - - void stdColFractions(int ncols) { - colFractions = new double[ncols]; - for (int i = 0; i < ncols; i++) { - colFractions[i] = 1.0 / ncols; - } - } - - public void setRowFraction(int rowNum, double fraction) { - rowsSet.set(rowNum); - rowFractions[rowNum] = fraction; - } - - public void setColFraction(int colNum, double fraction) { - colsSet.set(colNum); - colFractions[colNum] = fraction; - } - - public double getRowFraction(int rowNum) { - return rowFractions[rowNum]; - } - - public double getColFraction(int colNum) { - return colFractions[colNum]; - } - - void allocateExtraSpace(double vec[], BitSet userSet) { - // collect the space that's been explicitly allocated... - double total = 0.0; - int unallocated = 0; - int i; - for (i = 0; i < vec.length; i++) { - if (userSet.get(i)) { - total += vec[i]; - } else { - unallocated++; - } - } - - // ... then spread the extra space - if (unallocated != 0) { - double space = (1.0 - total) / unallocated; - for (i = 0; i < vec.length; i++) { - if (!userSet.get(i)) { - vec[i] = space; - userSet.set(i); - } - } - } - } - - - void allocateExtraSpace() { - allocateExtraSpace(rowFractions, rowsSet); - allocateExtraSpace(colFractions, colsSet); - } - - /** - * Lays out the container in the specified panel. - * @param parent the specified component being laid out - * @see Container - */ - public void layoutContainer(Container parent) { - Insets insets = parent.insets(); - int ncomponents = parent.countComponents(); - int nrows = rows; - int ncols = cols; - - if (nrows > 0) { - ncols = (ncomponents + nrows - 1) / nrows; - } else { - nrows = (ncomponents + ncols - 1) / ncols; - } - - if (rows == 0) { - stdRowFractions(nrows); - } - if (cols == 0) { - stdColFractions(ncols); - } - - Dimension size = parent.size(); - int w = size.width - (insets.left + insets.right); - int h = size.height - (insets.top + insets.bottom); - - w = (w - (ncols - 1) * hgap); - h = (h - (nrows - 1) * vgap); - - allocateExtraSpace(); - - for (int c = 0, x = insets.left ; c < ncols ; c++) { - int colWidth = (int)(getColFraction(c) * w); - for (int r = 0, y = insets.top ; r < nrows ; r++) { - int i = r * ncols + c; - int rowHeight = (int)(getRowFraction(r) * h); - - if (i < ncomponents) { - parent.getComponent(i).reshape(x, y, colWidth, rowHeight); - } - y += rowHeight + vgap; - } - x += colWidth + hgap; - } - } - - static String fracsToString(double array[]) { - String result = "["+array.length+"]"; - - for (int i = 0; i < array.length; i++) { - result += "<"+array[i]+">"; - } - return result; - } - - /** - * Returns the String representation of this VariableGridLayout's values. - */ - public String toString() { - return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + - ",rows=" + rows + ",cols=" + cols + - ",rowFracs=" + - fracsToString(rowFractions) + - ",colFracs=" + - fracsToString(colFractions) + "]"; - } -} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/VerticalBagLayout.java --- a/jdk/src/share/classes/sun/awt/VerticalBagLayout.java Fri Dec 23 16:39:22 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* - * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.awt; - -import java.awt.*; - - -/** - * A vertical 'bag' of Components. Allocates space for each Component from - * top to bottom. - * - * @author Herb Jellinek - */ -public class VerticalBagLayout implements LayoutManager { - - int vgap; - - /** - * Constructs a new VerticalBagLayout. - */ - public VerticalBagLayout() { - this(0); - } - - /** - * Constructs a VerticalBagLayout with the specified gaps. - * @param vgap the vertical gap - */ - public VerticalBagLayout(int vgap) { - this.vgap = vgap; - } - - /** - * Adds the specified named component to the layout. - * @param name the String name - * @param comp the component to be added - */ - public void addLayoutComponent(String name, Component comp) { - } - - /** - * Removes the specified component from the layout. - * @param comp the component to be removed - */ - public void removeLayoutComponent(Component comp) { - } - - /** - * Returns the minimum dimensions needed to lay out the components - * contained in the specified target container. - * @param target the Container on which to do the layout - * @see Container - * @see #preferredLayoutSize - */ - public Dimension minimumLayoutSize(Container target) { - Dimension dim = new Dimension(); - int nmembers = target.countComponents(); - - for (int i = 0; i < nmembers; i++) { - Component comp = target.getComponent(i); - if (comp.isVisible()) { - Dimension d = comp.minimumSize(); - dim.width = Math.max(d.width, dim.width); - dim.height += d.height + vgap; - } - } - - Insets insets = target.insets(); - dim.width += insets.left + insets.right; - dim.height += insets.top + insets.bottom; - - return dim; - } - - /** - * Returns the preferred dimensions for this layout given the components - * in the specified target container. - * @param target the component which needs to be laid out - * @see Container - * @see #minimumLayoutSize - */ - public Dimension preferredLayoutSize(Container target) { - Dimension dim = new Dimension(); - int nmembers = target.countComponents(); - - for (int i = 0; i < nmembers; i++) { - Component comp = target.getComponent(i); - if (true || comp.isVisible()) { - Dimension d = comp.preferredSize(); - dim.width = Math.max(d.width, dim.width); - dim.height += d.height + vgap; - } - } - - Insets insets = target.insets(); - dim.width += insets.left + insets.right; - dim.height += insets.top + insets.bottom; - - return dim; - } - - /** - * Lays out the specified container. This method will actually reshape the - * components in the specified target container in order to satisfy the - * constraints of the VerticalBagLayout object. - * @param target the component being laid out - * @see Container - */ - public void layoutContainer(Container target) { - Insets insets = target.insets(); - int top = insets.top; - int bottom = target.size().height - insets.bottom; - int left = insets.left; - int right = target.size().width - insets.right; - int nmembers = target.countComponents(); - - for (int i = 0; i < nmembers; i++) { - Component comp = target.getComponent(i); - if (comp.isVisible()) { - int compHeight = comp.size().height; - comp.resize(right - left, compHeight); - Dimension d = comp.preferredSize(); - comp.reshape(left, top, right - left, d.height); - top += d.height + vgap; - } - } - } - - /** - * Returns the String representation of this VerticalBagLayout's values. - */ - public String toString() { - return getClass().getName() + "[vgap=" + vgap + "]"; - } -} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java --- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Wed Jul 05 17:58:30 2017 +0200 @@ -649,8 +649,9 @@ * The map keys are sorted according to the native formats preference * order. */ - public SortedMap getFormatsForTransferable(Transferable contents, - FlavorTable map) { + public SortedMap getFormatsForTransferable( + Transferable contents, FlavorTable map) + { DataFlavor[] flavors = contents.getTransferDataFlavors(); if (flavors == null) { return new TreeMap(); @@ -686,9 +687,13 @@ * DataFlavors and data formats * @throws NullPointerException if flavors or map is null */ - public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) { - Map formatMap = new HashMap(flavors.length); - Map textPlainMap = new HashMap(flavors.length); + public SortedMap getFormatsForFlavors( + DataFlavor[] flavors, FlavorTable map) + { + Map formatMap = + new HashMap <> (flavors.length); + Map textPlainMap = + new HashMap <> (flavors.length); // Maps formats to indices that will be used to sort the formats // according to the preference order. // Larger index value corresponds to the more preferable format. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java --- a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -52,6 +52,7 @@ import sun.awt.SunToolkit; import sun.awt.datatransfer.DataTransferer; +import java.awt.datatransfer.DataFlavor; /** *

@@ -126,9 +127,9 @@ dragImageOffset = p; Transferable transferable = getDragSourceContext().getTransferable(); - SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable - (transferable, DataTransferer.adaptFlavorMap - (getTrigger().getDragSource().getFlavorMap())); + SortedMap formatMap = DataTransferer.getInstance(). + getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap + (getTrigger().getDragSource().getFlavorMap())); long[] formats = DataTransferer.getInstance(). keysToLongArray(formatMap); startDrag(transferable, formats, formatMap); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/misc/JavaNetHttpCookieAccess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/sun/misc/JavaNetHttpCookieAccess.java Wed Jul 05 17:58:30 2017 +0200 @@ -0,0 +1,44 @@ +/* + * 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 sun.misc; + +import java.net.HttpCookie; +import java.util.List; + +public interface JavaNetHttpCookieAccess { + /* + * Constructs cookies from Set-Cookie or Set-Cookie2 header string, + * retaining the original header String in the cookie itself. + */ + public List parse(String header); + + /* + * Returns the original header this cookie was consructed from, if it was + * constructed by parsing a header, otherwise null. + */ + public String header(HttpCookie cookie); +} + diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/misc/SharedSecrets.java --- a/jdk/src/share/classes/sun/misc/SharedSecrets.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/misc/SharedSecrets.java Wed Jul 05 17:58:30 2017 +0200 @@ -47,6 +47,7 @@ private static JavaLangAccess javaLangAccess; private static JavaIOAccess javaIOAccess; private static JavaNetAccess javaNetAccess; + private static JavaNetHttpCookieAccess javaNetHttpCookieAccess; private static JavaNioAccess javaNioAccess; private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; @@ -81,6 +82,16 @@ return javaNetAccess; } + public static void setJavaNetHttpCookieAccess(JavaNetHttpCookieAccess a) { + javaNetHttpCookieAccess = a; + } + + public static JavaNetHttpCookieAccess getJavaNetHttpCookieAccess() { + if (javaNetHttpCookieAccess == null) + unsafe.ensureClassInitialized(java.net.HttpCookie.class); + return javaNetHttpCookieAccess; + } + public static void setJavaNioAccess(JavaNioAccess jna) { javaNioAccess = jna; } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Wed Jul 05 17:58:30 2017 +0200 @@ -32,6 +32,7 @@ import java.net.HttpRetryException; import java.net.PasswordAuthentication; import java.net.Authenticator; +import java.net.HttpCookie; import java.net.InetAddress; import java.net.UnknownHostException; import java.net.SocketTimeoutException; @@ -46,6 +47,8 @@ import java.net.CacheRequest; import java.net.Authenticator.RequestorType; import java.io.*; +import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.Map; import java.util.List; @@ -2580,6 +2583,80 @@ return false; } + // constant strings represent set-cookie header names + private final static String SET_COOKIE = "set-cookie"; + private final static String SET_COOKIE2 = "set-cookie2"; + + /** + * Returns a filtered version of the given headers value. + * + * Note: The implementation currently only filters out HttpOnly cookies + * from Set-Cookie and Set-Cookie2 headers. + */ + private String filterHeaderField(String name, String value) { + if (value == null) + return null; + + if (SET_COOKIE.equalsIgnoreCase(name) || + SET_COOKIE2.equalsIgnoreCase(name)) { + // Filtering only if there is a cookie handler. [Assumption: the + // cookie handler will store/retrieve the HttpOnly cookies] + if (cookieHandler == null) + return value; + + sun.misc.JavaNetHttpCookieAccess access = + sun.misc.SharedSecrets.getJavaNetHttpCookieAccess(); + StringBuilder retValue = new StringBuilder(); + List cookies = access.parse(value); + boolean multipleCookies = false; + for (HttpCookie cookie : cookies) { + // skip HttpOnly cookies + if (cookie.isHttpOnly()) + continue; + if (multipleCookies) + retValue.append(','); // RFC 2965, comma separated + retValue.append(access.header(cookie)); + multipleCookies = true; + } + + return retValue.length() == 0 ? null : retValue.toString(); + } + + return value; + } + + // Cache the filtered response headers so that they don't need + // to be generated for every getHeaderFields() call. + private Map> filteredHeaders; // null + + private Map> getFilteredHeaderFields() { + if (filteredHeaders != null) + return filteredHeaders; + + filteredHeaders = new HashMap<>(); + Map> headers; + + if (cachedHeaders != null) + headers = cachedHeaders.getHeaders(); + else + headers = responses.getHeaders(); + + for (Map.Entry> e: headers.entrySet()) { + String key = e.getKey(); + List values = e.getValue(), filteredVals = new ArrayList<>(); + for (String value : values) { + String fVal = filterHeaderField(key, value); + if (fVal != null) + filteredVals.add(fVal); + } + if (!filteredVals.isEmpty()) + filteredHeaders.put(key, + Collections.unmodifiableList(filteredVals)); + } + + return filteredHeaders; + } + /** * Gets a header field by name. Returns null if not known. * @param name the name of the header field @@ -2591,10 +2668,10 @@ } catch (IOException e) {} if (cachedHeaders != null) { - return cachedHeaders.findValue(name); + return filterHeaderField(name, cachedHeaders.findValue(name)); } - return responses.findValue(name); + return filterHeaderField(name, responses.findValue(name)); } /** @@ -2613,11 +2690,7 @@ getInputStream(); } catch (IOException e) {} - if (cachedHeaders != null) { - return cachedHeaders.getHeaders(); - } - - return responses.getHeaders(); + return getFilteredHeaderFields(); } /** @@ -2631,9 +2704,10 @@ } catch (IOException e) {} if (cachedHeaders != null) { - return cachedHeaders.getValue(n); + return filterHeaderField(cachedHeaders.getKey(n), + cachedHeaders.getValue(n)); } - return responses.getValue(n); + return filterHeaderField(responses.getKey(n), responses.getValue(n)); } /** diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/share/classes/sun/text/resources/FormatData_bg.java --- a/jdk/src/share/classes/sun/text/resources/FormatData_bg.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/share/classes/sun/text/resources/FormatData_bg.java Wed Jul 05 17:58:30 2017 +0200 @@ -130,16 +130,16 @@ }, { "DateTimePatterns", new String[] { - "HH:mm:ss z", // full time pattern + "HH:mm:ss zzzz", // full time pattern "HH:mm:ss z", // long time pattern - "H:mm:ss", // medium time pattern - "H:mm", // short time pattern - "EEEE, yyyy, MMMM d", // full date pattern - "EEEE, yyyy, MMMM d", // long date pattern - "yyyy-M-d", // medium date pattern - "yy-M-d", // short date pattern + "HH:mm:ss", // medium time pattern + "HH:mm", // short time pattern + "dd MMMM y, EEEE", // full date pattern + "dd MMMM y", // long date pattern + "dd.MM.yyyy", // medium date pattern + "dd.MM.yy", // short date pattern "{1} {0}" // date-time pattern - } + } }, { "DateTimePatternChars", "GanjkHmsSEDFwWxhKzZ" }, }; diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/solaris/classes/java/lang/ProcessEnvironment.java --- a/jdk/src/solaris/classes/java/lang/ProcessEnvironment.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/solaris/classes/java/lang/ProcessEnvironment.java Wed Jul 05 17:58:30 2017 +0200 @@ -91,6 +91,7 @@ } /* Only for use by ProcessBuilder.environment() */ + @SuppressWarnings("unchecked") static Map environment() { return new StringEnvironment ((Map)(theEnvironment.clone())); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/solaris/classes/sun/awt/X11/XClipboard.java --- a/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java Wed Jul 05 17:58:30 2017 +0200 @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.util.SortedMap; import java.io.IOException; import java.security.AccessController; @@ -83,7 +84,8 @@ } protected synchronized void setContentsNative(Transferable contents) { - SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable + SortedMap formatMap = + DataTransferer.getInstance().getFormatsForTransferable (contents, DataTransferer.adaptFlavorMap(flavorMap)); long[] formats = DataTransferer.keysToLongArray(formatMap); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/solaris/native/java/net/Inet4AddressImpl.c --- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c Wed Jul 05 17:58:30 2017 +0200 @@ -367,11 +367,11 @@ sizeof(struct sockaddr)); if (n < 0 && errno != EINPROGRESS ) { #ifdef __linux__ - if (errno != EINVAL) + if (errno != EINVAL && errno != EHOSTUNREACH) /* * On some Linuxes, when bound to the loopback interface, sendto - * will fail and errno will be set to EINVAL. When that happens, - * don't throw an exception, just return false. + * will fail and errno will be set to EINVAL or EHOSTUNREACH. + * When that happens, don't throw an exception, just return false. */ #endif /*__linux__ */ NET_ThrowNew(env, errno, "Can't send ICMP packet"); @@ -525,10 +525,11 @@ case EADDRNOTAVAIL: /* address is not available on the remote machine */ #ifdef __linux__ case EINVAL: + case EHOSTUNREACH: /* * On some Linuxes, when bound to the loopback interface, connect - * will fail and errno will be set to EINVAL. When that happens, - * don't throw an exception, just return false. + * will fail and errno will be set to EINVAL or EHOSTUNREACH. + * When that happens, don't throw an exception, just return false. */ #endif /* __linux__ */ close(fd); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/solaris/native/java/net/Inet6AddressImpl.c --- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c Wed Jul 05 17:58:30 2017 +0200 @@ -502,11 +502,11 @@ n = sendto(fd, sendbuf, plen, 0, (struct sockaddr*) him, sizeof(struct sockaddr_in6)); if (n < 0 && errno != EINPROGRESS) { #ifdef __linux__ - if (errno != EINVAL) + if (errno != EINVAL && errno != EHOSTUNREACH) /* * On some Linuxes, when bound to the loopback interface, sendto - * will fail and errno will be set to EINVAL. When that happens, - * don't throw an exception, just return false. + * will fail and errno will be set to EINVAL or EHOSTUNREACH. + * When that happens, don't throw an exception, just return false. */ #endif /*__linux__ */ NET_ThrowNew(env, errno, "Can't send ICMP packet"); @@ -670,10 +670,11 @@ case EADDRNOTAVAIL: /* address is not available on the remote machine */ #ifdef __linux__ case EINVAL: + case EHOSTUNREACH: /* * On some Linuxes, when bound to the loopback interface, connect - * will fail and errno will be set to EINVAL. When that happens, - * don't throw an exception, just return false. + * will fail and errno will be set to EINVAL or EHOSTUNREACH. + * When that happens, don't throw an exception, just return false. */ #endif /* __linux__ */ close(fd); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/java/lang/ProcessEnvironment.java --- a/jdk/src/windows/classes/java/lang/ProcessEnvironment.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/java/lang/ProcessEnvironment.java Wed Jul 05 17:58:30 2017 +0200 @@ -68,6 +68,9 @@ final class ProcessEnvironment extends HashMap { + + private static final long serialVersionUID = -8017839552603542824L; + private static String validateName(String name) { // An initial `=' indicates a magic Windows variable name -- OK if (name.indexOf('=', 1) != -1 || @@ -144,6 +147,7 @@ }; } private static Map.Entry checkedEntry(Object o) { + @SuppressWarnings("unchecked") Map.Entry e = (Map.Entry) o; nonNullString(e.getKey()); nonNullString(e.getValue()); @@ -281,6 +285,7 @@ } // Only for use by ProcessBuilder.environment() + @SuppressWarnings("unchecked") static Map environment() { return (Map) theEnvironment.clone(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java --- a/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java Wed Jul 05 17:58:30 2017 +0200 @@ -40,6 +40,7 @@ import sun.java2d.InvalidPipeException; import sun.java2d.Surface; import sun.java2d.pipe.RenderQueue; +import sun.java2d.pipe.BufferedContext; import sun.java2d.pipe.hw.AccelGraphicsConfig; import sun.java2d.pipe.hw.AccelSurface; import sun.security.action.GetPropertyAction; @@ -310,7 +311,7 @@ RenderQueue rq = as.getContext().getRenderQueue(); rq.lock(); try { - as.getContext().validateContext(as); + BufferedContext.validateContext(as); rq.flushAndInvokeNow(new Runnable() { public void run() { long psdops = as.getNativeOps(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java --- a/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java Wed Jul 05 17:58:30 2017 +0200 @@ -37,7 +37,7 @@ */ public class WBufferStrategy { - private static native void initIDs(Class componentClass); + private static native void initIDs(Class componentClass); static { initIDs(Component.class); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -84,6 +84,7 @@ native void create(WComponentPeer parent); + @SuppressWarnings("deprecation") void initialize() { Choice opt = (Choice)target; int itemCount = opt.getItemCount(); @@ -116,6 +117,7 @@ super.initialize(); } + @SuppressWarnings("deprecation") protected void disposeImpl() { // TODO: we should somehow reset the listener when the choice // is moved to another toplevel without destroying its peer. diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WClipboard.java --- a/jdk/src/windows/classes/sun/awt/windows/WClipboard.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WClipboard.java Wed Jul 05 17:58:30 2017 +0200 @@ -71,17 +71,14 @@ // Get all of the target formats into which the Transferable can be // translated. Then, for each format, translate the data and post // it to the Clipboard. - Map formatMap = WDataTransferer.getInstance(). + Map formatMap = WDataTransferer.getInstance(). getFormatsForTransferable(contents, flavorMap); openClipboard(this); try { - for (Iterator iter = formatMap.keySet().iterator(); - iter.hasNext(); ) { - Long lFormat = (Long)iter.next(); - long format = lFormat.longValue(); - DataFlavor flavor = (DataFlavor)formatMap.get(lFormat); + for (Long format : formatMap.keySet()) { + DataFlavor flavor = formatMap.get(format); try { byte[] bytes = WDataTransferer.getInstance(). diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -222,7 +222,7 @@ updateWindow(); // make sure paint events are transferred to main event queue // for coalescing - WToolkit.getWToolkit().flushPendingEvents(); + SunToolkit.flushPendingEvents(); // paint the damaged area paintArea.paint(target, shouldClearRectBeforePaint()); } @@ -320,6 +320,7 @@ native void nativeHandleEvent(AWTEvent e); + @SuppressWarnings("fallthrough") public void handleEvent(AWTEvent e) { int id = e.getID(); @@ -549,6 +550,7 @@ // fallback default font object final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); + @SuppressWarnings("deprecation") public Graphics getGraphics() { if (isDisposed()) { return null; @@ -656,6 +658,7 @@ } // TODO: consider moving it to KeyboardFocusManagerPeerImpl + @SuppressWarnings("deprecation") public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) @@ -1058,6 +1061,7 @@ // in the browser on Vista when DWM is enabled. // @return true if the toplevel container is not an EmbeddedFrame or // if this EmbeddedFrame is acceleration capable, false otherwise + @SuppressWarnings("deprecation") private static final boolean isContainingTopLevelAccelCapable(Component c) { while (c != null && !(c instanceof WEmbeddedFrame)) { c = c.getParent(); @@ -1072,6 +1076,7 @@ * Applies the shape to the native component window. * @since 1.7 */ + @SuppressWarnings("deprecation") public void applyShape(Region shape) { if (shapeLog.isLoggable(PlatformLogger.FINER)) { shapeLog.finer( diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java --- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Wed Jul 05 17:58:30 2017 +0200 @@ -107,13 +107,15 @@ "DIBV5" }; - private static final Map predefinedClipboardNameMap; + private static final Map predefinedClipboardNameMap; static { - Map tempMap = new HashMap(predefinedClipboardNames.length, 1.0f); + Map tempMap = + new HashMap <> (predefinedClipboardNames.length, 1.0f); for (int i = 1; i < predefinedClipboardNames.length; i++) { tempMap.put(predefinedClipboardNames[i], Long.valueOf(i)); } - predefinedClipboardNameMap = Collections.synchronizedMap(tempMap); + predefinedClipboardNameMap = + Collections.synchronizedMap(tempMap); } /** @@ -135,7 +137,7 @@ public static final long CF_FILEGROUPDESCRIPTORA = registerClipboardFormat("FileGroupDescriptor"); //CF_FILECONTENTS supported as mandatory associated clipboard - private static final Long L_CF_LOCALE = (Long) + private static final Long L_CF_LOCALE = predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]); private static final DirectColorModel directColorModel = @@ -168,8 +170,11 @@ return transferer; } - public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) { - SortedMap retval = super.getFormatsForFlavors(flavors, map); + public SortedMap getFormatsForFlavors( + DataFlavor[] flavors, FlavorTable map) + { + SortedMap retval = + super.getFormatsForFlavors(flavors, map); // The Win32 native code does not support exporting LOCALE data, nor // should it. @@ -266,7 +271,7 @@ } protected Long getFormatForNativeAsLong(String str) { - Long format = (Long)predefinedClipboardNameMap.get(str); + Long format = predefinedClipboardNameMap.get(str); if (format == null) { format = Long.valueOf(registerClipboardFormat(str)); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java --- a/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java Wed Jul 05 17:58:30 2017 +0200 @@ -238,6 +238,7 @@ * Called by WToolkit when Windows settings change-- we (re)load properties and * set new values. */ + @SuppressWarnings("unchecked") synchronized Map getProperties() { ThemeReader.flush(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -87,6 +87,7 @@ } } + @SuppressWarnings("deprecation") public void hide() { Dialog dlg = (Dialog)target; if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java --- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java Wed Jul 05 17:58:30 2017 +0200 @@ -27,14 +27,12 @@ import sun.awt.*; import java.awt.*; -import java.awt.event.*; import java.awt.peer.ComponentPeer; -import java.util.*; -import java.awt.color.*; import java.awt.image.*; import sun.awt.image.ByteInterleavedRaster; import sun.security.action.GetPropertyAction; -import java.lang.reflect.*; +import java.security.PrivilegedAction; +import java.security.AccessController; public class WEmbeddedFrame extends EmbeddedFrame { @@ -52,8 +50,8 @@ private static int pScale = 0; private static final int MAX_BAND_SIZE = (1024*30); - private static String printScale = (String) java.security.AccessController - .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor")); + private static String printScale = AccessController.doPrivileged( + new GetPropertyAction("sun.java2d.print.pluginscalefactor")); public WEmbeddedFrame() { this((long)0); @@ -75,6 +73,7 @@ } } + @SuppressWarnings("deprecation") public void addNotify() { if (getPeer() == null) { WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit(); @@ -134,8 +133,8 @@ bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight); - imgWid = (int)(bandWidth * xscale); - imgHgt = (int)(bandHeight * yscale); + imgWid = bandWidth * xscale; + imgHgt = bandHeight * yscale; bandImage = new BufferedImage(imgWid, imgHgt, BufferedImage.TYPE_3BYTE_BGR); } @@ -159,7 +158,7 @@ if ((bandTop+bandHeight) > frameHeight) { // last band currBandHeight = frameHeight - bandTop; - currImgHeight = (int)(currBandHeight*yscale); + currImgHeight = currBandHeight*yscale; // multiply by 3 because the image is a 3 byte BGR imageOffset = imgWid*(imgHgt-currImgHeight)*3; @@ -179,9 +178,9 @@ if (printScale == null) { // if no system property is specified, // check for environment setting - printScale = (String) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + printScale = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE"); } } @@ -226,6 +225,7 @@ public void activateEmbeddingTopLevel() { } + @SuppressWarnings("deprecation") public void synthesizeWindowActivation(final boolean doActivate) { if (!doActivate || EventQueue.isDispatchThread()) { ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -167,7 +167,7 @@ WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { - fileDialog.hide(); + fileDialog.setVisible(false); } }); } // handleSelected() @@ -182,16 +182,16 @@ WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { - fileDialog.hide(); + fileDialog.setVisible(false); } }); } // handleCancel() //This whole static block is a part of 4152317 fix static { - String filterString = (String) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + String filterString = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { try { ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization"); return rb.getString("allFiles"); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WFramePeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -24,25 +24,12 @@ */ package sun.awt.windows; -import java.util.Vector; - import java.awt.*; import java.awt.peer.*; -import java.awt.image.ImageObserver; - -import java.awt.image.Raster; -import java.awt.image.DataBuffer; -import java.awt.image.DataBufferInt; -import java.awt.image.BufferedImage; - -import java.awt.image.ColorModel; - -import sun.awt.image.ImageRepresentation; -import sun.awt.image.IntegerComponentRaster; -import sun.awt.image.ToolkitImage; -import sun.awt.im.*; -import sun.awt.Win32GraphicsDevice; import sun.awt.AWTAccessor; +import sun.awt.im.InputMethodManager; +import java.security.AccessController; +import sun.security.action.GetPropertyAction; class WFramePeer extends WWindowPeer implements FramePeer { @@ -71,9 +58,9 @@ private native void clearMaximizedBounds(); private static final boolean keepOnMinimize = "true".equals( - (String)java.security.AccessController.doPrivileged( - new sun.security.action.GetPropertyAction( - "sun.awt.keepWorkingSetOnMinimize"))); + AccessController.doPrivileged( + new GetPropertyAction( + "sun.awt.keepWorkingSetOnMinimize"))); public void setMaximizedBounds(Rectangle b) { if (b == null) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WInputMethod.java --- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java Wed Jul 05 17:58:30 2017 +0200 @@ -82,12 +82,12 @@ private final static boolean COMMIT_INPUT = true; private final static boolean DISCARD_INPUT = false; - private static Map[] highlightStyles; + private static Map [] highlightStyles; // Initialize highlight mapping table static { - Map styles[] = new Map[4]; - HashMap map; + Map styles[] = new Map[4]; + HashMap map; // UNSELECTED_RAW_TEXT_HIGHLIGHT map = new HashMap(1); @@ -410,7 +410,7 @@ /** * @see java.awt.Toolkit#mapInputMethodHighlight */ - static Map mapInputMethodHighlight(InputMethodHighlight highlight) { + static Map mapInputMethodHighlight(InputMethodHighlight highlight) { int index; int state = highlight.getState(); if (state == InputMethodHighlight.RAW_TEXT) { diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -158,9 +158,9 @@ private static Font defaultMenuFont; static { - defaultMenuFont = (Font) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + defaultMenuFont = AccessController.doPrivileged( + new PrivilegedAction () { + public Font run() { try { ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization"); return Font.decode(rb.getString("menuFont")); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WPageDialog.java --- a/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java Wed Jul 05 17:58:30 2017 +0200 @@ -55,6 +55,7 @@ this.painter = painter; } + @SuppressWarnings("deprecation") public void addNotify() { synchronized(getTreeLock()) { Container parent = getParent(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -49,7 +49,7 @@ // but if it is we need to trap it so the thread does // not hide is called and the thread doesn't hang. } - ((WPrintDialog)target).hide(); + ((WPrintDialog)target).setVisible(false); } }).start(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java --- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java Wed Jul 05 17:58:30 2017 +0200 @@ -53,6 +53,7 @@ // Use native code to circumvent access restrictions on Component.peer protected native void setPeer(ComponentPeer peer); + @SuppressWarnings("deprecation") public void addNotify() { synchronized(getTreeLock()) { Container parent = getParent(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -73,7 +73,7 @@ // but if it is we need to trap it so the thread does // not hide is called and the thread doesn't hang. } - ((WPrintDialog)target).hide(); + ((WPrintDialog)target).setVisible(false); } }).start(); } diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WToolkit.java --- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Wed Jul 05 17:58:30 2017 +0200 @@ -74,7 +74,7 @@ WClipboard clipboard; // cache of font peers - private Hashtable cacheFontPeer; + private Hashtable cacheFontPeer; // Windows properties private WDesktopProperties wprops; @@ -110,10 +110,10 @@ log.fine("Win version: " + getWindowsVersion()); } - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() + AccessController.doPrivileged( + new PrivilegedAction () { - public Object run() { + public Void run() { String browserProp = System.getProperty("browser"); if (browserProp != null && browserProp.equals("sun.plugin")) { disableCustomPalette(); @@ -261,8 +261,8 @@ } private final void registerShutdownHook() { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { ThreadGroup currentTG = Thread.currentThread().getThreadGroup(); ThreadGroup parentTG = currentTG.getParent(); @@ -399,6 +399,7 @@ return peer; } + @SuppressWarnings("deprecation") public void disableBackgroundErase(Canvas canvas) { WCanvasPeer peer = (WCanvasPeer)canvas.getPeer(); if (peer == null) { @@ -592,7 +593,7 @@ FontPeer retval = null; String lcName = name.toLowerCase(); if (null != cacheFontPeer) { - retval = (FontPeer)cacheFontPeer.get(lcName + style); + retval = cacheFontPeer.get(lcName + style); if (null != retval) { return retval; } @@ -600,7 +601,7 @@ retval = new WFontPeer(name, style); if (retval != null) { if (null == cacheFontPeer) { - cacheFontPeer = new Hashtable(5, (float)0.9); + cacheFontPeer = new Hashtable<>(5, 0.9f); } if (null != cacheFontPeer) { cacheFontPeer.put(lcName + style, retval); @@ -698,7 +699,9 @@ /** * Returns a style map for the input method highlight. */ - public Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public Map mapInputMethodHighlight( + InputMethodHighlight highlight) + { return WInputMethod.mapInputMethodHighlight(highlight); } @@ -968,12 +971,14 @@ return !Win32GraphicsEnvironment.isDWMCompositionEnabled(); } + @SuppressWarnings("deprecation") public void grab(Window w) { if (w.getPeer() != null) { ((WWindowPeer)w.getPeer()).grab(); } } + @SuppressWarnings("deprecation") public void ungrab(Window w) { if (w.getPeer() != null) { ((WWindowPeer)w.getPeer()).ungrab(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java --- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed Jul 05 17:58:30 2017 +0200 @@ -92,7 +92,7 @@ } // WComponentPeer overrides - + @SuppressWarnings("unchecked") protected void disposeImpl() { AppContext appContext = SunToolkit.targetToAppContext(target); synchronized (appContext) { @@ -378,6 +378,7 @@ return modalBlocker != null; } + @SuppressWarnings("deprecation") public void setModalBlocked(Dialog dialog, boolean blocked) { synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock { @@ -417,6 +418,7 @@ * The list is sorted by the time of activation, so the latest * active window is always at the end. */ + @SuppressWarnings("unchecked") public static long[] getActiveWindowHandles() { AppContext appContext = AppContext.getAppContext(); synchronized (appContext) { @@ -571,6 +573,7 @@ super.print(g); } + @SuppressWarnings("deprecation") private void replaceSurfaceDataRecursively(Component c) { if (c instanceof Container) { for (Component child : ((Container)c).getComponents()) { @@ -691,13 +694,13 @@ // its shape only. To restore the correct visual appearance // of the window (i.e. w/ the correct shape) we have to reset // the shape. - Shape shape = ((Window)target).getShape(); + Shape shape = target.getShape(); if (shape != null) { - ((Window)target).setShape(shape); + target.setShape(shape); } } - if (((Window)target).isVisible()) { + if (target.isVisible()) { updateWindow(true); } } @@ -730,6 +733,7 @@ * then the method registers ActiveWindowListener, GuiDisposedListener listeners; * it executes the initilialization only once per AppContext. */ + @SuppressWarnings("unchecked") private static void initActiveWindowsTracking(Window w) { AppContext appContext = AppContext.getAppContext(); synchronized (appContext) { @@ -774,6 +778,7 @@ * updates the list of active windows per AppContext, so the latest active * window is always at the end of the list. The list is stored in AppContext. */ + @SuppressWarnings( value = {"deprecation", "unchecked"}) private static class ActiveWindowListener implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { Window w = (Window)e.getNewValue(); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/Makefile --- a/jdk/test/Makefile Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/test/Makefile Wed Jul 05 17:58:30 2017 +0200 @@ -322,8 +322,8 @@ ################################################################ -# Default make rule (runs jtreg_tests) -all: jtreg_tests +# Default make rule (runs default jdk tests) +all: jdk_default @$(ECHO) "Testing completed successfully" # Prep for output @@ -422,6 +422,7 @@ # ------------------------------------------------------------------ # Batches of tests (somewhat arbitrary assigments to jdk_* targets) +JDK_DEFAULT_TARGETS = JDK_ALL_TARGETS = # Stable othervm testruns (minus items from PROBLEM_LIST) @@ -433,6 +434,7 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_beans1 +JDK_DEFAULT_TARGETS += jdk_beans1 jdk_beans1: $(call TestDirs, \ java/beans/beancontext java/beans/PropertyChangeSupport \ java/beans/Introspector java/beans/Performance \ @@ -459,11 +461,13 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_io +JDK_DEFAULT_TARGETS += jdk_io jdk_io: $(call TestDirs, java/io) $(call RunAgentvmBatch) # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_lang +JDK_DEFAULT_TARGETS += jdk_lang jdk_lang: $(call TestDirs, java/lang) $(call RunAgentvmBatch) @@ -485,11 +489,13 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_math +JDK_DEFAULT_TARGETS += jdk_math jdk_math: $(call TestDirs, java/math) $(call RunAgentvmBatch) # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_misc +JDK_DEFAULT_TARGETS += jdk_misc jdk_misc: $(call TestDirs, \ demo/jvmti demo/zipfs javax/naming javax/script \ javax/smartcardio com/sun/jndi com/sun/xml sun/misc) @@ -497,16 +503,19 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_net +JDK_DEFAULT_TARGETS += jdk_net jdk_net: $(call TestDirs, com/sun/net java/net sun/net) $(call RunAgentvmBatch) # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_nio1 +JDK_DEFAULT_TARGETS += jdk_nio1 jdk_nio1: $(call TestDirs, java/nio/file) $(call RunAgentvmBatch) # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_nio2 +JDK_DEFAULT_TARGETS += jdk_nio2 jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \ java/nio/channels java/nio/MappedByteBuffer) $(call SharedLibraryPermissions,java/nio/channels) @@ -514,6 +523,7 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_nio3 +JDK_DEFAULT_TARGETS += jdk_nio3 jdk_nio3: $(call TestDirs, sun/nio) $(call RunAgentvmBatch) @@ -533,6 +543,7 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_security1 +JDK_DEFAULT_TARGETS += jdk_security1 jdk_security1: $(call TestDirs, java/security) $(call RunAgentvmBatch) @@ -566,6 +577,7 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_text +JDK_DEFAULT_TARGETS += jdk_text jdk_text: $(call TestDirs, java/text sun/text) $(call RunAgentvmBatch) @@ -589,15 +601,18 @@ # Stable agentvm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_util +JDK_DEFAULT_TARGETS += jdk_util jdk_util: $(call TestDirs, java/util sun/util) $(call RunAgentvmBatch) # ------------------------------------------------------------------ +# Run default tests +jdk_default: $(JDK_DEFAULT_TARGETS) + @$(SummaryInfo) + # Run all tests -FILTER_OUT_LIST=jdk_awt jdk_rmi jdk_swing -JDK_ALL_STABLE_TARGETS := $(filter-out $(FILTER_OUT_LIST), $(JDK_ALL_TARGETS)) -jdk_all: $(JDK_ALL_STABLE_TARGETS) +jdk_all: $(JDK_ALL_TARGETS) @$(SummaryInfo) # These are all phony targets diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/EventQueue/MainAppContext/MainAppContext.java Wed Jul 05 17:58:30 2017 +0200 @@ -0,0 +1,36 @@ +/* + * @test + * @bug 7122796 + * @summary Tests 7122796 + * @author anthony.petrov@oracle.com + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import sun.awt.*; + +public class MainAppContext { + + public static void main(String[] args) { + ThreadGroup secondGroup = new ThreadGroup("test"); + new Thread(secondGroup, new Runnable() { + public void run() { + SunToolkit.createNewAppContext(); + test(true); + } + }).start(); + + // Sleep on the main thread so that the AWT Toolkit is initialized + // in a user AppContext first + try { Thread.sleep(2000); } catch (Exception e) {} + + test(false); + } + + private static void test(boolean userAppContext) { + if (Toolkit.getDefaultToolkit().getSystemEventQueue() == null) { + throw new RuntimeException("No EventQueue for the current app context! userAppContext: " + userAppContext); + } + } +} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/java/nio/file/Files/CustomOptions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/nio/file/Files/CustomOptions.java Wed Jul 05 17:58:30 2017 +0200 @@ -0,0 +1,112 @@ +/* + * 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. + * + * 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 7087549 + * @summary Test custom options with newInputStream. + * @author Brandon Passanisi + * @library .. + * @build CustomOptions PassThroughFileSystem + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.nio.file.*; +import java.nio.file.attribute.FileAttribute; +import java.nio.file.spi.FileSystemProvider; +import java.nio.channels.SeekableByteChannel; +import java.util.Collections; +import java.util.Set; +import java.util.Map; + +public class CustomOptions { + + // Create a custom option + static enum CustomOption implements OpenOption { + IGNORE, + } + + // number of times that IGNORE option is observed + static int ignoreCount; + + // A pass through provider that supports a custom open option + static class MyCustomProvider extends PassThroughFileSystem.PassThroughProvider { + public MyCustomProvider() { } + + @Override + public SeekableByteChannel newByteChannel(Path path, + Set options, + FileAttribute... attrs) + throws IOException + { + if (options.contains(CustomOption.IGNORE)) { + ignoreCount++; + options.remove(CustomOption.IGNORE); + } + return super.newByteChannel(path, options, attrs); + } + } + + public static void main(String[] args) throws Exception { + FileSystemProvider provider = new MyCustomProvider(); + Map env = Collections.emptyMap(); + URI uri = URI.create("pass:///"); + FileSystem fs = provider.newFileSystem(uri, env); + + // Create temp dir for testing + Path dir = TestUtil.createTemporaryDirectory(); + try { + + // Create temp file for testing + Path path = fs.getPath(dir.resolve("foo").toString()); + Files.createFile(path); + + // Test custom option + Files.newInputStream(path, CustomOption.IGNORE).close(); + if (ignoreCount != 1) + throw new RuntimeException("IGNORE option not passed through"); + + // Test null option + try { + Files.newInputStream(path, new OpenOption[] { null }).close(); + throw new RuntimeException("NullPointerException expected"); + } catch (NullPointerException ignore) { } + + // Test unsupported options + try { + Files.newInputStream(path, StandardOpenOption.WRITE).close(); + throw new RuntimeException("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException uoe) { } + try { + Files.newInputStream(path, StandardOpenOption.APPEND).close(); + throw new RuntimeException("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException uoe) { } + + } finally { + // Cleanup + TestUtil.removeAll(dir); + } + } +} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/java/util/Collections/EmptyIterator.java --- a/jdk/test/java/util/Collections/EmptyIterator.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/test/java/util/Collections/EmptyIterator.java Wed Jul 05 17:58:30 2017 +0200 @@ -35,8 +35,6 @@ void test(String[] args) throws Throwable { testEmptyCollection(Collections.emptyList()); testEmptyCollection(Collections.emptySet()); - testEmptyCollection(new java.util.concurrent. - SynchronousQueue()); testEmptyMap(Collections.emptyMap()); diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/java/util/regex/RegExTest.java --- a/jdk/test/java/util/regex/RegExTest.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/test/java/util/regex/RegExTest.java Wed Jul 05 17:58:30 2017 +0200 @@ -32,7 +32,7 @@ * 4872664 4803179 4892980 4900747 4945394 4938995 4979006 4994840 4997476 * 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940 * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133 - * 6350801 6676425 6878475 6919132 6931676 6948903 7014645 7039066 + * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066 */ import java.util.regex.*; @@ -50,6 +50,7 @@ private static Random generator = new Random(); private static boolean failure = false; private static int failCount = 0; + private static String firstFailure = null; /** * Main to interpret arguments and run several tests. @@ -133,15 +134,19 @@ hitEndTest(); toMatchResultTest(); surrogatesInClassTest(); + removeQEQuotingTest(); namedGroupCaptureTest(); nonBmpClassComplementTest(); unicodePropertiesTest(); unicodeHexNotationTest(); unicodeClassesTest(); - if (failure) - throw new RuntimeException("Failure in the RE handling."); - else + if (failure) { + throw new + RuntimeException("RegExTest failed, 1st failure: " + + firstFailure); + } else { System.err.println("OKAY: All tests passed."); + } } // Utility functions @@ -215,8 +220,14 @@ String paddedName = paddedNameBuffer.toString(); System.err.println(paddedName + ": " + (failCount==0 ? "Passed":"Failed("+failCount+")")); - if (failCount > 0) + if (failCount > 0) { failure = true; + + if (firstFailure == null) { + firstFailure = testName; + } + } + failCount = 0; } @@ -295,6 +306,22 @@ Matcher matcher = pattern.matcher("\ud834\udd22"); if (!matcher.find()) failCount++; + + report("Surrogate pair in Unicode escape"); + } + + // This is for bug6990617 + // Test if Pattern.RemoveQEQuoting works correctly if the octal unicode + // char encoding is only 2 or 3 digits instead of 4 and the first quoted + // char is an octal digit. + private static void removeQEQuotingTest() throws Exception { + Pattern pattern = + Pattern.compile("\\011\\Q1sometext\\E\\011\\Q2sometext\\E"); + Matcher matcher = pattern.matcher("\t1sometext\t2sometext"); + if (!matcher.find()) + failCount++; + + report("Remove Q/E Quoting"); } // This is for bug 4988891 diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JScrollBar/4708809/bug4708809.java Wed Jul 05 17:58:30 2017 +0200 @@ -0,0 +1,134 @@ +/* + * 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. + * + * 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 4708809 + * @summary JScrollBar functionality slightly different from native scrollbar + * @author Andrey Pikalev + * @run main bug4708809 + */ +import javax.swing.*; +import java.awt.*; +import java.awt.Point; +import java.awt.event.*; +import sun.awt.SunToolkit; + +public class bug4708809 { + + private static volatile boolean do_test = false; + private static volatile boolean passed = true; + private static JScrollPane spane; + private static JScrollBar sbar; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(350); + + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + spane.requestFocus(); + sbar.setValue(sbar.getMaximum()); + } + }); + + toolkit.realSync(); + + Point point = getClickPoint(0.5, 0.5); + robot.mouseMove(point.x, point.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + final int oldValue = sbar.getValue(); + sbar.addAdjustmentListener(new AdjustmentListener() { + + public void adjustmentValueChanged(AdjustmentEvent e) { + if (e.getValue() >= oldValue) { + passed = false; + } + do_test = true; + } + }); + + } + }); + + toolkit.realSync(); + + point = getClickPoint(0.5, 0.2); + robot.mouseMove(point.x, point.y); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + + if (!do_test || !passed) { + throw new Exception("The scrollbar moved with incorrect direction"); + } + + } + + private static Point getClickPoint(final double scaleX, final double scaleY) throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + Point p = sbar.getLocationOnScreen(); + Rectangle rect = sbar.getBounds(); + result[0] = new Point((int) (p.x + scaleX * rect.width), + (int) (p.y + scaleY * rect.height)); + } + }); + + return result[0]; + + } + + private static void createAndShowGUI() { + JFrame fr = new JFrame("Test"); + + JLabel label = new JLabel("picture"); + label.setPreferredSize(new Dimension(500, 500)); + spane = new JScrollPane(label); + fr.getContentPane().add(spane); + sbar = spane.getVerticalScrollBar(); + + fr.setSize(200, 200); + fr.setVisible(true); + } +} \ No newline at end of file diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java Wed Jul 05 17:58:30 2017 +0200 @@ -0,0 +1,77 @@ +/* + * 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. + * + * 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 6416920 + * @summary Ensures that selected tab is painted properly in the scroll tab layout + * under WindowsLookAndFeel in Windows' "Windows XP" theme. + * @author Mikhail Lapshin + * @run main bug6416920 + */ + +import javax.swing.plaf.basic.BasicTabbedPaneUI; +import javax.swing.JTabbedPane; +import javax.swing.SwingConstants; +import java.awt.Rectangle; +import java.awt.Insets; +import sun.awt.OSInfo; + +public class bug6416920 extends BasicTabbedPaneUI { + public AccessibleTabbedPaneLayout layout = new AccessibleTabbedPaneLayout(); + + public static void main(String[] args) { + + if(OSInfo.getOSType() != OSInfo.OSType.WINDOWS){ + return; + } + + bug6416920 test = new bug6416920(); + test.layout.padSelectedTab(SwingConstants.TOP, 0); + if (test.rects[0].width < 0) { + throw new RuntimeException("A selected tab isn't painted properly " + + "in the scroll tab layout under WindowsLookAndFeel " + + "in Windows' \"Windows XP\" theme."); + } + } + + public bug6416920() { + super(); + + // Set parameters for the padSelectedTab() method + selectedTabPadInsets = new Insets(0, 0, 0, 0); + + tabPane = new JTabbedPane(); + tabPane.setSize(100, 0); + tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); + + rects = new Rectangle[1]; + rects[0] = new Rectangle(150, 0, 0, 0); + } + + public class AccessibleTabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout { + public void padSelectedTab(int tabPlacement, int selectedIndex) { + super.padSelectedTab(tabPlacement, selectedIndex); + } + } +} diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/sun/net/www/protocol/http/HttpOnly.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/net/www/protocol/http/HttpOnly.java Wed Jul 05 17:58:30 2017 +0200 @@ -0,0 +1,242 @@ +/* + * 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. + * + * 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 7095980 + * @summary Ensure HttpURLConnection (and supporting APIs) don't expose + * HttpOnly cookies + */ + +import java.io.IOException; +import java.net.CookieHandler; +import java.net.CookieManager; +import java.net.CookiePolicy; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.HttpURLConnection; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import com.sun.net.httpserver.Headers; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; + +/* + * 1) start the HTTP server + * 2) populate cookie store with HttpOnly cookies + * 3) make HTTP request that should contain HttpOnly cookies + * 4) check HttpOnly cookies received by server + * 5) server reply with Set-Cookie containing HttpOnly cookie + * 6) check HttpOnly cookies are not accessible from Http client + */ + +public class HttpOnly { + + static final String URI_PATH = "/xxyyzz/"; + static final int SESSION_ID = 12345; + + void test(String[] args) throws Exception { + HttpServer server = startHttpServer(); + CookieHandler previousHandler = CookieHandler.getDefault(); + try { + InetSocketAddress address = server.getAddress(); + URI uri = new URI("http://" + InetAddress.getLocalHost().getHostAddress() + + ":" + address.getPort() + URI_PATH); + populateCookieStore(uri); + doClient(uri); + } finally { + CookieHandler.setDefault(previousHandler); + server.stop(0); + } + } + + void populateCookieStore(URI uri) + throws IOException { + + CookieManager cm = new CookieManager(null, CookiePolicy.ACCEPT_ALL); + CookieHandler.setDefault(cm); + Map> header = new HashMap<>(); + List values = new ArrayList<>(); + values.add("JSESSIONID=" + SESSION_ID + "; version=1; Path=" + + URI_PATH +"; HttpOnly"); + values.add("CUSTOMER=WILE_E_COYOTE; version=1; Path=" + URI_PATH); + header.put("Set-Cookie", values); + cm.put(uri, header); + } + + void doClient(URI uri) throws Exception { + HttpURLConnection uc = (HttpURLConnection) uri.toURL().openConnection(); + int resp = uc.getResponseCode(); + check(resp == 200, + "Unexpected response code. Expected 200, got " + resp); + + // TEST 1: check getRequestProperty doesn't return the HttpOnly cookie + // In fact, that it doesn't return any automatically set cookies. + String cookie = uc.getRequestProperty("Cookie"); + check(cookie == null, + "Cookie header returned from getRequestProperty, value " + cookie); + + // TEST 2: check getRequestProperties doesn't return the HttpOnly cookie. + // In fact, that it doesn't return any automatically set cookies. + Map> reqHeaders = uc.getRequestProperties(); + Set>> entries = reqHeaders.entrySet(); + for (Map.Entry> entry : entries) { + String header = entry.getKey(); + check(!"Cookie".equalsIgnoreCase(header), + "Cookie header returned from getRequestProperties, value " + + entry.getValue()); + } + + // TEST 3: check getHeaderField doesn't return Set-Cookie with HttpOnly + String setCookie = uc.getHeaderField("Set-Cookie"); + if (setCookie != null) { + debug("Set-Cookie:" + setCookie); + check(!setCookie.toLowerCase().contains("httponly"), + "getHeaderField returned Set-Cookie header with HttpOnly, " + + "value = " + setCookie); + } + + // TEST 3.5: check getHeaderField doesn't return Set-Cookie2 with HttpOnly + String setCookie2 = uc.getHeaderField("Set-Cookie2"); + if (setCookie2 != null) { + debug("Set-Cookie2:" + setCookie2); + check(!setCookie2.toLowerCase().contains("httponly"), + "getHeaderField returned Set-Cookie2 header with HttpOnly, " + + "value = " + setCookie2); + } + + // TEST 4: check getHeaderFields doesn't return Set-Cookie + // or Set-Cookie2 headers with HttpOnly + Map> respHeaders = uc.getHeaderFields(); + Set>> respEntries = respHeaders.entrySet(); + for (Map.Entry> entry : respEntries) { + String header = entry.getKey(); + if ("Set-Cookie".equalsIgnoreCase(header)) { + List setCookieValues = entry.getValue(); + debug("Set-Cookie:" + setCookieValues); + for (String value : setCookieValues) + check(!value.toLowerCase().contains("httponly"), + "getHeaderFields returned Set-Cookie header with HttpOnly, " + + "value = " + value); + } + if ("Set-Cookie2".equalsIgnoreCase(header)) { + List setCookieValues = entry.getValue(); + debug("Set-Cookie2:" + setCookieValues); + for (String value : setCookieValues) + check(!value.toLowerCase().contains("httponly"), + "getHeaderFields returned Set-Cookie2 header with HttpOnly, " + + "value = " + value); + } + } + + // Now add some user set cookies into the mix. + uc = (HttpURLConnection) uri.toURL().openConnection(); + uc.addRequestProperty("Cookie", "CUSTOMER_ID=CHEGAR;"); + resp = uc.getResponseCode(); + check(resp == 200, + "Unexpected response code. Expected 200, got " + resp); + + // TEST 5: check getRequestProperty doesn't return the HttpOnly cookie + cookie = uc.getRequestProperty("Cookie"); + check(!cookie.toLowerCase().contains("httponly"), + "HttpOnly cookie returned from getRequestProperty, value " + cookie); + + // TEST 6: check getRequestProperties doesn't return the HttpOnly cookie. + reqHeaders = uc.getRequestProperties(); + entries = reqHeaders.entrySet(); + for (Map.Entry> entry : entries) { + String header = entry.getKey(); + if ("Cookie".equalsIgnoreCase(header)) { + for (String val : entry.getValue()) + check(!val.toLowerCase().contains("httponly"), + "HttpOnly cookie returned from getRequestProperties," + + " value " + val); + } + } + } + + // HTTP Server + HttpServer startHttpServer() throws IOException { + HttpServer httpServer = HttpServer.create(new InetSocketAddress(0), 0); + httpServer.createContext(URI_PATH, new SimpleHandler()); + httpServer.start(); + return httpServer; + } + + class SimpleHandler implements HttpHandler { + @Override + public void handle(HttpExchange t) throws IOException { + Headers reqHeaders = t.getRequestHeaders(); + + // some small sanity check + List cookies = reqHeaders.get("Cookie"); + for (String cookie : cookies) { + if (!cookie.contains("JSESSIONID") + || !cookie.contains("WILE_E_COYOTE")) + t.sendResponseHeaders(400, -1); + } + + // return some cookies so we can check getHeaderField(s) + Headers respHeaders = t.getResponseHeaders(); + List values = new ArrayList<>(); + values.add("ID=JOEBLOGGS; version=1; Path=" + URI_PATH); + values.add("NEW_JSESSIONID=" + (SESSION_ID+1) + "; version=1; Path=" + + URI_PATH +"; HttpOnly"); + values.add("NEW_CUSTOMER=WILE_E_COYOTE2; version=1; Path=" + URI_PATH); + respHeaders.put("Set-Cookie", values); + values = new ArrayList<>(); + values.add("COOKIE2_CUSTOMER=WILE_E_COYOTE2; version=1; Path=" + + URI_PATH); + respHeaders.put("Set-Cookie2", values); + values.add("COOKIE2_JSESSIONID=" + (SESSION_ID+100) + + "; version=1; Path=" + URI_PATH +"; HttpOnly"); + respHeaders.put("Set-Cookie2", values); + + t.sendResponseHeaders(200, -1); + t.close(); + } + } + + volatile int passed = 0, failed = 0; + boolean debug = false; + void pass() {passed++;} + void fail() {failed++;} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void debug(String message) { if (debug) System.out.println(message); } + void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);} + public static void main(String[] args) throws Throwable { + Class k = new Object(){}.getClass().getEnclosingClass(); + try {k.getMethod("instanceMain",String[].class) + .invoke( k.newInstance(), (Object) args);} + catch (Throwable e) {throw e.getCause();}} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} + diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/sun/text/resources/LocaleData --- a/jdk/test/sun/text/resources/LocaleData Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/test/sun/text/resources/LocaleData Wed Jul 05 17:58:30 2017 +0200 @@ -7010,3 +7010,12 @@ # bug 7101495 CalendarData/lv/firstDayOfWeek=2 CalendarData/lv/minimalDaysInFirstWeek=4 + +# bug 7003124 +FormatData/bg/DateTimePatterns/0=HH:mm:ss zzzz +FormatData/bg/DateTimePatterns/2=HH:mm:ss +FormatData/bg/DateTimePatterns/3=HH:mm +FormatData/bg/DateTimePatterns/4=dd MMMM y, EEEE +FormatData/bg/DateTimePatterns/5=dd MMMM y +FormatData/bg/DateTimePatterns/6=dd.MM.yyyy +FormatData/bg/DateTimePatterns/7=dd.MM.yy diff -r 8e546b2b9dd0 -r 0d73629f3a8d jdk/test/sun/text/resources/LocaleDataTest.java --- a/jdk/test/sun/text/resources/LocaleDataTest.java Fri Dec 23 16:39:22 2011 -0800 +++ b/jdk/test/sun/text/resources/LocaleDataTest.java Wed Jul 05 17:58:30 2017 +0200 @@ -34,6 +34,7 @@ * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611 * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495 + * 7003124 * @summary Verify locale data * */ diff -r 8e546b2b9dd0 -r 0d73629f3a8d make/jprt.properties --- a/make/jprt.properties Fri Dec 23 16:39:22 2011 -0800 +++ b/make/jprt.properties Wed Jul 05 17:58:30 2017 +0200 @@ -25,7 +25,7 @@ # Properties for jprt -# Release to build +# Locked down to jdk8 jprt.tools.default.release=jdk8 # The different build flavors we want, we override here so we just get these 2 @@ -45,284 +45,61 @@ # User can select the test set with jprt submit "-testset name" option jprt.my.test.set=${jprt.test.set} -# Default vm test targets (no fastdebug & limited c2 testing) +# Test target list (no fastdebug & limited c2 testing) +jprt.my.test.target.set= \ + solaris_sparc_5.10-product-c1-TESTNAME, \ + solaris_sparcv9_5.10-product-c2-TESTNAME, \ + solaris_i586_5.10-product-c1-TESTNAME, \ + solaris_x64_5.10-product-c2-TESTNAME, \ + linux_i586_2.6-product-{c1|c2}-TESTNAME, \ + linux_x64_2.6-product-c2-TESTNAME, \ + windows_i586_5.1-product-c1-TESTNAME, \ + windows_x64_5.2-product-c2-TESTNAME + +# Default vm test targets (testset=default) jprt.vm.default.test.targets= \ - \ - solaris_sparc_5.10-product-c1-jvm98, \ - solaris_sparcv9_5.10-product-c2-jvm98, \ - solaris_i586_5.10-product-c1-jvm98, \ - solaris_x64_5.10-product-c2-jvm98, \ - linux_i586_2.6-product-{c1|c2}-jvm98, \ - linux_x64_2.6-product-c2-jvm98, \ - windows_i586_5.1-product-c1-jvm98, \ - windows_x64_5.2-product-c2-jvm98, \ - \ - solaris_sparc_5.10-product-c1-scimark, \ - solaris_sparcv9_5.10-product-c2-scimark, \ - solaris_i586_5.10-product-c1-scimark, \ - solaris_x64_5.10-product-c2-scimark, \ - linux_i586_2.6-product-{c1|c2}-scimark, \ - linux_x64_2.6-product-c2-scimark, \ - windows_i586_5.1-product-c1-scimark, \ - windows_x64_5.2-product-c2-scimark + ${jprt.my.test.target.set:TESTNAME=jvm98}, \ + ${jprt.my.test.target.set:TESTNAME=scimark} -# Default jdk test targets in test/Makefile (no fastdebug & limited c2 testing) +# Default jdk test targets (testset=default) jprt.make.rule.default.test.targets= \ - \ - solaris_sparc_5.10-product-c1-langtools_jtreg, \ - solaris_sparcv9_5.10-product-c2-langtools_jtreg, \ - solaris_i586_5.10-product-c1-langtools_jtreg, \ - solaris_x64_5.10-product-c2-langtools_jtreg, \ - linux_i586_2.6-product-{c1|c2}-langtools_jtreg, \ - linux_x64_2.6-product-c2-langtools_jtreg, \ - windows_i586_5.1-product-c1-langtools_jtreg, \ - windows_x64_5.2-product-c2-langtools_jtreg, \ - \ - solaris_sparc_5.10-product-c1-jdk_beans1, \ - solaris_sparcv9_5.10-product-c2-jdk_beans1, \ - solaris_i586_5.10-product-c1-jdk_beans1, \ - solaris_x64_5.10-product-c2-jdk_beans1, \ - linux_i586_2.6-product-{c1|c2}-jdk_beans1, \ - linux_x64_2.6-product-c2-jdk_beans1, \ - windows_i586_5.1-product-c1-jdk_beans1, \ - windows_x64_5.2-product-c2-jdk_beans1, \ - \ - solaris_sparc_5.10-product-c1-jdk_io, \ - solaris_sparcv9_5.10-product-c2-jdk_io, \ - solaris_i586_5.10-product-c1-jdk_io, \ - solaris_x64_5.10-product-c2-jdk_io, \ - linux_i586_2.6-product-{c1|c2}-jdk_io, \ - linux_x64_2.6-product-c2-jdk_io, \ - windows_i586_5.1-product-c1-jdk_io, \ - windows_x64_5.2-product-c2-jdk_io, \ - \ - solaris_sparc_5.10-product-c1-jdk_lang, \ - solaris_sparcv9_5.10-product-c2-jdk_lang, \ - solaris_i586_5.10-product-c1-jdk_lang, \ - solaris_x64_5.10-product-c2-jdk_lang, \ - linux_i586_2.6-product-{c1|c2}-jdk_lang, \ - linux_x64_2.6-product-c2-jdk_lang, \ - windows_i586_5.1-product-c1-jdk_lang, \ - windows_x64_5.2-product-c2-jdk_lang, \ - \ - solaris_sparc_5.10-product-c1-jdk_math, \ - solaris_sparcv9_5.10-product-c2-jdk_math, \ - solaris_i586_5.10-product-c1-jdk_math, \ - solaris_x64_5.10-product-c2-jdk_math, \ - linux_i586_2.6-product-{c1|c2}-jdk_math, \ - linux_x64_2.6-product-c2-jdk_math, \ - windows_i586_5.1-product-c1-jdk_math, \ - windows_x64_5.2-product-c2-jdk_math, \ - \ - solaris_sparc_5.10-product-c1-jdk_misc, \ - solaris_sparcv9_5.10-product-c2-jdk_misc, \ - solaris_i586_5.10-product-c1-jdk_misc, \ - solaris_x64_5.10-product-c2-jdk_misc, \ - linux_i586_2.6-product-{c1|c2}-jdk_misc, \ - linux_x64_2.6-product-c2-jdk_misc, \ - windows_i586_5.1-product-c1-jdk_misc, \ - windows_x64_5.2-product-c2-jdk_misc, \ - \ - solaris_sparc_5.10-product-c1-jdk_net, \ - solaris_sparcv9_5.10-product-c2-jdk_net, \ - solaris_i586_5.10-product-c1-jdk_net, \ - solaris_x64_5.10-product-c2-jdk_net, \ - linux_i586_2.6-product-{c1|c2}-jdk_net, \ - linux_x64_2.6-product-c2-jdk_net, \ - windows_i586_5.1-product-c1-jdk_net, \ - windows_x64_5.2-product-c2-jdk_net, \ - \ - solaris_sparc_5.10-product-c1-jdk_nio1, \ - solaris_sparcv9_5.10-product-c2-jdk_nio1, \ - solaris_i586_5.10-product-c1-jdk_nio1, \ - solaris_x64_5.10-product-c2-jdk_nio1, \ - linux_i586_2.6-product-{c1|c2}-jdk_nio1, \ - linux_x64_2.6-product-c2-jdk_nio1, \ - windows_i586_5.1-product-c1-jdk_nio1, \ - windows_x64_5.2-product-c2-jdk_nio1, \ - \ - solaris_sparc_5.10-product-c1-jdk_nio2, \ - solaris_sparcv9_5.10-product-c2-jdk_nio2, \ - solaris_i586_5.10-product-c1-jdk_nio2, \ - solaris_x64_5.10-product-c2-jdk_nio2, \ - linux_i586_2.6-product-{c1|c2}-jdk_nio2, \ - linux_x64_2.6-product-c2-jdk_nio2, \ - windows_i586_5.1-product-c1-jdk_nio2, \ - windows_x64_5.2-product-c2-jdk_nio2, \ - \ - solaris_sparc_5.10-product-c1-jdk_nio3, \ - solaris_sparcv9_5.10-product-c2-jdk_nio3, \ - solaris_i586_5.10-product-c1-jdk_nio3, \ - solaris_x64_5.10-product-c2-jdk_nio3, \ - linux_i586_2.6-product-{c1|c2}-jdk_nio3, \ - linux_x64_2.6-product-c2-jdk_nio3, \ - windows_i586_5.1-product-c1-jdk_nio3, \ - windows_x64_5.2-product-c2-jdk_nio3, \ - \ - solaris_sparc_5.10-product-c1-jdk_security1, \ - solaris_sparcv9_5.10-product-c2-jdk_security1, \ - solaris_i586_5.10-product-c1-jdk_security1, \ - solaris_x64_5.10-product-c2-jdk_security1, \ - linux_i586_2.6-product-{c1|c2}-jdk_security1, \ - linux_x64_2.6-product-c2-jdk_security1, \ - windows_i586_5.1-product-c1-jdk_security1, \ - windows_x64_5.2-product-c2-jdk_security1, \ - \ - solaris_sparc_5.10-product-c1-jdk_text, \ - solaris_sparcv9_5.10-product-c2-jdk_text, \ - solaris_i586_5.10-product-c1-jdk_text, \ - solaris_x64_5.10-product-c2-jdk_text, \ - linux_i586_2.6-product-{c1|c2}-jdk_text, \ - linux_x64_2.6-product-c2-jdk_text, \ - windows_i586_5.1-product-c1-jdk_text, \ - windows_x64_5.2-product-c2-jdk_text, \ - \ - solaris_sparc_5.10-product-c1-jdk_tools1, \ - solaris_sparcv9_5.10-product-c2-jdk_tools1, \ - solaris_i586_5.10-product-c1-jdk_tools1, \ - solaris_x64_5.10-product-c2-jdk_tools1, \ - linux_i586_2.6-product-{c1|c2}-jdk_tools1, \ - linux_x64_2.6-product-c2-jdk_tools1, \ - windows_i586_5.1-product-c1-jdk_tools1, \ - windows_x64_5.2-product-c2-jdk_tools1, \ - \ - solaris_sparc_5.10-product-c1-jdk_util, \ - solaris_sparcv9_5.10-product-c2-jdk_util, \ - solaris_i586_5.10-product-c1-jdk_util, \ - solaris_x64_5.10-product-c2-jdk_util, \ - linux_i586_2.6-product-{c1|c2}-jdk_util, \ - linux_x64_2.6-product-c2-jdk_util, \ - windows_i586_5.1-product-c1-jdk_util, \ - windows_x64_5.2-product-c2-jdk_util + ${jprt.my.test.target.set:TESTNAME=langtools_jtreg}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_io}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_lang}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_math}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_misc}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_net}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_security1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_text}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_util} -# All vm test targets (but still no fastdebug & limited c2 testing) +# All vm test targets (testset=all) jprt.vm.all.test.targets= \ - \ - ${jprt.vm.default.test.targets}, \ - \ - solaris_sparc_5.10-product-c1-runThese, \ - solaris_sparcv9_5.10-product-c2-runThese, \ - solaris_i586_5.10-product-c1-runThese, \ - solaris_x64_5.10-product-c2-runThese, \ - linux_i586_2.6-product-{c1|c2}-runThese, \ - linux_x64_2.6-product-c2-runThese, \ - windows_i586_5.1-product-c1-runThese, \ - windows_x64_5.2-product-c2-runThese, \ - \ - solaris_sparc_5.10-product-c1-jbb_default, \ - solaris_sparcv9_5.10-product-c2-jbb_default, \ - solaris_i586_5.10-product-c1-jbb_default, \ - solaris_x64_5.10-product-c2-jbb_default, \ - linux_i586_2.6-product-{c1|c2}-jbb_default, \ - linux_x64_2.6-product-c2-jbb_default, \ - windows_i586_5.1-product-c1-jbb_default, \ - windows_x64_5.2-product-c2-jbb_default + ${jprt.vm.default.test.targets}, \ + ${jprt.my.test.target.set:TESTNAME=runThese}, \ + ${jprt.my.test.target.set:TESTNAME=jbb_default} -# All jdk test targets (but still no fastdebug & limited c2 testing) +# All jdk test targets (testset=all) jprt.make.rule.all.test.targets= \ - \ - ${jprt.make.rule.default.test.targets}, \ - \ - solaris_sparc_5.10-product-c1-jdk_awt, \ - solaris_sparcv9_5.10-product-c2-jdk_awt, \ - solaris_i586_5.10-product-c1-jdk_awt, \ - solaris_x64_5.10-product-c2-jdk_awt, \ - linux_i586_2.6-product-{c1|c2}-jdk_awt, \ - linux_x64_2.6-product-c2-jdk_awt, \ - windows_i586_5.1-product-c1-jdk_awt, \ - windows_x64_5.2-product-c2-jdk_awt, \ - \ - solaris_sparc_5.10-product-c1-jdk_beans2, \ - solaris_sparcv9_5.10-product-c2-jdk_beans2, \ - solaris_i586_5.10-product-c1-jdk_beans2, \ - solaris_x64_5.10-product-c2-jdk_beans2, \ - linux_i586_2.6-product-{c1|c2}-jdk_beans2, \ - linux_x64_2.6-product-c2-jdk_beans2, \ - windows_i586_5.1-product-c1-jdk_beans2, \ - windows_x64_5.2-product-c2-jdk_beans2, \ - \ - solaris_sparc_5.10-product-c1-jdk_beans3, \ - solaris_sparcv9_5.10-product-c2-jdk_beans3, \ - solaris_i586_5.10-product-c1-jdk_beans3, \ - solaris_x64_5.10-product-c2-jdk_beans3, \ - linux_i586_2.6-product-{c1|c2}-jdk_beans3, \ - linux_x64_2.6-product-c2-jdk_beans3, \ - windows_i586_5.1-product-c1-jdk_beans3, \ - windows_x64_5.2-product-c2-jdk_beans3, \ - \ - solaris_sparc_5.10-product-c1-jdk_management1, \ - solaris_sparcv9_5.10-product-c2-jdk_management1, \ - solaris_i586_5.10-product-c1-jdk_management1, \ - solaris_x64_5.10-product-c2-jdk_management1, \ - linux_i586_2.6-product-{c1|c2}-jdk_management1, \ - linux_x64_2.6-product-c2-jdk_management1, \ - windows_i586_5.1-product-c1-jdk_management1, \ - windows_x64_5.2-product-c2-jdk_management1, \ - \ - solaris_sparc_5.10-product-c1-jdk_management2, \ - solaris_sparcv9_5.10-product-c2-jdk_management2, \ - solaris_i586_5.10-product-c1-jdk_management2, \ - solaris_x64_5.10-product-c2-jdk_management2, \ - linux_i586_2.6-product-{c1|c2}-jdk_management2, \ - linux_x64_2.6-product-c2-jdk_management2, \ - windows_i586_5.1-product-c1-jdk_management2, \ - windows_x64_5.2-product-c2-jdk_management2, \ - \ - solaris_sparc_5.10-product-c1-jdk_rmi, \ - solaris_sparcv9_5.10-product-c2-jdk_rmi, \ - solaris_i586_5.10-product-c1-jdk_rmi, \ - solaris_x64_5.10-product-c2-jdk_rmi, \ - linux_i586_2.6-product-{c1|c2}-jdk_rmi, \ - linux_x64_2.6-product-c2-jdk_rmi, \ - windows_i586_5.1-product-c1-jdk_rmi, \ - windows_x64_5.2-product-c2-jdk_rmi, \ - \ - solaris_sparc_5.10-product-c1-jdk_security2, \ - solaris_sparcv9_5.10-product-c2-jdk_security2, \ - solaris_i586_5.10-product-c1-jdk_security2, \ - solaris_x64_5.10-product-c2-jdk_security2, \ - linux_i586_2.6-product-{c1|c2}-jdk_security2, \ - linux_x64_2.6-product-c2-jdk_security2, \ - windows_i586_5.1-product-c1-jdk_security2, \ - windows_x64_5.2-product-c2-jdk_security2, \ - \ - solaris_sparc_5.10-product-c1-jdk_security3, \ - solaris_sparcv9_5.10-product-c2-jdk_security3, \ - solaris_i586_5.10-product-c1-jdk_security3, \ - solaris_x64_5.10-product-c2-jdk_security3, \ - linux_i586_2.6-product-{c1|c2}-jdk_security3, \ - linux_x64_2.6-product-c2-jdk_security3, \ - windows_i586_5.1-product-c1-jdk_security3, \ - windows_x64_5.2-product-c2-jdk_security3, \ - \ - solaris_sparc_5.10-product-c1-jdk_sound, \ - solaris_sparcv9_5.10-product-c2-jdk_sound, \ - solaris_i586_5.10-product-c1-jdk_sound, \ - solaris_x64_5.10-product-c2-jdk_sound, \ - linux_i586_2.6-product-{c1|c2}-jdk_sound, \ - linux_x64_2.6-product-c2-jdk_sound, \ - windows_i586_5.1-product-c1-jdk_sound, \ - windows_x64_5.2-product-c2-jdk_sound, \ - \ - solaris_sparc_5.10-product-c1-jdk_swing, \ - solaris_sparcv9_5.10-product-c2-jdk_swing, \ - solaris_i586_5.10-product-c1-jdk_swing, \ - solaris_x64_5.10-product-c2-jdk_swing, \ - linux_i586_2.6-product-{c1|c2}-jdk_swing, \ - linux_x64_2.6-product-c2-jdk_swing, \ - windows_i586_5.1-product-c1-jdk_swing, \ - windows_x64_5.2-product-c2-jdk_swing, \ - \ - solaris_sparc_5.10-product-c1-jdk_tools2, \ - solaris_sparcv9_5.10-product-c2-jdk_tools2, \ - solaris_i586_5.10-product-c1-jdk_tools2, \ - solaris_x64_5.10-product-c2-jdk_tools2, \ - linux_i586_2.6-product-{c1|c2}-jdk_tools2, \ - linux_x64_2.6-product-c2-jdk_tools2, \ - windows_i586_5.1-product-c1-jdk_tools2, \ - windows_x64_5.2-product-c2-jdk_tools2 + ${jprt.make.rule.default.test.targets}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_awt}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_management1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_management2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_security2}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_security3}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_sound}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_swing}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \ + ${jprt.my.test.target.set:TESTNAME=jdk_tools2} -# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken) +# JCK test targets in test/Makefile (no windows) jprt.my.jck.test.target.set= \ solaris_sparc_5.10-product-c1-JCK7TESTRULE, \ solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \ @@ -338,11 +115,10 @@ ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler} # Select list to use (allow for testset to be empty too) -jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} -jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} -jprt.vm..test.targets=${jprt.vm.default.test.targets} -jprt.vm.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets} -jprt.test.targets=${jprt.vm.test.targets} +jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} +jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} +jprt.vm..test.targets=${jprt.vm.default.test.targets} +jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets} # Directories to be excluded from the source bundles jprt.bundle.exclude.src.dirs=build dist webrev diff -r 8e546b2b9dd0 -r 0d73629f3a8d test/Makefile --- a/test/Makefile Fri Dec 23 16:39:22 2011 -0800 +++ b/test/Makefile Wed Jul 05 17:58:30 2017 +0200 @@ -53,36 +53,45 @@ LANGTOOLS_TEST_LIST = langtools_jtreg # Test target list for jdk repository -JDK_TEST_LIST = \ - jdk_beans1 jdk_beans2 jdk_beans3 \ +JDK_DEFAULT_TEST_LIST = \ + jdk_beans1 \ jdk_io \ jdk_lang \ - jdk_management1 jdk_management2 \ jdk_math \ jdk_misc \ jdk_net \ jdk_nio1 jdk_nio2 jdk_nio3 \ - jdk_security1 jdk_security2 jdk_security3 \ + jdk_security1 \ jdk_text \ - jdk_tools1 jdk_tools2 \ jdk_util -# These tests need a DISPLAY and can create window interaction complications -JDK_TEST_LIST2 = \ +# These tests are not part of the default testing list +JDK_NONDEFAULT_TEST_LIST = \ jdk_awt \ + jdk_beans2 jdk_beans3 \ + jdk_management1 jdk_management2 \ + jdk_security2 jdk_security3 \ jdk_rmi \ - jdk_swing + jdk_sound \ + jdk_swing \ + jdk_tools1 jdk_tools2 + +# All jdk tests +JDK_ALL_TEST_LIST = $(JDK_DEFAULT_TEST_LIST) $(JDK_NONDEFAULT_TEST_LIST) # These are the current jck test targets in the jdk repository JDK_JCK7_LIST = jck7devtools jck7compiler jck7runtime # Default test target (everything) -all: $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST) +default: $(JDK_DEFAULT_TEST_LIST) $(LANGTOOLS_TEST_LIST) + +# All testing +all: $(JDK_ALL_TEST_LIST) $(LANGTOOLS_TEST_LIST) # Test targets $(LANGTOOLS_TEST_LIST): @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@)) -$(JDK_TEST_LIST) $(JDK_TEST_LIST2) $(JDK_JCK7_LIST): +$(JDK_ALL_TEST_LIST) $(JDK_JCK7_LIST): @$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), $@) clean: @@ -91,7 +100,7 @@ # Phony targets (e.g. these are not filenames) .PHONY: all clean \ - $(JDK_TEST_LIST) $(JDK_TEST_LIST2) $(JDK_JCK7_LIST) \ + $(JDK_ALL_TEST_LIST) $(JDK_JCK7_LIST) \ $(LANGTOOLS_TEST_LIST) ################################################################