diff --git a/.hgtags b/.hgtags
index b10973146f8..a2e16484b47 100644
--- a/.hgtags
+++ b/.hgtags
@@ -136,3 +136,5 @@ cc1f5ce8e504d350e0b0c28c5f84333f8d540132 jdk8-b11
86db042b3385c338e17f7664447fdc7d406dd19e jdk8-b12
4cc0ef72c812943743ef4765f1100e2fbe2b1a08 jdk8-b13
9ffaa48dbfb0f5936c2b789867d0785faec7071d jdk8-b14
+b5060eae3b32fd9f884a09774338cd8186d7fafa jdk8-b15
+736a63b854f321c7824b7e47890135f80aee05e3 jdk8-b16
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 9a2840005da..d837fdefdba 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -136,3 +136,4 @@ a6c4c248e8fa350c35014fa94bab5ac1a1ac3299 jdk8-b10
8e2104d565baee473895d5eba20e39f85ab4bf9f jdk8-b12
26fb81a1e9ceb9baffba216acd9ded62e9e9d5ab jdk8-b13
23aa7f2c80a2fa354c80decf03e7c2018177ef4e jdk8-b14
+a4f28069d44a379cda99dd1d921d19f819726d22 jdk8-b15
diff --git a/corba/.hgtags b/corba/.hgtags
index 0ed9489cb7a..0eedad9f973 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -136,3 +136,4 @@ cda87f7fefcee3b89742a57ce5ad9b03a54c210d jdk8-b10
31d70911b712c6b4e580a3110363d5f044cfed7a jdk8-b12
5b9d9b839d3d7fe02347827221c97c6d242a6f96 jdk8-b13
e59c47de1ad8982ff3b0e843773a6902b36c2337 jdk8-b14
+7da69e7175a7c7564ee6d0e52255cbb8a57ef577 jdk8-b15
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 871721f37dc..4099ac55a93 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -200,3 +200,4 @@ d815de2e85e511b7deab2a83cf80c0224d011da9 jdk8-b10
b92ca8e229d29004f840c67e620833d23a346761 jdk8-b13
088d09a130ff02d8f5f05e92256baabe412f0439 jdk8-b14
6c2a55d4902f202e1c2de1df17b7da083a2c31e8 hs23-b06
+fde2a39ed7f39233b287fbc278f437aac06c275b jdk8-b15
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index a5a1d0d667e..3947922b70a 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -136,3 +136,4 @@ d1b7a4f6dd2065fdeafbcdfd9dcc0072da8c6881 jdk8-b11
ca977d167697a561c04894187fc1c4d927582ffa jdk8-b12
bcc739229f6384786c7ac0b52c1822c85674dcf1 jdk8-b13
9d0c9d638757cb09de18933b946fa04b4f3fb94f jdk8-b14
+804f666d6d44e33caac12ad8da3d2780ac44ef72 jdk8-b15
diff --git a/jaxp/build.properties b/jaxp/build.properties
index 8ec3620b01e..a468f8175fc 100644
--- a/jaxp/build.properties
+++ b/jaxp/build.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 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
@@ -25,7 +25,7 @@
# Base locations where bundles are located
slashjava=/java
-drops.dir=${slashjava}/devtools/share/jdk7-drops
+drops.dir=${slashjava}/devtools/share/jdk8-drops
# This is the JDK used to build and run the bootstrap version of javac.
# The bootstrap javac is used to compile both boostrap versions of the
diff --git a/jaxp/make/Makefile b/jaxp/make/Makefile
index 55076a028af..b2574d7d6da 100644
--- a/jaxp/make/Makefile
+++ b/jaxp/make/Makefile
@@ -99,9 +99,9 @@ ifdef ALT_DROPS_DIR
DROPS_DIR = $(ALT_DROPS_DIR)
else
ifdef ALT_JDK_DEVTOOLS_DIR
- DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk7-drops
+ DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk8-drops
else
- DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk7-drops
+ DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk8-drops
endif
endif
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 3721c51e56d..be879b77d3c 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -136,3 +136,4 @@ a12ab897a249feb7859a6e6cd84b49411f4c06ac jdk8-b11
e6eed2ff5d5f62bdc815beb5276d23347600c760 jdk8-b12
adf2a6b5fde14090beb9ebc40c4114132ddee731 jdk8-b13
54c4bf4b83ecc191351747d5d28da849d34c0243 jdk8-b14
+c9ab96ff23d52d85d5dcce1f9c0fd7a3de418c74 jdk8-b15
diff --git a/jaxws/build.properties b/jaxws/build.properties
index 8ec3620b01e..a468f8175fc 100644
--- a/jaxws/build.properties
+++ b/jaxws/build.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 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
@@ -25,7 +25,7 @@
# Base locations where bundles are located
slashjava=/java
-drops.dir=${slashjava}/devtools/share/jdk7-drops
+drops.dir=${slashjava}/devtools/share/jdk8-drops
# This is the JDK used to build and run the bootstrap version of javac.
# The bootstrap javac is used to compile both boostrap versions of the
diff --git a/jaxws/make/Makefile b/jaxws/make/Makefile
index 55076a028af..b2574d7d6da 100644
--- a/jaxws/make/Makefile
+++ b/jaxws/make/Makefile
@@ -99,9 +99,9 @@ ifdef ALT_DROPS_DIR
DROPS_DIR = $(ALT_DROPS_DIR)
else
ifdef ALT_JDK_DEVTOOLS_DIR
- DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk7-drops
+ DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk8-drops
else
- DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk7-drops
+ DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk8-drops
endif
endif
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 472ceb82660..961824355d0 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -136,3 +136,6 @@ f1ec21b8142168ff40f3278d2f6b5fe4bd5f3b26 jdk8-b09
09fd2067f715e4505c44b01c301258a4e8f8964e jdk8-b12
4cb2e8679b27432854690cb688ea06d3b2d8e008 jdk8-b13
99632935785e2038b2fc836da9f2ede69dea294b jdk8-b14
+3c248d0e2c486624cc0d7aba1e4df45ae5774ff7 jdk8-b15
+b71d1acfae5240d8c1359443cd02b5ddb587231c jdk8-b17
+929597c6e777f742ad252660045ebaa4a3ea4772 jdk8-b16
diff --git a/jdk/make/common/Defs-embedded.gmk b/jdk/make/common/Defs-embedded.gmk
index de449f82b5a..089fae9d586 100644
--- a/jdk/make/common/Defs-embedded.gmk
+++ b/jdk/make/common/Defs-embedded.gmk
@@ -65,5 +65,12 @@ ifdef CROSS_COMPILE_ARCH
NIO_PLATFORM_CLASSES_ROOT_DIR = $(CLOSED_PLATFORM_SRC)/classes/
endif
+# For ARM sflt we need to link to a library with improved FP accuracy
+# and it must be linked after fdlibm - this places it at the end after libc
+# -z muldefs avoids linker errors for duplicate symbols.
+ifeq ($(CROSS_COMPILE_ARCH), arm)
+ EXTRA_LIBS += $(EXT_LIBS_PATH)/sflt_glibc_jdk.a -Xlinker -z -Xlinker muldefs
+endif
+
endif # JAVASE_EMBEDDED
diff --git a/jdk/make/common/Defs.gmk b/jdk/make/common/Defs.gmk
index 99d1ed1a69e..5f8d91171de 100644
--- a/jdk/make/common/Defs.gmk
+++ b/jdk/make/common/Defs.gmk
@@ -202,7 +202,7 @@ endif
#
# zlib version
#
-ZLIB_VERSION = 1.2.3
+ZLIB_VERSION = 1.2.5
#
diff --git a/jdk/make/common/Rules.gmk b/jdk/make/common/Rules.gmk
index 5072b33c2c9..041e1d20226 100644
--- a/jdk/make/common/Rules.gmk
+++ b/jdk/make/common/Rules.gmk
@@ -233,13 +233,15 @@ classes : $(CLASSES_INIT) .delete.classlist .compile.classlist
@$(MKDIR) -p $(CLASSDESTDIR)
@$(RM) $<.filtered
@$(CAT) $< | $(NAWK) 'length>0' | $(SORT) -u > $<.filtered
- @if [ `$(CAT) $<.filtered | $(WC) -l` -ge 1 ] ; then \
- $(ECHO) "# Java sources to be compiled: (listed in file $<)"; \
- $(CAT) $<.filtered; \
- $(ECHO) "# Running javac:"; \
- $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
- $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
- fi
+ @numfiles=`$(WC) -l < $<.filtered` ; \
+ if [ $$numfiles -ge 1 ] ; then \
+ $(ECHO) "# Java sources to be compiled: (listed in file $<)"; \
+ $(CAT) $<.filtered; \
+ $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
+ $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
+ $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
+ $(ECHO) "# javac finished"; \
+ fi
@$(java-vm-cleanup)
clobber clean::
diff --git a/jdk/make/java/zip/FILES_c.gmk b/jdk/make/java/zip/FILES_c.gmk
index 66648876daa..a1d5e933830 100644
--- a/jdk/make/java/zip/FILES_c.gmk
+++ b/jdk/make/java/zip/FILES_c.gmk
@@ -32,7 +32,10 @@ FILES_c = \
zip_util.c \
compress.c \
deflate.c \
- gzio.c \
+ gzclose.c \
+ gzlib.c \
+ gzread.c \
+ gzwrite.c \
infback.c \
inffast.c \
inflate.c \
diff --git a/jdk/make/java/zip/mapfile-vers b/jdk/make/java/zip/mapfile-vers
index fdcd5b63be1..3f95d470b90 100644
--- a/jdk/make/java/zip/mapfile-vers
+++ b/jdk/make/java/zip/mapfile-vers
@@ -30,8 +30,10 @@ SUNWprivate_1.1 {
Java_java_util_jar_JarFile_getMetaInfEntryNames;
Java_java_util_zip_Adler32_update;
Java_java_util_zip_Adler32_updateBytes;
+ Java_java_util_zip_Adler32_updateByteBuffer;
Java_java_util_zip_CRC32_update;
Java_java_util_zip_CRC32_updateBytes;
+ Java_java_util_zip_CRC32_updateByteBuffer;
Java_java_util_zip_Deflater_deflateBytes;
Java_java_util_zip_Deflater_end;
Java_java_util_zip_Deflater_getAdler;
diff --git a/jdk/make/sun/splashscreen/FILES_c.gmk b/jdk/make/sun/splashscreen/FILES_c.gmk
index a7684a21a3e..b6e234f10b5 100644
--- a/jdk/make/sun/splashscreen/FILES_c.gmk
+++ b/jdk/make/sun/splashscreen/FILES_c.gmk
@@ -51,7 +51,10 @@ FILES_c = \
gifalloc.c \
compress.c \
deflate.c \
- gzio.c \
+ gzclose.c \
+ gzlib.c \
+ gzread.c \
+ gzwrite.c \
infback.c \
inffast.c \
inflate.c \
diff --git a/jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java b/jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java
index c90578d46c2..8e7928dbe65 100644
--- a/jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java
+++ b/jdk/src/share/classes/com/sun/media/sound/JSSecurityManager.java
@@ -34,15 +34,13 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
+import java.util.ServiceLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.sound.sampled.AudioPermission;
-import sun.misc.Service;
-
-
/** Managing security in the Java Sound implementation.
* This class contains all code that uses and is used by
* SecurityManager.doPrivileged().
@@ -80,8 +78,8 @@ class JSSecurityManager {
try {
if (hasSecurityManager()) {
if(Printer.debug) Printer.debug("using security manager to load library");
- PrivilegedAction action = new PrivilegedAction() {
- public Object run() {
+ PrivilegedAction action = new PrivilegedAction() {
+ public Void run() {
System.loadLibrary(libName);
return null;
}
@@ -104,8 +102,8 @@ class JSSecurityManager {
if (hasSecurityManager()) {
if(Printer.debug) Printer.debug("using JDK 1.2 security to get property");
try{
- PrivilegedAction action = new PrivilegedAction() {
- public Object run() {
+ PrivilegedAction action = new PrivilegedAction() {
+ public String run() {
try {
return System.getProperty(propertyName);
} catch (Throwable t) {
@@ -113,7 +111,7 @@ class JSSecurityManager {
}
}
};
- propertyValue = (String) AccessController.doPrivileged(action);
+ propertyValue = AccessController.doPrivileged(action);
} catch( Exception e ) {
if(Printer.debug) Printer.debug("not using JDK 1.2 security to get properties");
propertyValue = System.getProperty(propertyName);
@@ -142,8 +140,8 @@ class JSSecurityManager {
if(hasSecurityManager()) {
try {
// invoke the privileged action using 1.2 security
- PrivilegedAction action = new PrivilegedAction() {
- public Object run() {
+ PrivilegedAction action = new PrivilegedAction() {
+ public Void run() {
loadPropertiesImpl(properties, filename);
return null;
}
@@ -197,8 +195,8 @@ class JSSecurityManager {
if(hasSecurityManager()) {
try {
// invoke the privileged action using 1.2 security
- PrivilegedAction action = new PrivilegedAction() {
- public Object run() {
+ PrivilegedAction action = new PrivilegedAction() {
+ public ThreadGroup run() {
try {
return getTopmostThreadGroupImpl();
} catch (Throwable t) {
@@ -206,7 +204,7 @@ class JSSecurityManager {
}
}
};
- topmostThreadGroup = (ThreadGroup) AccessController.doPrivileged(action);
+ topmostThreadGroup = AccessController.doPrivileged(action);
if(Printer.debug)Printer.debug("Got topmost thread group with JDK 1.2 security");
} catch (Exception e) {
if(Printer.debug)Printer.debug("Exception getting topmost thread group with JDK 1.2 security");
@@ -240,8 +238,8 @@ class JSSecurityManager {
final boolean doStart) {
Thread thread = null;
if(hasSecurityManager()) {
- PrivilegedAction action = new PrivilegedAction() {
- public Object run() {
+ PrivilegedAction action = new PrivilegedAction() {
+ public Thread run() {
try {
return createThreadImpl(runnable, threadName,
isDaemon, priority,
@@ -251,7 +249,7 @@ class JSSecurityManager {
}
}
};
- thread = (Thread) AccessController.doPrivileged(action);
+ thread = AccessController.doPrivileged(action);
if(Printer.debug) Printer.debug("created thread with JDK 1.2 security");
} else {
if(Printer.debug)Printer.debug("not using JDK 1.2 security");
@@ -282,11 +280,11 @@ class JSSecurityManager {
}
- static List getProviders(final Class providerClass) {
- List p = new ArrayList();
- // Service.providers(Class) just creates "lazy" iterator instance,
- // so it doesn't require do be called from privileged section
- final Iterator ps = Service.providers(providerClass);
+ static List getProviders(final Class providerClass) {
+ List p = new ArrayList<>();
+ // ServiceLoader creates "lazy" iterator instance, so it doesn't,
+ // require do be called from privileged section
+ final Iterator ps = ServiceLoader.load(providerClass).iterator();
// the iterator's hasNext() method looks through classpath for
// the provider class names, so it requires read permissions
@@ -301,7 +299,7 @@ class JSSecurityManager {
// the iterator's next() method creates instances of the
// providers and it should be called in the current security
// context
- Object provider = ps.next();
+ T provider = ps.next();
if (providerClass.isInstance(provider)) {
// $$mp 2003-08-22
// Always adding at the beginning reverses the
diff --git a/jdk/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java b/jdk/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java
index ec8b91c5f5d..7b5c05331fe 100644
--- a/jdk/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java
+++ b/jdk/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java
@@ -25,50 +25,58 @@
package com.sun.net.httpserver.spi;
-import java.io.FileDescriptor;
import java.io.IOException;
import java.net.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
-import sun.misc.Service;
-import sun.misc.ServiceConfigurationError;
-import sun.security.action.GetPropertyAction;
+import java.util.ServiceLoader;
+import java.util.ServiceConfigurationError;
import com.sun.net.httpserver.*;
/**
* Service provider class for HttpServer.
- * Sub-classes of HttpServerProvider provide an implementation of {@link HttpServer} and
- * associated classes. Applications do not normally use this class.
- * See {@link #provider()} for how providers are found and loaded.
+ * Sub-classes of HttpServerProvider provide an implementation of
+ * {@link HttpServer} and associated classes. Applications do not normally use
+ * this class. See {@link #provider()} for how providers are found and loaded.
*/
public abstract class HttpServerProvider {
/**
* creates a HttpServer from this provider
- * @param addr the address to bind to. May be null
- * @param backlog the socket backlog. A value of zero means the systems default
+ *
+ * @param addr
+ * the address to bind to. May be {@code null}
+ *
+ * @param backlog
+ * the socket backlog. A value of {@code zero} means the systems default
*/
- public abstract HttpServer createHttpServer (InetSocketAddress addr, int backlog) throws IOException;
+ public abstract HttpServer createHttpServer(InetSocketAddress addr,
+ int backlog)
+ throws IOException;
/**
* creates a HttpsServer from this provider
- * @param addr the address to bind to. May be null
- * @param backlog the socket backlog. A value of zero means the systems default
+ *
+ * @param addr
+ * the address to bind to. May be {@code null}
+ *
+ * @param backlog
+ * the socket backlog. A value of {@code zero} means the systems default
*/
- public abstract HttpsServer createHttpsServer (InetSocketAddress addr, int backlog) throws IOException;
-
-
+ public abstract HttpsServer createHttpsServer(InetSocketAddress addr,
+ int backlog)
+ throws IOException;
private static final Object lock = new Object();
private static HttpServerProvider provider = null;
/**
- * Initializes a new instance of this class.
+ * Initializes a new instance of this class.
*
* @throws SecurityException
* If a security manager has been installed and it denies
- * {@link RuntimePermission}("httpServerProvider")
+ * {@link RuntimePermission}{@code("httpServerProvider")}
*/
protected HttpServerProvider() {
SecurityManager sm = System.getSecurityManager();
@@ -82,21 +90,22 @@ public abstract class HttpServerProvider {
return false;
try {
Class> c = Class.forName(cn, true,
- ClassLoader.getSystemClassLoader());
+ ClassLoader.getSystemClassLoader());
provider = (HttpServerProvider)c.newInstance();
return true;
} catch (ClassNotFoundException |
IllegalAccessException |
InstantiationException |
SecurityException x) {
- throw new ServiceConfigurationError(x);
+ throw new ServiceConfigurationError(null, x);
}
}
private static boolean loadProviderAsService() {
- @SuppressWarnings("unchecked")
- Iterator i = Service.providers(HttpServerProvider.class,
- ClassLoader.getSystemClassLoader());
+ Iterator i =
+ ServiceLoader.load(HttpServerProvider.class,
+ ClassLoader.getSystemClassLoader())
+ .iterator();
for (;;) {
try {
if (!i.hasNext())
@@ -123,19 +132,19 @@ public abstract class HttpServerProvider {
*
*
*
If the system property
- * com.sun.net.httpserver.HttpServerProvider is defined then it is
- * taken to be the fully-qualified name of a concrete provider class.
+ * {@code com.sun.net.httpserver.HttpServerProvider} is defined then it
+ * is taken to be the fully-qualified name of a concrete provider class.
* The class is loaded and instantiated; if this process fails then an
* unspecified unchecked error or exception is thrown.
*
*
If a provider class has been installed in a jar file that is
* visible to the system class loader, and that jar file contains a
* provider-configuration file named
- * com.sun.net.httpserver.HttpServerProvider in the resource
+ * {@code com.sun.net.httpserver.HttpServerProvider} in the resource
* directory META-INF/services, then the first class name
* specified in that file is taken. The class is loaded and
- * instantiated; if this process fails then an unspecified unchecked error or exception is
- * thrown.
+ * instantiated; if this process fails then an unspecified unchecked error
+ * or exception is thrown.
*
*
Finally, if no provider has been specified by any of the above
* means then the system-default provider class is instantiated and the
diff --git a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
index 8008049a751..9b4670556c8 100644
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
@@ -357,7 +357,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
// set the Reader, this maybe overridden latter
provider =
- (SyncProvider)SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER);
+ SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER);
if (!(provider instanceof RIOptimisticProvider)) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString());
@@ -445,11 +445,10 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @param env a Hashtable object with a list of desired
* synchronization providers
* @throws SQLException if the requested provider cannot be found by the
- * synchonization factory
+ * synchronization factory
* @see SyncProvider
*/
-
- public CachedRowSetImpl(Hashtable env) throws SQLException {
+ public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) throws SQLException {
try {
@@ -467,7 +466,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
// set the Reader, this maybe overridden latter
provider =
- (SyncProvider)SyncFactory.getInstance(providerName);
+ SyncFactory.getInstance(providerName);
rowSetReader = provider.getRowSetReader();
rowSetWriter = provider.getRowSetWriter();
@@ -525,7 +524,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
iMatchColumns = new Vector(10);
for(int i = 0; i < 10 ; i++) {
- iMatchColumns.add(i,Integer.valueOf(-1));
+ iMatchColumns.add(i, -1);
}
strMatchColumns = new Vector(10);
@@ -540,7 +539,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
private void checkTransactionalWriter() {
if (rowSetWriter != null) {
- Class c = rowSetWriter.getClass();
+ Class> c = rowSetWriter.getClass();
if (c != null) {
Class[] theInterfaces = c.getInterfaces();
for (int i = 0; i < theInterfaces.length; i++) {
@@ -685,7 +684,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
obj = new SerialArray((java.sql.Array)obj);
}
- ((Row)currentRow).initColumnObject(i, obj);
+ currentRow.initColumnObject(i, obj);
}
rowsFetched++;
rvh.add(currentRow);
@@ -881,7 +880,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
cursorPos = saveCursorPos;
}
- if ((tXWriter) && this.COMMIT_ON_ACCEPT_CHANGES) {
+ if (tXWriter) {
// do commit/rollback's here
if (!conflict) {
tWriter = (TransactionalWriter)rowSetWriter;
@@ -901,7 +900,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
if (success == true) {
setOriginal();
- } else if (!(success) && !(this.COMMIT_ON_ACCEPT_CHANGES)) {
+ } else if (!(success) ) {
throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.accfailed").toString());
}
@@ -938,10 +937,8 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @see javax.sql.rowset.spi.SyncProvider
*/
public void acceptChanges(Connection con) throws SyncProviderException{
-
setConnection(con);
acceptChanges();
-
}
/**
@@ -957,7 +954,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/
public void restoreOriginal() throws SQLException {
Row currentRow;
- for (Iterator i = rvh.iterator(); i.hasNext();) {
+ for (Iterator> i = rvh.iterator(); i.hasNext();) {
currentRow = (Row)i.next();
if (currentRow.getInserted() == true) {
i.remove();
@@ -1287,7 +1284,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
TreeMap tMap = new TreeMap<>();
for (int i = 0; i c = map.get(s.getSQLTypeName());
if (c != null) {
// create new instance of the class
SQLData obj = null;
@@ -3091,7 +3088,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
}
- return (java.io.Reader)charStream;
+ return charStream;
}
/**
@@ -4006,7 +4003,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
switch (trgType) {
case java.sql.Types.BIT:
Integer i = Integer.valueOf(srcObj.toString().trim());
- return i.equals(Integer.valueOf((int)0)) ?
+ return i.equals(0) ?
Boolean.valueOf(false) :
Boolean.valueOf(true);
case java.sql.Types.TINYINT:
@@ -4173,7 +4170,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
switch (trgType) {
case java.sql.Types.BIT:
Integer i = Integer.valueOf(srcObj.toString().trim());
- return i.equals(Integer.valueOf((int)0)) ?
+ return i.equals(0) ?
Boolean.valueOf(false) :
Boolean.valueOf(true);
case java.sql.Types.BOOLEAN:
@@ -4358,7 +4355,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
checkIndex(columnIndex);
// make sure the cursor is on a valid row
checkCursor();
- Object obj = convertNumeric(Integer.valueOf(x),
+ Object obj = convertNumeric(x,
java.sql.Types.INTEGER,
RowSetMD.getColumnType(columnIndex));
@@ -5709,7 +5706,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
Struct s = (Struct)value;
// look up the class in the map
- Class c = (Class)map.get(s.getSQLTypeName());
+ Class> c = map.get(s.getSQLTypeName());
if (c != null) {
// create new instance of the class
SQLData obj = null;
@@ -6293,7 +6290,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
int colCount = RowSetMD.getColumnCount();
Row orig;
- for (Iterator i = rvh.iterator(); i.hasNext();) {
+ for (Iterator> i = rvh.iterator(); i.hasNext();) {
orig = new Row(colCount, ((Row)i.next()).getOrigRow());
crs.rvh.add(orig);
}
@@ -6379,7 +6376,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
* @throws SQLException if an error occurs
*/
public void setOriginal() throws SQLException {
- for (Iterator i = rvh.iterator(); i.hasNext();) {
+ for (Iterator> i = rvh.iterator(); i.hasNext();) {
Row row = (Row)i.next();
makeRowOriginal(row);
// remove deleted rows from the collection.
@@ -6930,7 +6927,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
}
for( int i = 0;i < columnIdxes.length ;i++) {
- iMatchColumns.set(i,Integer.valueOf(-1));
+ iMatchColumns.set(i, -1);
}
}
@@ -6998,7 +6995,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
int [] i_temp = new int[iMatchColumns.size()];
int i_val;
- i_val = ((Integer)iMatchColumns.get(0)).intValue();
+ i_val = iMatchColumns.get(0);
if( i_val == -1 ) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
@@ -7039,7 +7036,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
}
}
for(int i = 0 ;i < columnIdxes.length; i++) {
- iMatchColumns.add(i,Integer.valueOf(columnIdxes[i]));
+ iMatchColumns.add(i,columnIdxes[i]);
}
}
@@ -7094,7 +7091,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
} else {
// set iMatchColumn
- iMatchColumns.set(0, Integer.valueOf(columnIdx));
+ iMatchColumns.set(0, columnIdx);
//strMatchColumn = null;
}
}
@@ -7147,7 +7144,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString());
} else {
// that is, we are unsetting it.
- iMatchColumns.set(0, Integer.valueOf(-1));
+ iMatchColumns.set(0, -1);
}
}
@@ -7171,7 +7168,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
if(!((strMatchColumns.get(0)).equals(columnName))) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
- } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) {
+ } else if(iMatchColumns.get(0) > 0) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString());
} else {
strMatchColumns.set(0, null); // that is, we are unsetting it.
@@ -7369,7 +7366,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
obj = new SerialArray((java.sql.Array)obj, map);
}
- ((Row)currentRow).initColumnObject(i, obj);
+ currentRow.initColumnObject(i, obj);
}
rowsFetched++;
maxRowsreached++;
diff --git a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java
index f21013ca5f6..a18c0ac10bd 100644
--- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java
+++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java
@@ -66,6 +66,7 @@ public class FilteredRowSetImpl extends WebRowSetImpl implements Serializable, C
* @param env a Hashtable containing a desired synchconizatation provider
* name-value pair.
*/
+ @SuppressWarnings("rawtypes")
public FilteredRowSetImpl(Hashtable env) throws SQLException {
super(env);
}
diff --git a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java
index f29d7d9ef2a..f2a72f6a4ad 100644
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java
@@ -695,6 +695,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
return ps;
}
+ @SuppressWarnings("deprecation")
private void decodeParams(Object[] params, PreparedStatement ps)
throws SQLException {
@@ -761,14 +762,17 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
ps.setUnicodeStream(i + 1,
(java.io.InputStream)param[0],
((Integer)param[1]).intValue());
+ break;
case JdbcRowSetImpl.BINARY_STREAM_PARAM:
ps.setBinaryStream(i + 1,
(java.io.InputStream)param[0],
((Integer)param[1]).intValue());
+ break;
case JdbcRowSetImpl.ASCII_STREAM_PARAM:
ps.setAsciiStream(i + 1,
(java.io.InputStream)param[0],
((Integer)param[1]).intValue());
+ break;
default:
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString());
}
@@ -3822,7 +3826,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
int [] i_temp = new int[iMatchColumns.size()];
int i_val;
- i_val = ((Integer)iMatchColumns.get(0)).intValue();
+ i_val = iMatchColumns.get(0);
if( i_val == -1 ) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.setmatchcols").toString());
@@ -3996,7 +4000,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
if(!((strMatchColumns.get(0)).equals(columnName))) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString());
- } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) {
+ } else if(iMatchColumns.get(0) > 0) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolid").toString());
} else {
strMatchColumns.set(0, null); // that is, we are unsetting it.
diff --git a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java
index acf7479fc01..f6991552e3f 100644
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java
@@ -135,6 +135,7 @@ public class JdbcRowSetResourceBundle implements Serializable {
* @return an enumeration of keys which have messages tranlated to
* corresponding locales.
*/
+ @SuppressWarnings("rawtypes")
public Enumeration getKeys() {
return propResBundle.getKeys();
}
diff --git a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java
index 05feebc2824..0f712f9946c 100644
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java
@@ -233,7 +233,7 @@ public class JoinRowSetImpl extends WebRowSetImpl implements JoinRowSet {
}
int[] indexes = new int[indices.size()];
for(int i=0; iArrayList will hold the values of SyncResolver.*
*/
- private ArrayList status;
+ private ArrayList status;
/**
* This will check whether the same field value has changed both
@@ -305,7 +305,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
iColCount = rsmdWrite.getColumnCount();
int sz= crs.size()+1;
- status = new ArrayList(sz);
+ status = new ArrayList<>(sz);
status.add(0,null);
rsmdResolv.setColumnCount(iColCount);
@@ -338,11 +338,11 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
if (crs.rowDeleted()) {
// The row has been deleted.
if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
- status.add(rows, Integer.valueOf(SyncResolver.DELETE_ROW_CONFLICT));
+ status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
} else {
// delete happened without any occurrence of conflicts
// so update status accordingly
- status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, SyncResolver.NO_ROW_CONFLICT);
}
} else if (crs.rowInserted()) {
@@ -350,20 +350,20 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
pstmtIns = con.prepareStatement(insertCmd);
if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
- status.add(rows, Integer.valueOf(SyncResolver.INSERT_ROW_CONFLICT));
+ status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
} else {
// insert happened without any occurrence of conflicts
// so update status accordingly
- status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, SyncResolver.NO_ROW_CONFLICT);
}
} else if (crs.rowUpdated()) {
// The row has been updated.
if ( conflict = (updateOriginalRow(crs)) == true) {
- status.add(rows, Integer.valueOf(SyncResolver.UPDATE_ROW_CONFLICT));
+ status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
} else {
// update happened without any occurrence of conflicts
// so update status accordingly
- status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, SyncResolver.NO_ROW_CONFLICT);
}
} else {
@@ -375,7 +375,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* that is fine.
**/
int icolCount = crs.getMetaData().getColumnCount();
- status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
+ status.add(rows, SyncResolver.NO_ROW_CONFLICT);
this.crsResolve.moveToInsertRow();
for(int cols=0;cols cols = new Vector<>();
String updateExec = updateCmd;
Object orig;
Object curr;
@@ -566,14 +566,14 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* into a CachedRowSet so that comparison of the column values
* from the ResultSet and CachedRowSet are possible
*/
- Map map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
+ Map> map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
if (rsval instanceof Struct) {
Struct s = (Struct)rsval;
// look up the class in the map
- Class c = null;
- c = (Class)map.get(s.getSQLTypeName());
+ Class> c = null;
+ c = map.get(s.getSQLTypeName());
if (c != null) {
// create new instance of the class
SQLData obj = null;
@@ -652,7 +652,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
updateExec += ", ";
}
updateExec += crs.getMetaData().getColumnName(i);
- cols.add(Integer.valueOf(i));
+ cols.add(i);
updateExec += " = ? ";
first = false;
@@ -698,7 +698,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
updateExec += ", ";
}
updateExec += crs.getMetaData().getColumnName(i);
- cols.add(Integer.valueOf(i));
+ cols.add(i);
updateExec += " = ? ";
flag = false;
} else {
@@ -749,7 +749,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// Comments needed here
for (i = 0; i < cols.size(); i++) {
- Object obj = crs.getObject(((Integer)cols.get(i)).intValue());
+ Object obj = crs.getObject(cols.get(i));
if (obj != null)
pstmt.setObject(i + 1, obj);
else
diff --git a/jdk/src/share/classes/com/sun/rowset/internal/Row.java b/jdk/src/share/classes/com/sun/rowset/internal/Row.java
index 7fa2eda8b31..1fa4b767b02 100644
--- a/jdk/src/share/classes/com/sun/rowset/internal/Row.java
+++ b/jdk/src/share/classes/com/sun/rowset/internal/Row.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -27,9 +27,7 @@ package com.sun.rowset.internal;
import java.sql.*;
import java.io.*;
-import java.math.*;
import java.lang.*;
-import java.lang.reflect.*;
import java.util.*;
/**
@@ -48,6 +46,8 @@ import java.util.*;
*/
public class Row extends BaseRow implements Serializable, Cloneable {
+static final long serialVersionUID = 5047859032611314762L;
+
/**
* An array containing the current column values for this Row
* object.
@@ -115,9 +115,7 @@ public class Row extends BaseRow implements Serializable, Cloneable {
*/
public Row(int numCols, Object[] vals) {
origVals = new Object[numCols];
- for (int i=0; i < numCols; i++) {
- origVals[i] = vals[i];
- }
+ System.arraycopy(vals, 0, origVals, 0, numCols);
currentVals = new Object[numCols];
colsChanged = new BitSet(numCols);
this.numCols = numCols;
diff --git a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java
index 10573ae4d4d..911b1d17152 100644
--- a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java
+++ b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java
@@ -65,7 +65,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* This ArrayList will contain the status of a row
* from the SyncResolver.* values else it will be null.
*/
- private ArrayList stats;
+ private ArrayList> stats;
/**
* The RowSetWriter associated with the original
@@ -429,6 +429,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* This is used to set the status of each row
* to either of the values SyncResolver.*_CONFLICT
**/
+ @SuppressWarnings("rawtypes")
void setStatus(ArrayList status){
stats = status;
}
@@ -856,6 +857,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* @see #toCollection(String)
* @see java.util.TreeMap
*/
+ @SuppressWarnings("rawtypes")
public Collection toCollection() throws SQLException {
throw new UnsupportedOperationException();
}
@@ -878,6 +880,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* @see #toCollection(String)
* @see java.util.Vector
*/
+ @SuppressWarnings("rawtypes")
public Collection toCollection(int column) throws SQLException {
throw new UnsupportedOperationException();
}
@@ -900,6 +903,7 @@ public class SyncResolverImpl extends CachedRowSetImpl implements SyncResolver {
* @see #toCollection(int)
* @see java.util.Vector
*/
+ @SuppressWarnings("rawtypes")
public Collection toCollection(String column) throws SQLException {
throw new UnsupportedOperationException();
}
diff --git a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java
index 936c7f60764..41737b7c47c 100644
--- a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java
+++ b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java
@@ -55,7 +55,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
* object will use for storing the tags to be used for writing the calling
* WebRowSet object as an XML document.
*/
- private java.util.Stack stack;
+ private java.util.Stack stack;
private JdbcRowSetResourceBundle resBundle;
@@ -94,7 +94,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
throws SQLException {
// create a new stack for tag checking.
- stack = new java.util.Stack();
+ stack = new java.util.Stack<>();
writer = wrt;
writeRowSet(caller);
}
@@ -127,7 +127,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
throws SQLException {
// create a new stack for tag checking.
- stack = new java.util.Stack();
+ stack = new java.util.Stack<>();
writer = new OutputStreamWriter(oStream);
writeRowSet(caller);
}
@@ -205,10 +205,10 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
//Changed to beginSection and endSection for maps for proper indentation
beginSection("map");
- java.util.Map typeMap = caller.getTypeMap();
+ java.util.Map,?> typeMap = caller.getTypeMap();
if (typeMap != null) {
- Iterator i = typeMap.keySet().iterator();
- Class c;
+ Iterator> i = typeMap.keySet().iterator();
+ Class> c;
String type;
while (i.hasNext()) {
type = (String)i.next();
@@ -532,7 +532,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
}
private String getTag() {
- return (String)stack.pop();
+ return stack.pop();
}
private void writeNull() throws java.io.IOException {
diff --git a/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java b/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java
index 50cb7e31705..2d36ac174d8 100644
--- a/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java
+++ b/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -71,14 +71,14 @@ import java.text.MessageFormat;
public class XmlReaderContentHandler extends DefaultHandler {
- private HashMap propMap;
- private HashMap colDefMap;
- private HashMap dataMap;
+ private HashMap propMap;
+ private HashMap colDefMap;
+ private HashMap dataMap;
- private HashMap typeMap;
+ private HashMap> typeMap;
- private Vector updates;
- private Vector keyCols;
+ private Vector
*
*
- * @param domain the domain name to check host name with
- * @param host the host name in question
- * @return true if they domain-matches; false if not
+ * @param domain
+ * the domain name to check host name with
+ *
+ * @param host
+ * the host name in question
+ *
+ * @return {@code true} if they domain-matches; {@code false} if not
*/
public static boolean domainMatches(String domain, String host) {
if (domain == null || host == null)
@@ -745,7 +624,8 @@ public final class HttpCookie implements Cloneable {
if (embeddedDotInDomain == 0)
embeddedDotInDomain = domain.indexOf('.', 1);
if (!isLocalDomain
- && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1))
+ && (embeddedDotInDomain == -1 ||
+ embeddedDotInDomain == domain.length() - 1))
return false;
// if the host name contains no dot and the domain name
@@ -779,7 +659,6 @@ public final class HttpCookie implements Cloneable {
return false;
}
-
/**
* Constructs a cookie header string representation of this cookie,
* which is in the format defined by corresponding cookie specification,
@@ -796,17 +675,15 @@ public final class HttpCookie implements Cloneable {
}
}
-
/**
- * Test the equality of two http cookies.
+ * Test the equality of two HTTP cookies.
*
- *
The result is true only if two cookies
- * come from same domain (case-insensitive),
- * have same name (case-insensitive),
- * and have same path (case-sensitive).
+ *
The result is {@code true} only if two cookies come from same domain
+ * (case-insensitive), have same name (case-insensitive), and have same path
+ * (case-sensitive).
*
- * @return true if 2 http cookies equal to each other;
- * otherwise, false
+ * @return {@code true} if two HTTP cookies equal to each other;
+ * otherwise, {@code false}
*/
@Override
public boolean equals(Object obj) {
@@ -825,19 +702,17 @@ public final class HttpCookie implements Cloneable {
Objects.equals(getPath(), other.getPath());
}
-
/**
- * Return hash code of this http cookie. The result is the sum of
- * hash code value of three significant components of this cookie:
- * name, domain, and path.
- * That is, the hash code is the value of the expression:
+ * Returns the hash code of this HTTP cookie. The result is the sum of
+ * hash code value of three significant components of this cookie: name,
+ * domain, and path. That is, the hash code is the value of the expression:
*
*
- * @return this http cookie's hash code
+ * @return this HTTP cookie's hash code
*/
@Override
public int hashCode() {
@@ -851,7 +726,7 @@ public final class HttpCookie implements Cloneable {
/**
* Create and return a copy of this object.
*
- * @return a clone of this http cookie
+ * @return a clone of this HTTP cookie
*/
@Override
public Object clone() {
@@ -862,8 +737,7 @@ public final class HttpCookie implements Cloneable {
}
}
-
- /* ---------------- Private operations -------------- */
+ // ---------------- Private operations --------------
// Note -- disabled for now to allow full Netscape compatibility
// from RFC 2068, token special case characters
@@ -872,15 +746,14 @@ public final class HttpCookie implements Cloneable {
private static final String tspecials = ",;";
/*
- * Tests a string and returns true if the string counts as a
- * token.
+ * Tests a string and returns true if the string counts as a token.
*
- * @param value the String to be tested
+ * @param value
+ * the {@code String} to be tested
*
- * @return true if the String is
- * a token; false if it is not
+ * @return {@code true} if the {@code String} is a token;
+ * {@code false} if it is not
*/
-
private static boolean isToken(String value) {
int len = value.length();
@@ -893,11 +766,12 @@ public final class HttpCookie implements Cloneable {
return true;
}
-
/*
- * @param name the name to be tested
- * @return true if the name is reserved by cookie
- * specification, false if it is not
+ * @param name
+ * the name to be tested
+ *
+ * @return {@code true} if the name is reserved by cookie specification,
+ * {@code false} if it is not
*/
private static boolean isReserved(String name) {
if (name.equalsIgnoreCase("Comment")
@@ -919,16 +793,16 @@ public final class HttpCookie implements Cloneable {
return false;
}
-
/*
* Parse header string to cookie object.
*
- * @param header header string; should contain only one NAME=VALUE pair
+ * @param header
+ * header string; should contain only one NAME=VALUE pair
*
- * @return an HttpCookie being extracted
+ * @return an HttpCookie being extracted
*
- * @throws IllegalArgumentException if header string violates the cookie
- * specification
+ * @throws IllegalArgumentException
+ * if header string violates the cookie specification
*/
private static HttpCookie parseInternal(String header)
{
@@ -974,69 +848,97 @@ public final class HttpCookie implements Cloneable {
return cookie;
}
-
/*
* assign cookie attribute value to attribute name;
* use a map to simulate method dispatch
*/
static interface CookieAttributeAssignor {
- public void assign(HttpCookie cookie, String attrName, String attrValue);
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue);
}
- static java.util.Map assignors = null;
+ static final java.util.Map assignors =
+ new java.util.HashMap<>();
static {
- assignors = new java.util.HashMap();
- assignors.put("comment", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
- if (cookie.getComment() == null) cookie.setComment(attrValue);
+ assignors.put("comment", new CookieAttributeAssignor() {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
+ if (cookie.getComment() == null)
+ cookie.setComment(attrValue);
}
});
- assignors.put("commenturl", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
- if (cookie.getCommentURL() == null) cookie.setCommentURL(attrValue);
+ assignors.put("commenturl", new CookieAttributeAssignor() {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
+ if (cookie.getCommentURL() == null)
+ cookie.setCommentURL(attrValue);
}
});
- assignors.put("discard", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
+ assignors.put("discard", new CookieAttributeAssignor() {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
cookie.setDiscard(true);
}
});
assignors.put("domain", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
- if (cookie.getDomain() == null) cookie.setDomain(attrValue);
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
+ if (cookie.getDomain() == null)
+ cookie.setDomain(attrValue);
}
});
assignors.put("max-age", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
try {
long maxage = Long.parseLong(attrValue);
- if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED) cookie.setMaxAge(maxage);
+ if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED)
+ cookie.setMaxAge(maxage);
} catch (NumberFormatException ignored) {
- throw new IllegalArgumentException("Illegal cookie max-age attribute");
+ throw new IllegalArgumentException(
+ "Illegal cookie max-age attribute");
}
}
});
assignors.put("path", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
- if (cookie.getPath() == null) cookie.setPath(attrValue);
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
+ if (cookie.getPath() == null)
+ cookie.setPath(attrValue);
}
});
assignors.put("port", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
- if (cookie.getPortlist() == null) cookie.setPortlist(attrValue == null ? "" : attrValue);
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
+ if (cookie.getPortlist() == null)
+ cookie.setPortlist(attrValue == null ? "" : attrValue);
}
});
assignors.put("secure", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
cookie.setSecure(true);
}
});
assignors.put("httponly", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
cookie.setHttpOnly(true);
}
});
assignors.put("version", new CookieAttributeAssignor(){
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
try {
int version = Integer.parseInt(attrValue);
cookie.setVersion(version);
@@ -1046,7 +948,9 @@ public final class HttpCookie implements Cloneable {
}
});
assignors.put("expires", new CookieAttributeAssignor(){ // Netscape only
- public void assign(HttpCookie cookie, String attrName, String attrValue) {
+ public void assign(HttpCookie cookie,
+ String attrName,
+ String attrValue) {
if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED) {
cookie.setMaxAge(cookie.expiryDate2DeltaSeconds(attrValue));
}
@@ -1054,8 +958,8 @@ public final class HttpCookie implements Cloneable {
});
}
private static void assignAttribute(HttpCookie cookie,
- String attrName,
- String attrValue)
+ String attrName,
+ String attrValue)
{
// strip off the surrounding "-sign if there's any
attrValue = stripOffSurroundingQuote(attrValue);
@@ -1073,11 +977,7 @@ public final class HttpCookie implements Cloneable {
* as Netscape spec, but without leading "Cookie:" token.
*/
private String toNetscapeHeaderString() {
- StringBuilder sb = new StringBuilder();
-
- sb.append(getName() + "=" + getValue());
-
- return sb.toString();
+ return getName() + "=" + getValue();
}
/*
@@ -1101,15 +1001,16 @@ public final class HttpCookie implements Cloneable {
static final TimeZone GMT = TimeZone.getTimeZone("GMT");
/*
- * @param dateString a date string in one of the formats
- * defined in Netscape cookie spec
+ * @param dateString
+ * a date string in one of the formats defined in Netscape cookie spec
*
- * @return delta seconds between this cookie's creation
- * time and the time specified by dateString
+ * @return delta seconds between this cookie's creation time and the time
+ * specified by dateString
*/
private long expiryDate2DeltaSeconds(String dateString) {
for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) {
- SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US);
+ SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i],
+ Locale.US);
df.setTimeZone(GMT);
try {
Date date = df.parse(dateString);
@@ -1121,8 +1022,6 @@ public final class HttpCookie implements Cloneable {
return 0;
}
-
-
/*
* try to guess the cookie version through set-cookie header string
*/
@@ -1184,10 +1083,10 @@ public final class HttpCookie implements Cloneable {
* 2) but not the comma surrounding by double-quotes, which is the comma
* inside port list or embeded URIs.
*
- * @param header the cookie header string to split
- *
- * @return list of strings; never null
+ * @param header
+ * the cookie header string to split
*
+ * @return list of strings; never null
*/
private static List splitMultiCookies(String header) {
List cookies = new java.util.ArrayList();
@@ -1197,7 +1096,8 @@ public final class HttpCookie implements Cloneable {
for (p = 0, q = 0; p < header.length(); p++) {
char c = header.charAt(p);
if (c == '"') quoteCount++;
- if (c == ',' && (quoteCount % 2 == 0)) { // it is comma and not surrounding by double-quotes
+ if (c == ',' && (quoteCount % 2 == 0)) {
+ // it is comma and not surrounding by double-quotes
cookies.add(header.substring(q, p));
q = p + 1;
}
diff --git a/jdk/src/share/classes/java/net/InetAddress.java b/jdk/src/share/classes/java/net/InetAddress.java
index 8758cab7af3..d927d160a68 100644
--- a/jdk/src/share/classes/java/net/InetAddress.java
+++ b/jdk/src/share/classes/java/net/InetAddress.java
@@ -32,6 +32,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
+import java.util.ServiceLoader;
import java.security.AccessController;
import java.io.ObjectStreamException;
import java.io.IOException;
@@ -39,7 +40,6 @@ import java.io.ObjectInputStream;
import sun.security.action.*;
import sun.net.InetAddressCachePolicy;
import sun.net.util.IPAddressUtil;
-import sun.misc.Service;
import sun.net.spi.nameservice.*;
/**
@@ -876,10 +876,9 @@ class InetAddress implements java.io.Serializable {
nameService = java.security.AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction() {
public NameService run() {
- // sun.misc.Service.providers returns a raw Iterator
- @SuppressWarnings("unchecked")
Iterator itr =
- Service.providers(NameServiceDescriptor.class);
+ ServiceLoader.load(NameServiceDescriptor.class)
+ .iterator();
while (itr.hasNext()) {
NameServiceDescriptor nsd = itr.next();
if (providerName.
diff --git a/jdk/src/share/classes/java/rmi/MarshalledObject.java b/jdk/src/share/classes/java/rmi/MarshalledObject.java
index cd881294995..4ac4a8bc303 100644
--- a/jdk/src/share/classes/java/rmi/MarshalledObject.java
+++ b/jdk/src/share/classes/java/rmi/MarshalledObject.java
@@ -156,6 +156,7 @@ public final class MarshalledObject implements Serializable {
(locBytes == null ? null : new ByteArrayInputStream(locBytes));
MarshalledObjectInputStream in =
new MarshalledObjectInputStream(bin, lin);
+ @SuppressWarnings("unchecked")
T obj = (T) in.readObject();
in.close();
return obj;
@@ -190,7 +191,7 @@ public final class MarshalledObject implements Serializable {
return true;
if (obj != null && obj instanceof MarshalledObject) {
- MarshalledObject other = (MarshalledObject) obj;
+ MarshalledObject> other = (MarshalledObject>) obj;
// if either is a ref to null, both must be
if (objBytes == null || other.objBytes == null)
diff --git a/jdk/src/share/classes/java/rmi/dgc/VMID.java b/jdk/src/share/classes/java/rmi/dgc/VMID.java
index c9f1647e1f1..5e9c0a51b4b 100644
--- a/jdk/src/share/classes/java/rmi/dgc/VMID.java
+++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java
@@ -118,7 +118,7 @@ public final class VMID implements java.io.Serializable {
StringBuffer result = new StringBuffer();
if (addr != null)
for (int i = 0; i < addr.length; ++ i) {
- int x = (int) (addr[i] & 0xFF);
+ int x = addr[i] & 0xFF;
result.append((x < 0x10 ? "0" : "") +
Integer.toString(x, 16));
}
diff --git a/jdk/src/share/classes/java/rmi/server/LogStream.java b/jdk/src/share/classes/java/rmi/server/LogStream.java
index 4120e32de77..cc35f7a4407 100644
--- a/jdk/src/share/classes/java/rmi/server/LogStream.java
+++ b/jdk/src/share/classes/java/rmi/server/LogStream.java
@@ -39,7 +39,7 @@ import java.util.*;
public class LogStream extends PrintStream {
/** table mapping known log names to log stream objects */
- private static Hashtable known = new Hashtable(5);
+ private static Map known = new HashMap<>(5);
/** default output stream for new logs */
private static PrintStream defaultStream = System.err;
@@ -90,7 +90,7 @@ public class LogStream extends PrintStream {
public static LogStream log(String name) {
LogStream stream;
synchronized (known) {
- stream = (LogStream)known.get(name);
+ stream = known.get(name);
if (stream == null) {
stream = new LogStream(name, defaultStream);
}
diff --git a/jdk/src/share/classes/java/rmi/server/RemoteObject.java b/jdk/src/share/classes/java/rmi/server/RemoteObject.java
index 31aab0c3fbd..b3b32c5fb41 100644
--- a/jdk/src/share/classes/java/rmi/server/RemoteObject.java
+++ b/jdk/src/share/classes/java/rmi/server/RemoteObject.java
@@ -436,7 +436,7 @@ public abstract class RemoteObject implements Remote, java.io.Serializable {
*/
String internalRefClassName =
RemoteRef.packagePrefix + "." + refClassName;
- Class refClass = Class.forName(internalRefClassName);
+ Class> refClass = Class.forName(internalRefClassName);
try {
ref = (RemoteRef) refClass.newInstance();
diff --git a/jdk/src/share/classes/java/sql/Date.java b/jdk/src/share/classes/java/sql/Date.java
index 1d82ab36a1b..de39d148502 100644
--- a/jdk/src/share/classes/java/sql/Date.java
+++ b/jdk/src/share/classes/java/sql/Date.java
@@ -150,6 +150,7 @@ public class Date extends java.util.Date {
*
* @return a String in yyyy-mm-dd format
*/
+ @SuppressWarnings("deprecation")
public String toString () {
int year = super.getYear() + 1900;
int month = super.getMonth() + 1;
diff --git a/jdk/src/share/classes/java/sql/DriverManager.java b/jdk/src/share/classes/java/sql/DriverManager.java
index 4864eb2cc93..0a7cd94d348 100644
--- a/jdk/src/share/classes/java/sql/DriverManager.java
+++ b/jdk/src/share/classes/java/sql/DriverManager.java
@@ -80,7 +80,7 @@ public class DriverManager {
// List of registered JDBC drivers
- private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList();
+ private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList<>();
private static volatile int loginTimeout = 0;
private static volatile java.io.PrintWriter logWriter = null;
private static volatile java.io.PrintStream logStream = null;
@@ -357,7 +357,7 @@ public class DriverManager {
* @return the list of JDBC Drivers loaded by the caller's class loader
*/
public static java.util.Enumeration getDrivers() {
- java.util.Vector result = new java.util.Vector();
+ java.util.Vector result = new java.util.Vector<>();
// Gets the classloader of the code that called this method, may
// be null.
@@ -621,15 +621,18 @@ class DriverInfo {
this.driver = driver;
}
+ @Override
public boolean equals(Object other) {
return (other instanceof DriverInfo)
&& this.driver == ((DriverInfo) other).driver;
}
+ @Override
public int hashCode() {
return driver.hashCode();
}
+ @Override
public String toString() {
return ("driver[className=" + driver + "]");
}
diff --git a/jdk/src/share/classes/java/sql/Time.java b/jdk/src/share/classes/java/sql/Time.java
index 22d60d6c409..230e07b69ec 100644
--- a/jdk/src/share/classes/java/sql/Time.java
+++ b/jdk/src/share/classes/java/sql/Time.java
@@ -115,6 +115,7 @@ public class Time extends java.util.Date {
*
* @return a String in hh:mm:ss format
*/
+ @SuppressWarnings("deprecation")
public String toString () {
int hour = super.getHours();
int minute = super.getMinutes();
diff --git a/jdk/src/share/classes/java/sql/Timestamp.java b/jdk/src/share/classes/java/sql/Timestamp.java
index 14f648b2678..18b61edd6a7 100644
--- a/jdk/src/share/classes/java/sql/Timestamp.java
+++ b/jdk/src/share/classes/java/sql/Timestamp.java
@@ -271,6 +271,7 @@ public class Timestamp extends java.util.Date {
* @return a String object in
* yyyy-mm-dd hh:mm:ss.fffffffff format
*/
+ @SuppressWarnings("deprecation")
public String toString () {
int year = super.getYear() + 1900;
diff --git a/jdk/src/share/classes/java/util/Currency.java b/jdk/src/share/classes/java/util/Currency.java
index dc9271ae92d..87b7e01b75b 100644
--- a/jdk/src/share/classes/java/util/Currency.java
+++ b/jdk/src/share/classes/java/util/Currency.java
@@ -189,7 +189,7 @@ public final class Currency implements Serializable {
private static final int VALID_FORMAT_VERSION = 1;
static {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
String homeDir = System.getProperty("java.home");
try {
@@ -431,7 +431,9 @@ public final class Currency implements Serializable {
}
}
- return (Set) available.clone();
+ @SuppressWarnings("unchecked")
+ Set result = (Set) available.clone();
+ return result;
}
/**
diff --git a/jdk/src/share/classes/java/util/Date.java b/jdk/src/share/classes/java/util/Date.java
index e5e5e14454a..77352094173 100644
--- a/jdk/src/share/classes/java/util/Date.java
+++ b/jdk/src/share/classes/java/util/Date.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -770,7 +770,7 @@ public class Date
*/
@Deprecated
public int getDay() {
- return normalize().getDayOfWeek() - gcal.SUNDAY;
+ return normalize().getDayOfWeek() - BaseCalendar.SUNDAY;
}
/**
@@ -1027,7 +1027,7 @@ public class Date
BaseCalendar.Date date = normalize();
StringBuilder sb = new StringBuilder(28);
int index = date.getDayOfWeek();
- if (index == gcal.SUNDAY) {
+ if (index == BaseCalendar.SUNDAY) {
index = 8;
}
convertToAbbr(sb, wtb[index]).append(' '); // EEE
@@ -1039,7 +1039,7 @@ public class Date
CalendarUtils.sprintf0d(sb, date.getSeconds(), 2).append(' '); // ss
TimeZone zi = date.getZone();
if (zi != null) {
- sb.append(zi.getDisplayName(date.isDaylightTime(), zi.SHORT, Locale.US)); // zzz
+ sb.append(zi.getDisplayName(date.isDaylightTime(), TimeZone.SHORT, Locale.US)); // zzz
} else {
sb.append("GMT");
}
@@ -1237,7 +1237,7 @@ public class Date
}
GregorianCalendar gc = new GregorianCalendar(tz);
gc.clear();
- gc.set(gc.MILLISECOND, ms);
+ gc.set(GregorianCalendar.MILLISECOND, ms);
gc.set(y, m-1, d, hh, mm, ss);
fastTime = gc.getTimeInMillis();
BaseCalendar cal = getCalendarSystem(fastTime);
diff --git a/jdk/src/share/classes/java/util/Formatter.java b/jdk/src/share/classes/java/util/Formatter.java
index 038ec6eabf0..65d34fa7dd9 100644
--- a/jdk/src/share/classes/java/util/Formatter.java
+++ b/jdk/src/share/classes/java/util/Formatter.java
@@ -2879,7 +2879,7 @@ public final class Formatter implements Closeable, Flushable {
}
public String toString() {
- StringBuilder sb = new StringBuilder('%');
+ StringBuilder sb = new StringBuilder("%");
// Flags.UPPERCASE is set internally for legal conversions.
Flags dupf = f.dup().remove(Flags.UPPERCASE);
sb.append(dupf.toString());
diff --git a/jdk/src/share/classes/java/util/GregorianCalendar.java b/jdk/src/share/classes/java/util/GregorianCalendar.java
index 3a6d203256a..586524b3bd8 100644
--- a/jdk/src/share/classes/java/util/GregorianCalendar.java
+++ b/jdk/src/share/classes/java/util/GregorianCalendar.java
@@ -947,7 +947,7 @@ public class GregorianCalendar extends Calendar {
}
if (month >= 0) {
- set(MONTH, (int) (month % 12));
+ set(MONTH, month % 12);
} else {
// month < 0
month %= 12;
@@ -1313,8 +1313,8 @@ public class GregorianCalendar extends Calendar {
}
// the first day of week of the month.
- long monthDay1st = calsys.getDayOfWeekDateOnOrBefore(month1 + 6,
- getFirstDayOfWeek());
+ long monthDay1st = BaseCalendar.getDayOfWeekDateOnOrBefore(month1 + 6,
+ getFirstDayOfWeek());
// if the week has enough days to form a week, the
// week starts from the previous month.
if ((int)(monthDay1st - month1) >= getMinimalDaysInFirstWeek()) {
@@ -1407,7 +1407,7 @@ public class GregorianCalendar extends Calendar {
return;
}
long fd = getCurrentFixedDate();
- long dowFirst = calsys.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
+ long dowFirst = BaseCalendar.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
fd += amount;
if (fd < dowFirst) {
fd += 7;
@@ -1926,7 +1926,7 @@ public class GregorianCalendar extends Calendar {
* Returns the millisecond offset from the beginning of this
* year. This Calendar object must have been normalized.
*/
- private final long getYearOffsetInMillis() {
+ private long getYearOffsetInMillis() {
long t = (internalGet(DAY_OF_YEAR) - 1) * 24;
t += internalGet(HOUR_OF_DAY);
t *= 60;
@@ -2485,8 +2485,8 @@ public class GregorianCalendar extends Calendar {
if (cdate.isLeapYear()) {
nextJan1++;
}
- long nextJan1st = calsys.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
- getFirstDayOfWeek());
+ long nextJan1st = BaseCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(nextJan1st - nextJan1);
if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
// The first days forms a week in which the date is included.
@@ -2518,8 +2518,8 @@ public class GregorianCalendar extends Calendar {
calForJan1 = gcal;
}
- long nextJan1st = calForJan1.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
- getFirstDayOfWeek());
+ long nextJan1st = BaseCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(nextJan1st - nextJan1);
if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
// The first days forms a week in which the date is included.
@@ -2543,11 +2543,11 @@ public class GregorianCalendar extends Calendar {
* @param fixedDate the fixed date of the last day of the period
* @return the number of weeks of the given period
*/
- private final int getWeekNumber(long fixedDay1, long fixedDate) {
+ private int getWeekNumber(long fixedDay1, long fixedDate) {
// We can always use `gcal' since Julian and Gregorian are the
// same thing for this calculation.
- long fixedDay1st = gcal.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
- getFirstDayOfWeek());
+ long fixedDay1st = Gregorian.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(fixedDay1st - fixedDay1);
assert ndays <= 7;
if (ndays >= getMinimalDaysInFirstWeek()) {
@@ -2818,16 +2818,16 @@ public class GregorianCalendar extends Calendar {
}
} else {
if (isFieldSet(fieldMask, WEEK_OF_MONTH)) {
- long firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
- getFirstDayOfWeek());
+ long firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
+ getFirstDayOfWeek());
// If we have enough days in the first week, then
// move to the previous week.
if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
firstDayOfWeek -= 7;
}
if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
- firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
- internalGet(DAY_OF_WEEK));
+ firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
+ internalGet(DAY_OF_WEEK));
}
// In lenient mode, we treat days of the previous
// months as a part of the specified
@@ -2850,15 +2850,15 @@ public class GregorianCalendar extends Calendar {
dowim = 1;
}
if (dowim >= 0) {
- fixedDate = cal.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
- dayOfWeek);
+ fixedDate = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
+ dayOfWeek);
} else {
// Go to the first day of the next week of
// the specified week boundary.
int lastDate = monthLength(month, year) + (7 * (dowim + 1));
// Then, get the day of week date on or before the last date.
- fixedDate = cal.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
- dayOfWeek);
+ fixedDate = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
+ dayOfWeek);
}
}
}
@@ -2877,8 +2877,8 @@ public class GregorianCalendar extends Calendar {
fixedDate += internalGet(DAY_OF_YEAR);
fixedDate--;
} else {
- long firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
- getFirstDayOfWeek());
+ long firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
+ getFirstDayOfWeek());
// If we have enough days in the first week, then move
// to the previous week.
if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
@@ -2887,8 +2887,8 @@ public class GregorianCalendar extends Calendar {
if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
int dayOfWeek = internalGet(DAY_OF_WEEK);
if (dayOfWeek != getFirstDayOfWeek()) {
- firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
- dayOfWeek);
+ firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
+ dayOfWeek);
}
}
fixedDate = firstDayOfWeek + 7 * ((long)internalGet(WEEK_OF_YEAR) - 1);
@@ -2903,7 +2903,7 @@ public class GregorianCalendar extends Calendar {
* in sync). Otherwise, a cloned object is returned after calling
* complete() in lenient mode.
*/
- private final GregorianCalendar getNormalizedCalendar() {
+ private GregorianCalendar getNormalizedCalendar() {
GregorianCalendar gc;
if (isFullyNormalized()) {
gc = this;
@@ -2920,7 +2920,7 @@ public class GregorianCalendar extends Calendar {
* Returns the Julian calendar system instance (singleton). 'jcal'
* and 'jeras' are set upon the return.
*/
- synchronized private static final BaseCalendar getJulianCalendarSystem() {
+ synchronized private static BaseCalendar getJulianCalendarSystem() {
if (jcal == null) {
jcal = (JulianCalendar) CalendarSystem.forName("julian");
jeras = jcal.getEras();
@@ -2958,7 +2958,7 @@ public class GregorianCalendar extends Calendar {
* or Julian).
* @param fixedDate the fixed date representation of the date
*/
- private final long getFixedDateJan1(BaseCalendar.Date date, long fixedDate) {
+ private long getFixedDateJan1(BaseCalendar.Date date, long fixedDate) {
assert date.getNormalizedYear() == gregorianCutoverYear ||
date.getNormalizedYear() == gregorianCutoverYearJulian;
if (gregorianCutoverYear != gregorianCutoverYearJulian) {
@@ -2984,7 +2984,7 @@ public class GregorianCalendar extends Calendar {
* or Julian).
* @param fixedDate the fixed date representation of the date
*/
- private final long getFixedDateMonth1(BaseCalendar.Date date, long fixedDate) {
+ private long getFixedDateMonth1(BaseCalendar.Date date, long fixedDate) {
assert date.getNormalizedYear() == gregorianCutoverYear ||
date.getNormalizedYear() == gregorianCutoverYearJulian;
BaseCalendar.Date gCutover = getGregorianCutoverDate();
@@ -3023,7 +3023,7 @@ public class GregorianCalendar extends Calendar {
*
* @param fd the fixed date
*/
- private final BaseCalendar.Date getCalendarDate(long fd) {
+ private BaseCalendar.Date getCalendarDate(long fd) {
BaseCalendar cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem();
BaseCalendar.Date d = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE);
cal.getCalendarDateFromFixedDate(d, fd);
@@ -3034,7 +3034,7 @@ public class GregorianCalendar extends Calendar {
* Returns the Gregorian cutover date as a BaseCalendar.Date. The
* date is a Gregorian date.
*/
- private final BaseCalendar.Date getGregorianCutoverDate() {
+ private BaseCalendar.Date getGregorianCutoverDate() {
return getCalendarDate(gregorianCutoverDate);
}
@@ -3042,7 +3042,7 @@ public class GregorianCalendar extends Calendar {
* Returns the day before the Gregorian cutover date as a
* BaseCalendar.Date. The date is a Julian date.
*/
- private final BaseCalendar.Date getLastJulianDate() {
+ private BaseCalendar.Date getLastJulianDate() {
return getCalendarDate(gregorianCutoverDate - 1);
}
@@ -3052,7 +3052,7 @@ public class GregorianCalendar extends Calendar {
*
* @see #isLeapYear(int)
*/
- private final int monthLength(int month, int year) {
+ private int monthLength(int month, int year) {
return isLeapYear(year) ? LEAP_MONTH_LENGTH[month] : MONTH_LENGTH[month];
}
@@ -3062,7 +3062,7 @@ public class GregorianCalendar extends Calendar {
*
* @see #isLeapYear(int)
*/
- private final int monthLength(int month) {
+ private int monthLength(int month) {
int year = internalGet(YEAR);
if (internalGetEra() == BCE) {
year = 1 - year;
@@ -3070,7 +3070,7 @@ public class GregorianCalendar extends Calendar {
return monthLength(month, year);
}
- private final int actualMonthLength() {
+ private int actualMonthLength() {
int year = cdate.getNormalizedYear();
if (year != gregorianCutoverYear && year != gregorianCutoverYearJulian) {
return calsys.getMonthLength(cdate);
@@ -3094,7 +3094,7 @@ public class GregorianCalendar extends Calendar {
* Returns the length (in days) of the specified year. The year
* must be normalized.
*/
- private final int yearLength(int year) {
+ private int yearLength(int year) {
return isLeapYear(year) ? 366 : 365;
}
@@ -3102,7 +3102,7 @@ public class GregorianCalendar extends Calendar {
* Returns the length (in days) of the year provided by
* internalGet(YEAR).
*/
- private final int yearLength() {
+ private int yearLength() {
int year = internalGet(YEAR);
if (internalGetEra() == BCE) {
year = 1 - year;
@@ -3116,7 +3116,7 @@ public class GregorianCalendar extends Calendar {
* 3, we want it to go to Feb 28. Adjustments which might run into this
* problem call this method to retain the proper month.
*/
- private final void pinDayOfMonth() {
+ private void pinDayOfMonth() {
int year = internalGet(YEAR);
int monthLen;
if (year > gregorianCutoverYear || year < gregorianCutoverYearJulian) {
@@ -3135,14 +3135,14 @@ public class GregorianCalendar extends Calendar {
* Returns the fixed date value of this object. The time value and
* calendar fields must be in synch.
*/
- private final long getCurrentFixedDate() {
+ private long getCurrentFixedDate() {
return (calsys == gcal) ? cachedFixedDate : calsys.getFixedDate(cdate);
}
/**
* Returns the new value after 'roll'ing the specified value and amount.
*/
- private static final int getRolledValue(int value, int amount, int min, int max) {
+ private static int getRolledValue(int value, int amount, int min, int max) {
assert value >= min && value <= max;
int range = max - min + 1;
amount %= range;
@@ -3160,7 +3160,7 @@ public class GregorianCalendar extends Calendar {
* Returns the ERA. We need a special method for this because the
* default ERA is CE, but a zero (unset) ERA is BCE.
*/
- private final int internalGetEra() {
+ private int internalGetEra() {
return isSet(ERA) ? internalGet(ERA) : CE;
}
diff --git a/jdk/src/share/classes/java/util/JapaneseImperialCalendar.java b/jdk/src/share/classes/java/util/JapaneseImperialCalendar.java
index c18c0bb97fa..940ab6210c4 100644
--- a/jdk/src/share/classes/java/util/JapaneseImperialCalendar.java
+++ b/jdk/src/share/classes/java/util/JapaneseImperialCalendar.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -260,8 +260,9 @@ class JapaneseImperialCalendar extends Calendar {
// max value could be one year short. For example, if it's
// Showa 63 January 8, 63 is the actual max value since
// Showa 64 January 8 doesn't exist.
- if (!(lgd.getMonth() == BaseCalendar.JANUARY && lgd.getDayOfMonth() == 1))
+ if (!(lgd.getMonth() == BaseCalendar.JANUARY && lgd.getDayOfMonth() == 1)) {
y--;
+ }
year = Math.min(y, year);
}
LEAST_MAX_VALUES[YEAR] = year; // Max year could be smaller than this value.
@@ -294,7 +295,7 @@ class JapaneseImperialCalendar extends Calendar {
* @param zone the given time zone.
* @param aLocale the given locale.
*/
- public JapaneseImperialCalendar(TimeZone zone, Locale aLocale) {
+ JapaneseImperialCalendar(TimeZone zone, Locale aLocale) {
super(zone, aLocale);
jdate = jcal.newCalendarDate(zone);
setTimeInMillis(System.currentTimeMillis());
@@ -792,8 +793,8 @@ class JapaneseImperialCalendar extends Calendar {
}
// the first day of week of the month.
- long monthDay1st = jcal.getDayOfWeekDateOnOrBefore(month1 + 6,
- getFirstDayOfWeek());
+ long monthDay1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(month1 + 6,
+ getFirstDayOfWeek());
// if the week has enough days to form a week, the
// week starts from the previous month.
if ((int)(monthDay1st - month1) >= getMinimalDaysInFirstWeek()) {
@@ -884,7 +885,7 @@ class JapaneseImperialCalendar extends Calendar {
return;
}
long fd = cachedFixedDate;
- long dowFirst = jcal.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
+ long dowFirst = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
fd += amount;
if (fd < dowFirst) {
fd += 7;
@@ -963,8 +964,9 @@ class JapaneseImperialCalendar extends Calendar {
Era era = eras[index];
name = (style == SHORT) ? era.getAbbreviation() : era.getName();
} else {
- if (field == DAY_OF_WEEK)
+ if (field == DAY_OF_WEEK) {
--index;
+ }
name = strings[index];
}
}
@@ -1000,7 +1002,7 @@ class JapaneseImperialCalendar extends Calendar {
private Map getDisplayNamesImpl(int field, int style, Locale locale) {
ResourceBundle rb = LocaleData.getDateFormatData(locale);
String key = getKey(field, style);
- Map map = new HashMap();
+ Map map = new HashMap<>();
if (key != null) {
String[] strings = rb.getStringArray(key);
if (field == YEAR) {
@@ -1392,8 +1394,8 @@ class JapaneseImperialCalendar extends Calendar {
jcal.normalize(jd);
long jan1 = jcal.getFixedDate(d);
long nextJan1 = jcal.getFixedDate(jd);
- long nextJan1st = jcal.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
- getFirstDayOfWeek());
+ long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(nextJan1st - nextJan1);
if (ndays >= getMinimalDaysInFirstWeek()) {
nextJan1st -= 7;
@@ -1523,7 +1525,7 @@ class JapaneseImperialCalendar extends Calendar {
* beyond the limit. The given CalendarDate object must have been
* normalized before calling this method.
*/
- private final long getYearOffsetInMillis(CalendarDate date) {
+ private long getYearOffsetInMillis(CalendarDate date) {
long t = (jcal.getDayOfYear(date) - 1) * ONE_DAY;
return t + date.getTimeOfDay() - date.getZoneOffset();
}
@@ -1755,7 +1757,7 @@ class JapaneseImperialCalendar extends Calendar {
d.setMonth(pd.getMonth()).setDayOfMonth(pd.getDayOfMonth());
}
} else {
- d.setMonth(jcal.JANUARY).setDayOfMonth(1);
+ d.setMonth(LocalGregorianCalendar.JANUARY).setDayOfMonth(1);
}
jcal.normalize(d);
prevJan1 = jcal.getFixedDate(d);
@@ -1780,8 +1782,8 @@ class JapaneseImperialCalendar extends Calendar {
if (jdate.isLeapYear()) {
nextJan1++;
}
- long nextJan1st = jcal.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
- getFirstDayOfWeek());
+ long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(nextJan1st - nextJan1);
if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
// The first days forms a week in which the date is included.
@@ -1793,7 +1795,7 @@ class JapaneseImperialCalendar extends Calendar {
long nextJan1;
if (jdate.getYear() == 1) {
d.addYear(+1);
- d.setMonth(jcal.JANUARY).setDayOfMonth(1);
+ d.setMonth(LocalGregorianCalendar.JANUARY).setDayOfMonth(1);
nextJan1 = jcal.getFixedDate(d);
} else {
int nextEraIndex = getEraIndex(d) + 1;
@@ -1803,8 +1805,8 @@ class JapaneseImperialCalendar extends Calendar {
jcal.normalize(d);
nextJan1 = jcal.getFixedDate(d);
}
- long nextJan1st = jcal.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
- getFirstDayOfWeek());
+ long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(nextJan1st - nextJan1);
if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
// The first days forms a week in which the date is included.
@@ -1828,11 +1830,11 @@ class JapaneseImperialCalendar extends Calendar {
* @param fixedDate the fixed date of the last day of the period
* @return the number of weeks of the given period
*/
- private final int getWeekNumber(long fixedDay1, long fixedDate) {
+ private int getWeekNumber(long fixedDay1, long fixedDate) {
// We can always use `jcal' since Julian and Gregorian are the
// same thing for this calculation.
- long fixedDay1st = jcal.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
- getFirstDayOfWeek());
+ long fixedDay1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
+ getFirstDayOfWeek());
int ndays = (int)(fixedDay1st - fixedDay1);
assert ndays <= 7;
if (ndays >= getMinimalDaysInFirstWeek()) {
@@ -2026,10 +2028,12 @@ class JapaneseImperialCalendar extends Calendar {
if (year == MIN_VALUES[YEAR]) {
CalendarDate dx = jcal.getCalendarDate(Long.MIN_VALUE, getZone());
int m = dx.getMonth() - 1;
- if (month < m)
+ if (month < m) {
month = m;
- if (month == m)
+ }
+ if (month == m) {
firstDayOfMonth = dx.getDayOfMonth();
+ }
}
LocalGregorianCalendar.Date date = jcal.newCalendarDate(TimeZone.NO_TIMEZONE);
@@ -2058,16 +2062,16 @@ class JapaneseImperialCalendar extends Calendar {
}
} else {
if (isFieldSet(fieldMask, WEEK_OF_MONTH)) {
- long firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
- getFirstDayOfWeek());
+ long firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
+ getFirstDayOfWeek());
// If we have enough days in the first week, then
// move to the previous week.
if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
firstDayOfWeek -= 7;
}
if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
- firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
- internalGet(DAY_OF_WEEK));
+ firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
+ internalGet(DAY_OF_WEEK));
}
// In lenient mode, we treat days of the previous
// months as a part of the specified
@@ -2090,15 +2094,15 @@ class JapaneseImperialCalendar extends Calendar {
dowim = 1;
}
if (dowim >= 0) {
- fixedDate = jcal.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
- dayOfWeek);
+ fixedDate = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
+ dayOfWeek);
} else {
// Go to the first day of the next week of
// the specified week boundary.
int lastDate = monthLength(month, year) + (7 * (dowim + 1));
// Then, get the day of week date on or before the last date.
- fixedDate = jcal.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
- dayOfWeek);
+ fixedDate = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
+ dayOfWeek);
}
}
}
@@ -2112,8 +2116,8 @@ class JapaneseImperialCalendar extends Calendar {
fixedDate += internalGet(DAY_OF_YEAR);
fixedDate--;
} else {
- long firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
- getFirstDayOfWeek());
+ long firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
+ getFirstDayOfWeek());
// If we have enough days in the first week, then move
// to the previous week.
if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
@@ -2122,8 +2126,8 @@ class JapaneseImperialCalendar extends Calendar {
if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
int dayOfWeek = internalGet(DAY_OF_WEEK);
if (dayOfWeek != getFirstDayOfWeek()) {
- firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
- dayOfWeek);
+ firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
+ dayOfWeek);
}
}
fixedDate = firstDayOfWeek + 7 * ((long)internalGet(WEEK_OF_YEAR) - 1);
@@ -2140,7 +2144,7 @@ class JapaneseImperialCalendar extends Calendar {
* calculated. The date has to be in the cut-over year.
* @param fixedDate the fixed date representation of the date
*/
- private final long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
+ private long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
Era era = date.getEra();
if (date.getEra() != null && date.getYear() == 1) {
for (int eraIndex = getEraIndex(date); eraIndex > 0; eraIndex--) {
@@ -2154,7 +2158,7 @@ class JapaneseImperialCalendar extends Calendar {
}
}
CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE);
- d.setDate(date.getNormalizedYear(), gcal.JANUARY, 1);
+ d.setDate(date.getNormalizedYear(), Gregorian.JANUARY, 1);
return gcal.getFixedDate(d);
}
@@ -2166,7 +2170,7 @@ class JapaneseImperialCalendar extends Calendar {
* calculated. The date must be in the era transition year.
* @param fixedDate the fixed date representation of the date
*/
- private final long getFixedDateMonth1(LocalGregorianCalendar.Date date,
+ private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
long fixedDate) {
int eraIndex = getTransitionEraIndex(date);
if (eraIndex != -1) {
@@ -2187,7 +2191,7 @@ class JapaneseImperialCalendar extends Calendar {
*
* @param fd the fixed date
*/
- private static final LocalGregorianCalendar.Date getCalendarDate(long fd) {
+ private static LocalGregorianCalendar.Date getCalendarDate(long fd) {
LocalGregorianCalendar.Date d = jcal.newCalendarDate(TimeZone.NO_TIMEZONE);
jcal.getCalendarDateFromFixedDate(d, fd);
return d;
@@ -2199,7 +2203,7 @@ class JapaneseImperialCalendar extends Calendar {
*
* @see #isLeapYear(int)
*/
- private final int monthLength(int month, int gregorianYear) {
+ private int monthLength(int month, int gregorianYear) {
return CalendarUtils.isGregorianLeapYear(gregorianYear) ?
GregorianCalendar.LEAP_MONTH_LENGTH[month] : GregorianCalendar.MONTH_LENGTH[month];
}
@@ -2210,13 +2214,13 @@ class JapaneseImperialCalendar extends Calendar {
*
* @see #isLeapYear(int)
*/
- private final int monthLength(int month) {
+ private int monthLength(int month) {
assert jdate.isNormalized();
return jdate.isLeapYear() ?
GregorianCalendar.LEAP_MONTH_LENGTH[month] : GregorianCalendar.MONTH_LENGTH[month];
}
- private final int actualMonthLength() {
+ private int actualMonthLength() {
int length = jcal.getMonthLength(jdate);
int eraIndex = getTransitionEraIndex(jdate);
if (eraIndex == -1) {
@@ -2239,7 +2243,7 @@ class JapaneseImperialCalendar extends Calendar {
* January 3, then the era index for Heisei is returned. If the
* given date is not in any transition month, then -1 is returned.
*/
- private static final int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
+ private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
int eraIndex = getEraIndex(date);
CalendarDate transitionDate = eras[eraIndex].getSinceDate();
if (transitionDate.getYear() == date.getNormalizedYear() &&
@@ -2256,7 +2260,7 @@ class JapaneseImperialCalendar extends Calendar {
return -1;
}
- private final boolean isTransitionYear(int normalizedYear) {
+ private boolean isTransitionYear(int normalizedYear) {
for (int i = eras.length - 1; i > 0; i--) {
int transitionYear = eras[i].getSinceDate().getYear();
if (normalizedYear == transitionYear) {
@@ -2269,7 +2273,7 @@ class JapaneseImperialCalendar extends Calendar {
return false;
}
- private static final int getEraIndex(LocalGregorianCalendar.Date date) {
+ private static int getEraIndex(LocalGregorianCalendar.Date date) {
Era era = date.getEra();
for (int i = eras.length - 1; i > 0; i--) {
if (eras[i] == era) {
@@ -2284,7 +2288,7 @@ class JapaneseImperialCalendar extends Calendar {
* in sync). Otherwise, a cloned object is returned after calling
* complete() in lenient mode.
*/
- private final JapaneseImperialCalendar getNormalizedCalendar() {
+ private JapaneseImperialCalendar getNormalizedCalendar() {
JapaneseImperialCalendar jc;
if (isFullyNormalized()) {
jc = this;
@@ -2303,7 +2307,7 @@ class JapaneseImperialCalendar extends Calendar {
* 3, we want it to go to Feb 28. Adjustments which might run into this
* problem call this method to retain the proper month.
*/
- private final void pinDayOfMonth(LocalGregorianCalendar.Date date) {
+ private void pinDayOfMonth(LocalGregorianCalendar.Date date) {
int year = date.getYear();
int dom = date.getDayOfMonth();
if (year != getMinimum(YEAR)) {
@@ -2347,7 +2351,7 @@ class JapaneseImperialCalendar extends Calendar {
/**
* Returns the new value after 'roll'ing the specified value and amount.
*/
- private static final int getRolledValue(int value, int amount, int min, int max) {
+ private static int getRolledValue(int value, int amount, int min, int max) {
assert value >= min && value <= max;
int range = max - min + 1;
amount %= range;
@@ -2365,7 +2369,7 @@ class JapaneseImperialCalendar extends Calendar {
* Returns the ERA. We need a special method for this because the
* default ERA is the current era, but a zero (unset) ERA means before Meiji.
*/
- private final int internalGetEra() {
+ private int internalGetEra() {
return isSet(ERA) ? internalGet(ERA) : eras.length - 1;
}
diff --git a/jdk/src/share/classes/java/util/PropertyPermission.java b/jdk/src/share/classes/java/util/PropertyPermission.java
index 026ce9be0ee..17731883598 100644
--- a/jdk/src/share/classes/java/util/PropertyPermission.java
+++ b/jdk/src/share/classes/java/util/PropertyPermission.java
@@ -305,7 +305,7 @@ public final class PropertyPermission extends BasicPermission {
switch(a[i-matchlen]) {
case ',':
seencomma = true;
- /*FALLTHROUGH*/
+ break;
case ' ': case '\r': case '\n':
case '\f': case '\t':
break;
@@ -442,7 +442,7 @@ implements Serializable
* Key is property name; value is PropertyPermission.
* Not serialized; see serialization section at end of class.
*/
- private transient Map perms;
+ private transient Map perms;
/**
* Boolean saying if "*" is in the collection.
@@ -458,7 +458,7 @@ implements Serializable
*/
public PropertyPermissionCollection() {
- perms = new HashMap(32); // Capacity for default policy
+ perms = new HashMap<>(32); // Capacity for default policy
all_allowed = false;
}
@@ -593,7 +593,7 @@ implements Serializable
* @return an enumeration of all the PropertyPermission objects.
*/
- public Enumeration elements() {
+ public Enumeration elements() {
// Convert Iterator of Map values into an Enumeration
synchronized (this) {
return Collections.enumeration(perms.values());
@@ -633,7 +633,7 @@ implements Serializable
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
- Hashtable permissions = new Hashtable(perms.size()*2);
+ Hashtable permissions = new Hashtable<>(perms.size()*2);
synchronized (this) {
permissions.putAll(perms);
}
@@ -660,8 +660,10 @@ implements Serializable
all_allowed = gfields.get("all_allowed", false);
// Get permissions
- Hashtable permissions = (Hashtable)gfields.get("permissions", null);
- perms = new HashMap(permissions.size()*2);
+ @SuppressWarnings("unchecked")
+ Hashtable permissions =
+ (Hashtable)gfields.get("permissions", null);
+ perms = new HashMap<>(permissions.size()*2);
perms.putAll(permissions);
}
}
diff --git a/jdk/src/share/classes/java/util/ResourceBundle.java b/jdk/src/share/classes/java/util/ResourceBundle.java
index a4a4d55a1a5..c7b425db7ac 100644
--- a/jdk/src/share/classes/java/util/ResourceBundle.java
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java
@@ -294,7 +294,7 @@ public abstract class ResourceBundle {
/**
* Queue for reference objects referring to class loaders or bundles.
*/
- private static final ReferenceQueue referenceQueue = new ReferenceQueue();
+ private static final ReferenceQueue referenceQueue = new ReferenceQueue<>();
/**
* The parent bundle of this bundle.
@@ -389,12 +389,13 @@ public abstract class ResourceBundle {
if (parent != null) {
obj = parent.getObject(key);
}
- if (obj == null)
+ if (obj == null) {
throw new MissingResourceException("Can't find resource for bundle "
+this.getClass().getName()
+", key "+key,
this.getClass().getName(),
key);
+ }
}
return obj;
}
@@ -418,7 +419,7 @@ public abstract class ResourceBundle {
private static ClassLoader getLoader() {
Class[] stack = getClassContext();
/* Magic number 2 identifies our caller's caller */
- Class c = stack[2];
+ Class> c = stack[2];
ClassLoader cl = (c == null) ? null : c.getClassLoader();
if (cl == null) {
// When the caller's loader is the boot class loader, cl is null
@@ -488,7 +489,7 @@ public abstract class ResourceBundle {
* null, but the base name and the locale must have a non-null
* value.
*/
- private static final class CacheKey implements Cloneable {
+ private static class CacheKey implements Cloneable {
// These three are the actual keys for lookup in Map.
private String name;
private Locale locale;
@@ -583,8 +584,7 @@ public abstract class ResourceBundle {
// treat it as unequal
&& (loader != null)
&& (loader == otherEntry.loaderRef.get());
- } catch (NullPointerException e) {
- } catch (ClassCastException e) {
+ } catch ( NullPointerException | ClassCastException e) {
}
return false;
}
@@ -669,11 +669,11 @@ public abstract class ResourceBundle {
* garbage collected when nobody else is using them. The ResourceBundle
* class has no reason to keep class loaders alive.
*/
- private static final class LoaderReference extends WeakReference
- implements CacheKeyReference {
+ private static class LoaderReference extends WeakReference
+ implements CacheKeyReference {
private CacheKey cacheKey;
- LoaderReference(ClassLoader referent, ReferenceQueue q, CacheKey key) {
+ LoaderReference(ClassLoader referent, ReferenceQueue q, CacheKey key) {
super(referent, q);
cacheKey = key;
}
@@ -687,11 +687,11 @@ public abstract class ResourceBundle {
* References to bundles are soft references so that they can be garbage
* collected when they have no hard references.
*/
- private static final class BundleReference extends SoftReference
- implements CacheKeyReference {
+ private static class BundleReference extends SoftReference
+ implements CacheKeyReference {
private CacheKey cacheKey;
- BundleReference(ResourceBundle referent, ReferenceQueue q, CacheKey key) {
+ BundleReference(ResourceBundle referent, ReferenceQueue q, CacheKey key) {
super(referent, q);
cacheKey = key;
}
@@ -1331,8 +1331,8 @@ public abstract class ResourceBundle {
* Checks if the given List is not null, not empty,
* not having null in its elements.
*/
- private static final boolean checkList(List a) {
- boolean valid = (a != null && a.size() != 0);
+ private static boolean checkList(List> a) {
+ boolean valid = (a != null && !a.isEmpty());
if (valid) {
int size = a.size();
for (int i = 0; valid && i < size; i++) {
@@ -1342,12 +1342,12 @@ public abstract class ResourceBundle {
return valid;
}
- private static final ResourceBundle findBundle(CacheKey cacheKey,
- List candidateLocales,
- List formats,
- int index,
- Control control,
- ResourceBundle baseBundle) {
+ private static ResourceBundle findBundle(CacheKey cacheKey,
+ List candidateLocales,
+ List formats,
+ int index,
+ Control control,
+ ResourceBundle baseBundle) {
Locale targetLocale = candidateLocales.get(index);
ResourceBundle parent = null;
if (index != candidateLocales.size() - 1) {
@@ -1419,10 +1419,10 @@ public abstract class ResourceBundle {
return parent;
}
- private static final ResourceBundle loadBundle(CacheKey cacheKey,
- List formats,
- Control control,
- boolean reload) {
+ private static ResourceBundle loadBundle(CacheKey cacheKey,
+ List formats,
+ Control control,
+ boolean reload) {
// Here we actually load the bundle in the order of formats
// specified by the getFormats() value.
@@ -1459,7 +1459,7 @@ public abstract class ResourceBundle {
return bundle;
}
- private static final boolean isValidBundle(ResourceBundle bundle) {
+ private static boolean isValidBundle(ResourceBundle bundle) {
return bundle != null && bundle != NONEXISTENT_BUNDLE;
}
@@ -1467,7 +1467,7 @@ public abstract class ResourceBundle {
* Determines whether any of resource bundles in the parent chain,
* including the leaf, have expired.
*/
- private static final boolean hasValidParentChain(ResourceBundle bundle) {
+ private static boolean hasValidParentChain(ResourceBundle bundle) {
long now = System.currentTimeMillis();
while (bundle != null) {
if (bundle.expired) {
@@ -1488,9 +1488,9 @@ public abstract class ResourceBundle {
/**
* Throw a MissingResourceException with proper message
*/
- private static final void throwMissingResourceException(String baseName,
- Locale locale,
- Throwable cause) {
+ private static void throwMissingResourceException(String baseName,
+ Locale locale,
+ Throwable cause) {
// If the cause is a MissingResourceException, avoid creating
// a long chain. (6355009)
if (cause instanceof MissingResourceException) {
@@ -1513,8 +1513,8 @@ public abstract class ResourceBundle {
* cache or its parent has expired. bundle.expire is true
* upon return if the bundle in the cache has expired.
*/
- private static final ResourceBundle findBundleInCache(CacheKey cacheKey,
- Control control) {
+ private static ResourceBundle findBundleInCache(CacheKey cacheKey,
+ Control control) {
BundleReference bundleRef = cacheList.get(cacheKey);
if (bundleRef == null) {
return null;
@@ -1620,9 +1620,9 @@ public abstract class ResourceBundle {
* the bundle before this call, the one found in the cache is
* returned.
*/
- private static final ResourceBundle putBundleInCache(CacheKey cacheKey,
- ResourceBundle bundle,
- Control control) {
+ private static ResourceBundle putBundleInCache(CacheKey cacheKey,
+ ResourceBundle bundle,
+ Control control) {
setExpirationTime(cacheKey, control);
if (cacheKey.expirationTime != Control.TTL_DONT_CACHE) {
CacheKey key = (CacheKey) cacheKey.clone();
@@ -1653,7 +1653,7 @@ public abstract class ResourceBundle {
return bundle;
}
- private static final void setExpirationTime(CacheKey cacheKey, Control control) {
+ private static void setExpirationTime(CacheKey cacheKey, Control control) {
long ttl = control.getTimeToLive(cacheKey.getName(),
cacheKey.getLocale());
if (ttl >= 0) {
@@ -2350,18 +2350,27 @@ public abstract class ResourceBundle {
if (script.length() == 0 && region.length() > 0) {
// Supply script for users who want to use zh_Hans/zh_Hant
// as bundle names (recommended for Java7+)
- if (region.equals("TW") || region.equals("HK") || region.equals("MO")) {
+ switch (region) {
+ case "TW":
+ case "HK":
+ case "MO":
script = "Hant";
- } else if (region.equals("CN") || region.equals("SG")) {
+ break;
+ case "CN":
+ case "SG":
script = "Hans";
+ break;
}
} else if (script.length() > 0 && region.length() == 0) {
// Supply region(country) for users who still package Chinese
// bundles using old convension.
- if (script.equals("Hans")) {
+ switch (script) {
+ case "Hans":
region = "CN";
- } else if (script.equals("Hant")) {
+ break;
+ case "Hant":
region = "TW";
+ break;
}
}
}
@@ -2562,6 +2571,7 @@ public abstract class ResourceBundle {
ResourceBundle bundle = null;
if (format.equals("java.class")) {
try {
+ @SuppressWarnings("unchecked")
Class extends ResourceBundle> bundleClass
= (Class extends ResourceBundle>)loader.loadClass(bundleName);
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java
index c21df7bab8c..a4d6d8297da 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java
@@ -54,10 +54,10 @@ public class AtomicBoolean implements java.io.Serializable {
private static final long valueOffset;
static {
- try {
- valueOffset = unsafe.objectFieldOffset
- (AtomicBoolean.class.getDeclaredField("value"));
- } catch (Exception ex) { throw new Error(ex); }
+ try {
+ valueOffset = unsafe.objectFieldOffset
+ (AtomicBoolean.class.getDeclaredField("value"));
+ } catch (Exception ex) { throw new Error(ex); }
}
private volatile int value;
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
index ec68acd781a..1bc7fa2aa44 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
@@ -57,10 +57,10 @@ public class AtomicInteger extends Number implements java.io.Serializable {
private static final long valueOffset;
static {
- try {
- valueOffset = unsafe.objectFieldOffset
- (AtomicInteger.class.getDeclaredField("value"));
- } catch (Exception ex) { throw new Error(ex); }
+ try {
+ valueOffset = unsafe.objectFieldOffset
+ (AtomicInteger.class.getDeclaredField("value"));
+ } catch (Exception ex) { throw new Error(ex); }
}
private volatile int value;
@@ -247,8 +247,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
/**
- * Returns the value of this {@code AtomicInteger} as an
- * {@code int}.
+ * Returns the value of this {@code AtomicInteger} as an {@code int}.
*/
public int intValue() {
return get();
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java
index 46227019856..9928e5974fa 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java
@@ -35,7 +35,6 @@
package java.util.concurrent.atomic;
import sun.misc.Unsafe;
-import java.util.*;
/**
* An {@code int} array in which elements may be updated atomically.
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
index aed5d1fc170..9f4fee4aa84 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
@@ -135,7 +135,6 @@ public abstract class AtomicIntegerFieldUpdater {
*/
public abstract void lazySet(T obj, int newValue);
-
/**
* Gets the current value held in the field of the given object managed
* by this updater.
@@ -266,11 +265,11 @@ public abstract class AtomicIntegerFieldUpdater {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private final long offset;
private final Class tclass;
- private final Class cclass;
+ private final Class> cclass;
AtomicIntegerFieldUpdaterImpl(Class tclass, String fieldName) {
Field field = null;
- Class caller = null;
+ Class> caller = null;
int modifiers = 0;
try {
field = tclass.getDeclaredField(fieldName);
@@ -283,7 +282,7 @@ public abstract class AtomicIntegerFieldUpdater {
throw new RuntimeException(ex);
}
- Class fieldt = field.getType();
+ Class> fieldt = field.getType();
if (fieldt != int.class)
throw new IllegalArgumentException("Must be integer type");
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java
index bf2c71a340a..f503d577d1b 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java
@@ -71,10 +71,10 @@ public class AtomicLong extends Number implements java.io.Serializable {
private static native boolean VMSupportsCS8();
static {
- try {
- valueOffset = unsafe.objectFieldOffset
- (AtomicLong.class.getDeclaredField("value"));
- } catch (Exception ex) { throw new Error(ex); }
+ try {
+ valueOffset = unsafe.objectFieldOffset
+ (AtomicLong.class.getDeclaredField("value"));
+ } catch (Exception ex) { throw new Error(ex); }
}
private volatile long value;
@@ -270,8 +270,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
}
/**
- * Returns the value of this {@code AtomicLong} as a {@code long}
- * value.
+ * Returns the value of this {@code AtomicLong} as a {@code long}.
*/
public long longValue() {
return get();
@@ -287,8 +286,8 @@ public class AtomicLong extends Number implements java.io.Serializable {
}
/**
- * Returns the value of this {@code AtomicLong} as a {@code
- * double} after a widening primitive conversion.
+ * Returns the value of this {@code AtomicLong} as a {@code double}
+ * after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
*/
public double doubleValue() {
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java
index ece5b6ad9b0..856ab39e0c6 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java
@@ -35,7 +35,6 @@
package java.util.concurrent.atomic;
import sun.misc.Unsafe;
-import java.util.*;
/**
* A {@code long} array in which elements may be updated atomically.
@@ -136,7 +135,6 @@ public class AtomicLongArray implements java.io.Serializable {
unsafe.putOrderedLong(array, checkedByteOffset(i), newValue);
}
-
/**
* Atomically sets the element at position {@code i} to the given value
* and returns the old value.
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
index fa0a857152d..ccc5acbfe21 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
@@ -265,11 +265,11 @@ public abstract class AtomicLongFieldUpdater {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private final long offset;
private final Class tclass;
- private final Class cclass;
+ private final Class> cclass;
CASUpdater(Class tclass, String fieldName) {
Field field = null;
- Class caller = null;
+ Class> caller = null;
int modifiers = 0;
try {
field = tclass.getDeclaredField(fieldName);
@@ -282,7 +282,7 @@ public abstract class AtomicLongFieldUpdater {
throw new RuntimeException(ex);
}
- Class fieldt = field.getType();
+ Class> fieldt = field.getType();
if (fieldt != long.class)
throw new IllegalArgumentException("Must be long type");
@@ -348,11 +348,11 @@ public abstract class AtomicLongFieldUpdater {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private final long offset;
private final Class tclass;
- private final Class cclass;
+ private final Class> cclass;
LockedUpdater(Class tclass, String fieldName) {
Field field = null;
- Class caller = null;
+ Class> caller = null;
int modifiers = 0;
try {
field = tclass.getDeclaredField(fieldName);
@@ -365,7 +365,7 @@ public abstract class AtomicLongFieldUpdater {
throw new RuntimeException(ex);
}
- Class fieldt = field.getType();
+ Class> fieldt = field.getType();
if (fieldt != long.class)
throw new IllegalArgumentException("Must be long type");
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java
index 3178ca1579f..978664e2d83 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java
@@ -51,10 +51,10 @@ public class AtomicReference implements java.io.Serializable {
private static final long valueOffset;
static {
- try {
- valueOffset = unsafe.objectFieldOffset
- (AtomicReference.class.getDeclaredField("value"));
- } catch (Exception ex) { throw new Error(ex); }
+ try {
+ valueOffset = unsafe.objectFieldOffset
+ (AtomicReference.class.getDeclaredField("value"));
+ } catch (Exception ex) { throw new Error(ex); }
}
private volatile V value;
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java
index b173f26808b..d92bdb5f2f4 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java
@@ -113,6 +113,7 @@ public class AtomicReferenceArray implements java.io.Serializable {
return getRaw(checkedByteOffset(i));
}
+ @SuppressWarnings("unchecked")
private E getRaw(long offset) {
return (E) unsafe.getObjectVolatile(array, offset);
}
@@ -150,7 +151,7 @@ public class AtomicReferenceArray implements java.io.Serializable {
public final E getAndSet(int i, E newValue) {
long offset = checkedByteOffset(i);
while (true) {
- E current = (E) getRaw(offset);
+ E current = getRaw(offset);
if (compareAndSetRaw(offset, current, newValue))
return current;
}
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
index 7b72f0ff494..f2e0118aae7 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
@@ -183,7 +183,7 @@ public abstract class AtomicReferenceFieldUpdater {
private final long offset;
private final Class tclass;
private final Class vclass;
- private final Class cclass;
+ private final Class> cclass;
/*
* Internal type checks within all update methods contain
@@ -201,8 +201,8 @@ public abstract class AtomicReferenceFieldUpdater {
Class vclass,
String fieldName) {
Field field = null;
- Class fieldClass = null;
- Class caller = null;
+ Class> fieldClass = null;
+ Class> caller = null;
int modifiers = 0;
try {
field = tclass.getDeclaredField(fieldName);
@@ -280,6 +280,7 @@ public abstract class AtomicReferenceFieldUpdater {
unsafe.putOrderedObject(obj, offset, newValue);
}
+ @SuppressWarnings("unchecked")
public V get(T obj) {
if (obj == null || obj.getClass() != tclass || cclass != null)
targetCheck(obj);
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java
index 90aa3a0c538..5f8f1a03db9 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java
@@ -155,7 +155,6 @@ public class AtomicStampedReference {
casPair(current, Pair.of(newReference, newStamp)));
}
-
/**
* Unconditionally sets the value of both the reference and stamp.
*
diff --git a/jdk/src/share/classes/java/util/jar/JarVerifier.java b/jdk/src/share/classes/java/util/jar/JarVerifier.java
index 4f84ac28eff..6a9a8b55667 100644
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java
@@ -90,7 +90,7 @@ class JarVerifier {
private Object csdomain = new Object();
/** collect -DIGEST-MANIFEST values for blacklist */
- private List manifestDigests;
+ private List manifestDigests;
public JarVerifier(byte rawBytes[]) {
manifestRawBytes = rawBytes;
@@ -99,7 +99,7 @@ class JarVerifier {
sigFileData = new Hashtable(11);
pendingBlocks = new ArrayList();
baos = new ByteArrayOutputStream();
- manifestDigests = new ArrayList();
+ manifestDigests = new ArrayList<>();
}
/**
@@ -872,7 +872,7 @@ class JarVerifier {
eagerValidation = eager;
}
- public synchronized List getManifestDigests() {
+ public synchronized List getManifestDigests() {
return Collections.unmodifiableList(manifestDigests);
}
diff --git a/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java b/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java
index c53ba0c6f52..9541a5a45f3 100644
--- a/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java
+++ b/jdk/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java
@@ -57,7 +57,7 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
jar.setEagerValidation(eager);
}
- public List getManifestDigests(JarFile jar) {
+ public List getManifestDigests(JarFile jar) {
return jar.getManifestDigests();
}
}
diff --git a/jdk/src/share/classes/java/util/zip/Adler32.java b/jdk/src/share/classes/java/util/zip/Adler32.java
index fd534592c37..1e67a80ad19 100644
--- a/jdk/src/share/classes/java/util/zip/Adler32.java
+++ b/jdk/src/share/classes/java/util/zip/Adler32.java
@@ -25,16 +25,23 @@
package java.util.zip;
+import java.nio.ByteBuffer;
+import sun.nio.ch.DirectBuffer;
+
/**
* A class that can be used to compute the Adler-32 checksum of a data
* stream. An Adler-32 checksum is almost as reliable as a CRC-32 but
* can be computed much faster.
*
+ *
Passing a {@code null} argument to a method in this class will cause
+ * a {@link NullPointerException} to be thrown.
+ *
* @see Checksum
* @author David Connelly
*/
public
class Adler32 implements Checksum {
+
private int adler = 1;
/**
@@ -75,6 +82,39 @@ class Adler32 implements Checksum {
adler = updateBytes(adler, b, 0, b.length);
}
+
+ /**
+ * Updates the checksum with the bytes from the specified buffer.
+ *
+ * The checksum is updated using
+ * buffer.{@link java.nio.Buffer#remaining() remaining()}
+ * bytes starting at
+ * buffer.{@link java.nio.Buffer#position() position()}
+ * Upon return, the buffer's position will be updated to its
+ * limit; its limit will not have been changed.
+ *
+ * @param buffer the ByteBuffer to update the checksum with
+ * @since 1.8
+ */
+ public void update(ByteBuffer buffer) {
+ int pos = buffer.position();
+ int limit = buffer.limit();
+ assert (pos <= limit);
+ int rem = limit - pos;
+ if (rem <= 0)
+ return;
+ if (buffer instanceof DirectBuffer) {
+ adler = updateByteBuffer(adler, ((DirectBuffer)buffer).address(), pos, rem);
+ } else if (buffer.hasArray()) {
+ adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem);
+ } else {
+ byte[] b = new byte[rem];
+ buffer.get(b);
+ adler = updateBytes(adler, b, 0, b.length);
+ }
+ buffer.position(limit);
+ }
+
/**
* Resets the checksum to initial value.
*/
@@ -92,4 +132,6 @@ class Adler32 implements Checksum {
private native static int update(int adler, int b);
private native static int updateBytes(int adler, byte[] b, int off,
int len);
+ private native static int updateByteBuffer(int adler, long addr,
+ int off, int len);
}
diff --git a/jdk/src/share/classes/java/util/zip/CRC32.java b/jdk/src/share/classes/java/util/zip/CRC32.java
index 9f62c8572d5..7c173694eed 100644
--- a/jdk/src/share/classes/java/util/zip/CRC32.java
+++ b/jdk/src/share/classes/java/util/zip/CRC32.java
@@ -25,9 +25,15 @@
package java.util.zip;
+import java.nio.ByteBuffer;
+import sun.nio.ch.DirectBuffer;
+
/**
* A class that can be used to compute the CRC-32 of a data stream.
*
+ *
Passing a {@code null} argument to a method in this class will cause
+ * a {@link NullPointerException} to be thrown.
+ *
* @see Checksum
* @author David Connelly
*/
@@ -74,6 +80,38 @@ class CRC32 implements Checksum {
crc = updateBytes(crc, b, 0, b.length);
}
+ /**
+ * Updates the checksum with the bytes from the specified buffer.
+ *
+ * The checksum is updated using
+ * buffer.{@link java.nio.Buffer#remaining() remaining()}
+ * bytes starting at
+ * buffer.{@link java.nio.Buffer#position() position()}
+ * Upon return, the buffer's position will
+ * be updated to its limit; its limit will not have been changed.
+ *
+ * @param buffer the ByteBuffer to update the checksum with
+ * @since 1.8
+ */
+ public void update(ByteBuffer buffer) {
+ int pos = buffer.position();
+ int limit = buffer.limit();
+ assert (pos <= limit);
+ int rem = limit - pos;
+ if (rem <= 0)
+ return;
+ if (buffer instanceof DirectBuffer) {
+ crc = updateByteBuffer(crc, ((DirectBuffer)buffer).address(), pos, rem);
+ } else if (buffer.hasArray()) {
+ crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), rem);
+ } else {
+ byte[] b = new byte[rem];
+ buffer.get(b);
+ crc = updateBytes(crc, b, 0, b.length);
+ }
+ buffer.position(limit);
+ }
+
/**
* Resets CRC-32 to initial value.
*/
@@ -90,4 +128,7 @@ class CRC32 implements Checksum {
private native static int update(int crc, int b);
private native static int updateBytes(int crc, byte[] b, int off, int len);
+
+ private native static int updateByteBuffer(int adler, long addr,
+ int off, int len);
}
diff --git a/jdk/src/share/classes/javax/script/ScriptEngineManager.java b/jdk/src/share/classes/javax/script/ScriptEngineManager.java
index c87f4817562..bb43053426c 100644
--- a/jdk/src/share/classes/javax/script/ScriptEngineManager.java
+++ b/jdk/src/share/classes/javax/script/ScriptEngineManager.java
@@ -25,11 +25,9 @@
package javax.script;
import java.util.*;
-import java.net.URL;
-import java.io.*;
import java.security.*;
-import sun.misc.Service;
-import sun.misc.ServiceConfigurationError;
+import java.util.ServiceLoader;
+import java.util.ServiceConfigurationError;
import sun.reflect.Reflection;
import sun.security.util.SecurityConstants;
@@ -102,13 +100,15 @@ public class ScriptEngineManager {
}
private void initEngines(final ClassLoader loader) {
- Iterator itr = null;
+ Iterator itr = null;
try {
+ ServiceLoader sl;
if (loader != null) {
- itr = Service.providers(ScriptEngineFactory.class, loader);
+ sl = ServiceLoader.load(ScriptEngineFactory.class, loader);
} else {
- itr = Service.installedProviders(ScriptEngineFactory.class);
+ sl = ServiceLoader.loadInstalled(ScriptEngineFactory.class);
}
+ itr = sl.iterator();
} catch (ServiceConfigurationError err) {
System.err.println("Can't find ScriptEngineFactory providers: " +
err.getMessage());
@@ -124,7 +124,7 @@ public class ScriptEngineManager {
try {
while (itr.hasNext()) {
try {
- ScriptEngineFactory fact = (ScriptEngineFactory) itr.next();
+ ScriptEngineFactory fact = itr.next();
engineSpis.add(fact);
} catch (ServiceConfigurationError err) {
System.err.println("ScriptEngineManager providers.next(): "
@@ -441,7 +441,7 @@ public class ScriptEngineManager {
// Note that this code is same as ClassLoader.getCallerClassLoader().
// But, that method is package private and hence we can't call here.
private ClassLoader getCallerClassLoader() {
- Class caller = Reflection.getCallerClass(3);
+ Class> caller = Reflection.getCallerClass(3);
if (caller == null) {
return null;
}
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java
index c79d0e11e4c..a22e8cc4221 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java
@@ -369,7 +369,7 @@ public final class ServicePermission extends Permission
switch(a[i-matchlen]) {
case ',':
seencomma = true;
- /*FALLTHROUGH*/
+ break;
case ' ': case '\r': case '\n':
case '\f': case '\t':
break;
diff --git a/jdk/src/share/classes/javax/sql/StatementEvent.java b/jdk/src/share/classes/javax/sql/StatementEvent.java
index bb41be781f2..53c61c5ac64 100644
--- a/jdk/src/share/classes/javax/sql/StatementEvent.java
+++ b/jdk/src/share/classes/javax/sql/StatementEvent.java
@@ -42,6 +42,7 @@ import java.util.EventObject;
*/
public class StatementEvent extends EventObject {
+ static final long serialVersionUID = -8089573731826608315L;
private SQLException exception;
private PreparedStatement statement;
diff --git a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java
index cf0bbecf386..bbb1852b965 100644
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -619,8 +619,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
checkforRowSetInterface();
if (listeners.isEmpty() == false) {
RowSetEvent event = new RowSetEvent((RowSet)this);
- for (Iterator i = listeners.iterator(); i.hasNext(); ) {
- ((RowSetListener)i.next()).cursorMoved(event);
+ for (RowSetListener rsl : listeners) {
+ rsl.cursorMoved(event);
}
}
}
@@ -644,8 +644,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
checkforRowSetInterface();
if (listeners.isEmpty() == false) {
RowSetEvent event = new RowSetEvent((RowSet)this);
- for (Iterator i = listeners.iterator(); i.hasNext(); ) {
- ((RowSetListener)i.next()).rowChanged(event);
+ for (RowSetListener rsl : listeners) {
+ rsl.rowChanged(event);
}
}
}
@@ -669,8 +669,8 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
checkforRowSetInterface();
if (listeners.isEmpty() == false) {
RowSetEvent event = new RowSetEvent((RowSet)this);
- for (Iterator i = listeners.iterator(); i.hasNext(); ) {
- ((RowSetListener)i.next()).rowSetChanged(event);
+ for (RowSetListener rsl : listeners) {
+ rsl.rowSetChanged(event);
}
}
}
diff --git a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java
index f4591c09cb5..659f2e5463e 100644
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java
@@ -97,7 +97,7 @@ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
*/
private void checkColType(int SQLType) throws SQLException {
try {
- Class c = java.sql.Types.class;
+ Class> c = java.sql.Types.class;
Field[] publicFields = c.getFields();
int fieldValue = 0;
for (int i = 0; i < publicFields.length; i++) {
@@ -1091,5 +1091,7 @@ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
*@serial
*/
public boolean writable = true;
+
+ static final long serialVersionUID = 5490834817919311283L;
}
}
diff --git a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java
index c161eded789..68226eec15b 100644
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java
@@ -181,7 +181,7 @@ public class RowSetProvider {
trace("***In newInstance()");
try {
- Class providerClass = getFactoryClass(factoryClassName, cl, false);
+ Class> providerClass = getFactoryClass(factoryClassName, cl, false);
RowSetFactory instance = (RowSetFactory) providerClass.newInstance();
if (debug) {
trace("Created new instance of " + providerClass +
@@ -229,7 +229,7 @@ public class RowSetProvider {
* context class loader followed by the current class loader.
* @return The class which was loaded
*/
- static private Class getFactoryClass(String factoryClassName, ClassLoader cl,
+ static private Class> getFactoryClass(String factoryClassName, ClassLoader cl,
boolean doFallback) throws ClassNotFoundException {
try {
if (cl == null) {
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java b/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
index c84527d8036..c4b1e4d9120 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -22,13 +22,9 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package javax.sql.rowset.serial;
import java.sql.*;
-import javax.sql.*;
-import java.io.*;
-import java.math.*;
import java.util.Map;
/**
@@ -91,7 +87,7 @@ public class SQLInputImpl implements SQLInput {
* SQLData (the Java class that defines how the UDT
* will be mapped).
*/
- private Map map;
+ private Map> map;
/**
@@ -279,7 +275,7 @@ public class SQLInputImpl implements SQLInput {
if (attrib == null) {
lastValueWasNull = true;
- return (int)0;
+ return 0;
} else {
lastValueWasNull = false;
return attrib.intValue();
@@ -591,7 +587,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public Object readObject() throws SQLException {
- Object attrib = (Object)getNextAttribute();
+ Object attrib = getNextAttribute();
if (attrib == null) {
lastValueWasNull = true;
@@ -601,7 +597,7 @@ public class SQLInputImpl implements SQLInput {
if (attrib instanceof Struct) {
Struct s = (Struct)attrib;
// look up the class in the map
- Class c = (Class)map.get(s.getSQLTypeName());
+ Class> c = map.get(s.getSQLTypeName());
if (c != null) {
// create new instance of the class
SQLData obj = null;
@@ -620,10 +616,10 @@ public class SQLInputImpl implements SQLInput {
SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
// read the values...
obj.readSQL(sqlInput, s.getSQLTypeName());
- return (Object)obj;
+ return obj;
}
}
- return (Object)attrib;
+ return attrib;
}
}
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
index 7b5d8d4b867..2217e4e2cab 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
@@ -60,6 +60,7 @@ public class SQLOutputImpl implements SQLOutput {
* A reference to an existing vector that
* contains the attributes of a Struct object.
*/
+ @SuppressWarnings("rawtypes")
private Vector attribs;
/**
@@ -70,6 +71,7 @@ public class SQLOutputImpl implements SQLOutput {
* method will in turn call the appropriate
* SQLOutputImpl writer methods.
*/
+ @SuppressWarnings("rawtypes")
private Map map;
/**
@@ -121,6 +123,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeString(String x) throws SQLException {
//System.out.println("Adding :"+x);
attribs.add(x);
@@ -136,6 +139,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeBoolean(boolean x) throws SQLException {
attribs.add(Boolean.valueOf(x));
}
@@ -150,6 +154,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeByte(byte x) throws SQLException {
attribs.add(Byte.valueOf(x));
}
@@ -164,6 +169,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeShort(short x) throws SQLException {
attribs.add(Short.valueOf(x));
}
@@ -178,6 +184,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeInt(int x) throws SQLException {
attribs.add(Integer.valueOf(x));
}
@@ -192,6 +199,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeLong(long x) throws SQLException {
attribs.add(Long.valueOf(x));
}
@@ -206,6 +214,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeFloat(float x) throws SQLException {
attribs.add(new Float(x));
}
@@ -220,6 +229,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeDouble(double x) throws SQLException{
attribs.add(new Double(x));
}
@@ -234,6 +244,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeBigDecimal(java.math.BigDecimal x) throws SQLException{
attribs.add(x);
}
@@ -249,6 +260,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeBytes(byte[] x) throws SQLException {
attribs.add(x);
}
@@ -263,6 +275,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeDate(java.sql.Date x) throws SQLException {
attribs.add(x);
}
@@ -277,6 +290,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeTime(java.sql.Time x) throws SQLException {
attribs.add(x);
}
@@ -291,6 +305,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeTimestamp(java.sql.Timestamp x) throws SQLException {
attribs.add(x);
}
@@ -305,6 +320,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeCharacterStream(java.io.Reader x) throws SQLException {
BufferedReader bufReader = new BufferedReader(x);
try {
@@ -334,6 +350,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeAsciiStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try {
@@ -363,6 +380,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeBinaryStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try {
@@ -414,6 +432,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeObject(SQLData x) throws SQLException {
/*
@@ -434,7 +453,7 @@ public class SQLOutputImpl implements SQLOutput {
* the name of this class otherwise we don't know
* what to re-instantiate during readSQL()
*/
- attribs.add(new SerialStruct((SQLData)x, map));
+ attribs.add(new SerialStruct(x, map));
}
/**
@@ -448,6 +467,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeRef(Ref x) throws SQLException {
if (x == null) {
attribs.add(x);
@@ -467,6 +487,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeBlob(Blob x) throws SQLException {
if (x == null) {
attribs.add(x);
@@ -486,6 +507,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeClob(Clob x) throws SQLException {
if (x == null) {
attribs.add(x);
@@ -511,6 +533,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeStruct(Struct x) throws SQLException {
SerialStruct s = new SerialStruct(x,map);;
attribs.add(s);
@@ -528,6 +551,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeArray(Array x) throws SQLException {
if (x == null) {
attribs.add(x);
@@ -547,6 +571,7 @@ public class SQLOutputImpl implements SQLOutput {
* use by a SQLData object attempting to write the attribute
* values of a UDT to the database.
*/
+ @SuppressWarnings("unchecked")
public void writeURL(java.net.URL url) throws SQLException {
if (url == null) {
attribs.add(url);
@@ -570,6 +595,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs
* @since 1.6
*/
+ @SuppressWarnings("unchecked")
public void writeNString(String x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported");
}
@@ -583,6 +609,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs
* @since 1.6
*/
+ @SuppressWarnings("unchecked")
public void writeNClob(NClob x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported");
}
@@ -597,6 +624,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs
* @since 1.6
*/
+ @SuppressWarnings("unchecked")
public void writeRowId(RowId x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported");
}
@@ -611,6 +639,7 @@ public class SQLOutputImpl implements SQLOutput {
* @exception SQLException if a database access error occurs
* @since 1.6
*/
+ @SuppressWarnings("unchecked")
public void writeSQLXML(SQLXML x) throws SQLException {
throw new UnsupportedOperationException("Operation not supported");
}
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java
index 17856e17d66..5ab127c6ce3 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java
@@ -186,10 +186,8 @@ public class SerialArray implements Array, Serializable, Cloneable {
case java.sql.Types.JAVA_OBJECT:
for (int i = 0; i < len; i++) {
- elements[i] = new SerialJavaObject((Object)elements[i]);
+ elements[i] = new SerialJavaObject(elements[i]);
}
- default:
- ;
}
}
@@ -285,11 +283,10 @@ public class SerialArray implements Array, Serializable, Cloneable {
case java.sql.Types.JAVA_OBJECT:
for (int i = 0; i < len; i++) {
- elements[i] = new SerialJavaObject((Object)elements[i]);
+ elements[i] = new SerialJavaObject(elements[i]);
}
+ break;
- default:
- ;
}
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java
index 795e404fdaf..bae2d9355eb 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java
@@ -207,7 +207,7 @@ public class SerialBlob implements Blob, Serializable, Cloneable {
*/
public java.io.InputStream getBinaryStream() throws SerialException {
InputStream stream = new ByteArrayInputStream(buf);
- return (java.io.InputStream)stream;
+ return stream;
}
/**
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java
index 5aa034f6854..4517ff3c2d2 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java
@@ -142,14 +142,14 @@ public class SerialJavaObject implements Serializable, Cloneable {
* object. When there are multiple warnings, each warning is chained to the
* previous warning.
*/
- java.util.Vector chain;
+ java.util.Vector chain;
/**
* Registers the given warning.
*/
private void setWarning(RowSetWarning e) {
if (chain == null) {
- chain = new java.util.Vector();
+ chain = new java.util.Vector<>();
}
chain.add(e);
}
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java
index 8503caaaf78..efc88198e73 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java
@@ -109,7 +109,7 @@ public class SerialRef implements Ref, Serializable, Cloneable {
public Object getObject(java.util.Map> map)
throws SerialException
{
- map = new Hashtable(map);
+ map = new Hashtable>(map);
if (object != null) {
return map.get(object);
} else {
diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java
index b546da769f4..a9462eb8688 100644
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java
@@ -139,7 +139,7 @@ public class SerialStruct implements Struct, Serializable, Cloneable {
//set the type name
SQLTypeName = in.getSQLTypeName();
- Vector tmp = new Vector();
+ Vector tmp = new Vector<>();
in.writeSQL(new SQLOutputImpl(tmp, map));
attribs = tmp.toArray();
@@ -220,7 +220,7 @@ public class SerialStruct implements Struct, Serializable, Cloneable {
* that defines how the UDT is to be mapped
* @throws SerialException if an error occurs
*/
- private void mapToSerial(Map map) throws SerialException {
+ private void mapToSerial(Map> map) throws SerialException {
try {
diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
index 4e2b164d683..11a59c4a9e1 100644
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
@@ -257,7 +257,7 @@ public class SyncFactory {
* See section 2.0 of the class comment for SyncFactory for an
* explanation of how a provider can be added to this registry.
*/
- private static Hashtable implementations;
+ private static Hashtable implementations;
/**
* Internal sync object used to maintain the SPI as a singleton
*/
@@ -344,7 +344,7 @@ public class SyncFactory {
Properties properties = new Properties();
if (implementations == null) {
- implementations = new Hashtable();
+ implementations = new Hashtable<>();
try {
@@ -445,7 +445,7 @@ public class SyncFactory {
String key = null;
String[] propertyNames = null;
- for (Enumeration e = p.propertyNames(); e.hasMoreElements();) {
+ for (Enumeration> e = p.propertyNames(); e.hasMoreElements();) {
String str = (String) e.nextElement();
@@ -541,7 +541,7 @@ public class SyncFactory {
}
// Attempt to invoke classname from registered SyncProvider list
- Class c = null;
+ Class> c = null;
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -740,7 +740,7 @@ public class SyncFactory {
*/
private static Properties parseJNDIContext() throws NamingException {
- NamingEnumeration bindings = ic.listBindings("");
+ NamingEnumeration> bindings = ic.listBindings("");
Properties properties = new Properties();
// Hunt one level below context for available SyncProvider objects
@@ -755,7 +755,7 @@ public class SyncFactory {
* scan the current context using a re-entrant call to this method until all
* bindings have been enumerated.
*/
- private static void enumerateBindings(NamingEnumeration bindings,
+ private static void enumerateBindings(NamingEnumeration> bindings,
Properties properties) throws NamingException {
boolean syncProviderObj = false; // move to parameters ?
diff --git a/jdk/src/share/classes/sun/awt/im/CompositionArea.java b/jdk/src/share/classes/sun/awt/im/CompositionArea.java
index 5e0a19db852..15eb0885225 100644
--- a/jdk/src/share/classes/sun/awt/im/CompositionArea.java
+++ b/jdk/src/share/classes/sun/awt/im/CompositionArea.java
@@ -313,4 +313,7 @@ public final class CompositionArea extends JPanel implements InputMethodListener
compositionWindow.pack();
}
+ // Proclaim serial compatibility with 1.7.0
+ private static final long serialVersionUID = -1057247068746557444L;
+
}
diff --git a/jdk/src/share/classes/sun/awt/im/CompositionAreaHandler.java b/jdk/src/share/classes/sun/awt/im/CompositionAreaHandler.java
index 7a5626dc571..6ae4a957ce2 100644
--- a/jdk/src/share/classes/sun/awt/im/CompositionAreaHandler.java
+++ b/jdk/src/share/classes/sun/awt/im/CompositionAreaHandler.java
@@ -257,7 +257,7 @@ class CompositionAreaHandler implements InputMethodListener,
*/
InputMethodRequests getClientInputMethodRequests() {
if (clientComponent != null) {
- return (InputMethodRequests) clientComponent.getInputMethodRequests();
+ return clientComponent.getInputMethodRequests();
}
return null;
diff --git a/jdk/src/share/classes/sun/awt/im/InputContext.java b/jdk/src/share/classes/sun/awt/im/InputContext.java
index 226b7f9ff79..27f05465d95 100644
--- a/jdk/src/share/classes/sun/awt/im/InputContext.java
+++ b/jdk/src/share/classes/sun/awt/im/InputContext.java
@@ -79,7 +79,7 @@ public class InputContext extends java.awt.im.InputContext
private boolean inputMethodCreationFailed;
// holding bin for previously used input method instances, but not the current one
- private HashMap usedInputMethods;
+ private HashMap usedInputMethods;
// the current client component is kept until the user focusses on a different
// client component served by the same input context. When that happens, we call
@@ -106,7 +106,7 @@ public class InputContext extends java.awt.im.InputContext
// cache location notification
private Rectangle clientWindowLocation = null;
// holding the state of clientWindowNotificationEnabled of only non-current input methods
- private HashMap perInputMethodState;
+ private HashMap perInputMethodState;
// Input Method selection hot key stuff
private static AWTKeyStroke inputMethodSelectionKey;
@@ -219,6 +219,7 @@ public class InputContext extends java.awt.im.InputContext
/**
* @see java.awt.im.InputContext#dispatchEvent
*/
+ @SuppressWarnings("fallthrough")
public void dispatchEvent(AWTEvent event) {
if (event instanceof InputMethodEvent) {
@@ -394,7 +395,7 @@ public class InputContext extends java.awt.im.InputContext
isInputMethodActive = true;
if (perInputMethodState != null) {
- Boolean state = (Boolean) perInputMethodState.remove(inputMethod);
+ Boolean state = perInputMethodState.remove(inputMethod);
if (state != null) {
clientWindowNotificationEnabled = state.booleanValue();
}
@@ -549,10 +550,10 @@ public class InputContext extends java.awt.im.InputContext
// keep the input method instance around for future use
if (usedInputMethods == null) {
- usedInputMethods = new HashMap(5);
+ usedInputMethods = new HashMap<>(5);
}
if (perInputMethodState == null) {
- perInputMethodState = new HashMap(5);
+ perInputMethodState = new HashMap<>(5);
}
usedInputMethods.put(inputMethodLocator.deriveLocator(null), inputMethod);
perInputMethodState.put(inputMethod,
@@ -689,10 +690,10 @@ public class InputContext extends java.awt.im.InputContext
}
inputMethodLocator = null;
if (usedInputMethods != null && !usedInputMethods.isEmpty()) {
- Iterator iterator = usedInputMethods.values().iterator();
+ Iterator iterator = usedInputMethods.values().iterator();
usedInputMethods = null;
while (iterator.hasNext()) {
- ((InputMethod) iterator.next()).dispose();
+ iterator.next().dispose();
}
}
@@ -830,13 +831,13 @@ public class InputContext extends java.awt.im.InputContext
// see whether we have a previously used input method
if (usedInputMethods != null) {
- inputMethodInstance = (InputMethod) usedInputMethods.remove(locator.deriveLocator(null));
+ inputMethodInstance = usedInputMethods.remove(locator.deriveLocator(null));
if (inputMethodInstance != null) {
if (locale != null) {
inputMethodInstance.setLocale(locale);
}
inputMethodInstance.setCharacterSubsets(characterSubsets);
- Boolean state = (Boolean) perInputMethodState.remove(inputMethodInstance);
+ Boolean state = perInputMethodState.remove(inputMethodInstance);
if (state != null) {
enableClientWindowNotification(inputMethodInstance, state.booleanValue());
}
@@ -919,7 +920,7 @@ public class InputContext extends java.awt.im.InputContext
// method becomes the current one.
if (requester != inputMethod) {
if (perInputMethodState == null) {
- perInputMethodState = new HashMap(5);
+ perInputMethodState = new HashMap<>(5);
}
perInputMethodState.put(requester, Boolean.valueOf(enable));
return;
@@ -1029,7 +1030,7 @@ public class InputContext extends java.awt.im.InputContext
* Initializes the input method selection key definition in preference trees
*/
private void initializeInputMethodSelectionKey() {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// Look in user's tree
Preferences root = Preferences.userRoot();
diff --git a/jdk/src/share/classes/sun/awt/im/InputMethodContext.java b/jdk/src/share/classes/sun/awt/im/InputMethodContext.java
index 78706ba4c97..98f35387931 100644
--- a/jdk/src/share/classes/sun/awt/im/InputMethodContext.java
+++ b/jdk/src/share/classes/sun/awt/im/InputMethodContext.java
@@ -72,12 +72,11 @@ public class InputMethodContext
static {
// check whether we should use below-the-spot input
// get property from command line
- String inputStyle = (String) AccessController.doPrivileged
+ String inputStyle = AccessController.doPrivileged
(new GetPropertyAction("java.awt.im.style", null));
// get property from awt.properties file
if (inputStyle == null) {
- inputStyle = Toolkit.getDefaultToolkit().
- getProperty("java.awt.im.style", null);
+ inputStyle = Toolkit.getProperty("java.awt.im.style", null);
}
belowTheSpotInputRequested = "below-the-spot".equals(inputStyle);
}
diff --git a/jdk/src/share/classes/sun/awt/im/InputMethodJFrame.java b/jdk/src/share/classes/sun/awt/im/InputMethodJFrame.java
index 602b46d4963..e83dc9eb1dd 100644
--- a/jdk/src/share/classes/sun/awt/im/InputMethodJFrame.java
+++ b/jdk/src/share/classes/sun/awt/im/InputMethodJFrame.java
@@ -68,4 +68,7 @@ public class InputMethodJFrame
return super.getInputContext();
}
}
+
+ // Proclaim serial compatibility with 1.7.0
+ private static final long serialVersionUID = -4705856747771842549L;
}
diff --git a/jdk/src/share/classes/sun/awt/im/InputMethodManager.java b/jdk/src/share/classes/sun/awt/im/InputMethodManager.java
index 1b99c3d5815..0e15b7e7fce 100644
--- a/jdk/src/share/classes/sun/awt/im/InputMethodManager.java
+++ b/jdk/src/share/classes/sun/awt/im/InputMethodManager.java
@@ -270,7 +270,7 @@ class ExecutableInputMethodManager extends InputMethodManager
// IM preference stuff
private static final String preferredIMNode = "/sun/awt/im/preferredInputMethod";
private static final String descriptorKey = "descriptor";
- private Hashtable preferredLocatorCache = new Hashtable();
+ private Hashtable preferredLocatorCache = new Hashtable<>();
private Preferences userRoot;
ExecutableInputMethodManager() {
@@ -430,7 +430,7 @@ class ExecutableInputMethodManager extends InputMethodManager
synchronized (javaInputMethodLocatorList) {
javaInputMethodLocatorList.clear();
try {
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() {
for (InputMethodDescriptor descriptor :
ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
@@ -611,7 +611,7 @@ class ExecutableInputMethodManager extends InputMethodManager
}
// look for the cached preference first.
- preferredLocator = (InputMethodLocator)preferredLocatorCache.get(locale.toString().intern());
+ preferredLocator = preferredLocatorCache.get(locale.toString().intern());
if (preferredLocator != null) {
return preferredLocator;
}
@@ -767,8 +767,8 @@ class ExecutableInputMethodManager extends InputMethodManager
}
private Preferences getUserRoot() {
- return (Preferences)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ public Preferences run() {
return Preferences.userRoot();
}
});
diff --git a/jdk/src/share/classes/sun/awt/im/SimpleInputMethodWindow.java b/jdk/src/share/classes/sun/awt/im/SimpleInputMethodWindow.java
index 2bcbdc316bd..5ed13409171 100644
--- a/jdk/src/share/classes/sun/awt/im/SimpleInputMethodWindow.java
+++ b/jdk/src/share/classes/sun/awt/im/SimpleInputMethodWindow.java
@@ -61,4 +61,7 @@ public class SimpleInputMethodWindow
return super.getInputContext();
}
}
+
+ // Proclaim serial compatibility with 1.7.0
+ private static final long serialVersionUID = 5093376647036461555L;
}
diff --git a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
index 239f8834ac5..5910c4bb4a4 100644
--- a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
+++ b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
@@ -323,8 +323,8 @@ public class BufImgSurfaceData extends SurfaceData {
}
public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
- if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
- sg2d.compositeState <= sg2d.COMP_ISCOPY)
+ if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
+ sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY)
{
return solidloops;
}
diff --git a/jdk/src/share/classes/sun/instrument/InstrumentationImpl.java b/jdk/src/share/classes/sun/instrument/InstrumentationImpl.java
index 359cdbdff3e..9957e1c64d4 100644
--- a/jdk/src/share/classes/sun/instrument/InstrumentationImpl.java
+++ b/jdk/src/share/classes/sun/instrument/InstrumentationImpl.java
@@ -136,7 +136,7 @@ public class InstrumentationImpl implements Instrumentation {
}
public void
- retransformClasses(Class>[] classes) {
+ retransformClasses(Class>... classes) {
if (!isRetransformClassesSupported()) {
throw new UnsupportedOperationException(
"retransformClasses is not supported in this environment");
@@ -150,7 +150,7 @@ public class InstrumentationImpl implements Instrumentation {
}
public void
- redefineClasses(ClassDefinition[] definitions)
+ redefineClasses(ClassDefinition... definitions)
throws ClassNotFoundException {
if (!isRedefineClassesSupported()) {
throw new UnsupportedOperationException("redefineClasses is not supported in this environment");
@@ -321,7 +321,7 @@ public class InstrumentationImpl implements Instrumentation {
try {
m = javaAgentClass.getDeclaredMethod( methodname,
- new Class[] {
+ new Class>[] {
String.class,
java.lang.instrument.Instrumentation.class
}
@@ -336,7 +336,7 @@ public class InstrumentationImpl implements Instrumentation {
// now try the declared 1-arg method
try {
m = javaAgentClass.getDeclaredMethod(methodname,
- new Class[] { String.class });
+ new Class>[] { String.class });
} catch (NoSuchMethodException x) {
// ignore this exception because we'll try
// two arg inheritance next
@@ -347,7 +347,7 @@ public class InstrumentationImpl implements Instrumentation {
// now try the inherited 2-arg method
try {
m = javaAgentClass.getMethod( methodname,
- new Class[] {
+ new Class>[] {
String.class,
java.lang.instrument.Instrumentation.class
}
@@ -363,7 +363,7 @@ public class InstrumentationImpl implements Instrumentation {
// finally try the inherited 1-arg method
try {
m = javaAgentClass.getMethod(methodname,
- new Class[] { String.class });
+ new Class>[] { String.class });
} catch (NoSuchMethodException x) {
// none of the methods exists so we throw the
// first NoSuchMethodException as per 5.0
@@ -411,7 +411,7 @@ public class InstrumentationImpl implements Instrumentation {
private byte[]
transform( ClassLoader loader,
String classname,
- Class classBeingRedefined,
+ Class> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer,
boolean isRetransformer) {
diff --git a/jdk/src/share/classes/sun/instrument/TransformerManager.java b/jdk/src/share/classes/sun/instrument/TransformerManager.java
index 2f8cfa1ae0f..b0a020570ef 100644
--- a/jdk/src/share/classes/sun/instrument/TransformerManager.java
+++ b/jdk/src/share/classes/sun/instrument/TransformerManager.java
@@ -169,7 +169,7 @@ public class TransformerManager
public byte[]
transform( ClassLoader loader,
String classname,
- Class classBeingRedefined,
+ Class> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
boolean someoneTouchedTheBytecode = false;
diff --git a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
index 8d9c2ea233f..4571b81167f 100644
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java
@@ -941,7 +941,7 @@ public final class SunGraphics2D
}
}
}
- Class paintClass = paint.getClass();
+ Class extends Paint> paintClass = paint.getClass();
if (paintClass == GradientPaint.class) {
paintState = PAINT_GRADIENT;
} else if (paintClass == LinearGradientPaint.class) {
@@ -1280,7 +1280,7 @@ public final class SunGraphics2D
interpolationHint = -1;
interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
boolean customHintPresent = false;
- Iterator iter = hints.keySet().iterator();
+ Iterator> iter = hints.keySet().iterator();
while (iter.hasNext()) {
Object key = iter.next();
if (key == SunHints.KEY_RENDERING ||
@@ -1311,7 +1311,7 @@ public final class SunGraphics2D
*/
public void addRenderingHints(Map,?> hints) {
boolean customHintPresent = false;
- Iterator iter = hints.keySet().iterator();
+ Iterator> iter = hints.keySet().iterator();
while (iter.hasNext()) {
Object key = iter.next();
if (key == SunHints.KEY_RENDERING ||
diff --git a/jdk/src/share/classes/sun/java2d/SurfaceData.java b/jdk/src/share/classes/sun/java2d/SurfaceData.java
index 9916c5b38a8..bd882343862 100644
--- a/jdk/src/share/classes/sun/java2d/SurfaceData.java
+++ b/jdk/src/share/classes/sun/java2d/SurfaceData.java
@@ -520,8 +520,8 @@ public abstract class SurfaceData
}
public boolean canRenderParallelograms(SunGraphics2D sg2d) {
- if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
- if (sg2d.compositeState == sg2d.COMP_XOR) {
+ if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
+ if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
if (havePgramXORLoop == LOOP_UNKNOWN) {
FillParallelogram loop =
FillParallelogram.locate(SurfaceType.AnyColor,
@@ -531,9 +531,9 @@ public abstract class SurfaceData
(loop != null) ? LOOP_FOUND : LOOP_NOTFOUND;
}
return havePgramXORLoop == LOOP_FOUND;
- } else if (sg2d.compositeState <= sg2d.COMP_ISCOPY &&
+ } else if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
- sg2d.clipState != sg2d.CLIP_SHAPE)
+ sg2d.clipState != SunGraphics2D.CLIP_SHAPE)
{
if (havePgramSolidLoop == LOOP_UNKNOWN) {
FillParallelogram loop =
@@ -551,8 +551,8 @@ public abstract class SurfaceData
public void validatePipe(SunGraphics2D sg2d) {
sg2d.imagepipe = imagepipe;
- if (sg2d.compositeState == sg2d.COMP_XOR) {
- if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) {
+ if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
+ if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) {
sg2d.drawpipe = paintViaShape;
sg2d.fillpipe = paintViaShape;
sg2d.shapepipe = paintShape;
@@ -576,7 +576,7 @@ public abstract class SurfaceData
converter = colorViaShape;
sg2d.shapepipe = colorPrimitives;
}
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = converter;
sg2d.fillpipe = converter;
// REMIND: We should not be changing text strategies
@@ -589,11 +589,11 @@ public abstract class SurfaceData
// which is not defined for XOR.
sg2d.textpipe = outlineTextRenderer;
} else {
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = converter;
sg2d.fillpipe = converter;
} else {
- if (sg2d.strokeState != sg2d.STROKE_THIN) {
+ if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
sg2d.drawpipe = converter;
} else {
sg2d.drawpipe = colorPrimitives;
@@ -604,9 +604,9 @@ public abstract class SurfaceData
}
// assert(sg2d.surfaceData == this);
}
- } else if (sg2d.compositeState == sg2d.COMP_CUSTOM) {
+ } else if (sg2d.compositeState == SunGraphics2D.COMP_CUSTOM) {
if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = AAClipCompViaShape;
sg2d.fillpipe = AAClipCompViaShape;
sg2d.shapepipe = AAClipCompViaShape;
@@ -621,7 +621,7 @@ public abstract class SurfaceData
sg2d.drawpipe = compViaShape;
sg2d.fillpipe = compViaShape;
sg2d.shapepipe = compShape;
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.textpipe = clipCompText;
} else {
sg2d.textpipe = compText;
@@ -631,7 +631,7 @@ public abstract class SurfaceData
sg2d.alphafill = getMaskFill(sg2d);
// assert(sg2d.surfaceData == this);
if (sg2d.alphafill != null) {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = AAClipColorViaShape;
sg2d.fillpipe = AAClipColorViaShape;
sg2d.shapepipe = AAClipColorViaShape;
@@ -644,8 +644,8 @@ public abstract class SurfaceData
sg2d.drawpipe = converter;
sg2d.fillpipe = converter;
sg2d.shapepipe = converter;
- if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR ||
- sg2d.compositeState > sg2d.COMP_ISCOPY)
+ if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR ||
+ sg2d.compositeState > SunGraphics2D.COMP_ISCOPY)
{
sg2d.textpipe = colorText;
} else {
@@ -653,7 +653,7 @@ public abstract class SurfaceData
}
}
} else {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = AAClipPaintViaShape;
sg2d.fillpipe = AAClipPaintViaShape;
sg2d.shapepipe = AAClipPaintViaShape;
@@ -665,9 +665,9 @@ public abstract class SurfaceData
sg2d.textpipe = paintText;
}
}
- } else if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR ||
- sg2d.compositeState > sg2d.COMP_ISCOPY ||
- sg2d.clipState == sg2d.CLIP_SHAPE)
+ } else if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR ||
+ sg2d.compositeState > SunGraphics2D.COMP_ISCOPY ||
+ sg2d.clipState == SunGraphics2D.CLIP_SHAPE)
{
sg2d.drawpipe = paintViaShape;
sg2d.fillpipe = paintViaShape;
@@ -675,13 +675,13 @@ public abstract class SurfaceData
sg2d.alphafill = getMaskFill(sg2d);
// assert(sg2d.surfaceData == this);
if (sg2d.alphafill != null) {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.textpipe = clipColorText;
} else {
sg2d.textpipe = colorText;
}
} else {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.textpipe = clipPaintText;
} else {
sg2d.textpipe = paintText;
@@ -700,11 +700,11 @@ public abstract class SurfaceData
converter = colorViaShape;
sg2d.shapepipe = colorPrimitives;
}
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = converter;
sg2d.fillpipe = converter;
} else {
- if (sg2d.strokeState != sg2d.STROKE_THIN) {
+ if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
sg2d.drawpipe = converter;
} else {
sg2d.drawpipe = colorPrimitives;
@@ -817,7 +817,7 @@ public abstract class SurfaceData
private static CompositeType getFillCompositeType(SunGraphics2D sg2d) {
CompositeType compType = sg2d.imageComp;
- if (sg2d.compositeState == sg2d.COMP_ISCOPY) {
+ if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) {
if (compType == CompositeType.SrcOverNoEa) {
compType = CompositeType.OpaqueSrcOverNoEa;
} else {
diff --git a/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java b/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java
index 638579cfebe..fefb50797ca 100644
--- a/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java
+++ b/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java
@@ -71,7 +71,7 @@ public abstract class SurfaceDataProxy
static {
cachingAllowed = true;
- String manimg = (String)AccessController.doPrivileged(
+ String manimg = AccessController.doPrivileged(
new GetPropertyAction("sun.java2d.managedimages"));
if (manimg != null && manimg.equals("false")) {
cachingAllowed = false;
@@ -79,7 +79,7 @@ public abstract class SurfaceDataProxy
}
defaultThreshold = 1;
- String num = (String)AccessController.doPrivileged(
+ String num = AccessController.doPrivileged(
new GetPropertyAction("sun.java2d.accthreshold"));
if (num != null) {
try {
diff --git a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java
index 664d5ff7e47..205da2f0d3b 100644
--- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java
+++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java
@@ -328,7 +328,7 @@ public abstract class GraphicsPrimitive {
static {
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace");
- String trace = (String)AccessController.doPrivileged(gpa);
+ String trace = AccessController.doPrivileged(gpa);
if (trace != null) {
boolean verbose = false;
int traceflags = 0;
@@ -391,9 +391,9 @@ public abstract class GraphicsPrimitive {
private static PrintStream getTraceOutputFile() {
if (traceout == null) {
if (tracefile != null) {
- Object o =
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ FileOutputStream o = AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public FileOutputStream run() {
try {
return new FileOutputStream(tracefile);
} catch (FileNotFoundException e) {
@@ -402,7 +402,7 @@ public abstract class GraphicsPrimitive {
}
});
if (o != null) {
- traceout = new PrintStream((OutputStream) o);
+ traceout = new PrintStream(o);
} else {
traceout = System.err;
}
@@ -415,8 +415,8 @@ public abstract class GraphicsPrimitive {
public static class TraceReporter extends Thread {
public static void setShutdownHook() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Void run() {
TraceReporter t = new TraceReporter();
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
diff --git a/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java b/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java
index bcce58eb215..907c6f3c550 100644
--- a/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java
+++ b/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java
@@ -56,7 +56,7 @@ import java.util.HashMap;
public final class SurfaceType {
private static int unusedUID = 1;
- private static HashMap surfaceUIDMap = new HashMap(100);
+ private static HashMap surfaceUIDMap = new HashMap<>(100);
/*
* CONSTANTS USED BY ALL PRIMITIVES TO DESCRIBE THE SURFACES
@@ -402,7 +402,7 @@ public final class SurfaceType {
}
public synchronized static final int makeUniqueID(String desc) {
- Integer i = (Integer) surfaceUIDMap.get((Object) desc);
+ Integer i = surfaceUIDMap.get(desc);
if (i == null) {
if (unusedUID > 255) {
diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java b/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java
index 994b46ec8ea..8d8366bbc77 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java
@@ -78,12 +78,12 @@ class OGLBufImgOps extends BufferedBufImgOps {
}
SurfaceData srcData =
- dstData.getSourceSurfaceData(img, sg.TRANSFORM_ISIDENT,
+ dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_ISIDENT,
CompositeType.SrcOver, null);
if (!(srcData instanceof OGLSurfaceData)) {
// REMIND: this hack tries to ensure that we have a cached texture
srcData =
- dstData.getSourceSurfaceData(img, sg.TRANSFORM_ISIDENT,
+ dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_ISIDENT,
CompositeType.SrcOver, null);
if (!(srcData instanceof OGLSurfaceData)) {
return false;
diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java b/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java
index 07a416ed950..9e373f22647 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java
@@ -60,7 +60,7 @@ public class OGLDrawImage extends DrawImage {
SurfaceData dstData = sg.surfaceData;
SurfaceData srcData =
dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_GENERIC,
+ SunGraphics2D.TRANSFORM_GENERIC,
sg.imageComp,
bgColor);
diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java b/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java
index 24b839ba805..62d400153f7 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java
@@ -123,14 +123,16 @@ abstract class OGLPaints {
}
SurfaceData srcData =
- dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT,
+ dstData.getSourceSurfaceData(bi,
+ SunGraphics2D.TRANSFORM_ISIDENT,
CompositeType.SrcOver, null);
if (!(srcData instanceof OGLSurfaceData)) {
// REMIND: this is a hack that attempts to cache the system
// memory image from the TexturePaint instance into an
// OpenGL texture...
srcData =
- dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT,
+ dstData.getSourceSurfaceData(bi,
+ SunGraphics2D.TRANSFORM_ISIDENT,
CompositeType.SrcOver, null);
if (!(srcData instanceof OGLSurfaceData)) {
return false;
diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java b/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
index ca6c9a65b01..3968f05d58f 100644
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
@@ -428,18 +428,18 @@ public abstract class OGLSurfaceData extends SurfaceData
// by the CompositeType.SrcNoEa (any color) test below.)
if (/* CompositeType.SrcNoEa (any color) */
- (sg2d.compositeState <= sg2d.COMP_ISCOPY &&
- sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) ||
+ (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
+ sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) ||
/* CompositeType.SrcOver (any color) */
- (sg2d.compositeState == sg2d.COMP_ALPHA &&
- sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
+ (sg2d.compositeState == SunGraphics2D.COMP_ALPHA &&
+ sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
(((AlphaComposite)sg2d.composite).getRule() ==
- AlphaComposite.SRC_OVER)) ||
+ AlphaComposite.SRC_OVER)) ||
/* CompositeType.Xor (any color) */
- (sg2d.compositeState == sg2d.COMP_XOR &&
- sg2d.paintState <= sg2d.PAINT_ALPHACOLOR))
+ (sg2d.compositeState == SunGraphics2D.COMP_XOR &&
+ sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR))
{
textpipe = oglTextPipe;
} else {
@@ -454,12 +454,12 @@ public abstract class OGLSurfaceData extends SurfaceData
OGLRenderer nonTxPipe = null;
if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
- if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
- if (sg2d.compositeState <= sg2d.COMP_XOR) {
+ if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
+ if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
txPipe = oglTxRenderPipe;
nonTxPipe = oglRenderPipe;
}
- } else if (sg2d.compositeState <= sg2d.COMP_ALPHA) {
+ } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
if (OGLPaints.isValid(sg2d)) {
txPipe = oglTxRenderPipe;
nonTxPipe = oglRenderPipe;
@@ -467,7 +467,7 @@ public abstract class OGLSurfaceData extends SurfaceData
// custom paints handled by super.validatePipe() below
}
} else {
- if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
+ if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
if (graphicsConfig.isCapPresent(CAPS_PS30) &&
(sg2d.imageComp == CompositeType.SrcOverNoEa ||
sg2d.imageComp == CompositeType.SrcOver))
@@ -484,7 +484,7 @@ public abstract class OGLSurfaceData extends SurfaceData
sg2d.drawpipe = aaConverter;
sg2d.fillpipe = aaConverter;
sg2d.shapepipe = aaConverter;
- } else if (sg2d.compositeState == sg2d.COMP_XOR) {
+ } else if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
// install the solid pipes when AA and XOR are both enabled
txPipe = oglTxRenderPipe;
nonTxPipe = oglRenderPipe;
@@ -494,10 +494,10 @@ public abstract class OGLSurfaceData extends SurfaceData
}
if (txPipe != null) {
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = txPipe;
sg2d.fillpipe = txPipe;
- } else if (sg2d.strokeState != sg2d.STROKE_THIN) {
+ } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
sg2d.drawpipe = txPipe;
sg2d.fillpipe = nonTxPipe;
} else {
@@ -524,7 +524,7 @@ public abstract class OGLSurfaceData extends SurfaceData
@Override
protected MaskFill getMaskFill(SunGraphics2D sg2d) {
- if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) {
+ if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) {
/*
* We can only accelerate non-Color MaskFill operations if
* all of the following conditions hold true:
@@ -548,8 +548,8 @@ public abstract class OGLSurfaceData extends SurfaceData
public boolean copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{
- if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE &&
- sg2d.compositeState < sg2d.COMP_XOR)
+ if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
+ sg2d.compositeState < SunGraphics2D.COMP_XOR)
{
x += sg2d.transX;
y += sg2d.transY;
diff --git a/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java b/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java
index eaa821d9022..7da9b58ea10 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java
@@ -144,7 +144,7 @@ public class AAShapePipe
public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) {
boolean adjust = (bs != null &&
sg.strokeHint != SunHints.INTVAL_STROKE_PURE);
- boolean thin = (sg.strokeState <= sg.STROKE_THINDASHED);
+ boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED);
Region clip = sg.getCompClip();
int abox[] = new int[4];
diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java
index 87ff6490bfd..afdfe6d2063 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java
@@ -247,7 +247,7 @@ public class BufferedPaints {
BufferedImage bi = paint.getImage();
SurfaceData dstData = sg2d.surfaceData;
SurfaceData srcData =
- dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT,
+ dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT,
CompositeType.SrcOver, null);
boolean filter =
(sg2d.interpolationType !=
diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java
index c5f30976958..3270a463c4c 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java
@@ -508,9 +508,9 @@ public abstract class BufferedRenderPipe
}
public void draw(SunGraphics2D sg2d, Shape s) {
- if (sg2d.strokeState == sg2d.STROKE_THIN) {
+ if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
if (s instanceof Polygon) {
- if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
Polygon p = (Polygon)s;
drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
return;
@@ -518,7 +518,7 @@ public abstract class BufferedRenderPipe
}
Path2D.Float p2df;
int transx, transy;
- if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
+ if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
@@ -532,7 +532,7 @@ public abstract class BufferedRenderPipe
transy = 0;
}
drawPath(sg2d, p2df, transx, transy);
- } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) {
+ } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
try {
fillSpans(sg2d, si, 0, 0);
@@ -547,11 +547,11 @@ public abstract class BufferedRenderPipe
public void fill(SunGraphics2D sg2d, Shape s) {
int transx, transy;
- if (sg2d.strokeState == sg2d.STROKE_THIN) {
+ if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
// Here we are able to use fillPath() for
// high-quality fills.
Path2D.Float p2df;
- if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
+ if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
@@ -569,7 +569,7 @@ public abstract class BufferedRenderPipe
}
AffineTransform at;
- if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
+ if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
// Transform (translation) will be done by FillSpans (we could
// delegate to fillPolygon() here, but most hardware accelerated
// libraries cannot handle non-convex polygons, so we will use
diff --git a/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java b/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java
index f702a68be68..510a46bd253 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java
@@ -146,7 +146,7 @@ public class DrawImage implements DrawImagePipe
int imgh = img.getHeight(null);
boolean checkfinalxform;
- if (sg.transformState <= sg.TRANSFORM_ANY_TRANSLATE &&
+ if (sg.transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE &&
(txtype == AffineTransform.TYPE_IDENTITY ||
txtype == AffineTransform.TYPE_TRANSLATION))
{
@@ -166,7 +166,7 @@ public class DrawImage implements DrawImagePipe
return;
}
checkfinalxform = false;
- } else if (sg.transformState <= sg.TRANSFORM_TRANSLATESCALE &&
+ } else if (sg.transformState <= SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
((txtype & (AffineTransform.TYPE_FLIP |
AffineTransform.TYPE_MASK_ROTATION |
AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0))
@@ -344,14 +344,14 @@ public class DrawImage implements DrawImagePipe
Region clip = sg.getCompClip();
SurfaceData dstData = sg.surfaceData;
SurfaceData srcData = dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_GENERIC,
+ SunGraphics2D.TRANSFORM_GENERIC,
sg.imageComp,
bgColor);
if (srcData == null) {
img = getBufferedImage(img);
srcData = dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_GENERIC,
+ SunGraphics2D.TRANSFORM_GENERIC,
sg.imageComp,
bgColor);
if (srcData == null) {
@@ -372,7 +372,7 @@ public class DrawImage implements DrawImagePipe
sx1 = sy1 = 0;
srcData = dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_GENERIC,
+ SunGraphics2D.TRANSFORM_GENERIC,
sg.imageComp,
bgColor);
}
@@ -398,7 +398,7 @@ public class DrawImage implements DrawImagePipe
sx1 = sy1 = 0;
srcData = dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_GENERIC,
+ SunGraphics2D.TRANSFORM_GENERIC,
sg.imageComp,
null);
srcType = srcData.getSurfaceType();
@@ -449,7 +449,7 @@ public class DrawImage implements DrawImagePipe
SurfaceType dstType = dstData.getSurfaceType();
MaskBlit maskblit;
Blit blit;
- if (sg.compositeState <= sg.COMP_ALPHA) {
+ if (sg.compositeState <= SunGraphics2D.COMP_ALPHA) {
/* NOTE: We either have, or we can make,
* a MaskBlit for any alpha composite type
*/
@@ -565,7 +565,7 @@ public class DrawImage implements DrawImagePipe
while (true) {
SurfaceData srcData =
dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_ISIDENT,
+ SunGraphics2D.TRANSFORM_ISIDENT,
sg.imageComp,
bgColor);
if (srcData == null) {
@@ -628,7 +628,7 @@ public class DrawImage implements DrawImagePipe
while (true) {
SurfaceData srcData =
dstData.getSourceSurfaceData(img,
- sg.TRANSFORM_TRANSLATESCALE,
+ SunGraphics2D.TRANSFORM_TRANSLATESCALE,
sg.imageComp,
bgColor);
@@ -800,11 +800,11 @@ public class DrawImage implements DrawImagePipe
public static boolean isSimpleTranslate(SunGraphics2D sg) {
int ts = sg.transformState;
- if (ts <= sg.TRANSFORM_INT_TRANSLATE) {
+ if (ts <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
// Integer translates are always "simple"
return true;
}
- if (ts >= sg.TRANSFORM_TRANSLATESCALE) {
+ if (ts >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
// Scales and beyond are always "not simple"
return false;
}
@@ -846,8 +846,11 @@ public class DrawImage implements DrawImagePipe
}
int type = tx.getType();
boolean needTrans =
- ((type&(tx.TYPE_MASK_ROTATION|tx.TYPE_GENERAL_TRANSFORM)) != 0);
- if (! needTrans && type != tx.TYPE_TRANSLATION && type != tx.TYPE_IDENTITY)
+ ((type & (AffineTransform.TYPE_MASK_ROTATION |
+ AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0);
+ if (! needTrans &&
+ type != AffineTransform.TYPE_TRANSLATION &&
+ type != AffineTransform.TYPE_IDENTITY)
{
double[] mtx = new double[4];
tx.getMatrix(mtx);
@@ -861,7 +864,7 @@ public class DrawImage implements DrawImagePipe
Raster raster = bImg.getRaster();
IndexColorModel icm = (IndexColorModel) cm;
// Just need to make sure that we have a transparent pixel
- if (needTrans && cm.getTransparency() == cm.OPAQUE) {
+ if (needTrans && cm.getTransparency() == Transparency.OPAQUE) {
// Fix 4221407
if (raster instanceof sun.awt.image.BytePackedRaster) {
dstCM = ColorModel.getRGBdefault();
@@ -892,7 +895,7 @@ public class DrawImage implements DrawImagePipe
} /* raster instanceof sun.awt.image.BytePackedRaster */
} /* if (cm.getTransparency() == cm.OPAQUE) */
} /* if (cm instanceof IndexColorModel) */
- else if (needTrans && cm.getTransparency() == cm.OPAQUE) {
+ else if (needTrans && cm.getTransparency() == Transparency.OPAQUE) {
// Need a bitmask transparency
// REMIND: for now, use full transparency since no loops
// for bitmask
@@ -902,7 +905,7 @@ public class DrawImage implements DrawImagePipe
else {
if (cm instanceof IndexColorModel ||
- (needTrans && cm.getTransparency() == cm.OPAQUE))
+ (needTrans && cm.getTransparency() == Transparency.OPAQUE))
{
// Need a bitmask transparency
// REMIND: for now, use full transparency since no loops
diff --git a/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java b/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java
index 5a44749c4e9..0467290cb8b 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java
@@ -54,7 +54,7 @@ public abstract class GlyphListPipe implements TextPipe {
}
float devx, devy;
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
double origin[] = {x + info.originX, y + info.originY};
sg2d.transform.transform(origin, 0, origin, 0, 1);
devx = (float)origin[0];
@@ -90,7 +90,7 @@ public abstract class GlyphListPipe implements TextPipe {
sg2d, data, offset, length, ix, iy);
return;
}
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
double origin[] = {ix + info.originX, iy + info.originY};
sg2d.transform.transform(origin, 0, origin, 0, 1);
x = (float) origin[0];
@@ -122,7 +122,7 @@ public abstract class GlyphListPipe implements TextPipe {
SurfaceData.outlineTextRenderer.drawGlyphVector(sg2d, gv, x, y);
return;
}
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
double origin[] = {x, y};
sg2d.transform.transform(origin, 0, origin, 0, 1);
x = (float) origin[0];
diff --git a/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java b/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java
index e975cc9c3cd..e70ab694795 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java
@@ -171,11 +171,11 @@ public class LoopPipe
public void draw(SunGraphics2D sg2d, Shape s) {
- if (sg2d.strokeState == sg2d.STROKE_THIN) {
+ if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
Path2D.Float p2df;
int transX;
int transY;
- if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
+ if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
@@ -193,7 +193,7 @@ public class LoopPipe
return;
}
- if (sg2d.strokeState == sg2d.STROKE_CUSTOM) {
+ if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM) {
fill(sg2d, sg2d.stroke.createStrokedShape(s));
return;
}
@@ -271,7 +271,7 @@ public class LoopPipe
sr.setRule(PathIterator.WIND_NON_ZERO);
BasicStroke bs = (BasicStroke) sg2d.stroke;
- boolean thin = (sg2d.strokeState <= sg2d.STROKE_THINDASHED);
+ boolean thin = (sg2d.strokeState <= SunGraphics2D.STROKE_THINDASHED);
boolean normalize =
(sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE);
@@ -288,11 +288,11 @@ public class LoopPipe
}
public void fill(SunGraphics2D sg2d, Shape s) {
- if (sg2d.strokeState == sg2d.STROKE_THIN) {
+ if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
Path2D.Float p2df;
int transX;
int transY;
- if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
+ if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
if (s instanceof Path2D.Float) {
p2df = (Path2D.Float)s;
} else {
@@ -314,7 +314,7 @@ public class LoopPipe
try {
sr.setOutputArea(sg2d.getCompClip());
AffineTransform at =
- ((sg2d.transformState == sg2d.TRANSFORM_ISIDENT)
+ ((sg2d.transformState == SunGraphics2D.TRANSFORM_ISIDENT)
? null
: sg2d.transform);
sr.appendPath(s.getPathIterator(at));
@@ -328,7 +328,7 @@ public class LoopPipe
// REMIND: Eventually, the plan is that it will not be possible for
// fs to be null since the FillSpans loop will be the fundamental
// loop implemented for any destination type...
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
si = sg2d.clipRegion.filter(si);
// REMIND: Region.filter produces a Java-only iterator
// with no native counterpart...
diff --git a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java
index e2913ab45e3..83b691186ce 100644
--- a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java
+++ b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java
@@ -117,16 +117,16 @@ public abstract class RenderingEngine {
return reImpl;
}
- reImpl = (RenderingEngine)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ reImpl =
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public RenderingEngine run() {
final String ductusREClass = "sun.dc.DuctusRenderingEngine";
String reClass =
System.getProperty("sun.java2d.renderer", ductusREClass);
if (reClass.equals(ductusREClass)) {
try {
- Class cls = Class.forName(ductusREClass);
- return cls.newInstance();
+ Class> cls = Class.forName(ductusREClass);
+ return (RenderingEngine) cls.newInstance();
} catch (ReflectiveOperationException ignored) {
// not found
}
@@ -153,7 +153,7 @@ public abstract class RenderingEngine {
GetPropertyAction gpa =
new GetPropertyAction("sun.java2d.renderer.trace");
- String reTrace = (String) AccessController.doPrivileged(gpa);
+ String reTrace = AccessController.doPrivileged(gpa);
if (reTrace != null) {
reImpl = new Tracer(reImpl);
}
diff --git a/jdk/src/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/share/classes/sun/launcher/LauncherHelper.java
index 24eeaca2cc1..2f3710bce10 100644
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java
@@ -428,7 +428,7 @@ public enum LauncherHelper {
if (t != null) {
t.printStackTrace();
} else {
- Thread.currentThread().dumpStack();
+ Thread.dumpStack();
}
}
System.exit(1);
diff --git a/jdk/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java b/jdk/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java
index 154174407ba..eb7ae7ac332 100644
--- a/jdk/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java
+++ b/jdk/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java
@@ -169,17 +169,15 @@ public class PerfInstrumentation {
Matcher matcher = pattern.matcher("");
List matches = new ArrayList();
- Iterator iter = map.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry me = (Map.Entry) iter.next();
- String name = (String) me.getKey();
+ for (Map.Entry me: map.entrySet()) {
+ String name = me.getKey();
// apply pattern to counter name
matcher.reset(name);
// if the pattern matches, then add Counter to list
if (matcher.lookingAt()) {
- matches.add((Counter)me.getValue());
+ matches.add(me.getValue());
}
}
return matches;
diff --git a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
index 3e480891772..a3b318a8cec 100644
--- a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
+++ b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
@@ -233,16 +233,14 @@ public final class ConnectorBootstrap {
"the access file [" + accessFile + "] as the " +
"authenticated Subject is null");
}
- final Set principals = subject.getPrincipals();
- for (Iterator i = principals.iterator(); i.hasNext();) {
- final Principal p = (Principal) i.next();
+ final Set principals = subject.getPrincipals();
+ for (Principal p: principals) {
if (properties.containsKey(p.getName())) {
return;
}
}
final Set principalsStr = new HashSet();
- for (Iterator i = principals.iterator(); i.hasNext();) {
- final Principal p = (Principal) i.next();
+ for (Principal p: principals) {
principalsStr.add(p.getName());
}
throw new SecurityException(
@@ -653,7 +651,7 @@ public final class ConnectorBootstrap {
}
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm());
- tmf.init((KeyStore) ts);
+ tmf.init(ts);
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
diff --git a/jdk/src/share/classes/sun/misc/BASE64Decoder.java b/jdk/src/share/classes/sun/misc/BASE64Decoder.java
index 63f1228ad98..d4132529f91 100644
--- a/jdk/src/share/classes/sun/misc/BASE64Decoder.java
+++ b/jdk/src/share/classes/sun/misc/BASE64Decoder.java
@@ -102,6 +102,7 @@ public class BASE64Decoder extends CharacterDecoder {
/**
* Decode one BASE64 atom into 1, 2, or 3 bytes of data.
*/
+ @SuppressWarnings("fallthrough")
protected void decodeAtom(PushbackInputStream inStream, OutputStream outStream, int rem)
throws java.io.IOException
{
diff --git a/jdk/src/share/classes/sun/misc/CEFormatException.java b/jdk/src/share/classes/sun/misc/CEFormatException.java
index 974a55ca116..0b3aa0514c6 100644
--- a/jdk/src/share/classes/sun/misc/CEFormatException.java
+++ b/jdk/src/share/classes/sun/misc/CEFormatException.java
@@ -28,7 +28,9 @@ package sun.misc;
import java.io.IOException;
public class CEFormatException extends IOException {
- public CEFormatException(String s) {
- super(s);
- }
+ static final long serialVersionUID = -7139121221067081482L;
+ public CEFormatException(String s) {
+ super(s);
+ }
}
+
diff --git a/jdk/src/share/classes/sun/misc/CEStreamExhausted.java b/jdk/src/share/classes/sun/misc/CEStreamExhausted.java
index 28e0ffe6ae3..d346d550772 100644
--- a/jdk/src/share/classes/sun/misc/CEStreamExhausted.java
+++ b/jdk/src/share/classes/sun/misc/CEStreamExhausted.java
@@ -27,4 +27,7 @@ package sun.misc;
import java.io.IOException;
/** This exception is thrown when EOF is reached */
-public class CEStreamExhausted extends IOException { };
+public class CEStreamExhausted extends IOException {
+ static final long serialVersionUID = -5889118049525891904L;
+}
+
diff --git a/jdk/src/share/classes/sun/misc/ClassLoaderUtil.java b/jdk/src/share/classes/sun/misc/ClassLoaderUtil.java
index 61106dbb73b..81f00d4ac40 100644
--- a/jdk/src/share/classes/sun/misc/ClassLoaderUtil.java
+++ b/jdk/src/share/classes/sun/misc/ClassLoaderUtil.java
@@ -79,9 +79,9 @@ public class ClassLoaderUtil {
URLClassPath ucp = SharedSecrets.getJavaNetAccess()
.getURLClassPath(classLoader);
- ArrayList loaders = ucp.loaders;
- Stack urls = ucp.urls;
- HashMap lmap = ucp.lmap;
+ ArrayList> loaders = ucp.loaders;
+ Stack> urls = ucp.urls;
+ HashMap,?> lmap = ucp.lmap;
/*
*The urls variable in the URLClassPath object holds URLs that have not yet
diff --git a/jdk/src/share/classes/sun/misc/CompoundEnumeration.java b/jdk/src/share/classes/sun/misc/CompoundEnumeration.java
index 69de7f89753..fc3ecea3e9f 100644
--- a/jdk/src/share/classes/sun/misc/CompoundEnumeration.java
+++ b/jdk/src/share/classes/sun/misc/CompoundEnumeration.java
@@ -33,10 +33,10 @@ import java.util.NoSuchElementException;
* enumerations.
*/
public class CompoundEnumeration implements Enumeration {
- private Enumeration[] enums;
+ private Enumeration[] enums;
private int index = 0;
- public CompoundEnumeration(Enumeration[] enums) {
+ public CompoundEnumeration(Enumeration[] enums) {
this.enums = enums;
}
@@ -58,6 +58,6 @@ public class CompoundEnumeration implements Enumeration {
if (!next()) {
throw new NoSuchElementException();
}
- return (E)enums[index].nextElement();
+ return enums[index].nextElement();
}
}
diff --git a/jdk/src/share/classes/sun/misc/ExtensionDependency.java b/jdk/src/share/classes/sun/misc/ExtensionDependency.java
index ca9ad721486..81a77747178 100644
--- a/jdk/src/share/classes/sun/misc/ExtensionDependency.java
+++ b/jdk/src/share/classes/sun/misc/ExtensionDependency.java
@@ -70,7 +70,7 @@ import sun.net.www.ParseUtil;
public class ExtensionDependency {
/* Callbak interfaces to delegate installation of missing extensions */
- private static Vector providers;
+ private static Vector providers;
/**
*
@@ -83,7 +83,7 @@ public class ExtensionDependency {
(ExtensionInstallationProvider eip)
{
if (providers == null) {
- providers = new Vector();
+ providers = new Vector<>();
}
providers.add(eip);
}
@@ -93,7 +93,7 @@ public class ExtensionDependency {
* Unregister a previously installed installation provider
*
*/
- public synchronized static void removeExtensionInstallationProvider
+ public synchronized static void removeExtensionInstallationProvider
(ExtensionInstallationProvider eip)
{
providers.remove(eip);
@@ -348,14 +348,16 @@ public class ExtensionDependency {
ExtensionInfo instInfo)
throws ExtensionInstallationException
{
-
- Vector currentProviders;
+ Vector currentProviders;
synchronized(providers) {
- currentProviders = (Vector) providers.clone();
+ @SuppressWarnings("unchecked")
+ Vector tmp =
+ (Vector) providers.clone();
+ currentProviders = tmp;
}
- for (Enumeration e=currentProviders.elements();e.hasMoreElements();) {
- ExtensionInstallationProvider eip =
- (ExtensionInstallationProvider) e.nextElement();
+ for (Enumeration e = currentProviders.elements();
+ e.hasMoreElements();) {
+ ExtensionInstallationProvider eip = e.nextElement();
if (eip!=null) {
// delegate the installation to the provider
diff --git a/jdk/src/share/classes/sun/misc/ExtensionInstallationException.java b/jdk/src/share/classes/sun/misc/ExtensionInstallationException.java
index 61f484a786d..156ba0babb4 100644
--- a/jdk/src/share/classes/sun/misc/ExtensionInstallationException.java
+++ b/jdk/src/share/classes/sun/misc/ExtensionInstallationException.java
@@ -34,6 +34,8 @@ package sun.misc;
public class ExtensionInstallationException extends Exception {
+ static final long serialVersionUID = 3139688306909345924L;
+
/*
*
* Construct a new exception with an exception reason
diff --git a/jdk/src/share/classes/sun/misc/FloatingDecimal.java b/jdk/src/share/classes/sun/misc/FloatingDecimal.java
index 4df0487c88e..478f120035c 100644
--- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java
+++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java
@@ -325,7 +325,7 @@ public class FloatingDecimal{
// can do int arithmetic rather than long!
int ivalue = (int)lvalue;
ndigits = 10;
- digits = (char[])(perThreadBuffer.get());
+ digits = perThreadBuffer.get();
digitno = ndigits-1;
c = ivalue%10;
ivalue /= 10;
@@ -345,7 +345,7 @@ public class FloatingDecimal{
// same algorithm as above (same bugs, too )
// but using long arithmetic.
ndigits = 20;
- digits = (char[])(perThreadBuffer.get());
+ digits = perThreadBuffer.get();
digitno = ndigits-1;
c = (int)(lvalue%10L);
lvalue /= 10L;
@@ -477,9 +477,9 @@ public class FloatingDecimal{
}
// Begin to unpack
// Discover obvious special cases of NaN and Infinity.
- binExp = (int)( (fBits&singleExpMask) >> singleExpShift );
+ binExp = (fBits&singleExpMask) >> singleExpShift;
fractBits = fBits&singleFractMask;
- if ( binExp == (int)(singleExpMask>>singleExpShift) ) {
+ if ( binExp == (singleExpMask>>singleExpShift) ) {
isExceptional = true;
if ( fractBits == 0L ){
digits = infinity;
@@ -900,7 +900,7 @@ public class FloatingDecimal{
}
public String toJavaFormatString() {
- char result[] = (char[])(perThreadBuffer.get());
+ char result[] = perThreadBuffer.get();
int i = getChars(result);
return new String(result, 0, i);
}
@@ -978,14 +978,14 @@ public class FloatingDecimal{
}
// Per-thread buffer for string/stringbuffer conversion
- private static ThreadLocal perThreadBuffer = new ThreadLocal() {
- protected synchronized Object initialValue() {
+ private static ThreadLocal perThreadBuffer = new ThreadLocal() {
+ protected synchronized char[] initialValue() {
return new char[26];
}
};
public void appendTo(Appendable buf) {
- char result[] = (char[])(perThreadBuffer.get());
+ char result[] = perThreadBuffer.get();
int i = getChars(result);
if (buf instanceof StringBuilder)
((StringBuilder) buf).append(result, 0, i);
@@ -995,6 +995,7 @@ public class FloatingDecimal{
assert false;
}
+ @SuppressWarnings("fallthrough")
public static FloatingDecimal
readJavaFormatString( String in ) throws NumberFormatException {
boolean isNegative = false;
@@ -2209,7 +2210,7 @@ public class FloatingDecimal{
// exponent correctly, even in the case of
// Double.MAX_VALUE overflowing to infinity.
- significand = (( ((long)exponent +
+ significand = (( (exponent +
(long)DoubleConsts.EXP_BIAS) <<
(DoubleConsts.SIGNIFICAND_WIDTH-1))
& DoubleConsts.EXP_BIT_MASK) |
diff --git a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java
index 261dbc07e2f..5532b92c3ea 100644
--- a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java
+++ b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java
@@ -333,7 +333,7 @@ public class FormattedFloatingDecimal{
// can do int arithmetic rather than long!
int ivalue = (int)lvalue;
ndigits = 10;
- digits = (char[])(perThreadBuffer.get());
+ digits = perThreadBuffer.get();
digitno = ndigits-1;
c = ivalue%10;
ivalue /= 10;
@@ -353,7 +353,7 @@ public class FormattedFloatingDecimal{
// same algorithm as above (same bugs, too )
// but using long arithmetic.
ndigits = 20;
- digits = (char[])(perThreadBuffer.get());
+ digits = perThreadBuffer.get();
digitno = ndigits-1;
c = (int)(lvalue%10L);
lvalue /= 10L;
@@ -554,9 +554,9 @@ public class FormattedFloatingDecimal{
}
// Begin to unpack
// Discover obvious special cases of NaN and Infinity.
- binExp = (int)( (fBits&singleExpMask) >> singleExpShift );
+ binExp = (fBits&singleExpMask) >> singleExpShift;
fractBits = fBits&singleFractMask;
- if ( binExp == (int)(singleExpMask>>singleExpShift) ) {
+ if ( binExp == (singleExpMask>>singleExpShift) ) {
isExceptional = true;
if ( fractBits == 0L ){
digits = infinity;
@@ -1140,8 +1140,8 @@ public class FormattedFloatingDecimal{
}
// Per-thread buffer for string/stringbuffer conversion
- private static ThreadLocal perThreadBuffer = new ThreadLocal() {
- protected synchronized Object initialValue() {
+ private static ThreadLocal perThreadBuffer = new ThreadLocal() {
+ protected synchronized char[] initialValue() {
return new char[26];
}
};
diff --git a/jdk/src/share/classes/sun/misc/InvalidJarIndexException.java b/jdk/src/share/classes/sun/misc/InvalidJarIndexException.java
index 83e81991f7d..4c6de5d1d83 100644
--- a/jdk/src/share/classes/sun/misc/InvalidJarIndexException.java
+++ b/jdk/src/share/classes/sun/misc/InvalidJarIndexException.java
@@ -38,6 +38,8 @@ import java.lang.LinkageError;
public
class InvalidJarIndexException extends RuntimeException {
+ static final long serialVersionUID = -6159797516569680148L;
+
/**
* Constructs an InvalidJarIndexException with no
* detail message.
diff --git a/jdk/src/share/classes/sun/misc/JarIndex.java b/jdk/src/share/classes/sun/misc/JarIndex.java
index f9781d65a0d..02f3c529c43 100644
--- a/jdk/src/share/classes/sun/misc/JarIndex.java
+++ b/jdk/src/share/classes/sun/misc/JarIndex.java
@@ -48,13 +48,13 @@ public class JarIndex {
* The hash map that maintains mappings from
* package/classe/resource to jar file list(s)
*/
- private HashMap indexMap;
+ private HashMap> indexMap;
/**
* The hash map that maintains mappings from
* jar file to package/class/resource lists
*/
- private HashMap jarMap;
+ private HashMap> jarMap;
/*
* An ordered list of jar file names.
@@ -78,8 +78,8 @@ public class JarIndex {
* Constructs a new, empty jar index.
*/
public JarIndex() {
- indexMap = new HashMap();
- jarMap = new HashMap();
+ indexMap = new HashMap<>();
+ jarMap = new HashMap<>();
}
/**
@@ -150,10 +150,11 @@ public class JarIndex {
* Add the key, value pair to the hashmap, the value will
* be put in a linked list which is created if necessary.
*/
- private void addToList(String key, String value, HashMap t) {
- LinkedList list = (LinkedList)t.get(key);
+ private void addToList(String key, String value,
+ HashMap> t) {
+ LinkedList list = t.get(key);
if (list == null) {
- list = new LinkedList();
+ list = new LinkedList<>();
list.add(value);
t.put(key, list);
} else if (!list.contains(value)) {
@@ -166,13 +167,13 @@ public class JarIndex {
*
* @param fileName the key of the mapping
*/
- public LinkedList get(String fileName) {
- LinkedList jarFiles = null;
- if ((jarFiles = (LinkedList)indexMap.get(fileName)) == null) {
+ public LinkedList get(String fileName) {
+ LinkedList jarFiles = null;
+ if ((jarFiles = indexMap.get(fileName)) == null) {
/* try the package name again */
int pos;
if((pos = fileName.lastIndexOf("/")) != -1) {
- jarFiles = (LinkedList)indexMap.get(fileName.substring(0, pos));
+ jarFiles = indexMap.get(fileName.substring(0, pos));
}
}
return jarFiles;
@@ -235,9 +236,9 @@ public class JarIndex {
ZipFile zrf = new ZipFile(currentJar.replace
('/', File.separatorChar));
- Enumeration entries = zrf.entries();
+ Enumeration extends ZipEntry> entries = zrf.entries();
while(entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) entries.nextElement();
+ ZipEntry entry = entries.nextElement();
String fileName = entry.getName();
// Skip the META-INF directory, the index, and manifest.
@@ -282,11 +283,11 @@ public class JarIndex {
/* print out the jar file name */
String jar = jarFiles[i];
bw.write(jar + "\n");
- LinkedList jarlist = (LinkedList)jarMap.get(jar);
+ LinkedList jarlist = jarMap.get(jar);
if (jarlist != null) {
- Iterator listitr = jarlist.iterator();
+ Iterator listitr = jarlist.iterator();
while(listitr.hasNext()) {
- bw.write((String)(listitr.next()) + "\n");
+ bw.write(listitr.next() + "\n");
}
}
bw.write("\n");
@@ -309,7 +310,7 @@ public class JarIndex {
String currentJar = null;
/* an ordered list of jar file names */
- Vector jars = new Vector();
+ Vector jars = new Vector<>();
/* read until we see a .jar line */
while((line = br.readLine()) != null && !line.endsWith(".jar"));
@@ -328,7 +329,7 @@ public class JarIndex {
}
}
- jarFiles = (String[])jars.toArray(new String[jars.size()]);
+ jarFiles = jars.toArray(new String[jars.size()]);
}
/**
@@ -342,14 +343,14 @@ public class JarIndex {
*
*/
public void merge(JarIndex toIndex, String path) {
- Iterator itr = indexMap.entrySet().iterator();
+ Iterator>> itr = indexMap.entrySet().iterator();
while(itr.hasNext()) {
- Map.Entry e = (Map.Entry)itr.next();
- String packageName = (String)e.getKey();
- LinkedList from_list = (LinkedList)e.getValue();
- Iterator listItr = from_list.iterator();
+ Map.Entry> e = itr.next();
+ String packageName = e.getKey();
+ LinkedList from_list = e.getValue();
+ Iterator listItr = from_list.iterator();
while(listItr.hasNext()) {
- String jarName = (String)listItr.next();
+ String jarName = listItr.next();
if (path != null) {
jarName = path.concat(jarName);
}
diff --git a/jdk/src/share/classes/sun/misc/JavaLangAccess.java b/jdk/src/share/classes/sun/misc/JavaLangAccess.java
index c61f590cdda..d4805d87d45 100644
--- a/jdk/src/share/classes/sun/misc/JavaLangAccess.java
+++ b/jdk/src/share/classes/sun/misc/JavaLangAccess.java
@@ -31,19 +31,19 @@ import sun.nio.ch.Interruptible;
public interface JavaLangAccess {
/** Return the constant pool for a class. */
- ConstantPool getConstantPool(Class klass);
+ ConstantPool getConstantPool(Class> klass);
/**
* Set the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.)
*/
- void setAnnotationType(Class klass, AnnotationType annotationType);
+ void setAnnotationType(Class> klass, AnnotationType annotationType);
/**
* Get the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.)
*/
- AnnotationType getAnnotationType(Class klass);
+ AnnotationType getAnnotationType(Class> klass);
/**
* Returns the elements of an enum class or null if the
diff --git a/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java b/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java
index 0f1efd1d2cb..81654824c3a 100644
--- a/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java
+++ b/jdk/src/share/classes/sun/misc/JavaUtilJarAccess.java
@@ -40,5 +40,5 @@ public interface JavaUtilJarAccess {
public Enumeration entryNames(JarFile jar, CodeSource[] cs);
public Enumeration entries2(JarFile jar);
public void setEagerValidation(JarFile jar, boolean eager);
- public List getManifestDigests(JarFile jar);
+ public List getManifestDigests(JarFile jar);
}
diff --git a/jdk/src/share/classes/sun/misc/LRUCache.java b/jdk/src/share/classes/sun/misc/LRUCache.java
index d4b95547bc9..f40f65a7a80 100644
--- a/jdk/src/share/classes/sun/misc/LRUCache.java
+++ b/jdk/src/share/classes/sun/misc/LRUCache.java
@@ -52,7 +52,9 @@ public abstract class LRUCache {
public V forName(N name) {
if (oa == null) {
- oa = (V[])new Object[size];
+ @SuppressWarnings("unchecked")
+ V[] temp = (V[])new Object[size];
+ oa = temp;
} else {
for (int i = 0; i < oa.length; i++) {
V ob = oa[i];
diff --git a/jdk/src/share/classes/sun/misc/Launcher.java b/jdk/src/share/classes/sun/misc/Launcher.java
index 3d9b336edc2..71b3d3bbce8 100644
--- a/jdk/src/share/classes/sun/misc/Launcher.java
+++ b/jdk/src/share/classes/sun/misc/Launcher.java
@@ -295,7 +295,7 @@ public class Launcher {
/**
* Override loadClass so we can checkPackageAccess.
*/
- public Class loadClass(String name, boolean resolve)
+ public Class> loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
int i = name.lastIndexOf('.');
@@ -473,7 +473,7 @@ public class Launcher {
public URLStreamHandler createURLStreamHandler(String protocol) {
String name = PREFIX + "." + protocol + ".Handler";
try {
- Class c = Class.forName(name);
+ Class> c = Class.forName(name);
return (URLStreamHandler)c.newInstance();
} catch (ReflectiveOperationException e) {
throw new InternalError("could not load " + protocol +
diff --git a/jdk/src/share/classes/sun/misc/ProxyGenerator.java b/jdk/src/share/classes/sun/misc/ProxyGenerator.java
index c66f82ce8f1..4b5e3613336 100644
--- a/jdk/src/share/classes/sun/misc/ProxyGenerator.java
+++ b/jdk/src/share/classes/sun/misc/ProxyGenerator.java
@@ -351,7 +351,7 @@ public class ProxyGenerator {
try {
hashCodeMethod = Object.class.getMethod("hashCode");
equalsMethod =
- Object.class.getMethod("equals", new Class[] { Object.class });
+ Object.class.getMethod("equals", new Class>[] { Object.class });
toStringMethod = Object.class.getMethod("toString");
} catch (NoSuchMethodException e) {
throw new NoSuchMethodError(e.getMessage());
@@ -559,11 +559,11 @@ public class ProxyGenerator {
* passed to the invocation handler's "invoke" method for a given
* set of duplicate methods.
*/
- private void addProxyMethod(Method m, Class fromClass) {
+ private void addProxyMethod(Method m, Class> fromClass) {
String name = m.getName();
- Class[] parameterTypes = m.getParameterTypes();
- Class returnType = m.getReturnType();
- Class[] exceptionTypes = m.getExceptionTypes();
+ Class>[] parameterTypes = m.getParameterTypes();
+ Class> returnType = m.getReturnType();
+ Class>[] exceptionTypes = m.getExceptionTypes();
String sig = name + getParameterDescriptors(parameterTypes);
List sigmethods = proxyMethods.get(sig);
@@ -581,7 +581,7 @@ public class ProxyGenerator {
exceptionTypes, pm.exceptionTypes, legalExceptions);
collectCompatibleTypes(
pm.exceptionTypes, exceptionTypes, legalExceptions);
- pm.exceptionTypes = new Class[legalExceptions.size()];
+ pm.exceptionTypes = new Class>[legalExceptions.size()];
pm.exceptionTypes =
legalExceptions.toArray(pm.exceptionTypes);
return;
@@ -848,15 +848,15 @@ public class ProxyGenerator {
private class ProxyMethod {
public String methodName;
- public Class[] parameterTypes;
- public Class returnType;
- public Class[] exceptionTypes;
- public Class fromClass;
+ public Class>[] parameterTypes;
+ public Class> returnType;
+ public Class>[] exceptionTypes;
+ public Class> fromClass;
public String methodFieldName;
- private ProxyMethod(String methodName, Class[] parameterTypes,
- Class returnType, Class[] exceptionTypes,
- Class fromClass)
+ private ProxyMethod(String methodName, Class>[] parameterTypes,
+ Class> returnType, Class>[] exceptionTypes,
+ Class> fromClass)
{
this.methodName = methodName;
this.parameterTypes = parameterTypes;
@@ -1001,7 +1001,7 @@ public class ProxyGenerator {
* invocation handler's "invoke" method. The code is written
* to the supplied stream.
*/
- private void codeWrapArgument(Class type, int slot,
+ private void codeWrapArgument(Class> type, int slot,
DataOutputStream out)
throws IOException
{
@@ -1042,7 +1042,7 @@ public class ProxyGenerator {
* Object) to its correct type. The code is written to the
* supplied stream.
*/
- private void codeUnwrapReturnValue(Class type, DataOutputStream out)
+ private void codeUnwrapReturnValue(Class> type, DataOutputStream out)
throws IOException
{
if (type.isPrimitive()) {
@@ -1391,7 +1391,7 @@ public class ProxyGenerator {
* the supplied stream. Note that the code generated by this method
* may caused the checked ClassNotFoundException to be thrown.
*/
- private void codeClassForName(Class cl, DataOutputStream out)
+ private void codeClassForName(Class> cl, DataOutputStream out)
throws IOException
{
code_ldc(cp.getString(cl.getName()), out);
@@ -1422,8 +1422,8 @@ public class ProxyGenerator {
* Return the "method descriptor" string for a method with the given
* parameter types and return type. See JVMS section 4.3.3.
*/
- private static String getMethodDescriptor(Class[] parameterTypes,
- Class returnType)
+ private static String getMethodDescriptor(Class>[] parameterTypes,
+ Class> returnType)
{
return getParameterDescriptors(parameterTypes) +
((returnType == void.class) ? "V" : getFieldType(returnType));
@@ -1436,7 +1436,7 @@ public class ProxyGenerator {
* string is useful for constructing string keys for methods without
* regard to their return type.
*/
- private static String getParameterDescriptors(Class[] parameterTypes) {
+ private static String getParameterDescriptors(Class>[] parameterTypes) {
StringBuilder desc = new StringBuilder("(");
for (int i = 0; i < parameterTypes.length; i++) {
desc.append(getFieldType(parameterTypes[i]));
@@ -1450,7 +1450,7 @@ public class ProxyGenerator {
* a field descriptor, a parameter descriptor, or a return descriptor
* other than "void". See JVMS section 4.3.2.
*/
- private static String getFieldType(Class type) {
+ private static String getFieldType(Class> type) {
if (type.isPrimitive()) {
return PrimitiveTypeInfo.get(type).baseTypeString;
} else if (type.isArray()) {
@@ -1472,7 +1472,7 @@ public class ProxyGenerator {
* method with the given name and parameter types.
*/
private static String getFriendlyMethodSignature(String name,
- Class[] parameterTypes)
+ Class>[] parameterTypes)
{
StringBuilder sig = new StringBuilder(name);
sig.append('(');
@@ -1480,7 +1480,7 @@ public class ProxyGenerator {
if (i > 0) {
sig.append(',');
}
- Class parameterType = parameterTypes[i];
+ Class> parameterType = parameterTypes[i];
int dimensions = 0;
while (parameterType.isArray()) {
parameterType = parameterType.getComponentType();
@@ -1504,7 +1504,7 @@ public class ProxyGenerator {
* this abstract notion of a "word" in section 3.4, but that definition
* was removed for the second edition.
*/
- private static int getWordsPerType(Class type) {
+ private static int getWordsPerType(Class> type) {
if (type == long.class || type == double.class) {
return 2;
} else {
@@ -1632,8 +1632,7 @@ public class ProxyGenerator {
/** descriptor of same method */
public String unwrapMethodDesc;
- private static Map table =
- new HashMap();
+ private static Map,PrimitiveTypeInfo> table = new HashMap<>();
static {
add(byte.class, Byte.class);
add(char.class, Character.class);
@@ -1645,12 +1644,12 @@ public class ProxyGenerator {
add(boolean.class, Boolean.class);
}
- private static void add(Class primitiveClass, Class wrapperClass) {
+ private static void add(Class> primitiveClass, Class> wrapperClass) {
table.put(primitiveClass,
new PrimitiveTypeInfo(primitiveClass, wrapperClass));
}
- private PrimitiveTypeInfo(Class primitiveClass, Class wrapperClass) {
+ private PrimitiveTypeInfo(Class> primitiveClass, Class> wrapperClass) {
assert primitiveClass.isPrimitive();
baseTypeString =
@@ -1663,7 +1662,7 @@ public class ProxyGenerator {
unwrapMethodDesc = "()" + baseTypeString;
}
- public static PrimitiveTypeInfo get(Class cl) {
+ public static PrimitiveTypeInfo get(Class> cl) {
return table.get(cl);
}
}
@@ -1694,7 +1693,7 @@ public class ProxyGenerator {
* and for assigning the next index value. Note that element 0
* of this list corresponds to constant pool index 1.
*/
- private List pool = new ArrayList(32);
+ private List pool = new ArrayList<>(32);
/**
* maps constant pool data of all types to constant pool indexes.
@@ -1702,7 +1701,7 @@ public class ProxyGenerator {
* This map is used to look up the index of an existing entry for
* values of all types.
*/
- private Map map = new HashMap(16);
+ private Map map = new HashMap<>(16);
/** true if no new constant pool entries may be added */
private boolean readOnly = false;
diff --git a/jdk/src/share/classes/sun/misc/Queue.java b/jdk/src/share/classes/sun/misc/Queue.java
index 4edc8c9187b..5a447a54bb5 100644
--- a/jdk/src/share/classes/sun/misc/Queue.java
+++ b/jdk/src/share/classes/sun/misc/Queue.java
@@ -35,12 +35,12 @@ import java.util.NoSuchElementException;
* @author Herb Jellinek
*/
-public class Queue {
+public class Queue {
int length = 0;
- QueueElement head = null;
- QueueElement tail = null;
+ QueueElement head = null;
+ QueueElement tail = null;
public Queue() {
}
@@ -48,9 +48,9 @@ public class Queue {
/**
* Enqueue an object.
*/
- public synchronized void enqueue(Object obj) {
+ public synchronized void enqueue(T obj) {
- QueueElement newElt = new QueueElement(obj);
+ QueueElement newElt = new QueueElement<>(obj);
if (head == null) {
head = newElt;
@@ -72,7 +72,7 @@ public class Queue {
* @exception java.lang.InterruptedException if any thread has
* interrupted this thread.
*/
- public Object dequeue() throws InterruptedException {
+ public T dequeue() throws InterruptedException {
return dequeue(0L);
}
@@ -85,13 +85,13 @@ public class Queue {
* @exception java.lang.InterruptedException if any thread has
* interrupted this thread.
*/
- public synchronized Object dequeue(long timeOut)
+ public synchronized T dequeue(long timeOut)
throws InterruptedException {
while (tail == null) {
wait(timeOut);
}
- QueueElement elt = tail;
+ QueueElement elt = tail;
tail = elt.prev;
if (tail == null) {
head = null;
@@ -115,8 +115,8 @@ public class Queue {
* order. Use the Enumeration methods on the returned object to
* fetch the elements sequentially.
*/
- public final synchronized Enumeration elements() {
- return new LIFOQueueEnumerator(this);
+ public final synchronized Enumeration elements() {
+ return new LIFOQueueEnumerator<>(this);
}
/**
@@ -124,8 +124,8 @@ public class Queue {
* order. Use the Enumeration methods on the returned object to
* fetch the elements sequentially.
*/
- public final synchronized Enumeration reverseElements() {
- return new FIFOQueueEnumerator(this);
+ public final synchronized Enumeration reverseElements() {
+ return new FIFOQueueEnumerator<>(this);
}
public synchronized void dump(String msg) {
@@ -133,8 +133,8 @@ public class Queue {
System.err.println("["+length+" elt(s); head = "+
(head == null ? "null" : (head.obj)+"")+
" tail = "+(tail == null ? "null" : (tail.obj)+""));
- QueueElement cursor = head;
- QueueElement last = null;
+ QueueElement cursor = head;
+ QueueElement last = null;
while (cursor != null) {
System.err.println(" "+cursor);
last = cursor;
@@ -147,11 +147,11 @@ public class Queue {
}
}
-final class FIFOQueueEnumerator implements Enumeration {
- Queue queue;
- QueueElement cursor;
+final class FIFOQueueEnumerator implements Enumeration {
+ Queue queue;
+ QueueElement cursor;
- FIFOQueueEnumerator(Queue q) {
+ FIFOQueueEnumerator(Queue q) {
queue = q;
cursor = q.tail;
}
@@ -160,10 +160,10 @@ final class FIFOQueueEnumerator implements Enumeration {
return (cursor != null);
}
- public Object nextElement() {
+ public T nextElement() {
synchronized (queue) {
if (cursor != null) {
- QueueElement result = cursor;
+ QueueElement result = cursor;
cursor = cursor.prev;
return result.obj;
}
@@ -172,11 +172,11 @@ final class FIFOQueueEnumerator implements Enumeration {
}
}
-final class LIFOQueueEnumerator implements Enumeration {
- Queue queue;
- QueueElement cursor;
+final class LIFOQueueEnumerator implements Enumeration {
+ Queue queue;
+ QueueElement cursor;
- LIFOQueueEnumerator(Queue q) {
+ LIFOQueueEnumerator(Queue q) {
queue = q;
cursor = q.head;
}
@@ -185,10 +185,10 @@ final class LIFOQueueEnumerator implements Enumeration {
return (cursor != null);
}
- public Object nextElement() {
+ public T nextElement() {
synchronized (queue) {
if (cursor != null) {
- QueueElement result = cursor;
+ QueueElement result = cursor;
cursor = cursor.next;
return result.obj;
}
@@ -197,13 +197,13 @@ final class LIFOQueueEnumerator implements Enumeration {
}
}
-class QueueElement {
- QueueElement next = null;
- QueueElement prev = null;
+class QueueElement {
+ QueueElement next = null;
+ QueueElement prev = null;
- Object obj = null;
+ T obj = null;
- QueueElement(Object obj) {
+ QueueElement(T obj) {
this.obj = obj;
}
diff --git a/jdk/src/share/classes/sun/misc/RequestProcessor.java b/jdk/src/share/classes/sun/misc/RequestProcessor.java
index ae9e1b9ec3e..51b8e99f267 100644
--- a/jdk/src/share/classes/sun/misc/RequestProcessor.java
+++ b/jdk/src/share/classes/sun/misc/RequestProcessor.java
@@ -36,7 +36,7 @@ package sun.misc;
public class RequestProcessor implements Runnable {
- private static Queue requestQueue;
+ private static Queue requestQueue;
private static Thread dispatcher;
/**
@@ -55,15 +55,12 @@ public class RequestProcessor implements Runnable {
lazyInitialize();
while (true) {
try {
- Object obj = requestQueue.dequeue();
- if (obj instanceof Request) { // ignore bogons
- Request req = (Request)obj;
- try {
- req.execute();
- } catch (Throwable t) {
- // do nothing at the moment...maybe report an error
- // in the future
- }
+ Request req = requestQueue.dequeue();
+ try {
+ req.execute();
+ } catch (Throwable t) {
+ // do nothing at the moment...maybe report an error
+ // in the future
}
} catch (InterruptedException e) {
// do nothing at the present time.
@@ -92,7 +89,7 @@ public class RequestProcessor implements Runnable {
*/
private static synchronized void lazyInitialize() {
if (requestQueue == null) {
- requestQueue = new Queue();
+ requestQueue = new Queue();
}
}
diff --git a/jdk/src/share/classes/sun/misc/Service.java b/jdk/src/share/classes/sun/misc/Service.java
index ce0ed44f937..37d39b43019 100644
--- a/jdk/src/share/classes/sun/misc/Service.java
+++ b/jdk/src/share/classes/sun/misc/Service.java
@@ -125,13 +125,13 @@ import java.util.TreeSet;
* @since 1.3
*/
-public final class Service {
+public final class Service {
private static final String prefix = "META-INF/services/";
private Service() { }
- private static void fail(Class service, String msg, Throwable cause)
+ private static void fail(Class> service, String msg, Throwable cause)
throws ServiceConfigurationError
{
ServiceConfigurationError sce
@@ -140,13 +140,13 @@ public final class Service {
throw sce;
}
- private static void fail(Class service, String msg)
+ private static void fail(Class> service, String msg)
throws ServiceConfigurationError
{
throw new ServiceConfigurationError(service.getName() + ": " + msg);
}
- private static void fail(Class service, URL u, int line, String msg)
+ private static void fail(Class> service, URL u, int line, String msg)
throws ServiceConfigurationError
{
fail(service, u + ":" + line + ": " + msg);
@@ -157,8 +157,8 @@ public final class Service {
* on the line to both the names list and the returned set iff the name is
* not already a member of the returned set.
*/
- private static int parseLine(Class service, URL u, BufferedReader r, int lc,
- List names, Set returned)
+ private static int parseLine(Class> service, URL u, BufferedReader r, int lc,
+ List names, Set returned)
throws IOException, ServiceConfigurationError
{
String ln = r.readLine();
@@ -211,12 +211,12 @@ public final class Service {
* If an I/O error occurs while reading from the given URL, or
* if a configuration-file format error is detected
*/
- private static Iterator parse(Class service, URL u, Set returned)
+ private static Iterator parse(Class> service, URL u, Set returned)
throws ServiceConfigurationError
{
InputStream in = null;
BufferedReader r = null;
- ArrayList names = new ArrayList();
+ ArrayList names = new ArrayList<>();
try {
in = u.openStream();
r = new BufferedReader(new InputStreamReader(in, "utf-8"));
@@ -239,16 +239,16 @@ public final class Service {
/**
* Private inner class implementing fully-lazy provider lookup
*/
- private static class LazyIterator implements Iterator {
+ private static class LazyIterator implements Iterator {
- Class service;
+ Class service;
ClassLoader loader;
- Enumeration configs = null;
- Iterator pending = null;
- Set returned = new TreeSet();
+ Enumeration configs = null;
+ Iterator pending = null;
+ Set returned = new TreeSet<>();
String nextName = null;
- private LazyIterator(Class service, ClassLoader loader) {
+ private LazyIterator(Class service, ClassLoader loader) {
this.service = service;
this.loader = loader;
}
@@ -272,20 +272,20 @@ public final class Service {
if (!configs.hasMoreElements()) {
return false;
}
- pending = parse(service, (URL)configs.nextElement(), returned);
+ pending = parse(service, configs.nextElement(), returned);
}
- nextName = (String)pending.next();
+ nextName = pending.next();
return true;
}
- public Object next() throws ServiceConfigurationError {
+ public S next() throws ServiceConfigurationError {
if (!hasNext()) {
throw new NoSuchElementException();
}
String cn = nextName;
nextName = null;
try {
- return Class.forName(cn, true, loader).newInstance();
+ return service.cast(Class.forName(cn, true, loader).newInstance());
} catch (ClassNotFoundException x) {
fail(service,
"Provider " + cn + " not found");
@@ -342,10 +342,10 @@ public final class Service {
* @see #providers(java.lang.Class)
* @see #installedProviders(java.lang.Class)
*/
- public static Iterator providers(Class service, ClassLoader loader)
+ public static Iterator providers(Class service, ClassLoader loader)
throws ServiceConfigurationError
{
- return new LazyIterator(service, loader);
+ return new LazyIterator(service, loader);
}
@@ -374,7 +374,7 @@ public final class Service {
*
* @see #providers(java.lang.Class, java.lang.ClassLoader)
*/
- public static Iterator providers(Class service)
+ public static Iterator providers(Class service)
throws ServiceConfigurationError
{
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -411,7 +411,7 @@ public final class Service {
*
* @see #providers(java.lang.Class, java.lang.ClassLoader)
*/
- public static Iterator installedProviders(Class service)
+ public static Iterator installedProviders(Class service)
throws ServiceConfigurationError
{
ClassLoader cl = ClassLoader.getSystemClassLoader();
diff --git a/jdk/src/share/classes/sun/misc/ServiceConfigurationError.java b/jdk/src/share/classes/sun/misc/ServiceConfigurationError.java
index 5659b23870a..74d0c846b58 100644
--- a/jdk/src/share/classes/sun/misc/ServiceConfigurationError.java
+++ b/jdk/src/share/classes/sun/misc/ServiceConfigurationError.java
@@ -43,6 +43,8 @@ package sun.misc;
public class ServiceConfigurationError extends Error {
+ static final long serialVersionUID = 8769866263384244465L;
+
/**
* Constructs a new instance with the specified detail string.
*/
diff --git a/jdk/src/share/classes/sun/misc/Signal.java b/jdk/src/share/classes/sun/misc/Signal.java
index 613cc3881e8..b663c5bba63 100644
--- a/jdk/src/share/classes/sun/misc/Signal.java
+++ b/jdk/src/share/classes/sun/misc/Signal.java
@@ -72,8 +72,8 @@ import java.util.Hashtable;
* @since 1.2
*/
public final class Signal {
- private static Hashtable handlers = new Hashtable(4);
- private static Hashtable signals = new Hashtable(4);
+ private static Hashtable handlers = new Hashtable<>(4);
+ private static Hashtable signals = new Hashtable<>(4);
private int number;
private String name;
@@ -166,9 +166,9 @@ public final class Signal {
throw new IllegalArgumentException
("Signal already used by VM or OS: " + sig);
}
- signals.put(new Integer(sig.number), sig);
+ signals.put(sig.number, sig);
synchronized (handlers) {
- SignalHandler oldHandler = (SignalHandler)handlers.get(sig);
+ SignalHandler oldHandler = handlers.get(sig);
handlers.remove(sig);
if (newH == 2) {
handlers.put(sig, handler);
@@ -200,8 +200,8 @@ public final class Signal {
/* Called by the VM to execute Java signal handlers. */
private static void dispatch(final int number) {
- final Signal sig = (Signal)signals.get(new Integer(number));
- final SignalHandler handler = (SignalHandler)handlers.get(sig);
+ final Signal sig = signals.get(number);
+ final SignalHandler handler = handlers.get(sig);
Runnable runnable = new Runnable () {
public void run() {
diff --git a/jdk/src/share/classes/sun/misc/URLClassPath.java b/jdk/src/share/classes/sun/misc/URLClassPath.java
index cee982369c4..eb6b86aecbd 100644
--- a/jdk/src/share/classes/sun/misc/URLClassPath.java
+++ b/jdk/src/share/classes/sun/misc/URLClassPath.java
@@ -836,10 +836,9 @@ public class URLClassPath {
Set visited) {
Resource res;
- Object[] jarFiles;
- boolean done = false;
+ String[] jarFiles;
int count = 0;
- LinkedList jarFilesList = null;
+ LinkedList jarFilesList = null;
/* If there no jar files in the index that can potential contain
* this resource then return immediately.
@@ -848,11 +847,11 @@ public class URLClassPath {
return null;
do {
- jarFiles = jarFilesList.toArray();
int size = jarFilesList.size();
+ jarFiles = jarFilesList.toArray(new String[size]);
/* loop through the mapped jar file list */
while(count < size) {
- String jarName = (String)jarFiles[count++];
+ String jarName = jarFiles[count++];
JarLoader newLoader;
final URL url;
diff --git a/jdk/src/share/classes/sun/misc/Unsafe.java b/jdk/src/share/classes/sun/misc/Unsafe.java
index dba16284b36..da7ec279865 100644
--- a/jdk/src/share/classes/sun/misc/Unsafe.java
+++ b/jdk/src/share/classes/sun/misc/Unsafe.java
@@ -81,7 +81,7 @@ public final class Unsafe {
* access to the system properties.
*/
public static Unsafe getUnsafe() {
- Class cc = sun.reflect.Reflection.getCallerClass(2);
+ Class> cc = sun.reflect.Reflection.getCallerClass(2);
if (cc.getClassLoader() != null)
throw new SecurityException("Unsafe");
return theUnsafe;
@@ -616,7 +616,7 @@ public final class Unsafe {
* for a given class in one place.
*/
@Deprecated
- public Object staticFieldBase(Class c) {
+ public Object staticFieldBase(Class> c) {
Field[] fields = c.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (Modifier.isStatic(fields[i].getModifiers())) {
@@ -682,7 +682,7 @@ public final class Unsafe {
* needed in conjunction with obtaining the static field base of a
* class.
*/
- public native void ensureClassInitialized(Class c);
+ public native void ensureClassInitialized(Class> c);
/**
* Report the offset of the first element in the storage allocation of a
@@ -694,7 +694,7 @@ public final class Unsafe {
* @see #getInt(Object, long)
* @see #putInt(Object, long, int)
*/
- public native int arrayBaseOffset(Class arrayClass);
+ public native int arrayBaseOffset(Class> arrayClass);
/** The value of {@code arrayBaseOffset(boolean[].class)} */
public static final int ARRAY_BOOLEAN_BASE_OFFSET
@@ -743,7 +743,7 @@ public final class Unsafe {
* @see #getInt(Object, long)
* @see #putInt(Object, long, int)
*/
- public native int arrayIndexScale(Class arrayClass);
+ public native int arrayIndexScale(Class> arrayClass);
/** The value of {@code arrayIndexScale(boolean[].class)} */
public static final int ARRAY_BOOLEAN_INDEX_SCALE
@@ -805,11 +805,11 @@ public final class Unsafe {
* Tell the VM to define a class, without security checks. By default, the
* class loader and protection domain come from the caller's class.
*/
- public native Class defineClass(String name, byte[] b, int off, int len,
- ClassLoader loader,
- ProtectionDomain protectionDomain);
+ public native Class> defineClass(String name, byte[] b, int off, int len,
+ ClassLoader loader,
+ ProtectionDomain protectionDomain);
- public native Class defineClass(String name, byte[] b, int off, int len);
+ public native Class> defineClass(String name, byte[] b, int off, int len);
/**
* Define a class but do not make it known to the class loader or system dictionary.
@@ -827,12 +827,12 @@ public final class Unsafe {
* @params data bytes of a class file
* @params cpPatches where non-null entries exist, they replace corresponding CP entries in data
*/
- public native Class defineAnonymousClass(Class hostClass, byte[] data, Object[] cpPatches);
+ public native Class> defineAnonymousClass(Class> hostClass, byte[] data, Object[] cpPatches);
/** Allocate an instance but do not run any constructor.
Initializes the class if it has not yet been. */
- public native Object allocateInstance(Class cls)
+ public native Object allocateInstance(Class> cls)
throws InstantiationException;
/** Lock the object. It must get unlocked via {@link #monitorExit}. */
diff --git a/jdk/src/share/classes/sun/misc/VM.java b/jdk/src/share/classes/sun/misc/VM.java
index e1fb584bb2c..61b3b0fd974 100644
--- a/jdk/src/share/classes/sun/misc/VM.java
+++ b/jdk/src/share/classes/sun/misc/VM.java
@@ -48,6 +48,7 @@ public class VM {
return suspended;
}
+ @SuppressWarnings("deprecation")
public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
return g.allowThreadSuspension(b);
}
diff --git a/jdk/src/share/classes/sun/net/RegisteredDomain.java b/jdk/src/share/classes/sun/net/RegisteredDomain.java
index 49c67c2b24b..7e75b321eb6 100644
--- a/jdk/src/share/classes/sun/net/RegisteredDomain.java
+++ b/jdk/src/share/classes/sun/net/RegisteredDomain.java
@@ -118,8 +118,8 @@ private static Set usStateSet = new HashSet(Arrays.asList("ak",
private static Set usSubStateSet = new HashSet(Arrays.asList("state",
"lib", "k12", "cc", "tec", "gen", "cog", "mus", "dst"));
-private static Map topMap = new HashMap();
-private static Map top3Map = new HashMap();
+private static Map> topMap = new HashMap<>();
+private static Map> top3Map = new HashMap<>();
static {
/*
@@ -764,7 +764,7 @@ static {
*/
String str = cname.substring(third + 1);
if (third != -1) {
- Set set = top3Map.get(s);
+ Set set = top3Map.get(s);
if (set != null) {
if (set.contains(str)) {
return cname.substring(fourth + 1);
@@ -801,7 +801,7 @@ static {
/*
* XX.MA.US.
*/
- Set topSet = topMap.get(s);
+ Set topSet = topMap.get(s);
if (topSet != null) {
if (topSet.contains(s2)) {
return cname.substring(third + 1);
diff --git a/jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java b/jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
index 7a09810718c..06deae65817 100644
--- a/jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
+++ b/jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
@@ -27,7 +27,7 @@ package sun.net.ftp;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ServiceConfigurationError;
-//import sun.misc.Service;
+//import java.util.ServiceLoader;
/**
* Service provider class for FtpClient.
@@ -79,20 +79,22 @@ public abstract class FtpClientProvider {
}
private static boolean loadProviderAsService() {
- // Iterator i = Service.providers(FtpClientProvider.class,
- // ClassLoader.getSystemClassLoader());
- // while (i.hasNext()) {
- // try {
- // provider = (FtpClientProvider) i.next();
- // return true;
- // } catch (ServiceConfigurationError sce) {
- // if (sce.getCause() instanceof SecurityException) {
- // // Ignore, try next provider, if any
- // continue;
- // }
- // throw sce;
- // }
- // }
+// Iterator i =
+// ServiceLoader.load(FtpClientProvider.class,
+// ClassLoader.getSystemClassLoader()).iterator();
+//
+// while (i.hasNext()) {
+// try {
+// provider = i.next();
+// return true;
+// } catch (ServiceConfigurationError sce) {
+// if (sce.getCause() instanceof SecurityException) {
+// // Ignore, try next provider, if any
+// continue;
+// }
+// throw sce;
+// }
+// }
return false;
}
diff --git a/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java b/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java
index 62686c6b99e..8e9f8e3a35f 100644
--- a/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java
+++ b/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java
@@ -123,6 +123,7 @@ public class Handler extends java.net.URLStreamHandler {
@Override
+ @SuppressWarnings("deprecation")
protected void parseURL(URL url, String spec,
int start, int limit) {
String file = null;
diff --git a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
index dd10a721073..2fbc517193c 100644
--- a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
+++ b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
@@ -57,13 +57,17 @@ public class SocketAdaptor
// Timeout "option" value for reads
private volatile int timeout = 0;
- // ## super will create a useless impl
- private SocketAdaptor(SocketChannelImpl sc) {
+ private SocketAdaptor(SocketChannelImpl sc) throws SocketException {
+ super((SocketImpl) null);
this.sc = sc;
}
public static Socket create(SocketChannelImpl sc) {
- return new SocketAdaptor(sc);
+ try {
+ return new SocketAdaptor(sc);
+ } catch (SocketException e) {
+ throw new InternalError("Should not reach here");
+ }
}
public SocketChannel getChannel() {
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java b/jdk/src/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java
index 5109e132d22..f2a999f51de 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java
@@ -44,12 +44,16 @@ import java.security.cert.CertStoreSpi;
import java.security.cert.CRLSelector;
import java.security.cert.X509Certificate;
import java.security.cert.X509CRL;
+import java.net.Socket;
+import java.net.URLConnection;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
+import javax.net.ssl.X509ExtendedTrustManager;
/**
* A CertStore that retrieves an SSL server's certificate chain.
@@ -57,31 +61,74 @@ import javax.net.ssl.X509TrustManager;
public final class SSLServerCertStore extends CertStoreSpi {
private final URI uri;
+ private final static GetChainTrustManager trustManager;
+ private final static SSLSocketFactory socketFactory;
+ private final static HostnameVerifier hostnameVerifier;
+
+ static {
+ trustManager = new GetChainTrustManager();
+ hostnameVerifier = new HostnameVerifier() {
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+
+ SSLSocketFactory tempFactory;
+ try {
+ SSLContext context = SSLContext.getInstance("SSL");
+ context.init(null, new TrustManager[] { trustManager }, null);
+ tempFactory = context.getSocketFactory();
+ } catch (GeneralSecurityException gse) {
+ tempFactory = null;
+ }
+
+ socketFactory = tempFactory;
+ }
SSLServerCertStore(URI uri) throws InvalidAlgorithmParameterException {
super(null);
this.uri = uri;
}
- public synchronized Collection engineGetCertificates
- (CertSelector selector) throws CertStoreException
- {
+ public Collection engineGetCertificates
+ (CertSelector selector) throws CertStoreException {
+
try {
- SSLContext sc = SSLContext.getInstance("SSL");
- GetChainTrustManager xtm = new GetChainTrustManager();
- sc.init(null, new TrustManager[] { xtm }, null);
- HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- HttpsURLConnection.setDefaultHostnameVerifier(
- new HostnameVerifier() {
- public boolean verify(String hostname, SSLSession session) {
- return true;
+ URLConnection urlConn = uri.toURL().openConnection();
+ if (urlConn instanceof HttpsURLConnection) {
+ if (socketFactory == null) {
+ throw new CertStoreException(
+ "No initialized SSLSocketFactory");
+ }
+
+ HttpsURLConnection https = (HttpsURLConnection)urlConn;
+ https.setSSLSocketFactory(socketFactory);
+ https.setHostnameVerifier(hostnameVerifier);
+ synchronized (trustManager) {
+ try {
+ https.connect();
+ return getMatchingCerts(
+ trustManager.serverChain, selector);
+ } catch (IOException ioe) {
+ // If the server certificate has already been
+ // retrieved, don't mind the connection state.
+ if (trustManager.exchangedServerCerts) {
+ return getMatchingCerts(
+ trustManager.serverChain, selector);
+ }
+
+ // otherwise, rethrow the exception
+ throw ioe;
+ } finally {
+ trustManager.cleanup();
}
- });
- uri.toURL().openConnection().connect();
- return getMatchingCerts(xtm.serverChain, selector);
- } catch (GeneralSecurityException | IOException e) {
- throw new CertStoreException(e);
+ }
+ }
+ } catch (IOException ioe) {
+ throw new CertStoreException(ioe);
}
+
+ return Collections.emptySet();
}
private static List getMatchingCerts
@@ -106,37 +153,77 @@ public final class SSLServerCertStore extends CertStoreSpi {
throw new UnsupportedOperationException();
}
- static synchronized CertStore getInstance(URI uri)
+ static CertStore getInstance(URI uri)
throws InvalidAlgorithmParameterException
{
return new CS(new SSLServerCertStore(uri), null, "SSLServer", null);
}
/*
- * An X509TrustManager that simply stores a reference to the server's
- * certificate chain.
+ * An X509ExtendedTrustManager that ignores the server certificate
+ * validation.
*/
- private static class GetChainTrustManager implements X509TrustManager {
- private List serverChain;
+ private static class GetChainTrustManager
+ extends X509ExtendedTrustManager {
+ private List serverChain =
+ Collections.emptyList();
+ private boolean exchangedServerCerts = false;
+
+ @Override
public X509Certificate[] getAcceptedIssuers() {
- throw new UnsupportedOperationException();
+ return new X509Certificate[0];
}
+ @Override
public void checkClientTrusted(X509Certificate[] chain,
- String authType)
- throws CertificateException
- {
+ String authType) throws CertificateException {
+
throw new UnsupportedOperationException();
}
+ @Override
+ public void checkClientTrusted(X509Certificate[] chain, String authType,
+ Socket socket) throws CertificateException {
+
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] chain, String authType,
+ SSLEngine engine) throws CertificateException {
+
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public void checkServerTrusted(X509Certificate[] chain,
- String authType)
- throws CertificateException
- {
+ String authType) throws CertificateException {
+
+ exchangedServerCerts = true;
this.serverChain = (chain == null)
- ? Collections.emptyList()
- : Arrays.asList(chain);
+ ? Collections.emptyList()
+ : Arrays.asList(chain);
+
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] chain, String authType,
+ Socket socket) throws CertificateException {
+
+ checkServerTrusted(chain, authType);
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] chain, String authType,
+ SSLEngine engine) throws CertificateException {
+
+ checkServerTrusted(chain, authType);
+ }
+
+ void cleanup() {
+ exchangedServerCerts = false;
+ serverChain = Collections.emptyList();
}
}
diff --git a/jdk/src/share/classes/sun/text/CompactByteArray.java b/jdk/src/share/classes/sun/text/CompactByteArray.java
index 042d88ff271..d28b1db0356 100644
--- a/jdk/src/share/classes/sun/text/CompactByteArray.java
+++ b/jdk/src/share/classes/sun/text/CompactByteArray.java
@@ -264,9 +264,9 @@ public final class CompactByteArray implements Cloneable {
{
try {
CompactByteArray other = (CompactByteArray) super.clone();
- other.values = (byte[])values.clone();
- other.indices = (short[])indices.clone();
- if (hashes != null) other.hashes = (int[])hashes.clone();
+ other.values = values.clone();
+ other.indices = indices.clone();
+ if (hashes != null) other.hashes = hashes.clone();
return other;
} catch (CloneNotSupportedException e) {
throw new InternalError(e);
diff --git a/jdk/src/share/classes/sun/text/IntHashtable.java b/jdk/src/share/classes/sun/text/IntHashtable.java
index a066d095347..679c710608b 100644
--- a/jdk/src/share/classes/sun/text/IntHashtable.java
+++ b/jdk/src/share/classes/sun/text/IntHashtable.java
@@ -122,11 +122,11 @@ public final class IntHashtable {
// this line just scrambles the bits as each value is added into the
// has value. This helps to make sure we affect all the bits and that
// the same values in a different order will produce a different hash value
- result = (int)(result * scrambler + 1);
+ result = result * scrambler + 1;
result += keyList[i];
}
for (int i = 0; i < values.length; ++i) {
- result = (int)(result * scrambler + 1);
+ result = result * scrambler + 1;
result += values[i];
}
return result;
@@ -135,8 +135,8 @@ public final class IntHashtable {
public Object clone ()
throws CloneNotSupportedException {
IntHashtable result = (IntHashtable) super.clone();
- values = (int[]) values.clone();
- keyList = (int[])keyList.clone();
+ values = values.clone();
+ keyList = keyList.clone();
return result;
}
diff --git a/jdk/src/share/classes/sun/text/bidi/BidiBase.java b/jdk/src/share/classes/sun/text/bidi/BidiBase.java
index d6733ceb0a0..a803f8281fd 100644
--- a/jdk/src/share/classes/sun/text/bidi/BidiBase.java
+++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java
@@ -1106,7 +1106,7 @@ public class BidiBase {
* Assume sizeNeeded>0.
* If object != null, then assume size > 0.
*/
- private Object getMemory(String label, Object array, Class arrayClass,
+ private Object getMemory(String label, Object array, Class> arrayClass,
boolean mayAllocate, int sizeNeeded)
{
int len = Array.getLength(array);
@@ -1990,7 +1990,7 @@ public class BidiBase {
cell = impTab[oldStateSeq][_prop];
levState.state = GetState(cell); /* isolate the new state */
actionSeq = impAct[GetAction(cell)]; /* isolate the action */
- addLevel = (byte)impTab[levState.state][IMPTABLEVELS_RES];
+ addLevel = impTab[levState.state][IMPTABLEVELS_RES];
if (actionSeq != 0) {
switch (actionSeq) {
@@ -2014,7 +2014,7 @@ public class BidiBase {
/* nothing, just clean up */
levState.lastStrongRTL = -1;
/* check if we have a pending conditional segment */
- level = (byte)impTab[oldStateSeq][IMPTABLEVELS_RES];
+ level = impTab[oldStateSeq][IMPTABLEVELS_RES];
if ((level & 1) != 0 && levState.startON > 0) { /* after ON */
start = levState.startON; /* reset to basic run level */
}
@@ -2115,7 +2115,7 @@ public class BidiBase {
break;
case 11: /* L after L+ON+EN/AN/ON */
- level = (byte)levState.runLevel;
+ level = levState.runLevel;
for (k = start0-1; k >= levState.startON; k--) {
if (levels[k] == level+3) {
while (levels[k] == level+3) {
@@ -2178,7 +2178,7 @@ public class BidiBase {
levState.runLevel = levels[start];
levState.impTab = impTabPair.imptab[levState.runLevel & 1];
levState.impAct = impTabPair.impact[levState.runLevel & 1];
- processPropertySeq(levState, (short)sor, start, start);
+ processPropertySeq(levState, sor, start, start);
/* initialize for property state table */
if (dirProps[start] == NSM) {
stateImp = (short)(1 + sor);
@@ -2230,7 +2230,7 @@ public class BidiBase {
}
}
/* flush possible pending sequence, e.g. ON */
- processPropertySeq(levState, (short)eor, limit, limit);
+ processPropertySeq(levState, eor, limit, limit);
}
/* perform (L1) and (X9) ---------------------------------------------------- */
@@ -3484,6 +3484,7 @@ public class BidiBase {
}
}
+ @SuppressWarnings("serial")
private static AttributedCharacterIterator.Attribute
getTextAttribute(String name)
{
diff --git a/jdk/src/share/classes/sun/text/normalizer/ICUData.java b/jdk/src/share/classes/sun/text/normalizer/ICUData.java
index bf6e60ffb83..6163329ed4d 100644
--- a/jdk/src/share/classes/sun/text/normalizer/ICUData.java
+++ b/jdk/src/share/classes/sun/text/normalizer/ICUData.java
@@ -48,12 +48,12 @@ import java.util.MissingResourceException;
*/
public final class ICUData {
- private static InputStream getStream(final Class root, final String resourceName, boolean required) {
+ private static InputStream getStream(final Class root, final String resourceName, boolean required) {
InputStream i = null;
if (System.getSecurityManager() != null) {
- i = (InputStream)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ i = AccessController.doPrivileged(new PrivilegedAction() {
+ public InputStream run() {
return root.getResourceAsStream(resourceName);
}
});
diff --git a/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java b/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java
index 576e67bd978..875d059f156 100644
--- a/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java
+++ b/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java
@@ -886,6 +886,7 @@ public final class NormalizerBase implements Cloneable {
* @deprecated ICU 3.2
* @obsolete ICU 3.2
*/
+ @Deprecated
public int setIndex(int index) {
setIndexOnly(index);
return current();
@@ -899,6 +900,7 @@ public final class NormalizerBase implements Cloneable {
* @return The codepoint as an int
* @see #startIndex
*/
+ @Deprecated
public int getBeginIndex() {
return 0;
}
@@ -911,6 +913,7 @@ public final class NormalizerBase implements Cloneable {
* @return The codepoint as an int
* @see #endIndex
*/
+ @Deprecated
public int getEndIndex() {
return endIndex();
}
@@ -1235,11 +1238,11 @@ public final class NormalizerBase implements Cloneable {
mode, options);
if(pNeededToNormalize!=null) {
- pNeededToNormalize[0]=(boolean)(destLength!=bufferLength ||
- Utility.arrayRegionMatches(
- buffer,0,dest,
- destStart,destLimit
- ));
+ pNeededToNormalize[0]=destLength!=bufferLength ||
+ Utility.arrayRegionMatches(
+ buffer,0,dest,
+ destStart,destLimit
+ );
}
} else {
/* just copy the source characters */
@@ -1458,10 +1461,10 @@ public final class NormalizerBase implements Cloneable {
dest,destStart,destLimit, options);
if(pNeededToNormalize!=null) {
- pNeededToNormalize[0]=(boolean)(destLength!=bufferLength ||
- Utility.arrayRegionMatches(buffer,startIndex[0],
- dest,destStart,
- destLength));
+ pNeededToNormalize[0]=destLength!=bufferLength ||
+ Utility.arrayRegionMatches(buffer,startIndex[0],
+ dest,destStart,
+ destLength);
}
} else {
/* just copy the source characters */
diff --git a/jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java b/jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java
index b0b8e371200..8f0c9662a2b 100644
--- a/jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java
+++ b/jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java
@@ -98,11 +98,11 @@ public final class NormalizerImpl {
private static final int EXTRA_SHIFT=16;
/* norm32 value constants using >16 bits */
- private static final long MIN_SPECIAL = (long)(0xfc000000 & UNSIGNED_INT_MASK);
- private static final long SURROGATES_TOP = (long)(0xfff00000 & UNSIGNED_INT_MASK);
- private static final long MIN_HANGUL = (long)(0xfff00000 & UNSIGNED_INT_MASK);
-// private static final long MIN_JAMO_V = (long)(0xfff20000 & UNSIGNED_INT_MASK);
- private static final long JAMO_V_TOP = (long)(0xfff30000 & UNSIGNED_INT_MASK);
+ private static final long MIN_SPECIAL = 0xfc000000 & UNSIGNED_INT_MASK;
+ private static final long SURROGATES_TOP = 0xfff00000 & UNSIGNED_INT_MASK;
+ private static final long MIN_HANGUL = 0xfff00000 & UNSIGNED_INT_MASK;
+// private static final long MIN_JAMO_V = 0xfff20000 & UNSIGNED_INT_MASK;
+ private static final long JAMO_V_TOP = 0xfff30000 & UNSIGNED_INT_MASK;
/* indexes[] value names */
@@ -134,7 +134,7 @@ public final class NormalizerImpl {
private static final int AUX_COMP_EX_SHIFT = 10;
private static final int AUX_NFC_SKIPPABLE_F_SHIFT = 12;
- private static final int AUX_MAX_FNC = ((int)1<>CC_SHIFT)&0xFF);
+ return (int)((norm32>>CC_SHIFT)&0xFF);
}
public static boolean isFullCompositionExclusion(int c) {
if(isFormatVersion_2_1) {
int aux =AuxTrieImpl.auxTrie.getCodePointValue(c);
- return (boolean)((aux & AUX_COMP_EX_MASK)!=0);
+ return (aux & AUX_COMP_EX_MASK)!=0;
} else {
return false;
}
@@ -2037,7 +2037,7 @@ public final class NormalizerImpl {
public static boolean isCanonSafeStart(int c) {
if(isFormatVersion_2_1) {
int aux = AuxTrieImpl.auxTrie.getCodePointValue(c);
- return (boolean)((aux & AUX_UNSAFE_MASK)==0);
+ return (aux & AUX_UNSAFE_MASK)==0;
} else {
return false;
}
@@ -2546,7 +2546,7 @@ public final class NormalizerImpl {
// copy these code units all at once
if (srcIndex != prevSrc) {
- length = (int)(srcIndex - prevSrc);
+ length = srcIndex - prevSrc;
if ((destIndex + length) <= destLimit) {
System.arraycopy(src,prevSrc,dest,destIndex,length);
}
diff --git a/jdk/src/share/classes/sun/text/normalizer/SymbolTable.java b/jdk/src/share/classes/sun/text/normalizer/SymbolTable.java
index a1dfab5bd29..95af219f5bc 100644
--- a/jdk/src/share/classes/sun/text/normalizer/SymbolTable.java
+++ b/jdk/src/share/classes/sun/text/normalizer/SymbolTable.java
@@ -65,6 +65,7 @@ import java.text.ParsePosition;
* @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU.
*/
+@Deprecated
public interface SymbolTable {
/**
@@ -72,6 +73,7 @@ public interface SymbolTable {
* @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU.
*/
+ @Deprecated
static final char SYMBOL_REF = '$';
/**
@@ -84,6 +86,7 @@ public interface SymbolTable {
* @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU.
*/
+ @Deprecated
char[] lookup(String s);
/**
@@ -95,6 +98,7 @@ public interface SymbolTable {
* @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU.
*/
+ @Deprecated
UnicodeMatcher lookupMatcher(int ch);
/**
@@ -115,5 +119,6 @@ public interface SymbolTable {
* @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU.
*/
+ @Deprecated
String parseReference(String text, ParsePosition pos, int limit);
}
diff --git a/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java b/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java
index 569daff4ca6..42f6fdb54b8 100644
--- a/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java
+++ b/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java
@@ -298,7 +298,7 @@ public class UnicodeSet implements UnicodeMatcher {
// NOTE: normally the field should be of type SortedSet; but that is missing a public clone!!
// is not private so that UnicodeSetIterator can get access
- TreeSet strings = new TreeSet();
+ TreeSet strings = new TreeSet<>();
/**
* The pattern representation of this set. This may not be the
@@ -368,7 +368,7 @@ public class UnicodeSet implements UnicodeMatcher {
* @stable ICU 2.0
*/
public UnicodeSet set(UnicodeSet other) {
- list = (int[]) other.list.clone();
+ list = other.list.clone();
len = other.len;
pat = other.pat;
strings = (TreeSet)other.strings.clone();
@@ -524,10 +524,10 @@ public class UnicodeSet implements UnicodeMatcher {
}
if (includeStrings && strings.size() > 0) {
- Iterator it = strings.iterator();
+ Iterator it = strings.iterator();
while (it.hasNext()) {
result.append('{');
- _appendToPat(result, (String) it.next(), escapeUnprintable);
+ _appendToPat(result, it.next(), escapeUnprintable);
result.append('}');
}
}
@@ -1180,14 +1180,17 @@ public class UnicodeSet implements UnicodeMatcher {
}
}
syntaxError(chars, "'-' not after char or set");
+ break;
case '&':
if (lastItem == 2 && op == 0) {
op = (char) c;
continue;
}
syntaxError(chars, "'&' not after set");
+ break;
case '^':
syntaxError(chars, "'^' not after '['");
+ break;
case '{':
if (op != 0) {
syntaxError(chars, "Missing operand after operator");
@@ -1251,6 +1254,7 @@ public class UnicodeSet implements UnicodeMatcher {
continue;
}
syntaxError(chars, "Unquoted '$'");
+ break;
default:
break;
}
diff --git a/jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java b/jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java
index a27df03de3a..53a145c200f 100644
--- a/jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java
+++ b/jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java
@@ -154,7 +154,7 @@ public class UnicodeSetIterator {
if (stringIterator == null) return false;
codepoint = IS_STRING; // signal that value is actually a string
- string = (String)stringIterator.next();
+ string = stringIterator.next();
if (!stringIterator.hasNext()) stringIterator = null;
return true;
}
@@ -203,7 +203,7 @@ public class UnicodeSetIterator {
* @internal
*/
protected int nextElement;
- private Iterator stringIterator = null;
+ private Iterator stringIterator = null;
/**
* Invariant: stringIterator is null when there are no (more) strings remaining
diff --git a/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java b/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java
index 44b2e69f347..2f418b00753 100644
--- a/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java
+++ b/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java
@@ -153,7 +153,7 @@ public final class VersionInfo
/**
* Map of singletons
*/
- private static final HashMap MAP_ = new HashMap();
+ private static final HashMap MAP_ = new HashMap<>();
/**
* Error statement string
*/
diff --git a/jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java b/jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java
index 08535a1fff6..c28dddad9d7 100644
--- a/jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java
+++ b/jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java
@@ -75,7 +75,7 @@ public abstract class HotSpotAttachProvider extends AttachProvider {
new ArrayList();
MonitoredHost host;
- Set vms;
+ Set vms;
try {
host = MonitoredHost.getMonitoredHost(new HostIdentifier((String)null));
vms = host.activeVms();
@@ -92,31 +92,29 @@ public abstract class HotSpotAttachProvider extends AttachProvider {
throw new InternalError(t); // shouldn't happen
}
- for (Object vmid: vms) {
- if (vmid instanceof Integer) {
- String pid = vmid.toString();
- String name = pid; // default to pid if name not available
- boolean isAttachable = false;
- MonitoredVm mvm = null;
+ for (Integer vmid: vms) {
+ String pid = vmid.toString();
+ String name = pid; // default to pid if name not available
+ boolean isAttachable = false;
+ MonitoredVm mvm = null;
+ try {
+ mvm = host.getMonitoredVm(new VmIdentifier(pid));
try {
- mvm = host.getMonitoredVm(new VmIdentifier(pid));
- try {
- isAttachable = MonitoredVmUtil.isAttachable(mvm);
- // use the command line as the display name
- name = MonitoredVmUtil.commandLine(mvm);
- } catch (Exception e) {
- }
- if (isAttachable) {
- result.add(new HotSpotVirtualMachineDescriptor(this, pid, name));
- }
- } catch (Throwable t) {
- if (t instanceof ThreadDeath) {
- throw (ThreadDeath)t;
- }
- } finally {
- if (mvm != null) {
- mvm.detach();
- }
+ isAttachable = MonitoredVmUtil.isAttachable(mvm);
+ // use the command line as the display name
+ name = MonitoredVmUtil.commandLine(mvm);
+ } catch (Exception e) {
+ }
+ if (isAttachable) {
+ result.add(new HotSpotVirtualMachineDescriptor(this, pid, name));
+ }
+ } catch (Throwable t) {
+ if (t instanceof ThreadDeath) {
+ throw (ThreadDeath)t;
+ }
+ } finally {
+ if (mvm != null) {
+ mvm.detach();
}
}
}
diff --git a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java
index 9812a1ef565..5a405341685 100644
--- a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java
+++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java
@@ -98,7 +98,7 @@ public class JInfo {
}
// loads the given class using the system class loader
- private static Class loadClass(String name) {
+ private static Class> loadClass(String name) {
//
// We specify the system clas loader so as to cater for development
// environments where this class is on the boot class path but sa-jdi.jar
@@ -178,7 +178,7 @@ public class JInfo {
// print usage message
private static void usage() {
- Class c = loadClass("sun.jvm.hotspot.tools.JInfo");
+ Class> c = loadClass("sun.jvm.hotspot.tools.JInfo");
boolean usageSA = (c != null);
System.out.println("Usage:");
diff --git a/jdk/src/share/classes/sun/tools/jmap/JMap.java b/jdk/src/share/classes/sun/tools/jmap/JMap.java
index 0fb7b79a7e3..1d68b668fbf 100644
--- a/jdk/src/share/classes/sun/tools/jmap/JMap.java
+++ b/jdk/src/share/classes/sun/tools/jmap/JMap.java
@@ -198,7 +198,7 @@ public class JMap {
}
// loads the given class using the system class loader
- private static Class loadClass(String name) {
+ private static Class> loadClass(String name) {
//
// We specify the system clas loader so as to cater for development
// environments where this class is on the boot class path but sa-jdi.jar
@@ -336,7 +336,7 @@ public class JMap {
// returns true if SA is available
private static boolean haveSA() {
- Class c = loadClass("sun.jvm.hotspot.tools.HeapSummary");
+ Class> c = loadClass("sun.jvm.hotspot.tools.HeapSummary");
return (c != null);
}
diff --git a/jdk/src/share/classes/sun/tools/jps/Jps.java b/jdk/src/share/classes/sun/tools/jps/Jps.java
index 9611dd3a007..9c653816b30 100644
--- a/jdk/src/share/classes/sun/tools/jps/Jps.java
+++ b/jdk/src/share/classes/sun/tools/jps/Jps.java
@@ -59,13 +59,13 @@ public class Jps {
MonitoredHost.getMonitoredHost(hostId);
// get the set active JVMs on the specified host.
- Set jvms = monitoredHost.activeVms();
+ Set jvms = monitoredHost.activeVms();
- for (Iterator j = jvms.iterator(); j.hasNext(); /* empty */ ) {
+ for (Integer jvm: jvms) {
StringBuilder output = new StringBuilder();
Throwable lastError = null;
- int lvmid = ((Integer)j.next()).intValue();
+ int lvmid = jvm;
output.append(String.valueOf(lvmid));
diff --git a/jdk/src/share/classes/sun/tools/jstack/JStack.java b/jdk/src/share/classes/sun/tools/jstack/JStack.java
index 004c2abdfb7..66fc672652c 100644
--- a/jdk/src/share/classes/sun/tools/jstack/JStack.java
+++ b/jdk/src/share/classes/sun/tools/jstack/JStack.java
@@ -137,7 +137,7 @@ public class JStack {
}
// Returns sun.jvm.hotspot.tools.JStack if available, otherwise null.
- private static Class loadSAClass() {
+ private static Class> loadSAClass() {
//
// Attempt to load JStack class - we specify the system class
// loader so as to cater for development environments where
diff --git a/jdk/src/share/classes/sun/tools/serialver/SerialVer.java b/jdk/src/share/classes/sun/tools/serialver/SerialVer.java
index 13ff3599609..4b310a81ad7 100644
--- a/jdk/src/share/classes/sun/tools/serialver/SerialVer.java
+++ b/jdk/src/share/classes/sun/tools/serialver/SerialVer.java
@@ -98,6 +98,7 @@ public class SerialVer extends Applet {
classname_t.requestFocus();
}
+ @SuppressWarnings("deprecation")
public boolean action(Event ev, Object obj) {
if (ev.target == classname_t) {
show((String)ev.arg);
@@ -110,6 +111,7 @@ public class SerialVer extends Applet {
}
+ @SuppressWarnings("deprecation")
public boolean handleEvent(Event ev) {
boolean rc = super.handleEvent(ev);
return rc;
@@ -206,7 +208,7 @@ public class SerialVer extends Applet {
}
static String resolveClass(String classname) throws ClassNotFoundException {
- Class cl = Class.forName(classname, false, loader);
+ Class> cl = Class.forName(classname, false, loader);
ObjectStreamClass desc = ObjectStreamClass.lookup(cl);
if (desc != null) {
return " static final long serialVersionUID = " +
@@ -216,6 +218,10 @@ public class SerialVer extends Applet {
}
}
+ @SuppressWarnings("deprecation")
+ private static void showWindow(Window w) {
+ w.show();
+ }
public static void main(String[] args) {
boolean show = false;
@@ -316,7 +322,7 @@ public class SerialVer extends Applet {
f.add("Center", sv);
f.pack();
- f.show();
+ showWindow(f);
}
}
@@ -362,6 +368,7 @@ class SerialVerFrame extends Frame {
/*
* Handle a window destroy event by exiting.
*/
+ @SuppressWarnings("deprecation")
public boolean handleEvent(Event e) {
if (e.id == Event.WINDOW_DESTROY) {
exit(0);
@@ -371,6 +378,7 @@ class SerialVerFrame extends Frame {
/*
* Handle an Exit event by exiting.
*/
+ @SuppressWarnings("deprecation")
public boolean action(Event ev, Object obj) {
if (ev.target == exit_i) {
exit(0);
@@ -455,11 +463,7 @@ class Res {
}
try {
String message = messageRB.getString(key);
- String[] args = new String[3];
- args[0] = a1;
- args[1] = a2;
- args[2] = a3;
- return MessageFormat.format(message, args);
+ return MessageFormat.format(message, a1, a2, a3);
} catch (MissingResourceException e) {
throw new Error("Fatal: Resource for serialver is broken. There is no " + key + " key in resource.");
}
diff --git a/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java b/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java
index c45100d7508..349ce56e90e 100644
--- a/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java
+++ b/jdk/src/share/classes/sun/util/LocaleServiceProviderPool.java
@@ -58,7 +58,7 @@ public final class LocaleServiceProviderPool {
* A Map that holds singleton instances of this class. Each instance holds a
* set of provider implementations of a particular locale sensitive service.
*/
- private static ConcurrentMap poolOfPools =
+ private static ConcurrentMap, LocaleServiceProviderPool> poolOfPools =
new ConcurrentHashMap<>();
/**
@@ -147,6 +147,10 @@ public final class LocaleServiceProviderPool {
/**
* Lazy loaded set of available locales.
* Loading all locales is a very long operation.
+ *
+ * We know "providerClasses" contains classes that extends LocaleServiceProvider,
+ * but generic array creation is not allowed, thus the "unchecked" warning
+ * is suppressed here.
*/
private static class AllAvailableLocales {
/**
@@ -156,7 +160,9 @@ public final class LocaleServiceProviderPool {
static final Locale[] allAvailableLocales;
static {
- Class[] providerClasses = {
+ @SuppressWarnings("unchecked")
+ Class[] providerClasses =
+ (Class[]) new Class>[] {
java.text.spi.BreakIteratorProvider.class,
java.text.spi.CollatorProvider.class,
java.text.spi.DateFormatProvider.class,
@@ -174,7 +180,7 @@ public final class LocaleServiceProviderPool {
all.add(getLookupLocale(locale));
}
- for (Class providerClass : providerClasses) {
+ for (Class providerClass : providerClasses) {
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(providerClass);
all.addAll(pool.getProviderLocales());
@@ -355,7 +361,6 @@ public final class LocaleServiceProviderPool {
}
Locale bundleLocale = (bundle != null ? bundle.getLocale() : null);
List lookupLocales = getLookupLocales(locale);
- P lsp;
S providersObj = null;
// check whether a provider has an implementation that's closer
@@ -375,7 +380,9 @@ public final class LocaleServiceProviderPool {
}
}
if (provLoc.contains(current)) {
- lsp = (P)findProvider(current);
+ // It is safe to assume that findProvider() returns the instance of type P.
+ @SuppressWarnings("unchecked")
+ P lsp = (P)findProvider(current);
if (lsp != null) {
providersObj = getter.getObject(lsp, locale, key, params);
if (providersObj != null) {
@@ -397,7 +404,9 @@ public final class LocaleServiceProviderPool {
// JRE has it.
return null;
} else {
- lsp = (P)findProvider(bundleLocale);
+ // It is safe to assume that findProvider() returns the instance of type P.
+ @SuppressWarnings("unchecked")
+ P lsp = (P)findProvider(bundleLocale);
if (lsp != null) {
providersObj = getter.getObject(lsp, locale, key, params);
if (providersObj != null) {
diff --git a/jdk/src/share/classes/sun/util/calendar/BaseCalendar.java b/jdk/src/share/classes/sun/util/calendar/BaseCalendar.java
index 21528dc487c..a7e763a0d7c 100644
--- a/jdk/src/share/classes/sun/util/calendar/BaseCalendar.java
+++ b/jdk/src/share/classes/sun/util/calendar/BaseCalendar.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -25,7 +25,6 @@
package sun.util.calendar;
-import java.util.Locale;
import java.util.TimeZone;
/**
@@ -203,7 +202,7 @@ public abstract class BaseCalendar extends AbstractCalendar {
return false;
}
int dow = bdate.getDayOfWeek();
- if (dow != bdate.FIELD_UNDEFINED && dow != getDayOfWeek(bdate)) {
+ if (dow != Date.FIELD_UNDEFINED && dow != getDayOfWeek(bdate)) {
return false;
}
@@ -329,7 +328,7 @@ public abstract class BaseCalendar extends AbstractCalendar {
}
// accepts 0 (December in the previous year) to 12.
- private final int getMonthLength(int year, int month) {
+ private int getMonthLength(int year, int month) {
int days = DAYS_IN_MONTH[month];
if (month == FEBRUARY && isLeapYear(year)) {
days++;
diff --git a/jdk/src/share/classes/sun/util/calendar/CalendarSystem.java b/jdk/src/share/classes/sun/util/calendar/CalendarSystem.java
index ac856412519..fdbdcb07099 100644
--- a/jdk/src/share/classes/sun/util/calendar/CalendarSystem.java
+++ b/jdk/src/share/classes/sun/util/calendar/CalendarSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -25,13 +25,6 @@
package sun.util.calendar;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -99,7 +92,7 @@ public abstract class CalendarSystem {
};
private static void initNames() {
- ConcurrentMap nameMap = new ConcurrentHashMap();
+ ConcurrentMap nameMap = new ConcurrentHashMap<>();
// Associate a calendar name with its class name and the
// calendar class name with its date class name.
@@ -112,7 +105,7 @@ public abstract class CalendarSystem {
synchronized (CalendarSystem.class) {
if (!initialized) {
names = nameMap;
- calendars = new ConcurrentHashMap();
+ calendars = new ConcurrentHashMap<>();
initialized = true;
}
}
@@ -164,10 +157,10 @@ public abstract class CalendarSystem {
cal = LocalGregorianCalendar.getLocalGregorianCalendar(calendarName);
} else {
try {
- Class cl = Class.forName(className);
+ Class> cl = Class.forName(className);
cal = (CalendarSystem) cl.newInstance();
} catch (Exception e) {
- throw new RuntimeException("internal error", e);
+ throw new InternalError(e);
}
}
if (cal == null) {
diff --git a/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java b/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java
index 99da4cd3bbf..d107a004d63 100644
--- a/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java
+++ b/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java
@@ -29,7 +29,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
@@ -124,8 +123,8 @@ public class LocalGregorianCalendar extends BaseCalendar {
new sun.security.action.GetPropertyAction("java.home"));
final String fname = homeDir + File.separator + "lib" + File.separator
+ "calendars.properties";
- calendarProps = (Properties) AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
+ calendarProps = AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Properties run() throws IOException {
Properties props = new Properties();
try (FileInputStream fis = new FileInputStream(fname)) {
props.load(fis);
@@ -142,7 +141,7 @@ public class LocalGregorianCalendar extends BaseCalendar {
if (props == null) {
return null;
}
- List eras = new ArrayList();
+ List eras = new ArrayList<>();
StringTokenizer eraTokens = new StringTokenizer(props, ";");
while (eraTokens.hasMoreTokens()) {
String items = eraTokens.nextToken().trim();
diff --git a/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java b/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java
index b79e7cc3901..975e3ed1087 100644
--- a/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfo.java
@@ -31,7 +31,6 @@ import java.lang.ref.SoftReference;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -318,7 +317,7 @@ public class ZoneInfo extends TimeZone {
return offset;
}
- private final int getTransitionIndex(long date, int type) {
+ private int getTransitionIndex(long date, int type) {
int low = 0;
int high = transitions.length - 1;
@@ -572,7 +571,7 @@ public class ZoneInfo extends TimeZone {
List excluded = ZoneInfoFile.getExcludedZones();
if (excluded != null) {
// List all zones from the idList and excluded lists
- List list = new ArrayList(idList.size() + excluded.size());
+ List list = new ArrayList<>(idList.size() + excluded.size());
list.addAll(idList);
list.addAll(excluded);
idList = list;
@@ -592,7 +591,7 @@ public class ZoneInfo extends TimeZone {
*/
public static String[] getAvailableIDs(int rawOffset) {
String[] result;
- List matched = new ArrayList();
+ List matched = new ArrayList<>();
List IDs = ZoneInfoFile.getZoneIDs();
int[] rawOffsets = ZoneInfoFile.getRawOffsets();
@@ -807,7 +806,7 @@ public class ZoneInfo extends TimeZone {
return (checksum == ((ZoneInfo)other).checksum);
}
- private static SoftReference