6850612: Deprecate Class.newInstance since it violates the checked exception language contract
authordarcy
Tue, 03 May 2016 10:40:54 -0700
changeset 37782 ad8fe7507ecc
parent 37781 71ed5645f17c
child 37783 c6aca850d162
6850612: Deprecate Class.newInstance since it violates the checked exception language contract Reviewed-by: lancea, mullan, dfuchs
jdk/src/java.base/share/classes/java/lang/Class.java
jdk/src/java.base/share/classes/java/net/InetAddress.java
jdk/src/java.base/share/classes/java/net/ProxySelector.java
jdk/src/java.base/share/classes/java/net/URL.java
jdk/src/java.base/share/classes/java/net/URLConnection.java
jdk/src/java.base/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java
jdk/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java
jdk/src/java.base/share/classes/java/security/Policy.java
jdk/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java
jdk/src/java.base/share/classes/java/util/ServiceLoader.java
jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
jdk/src/java.base/share/classes/java/util/jar/Pack200.java
jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java
jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java
jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java
jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java
jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java
jdk/src/java.base/share/classes/sun/net/ftp/FtpClientProvider.java
jdk/src/java.base/share/classes/sun/nio/ch/ThreadPool.java
jdk/src/java.base/share/classes/sun/nio/cs/FastCharsetProvider.java
jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
jdk/src/java.base/share/classes/sun/security/pkcs/PKCS8Key.java
jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java
jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java
jdk/src/java.base/share/classes/sun/security/x509/X509Key.java
jdk/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java
jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java
jdk/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java
jdk/src/java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java
jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
jdk/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java
jdk/src/java.httpclient/share/classes/java/net/http/FilterFactory.java
jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
jdk/src/java.logging/share/classes/java/util/logging/MemoryHandler.java
jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java
jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
jdk/src/java.naming/share/classes/com/sun/naming/internal/FactoryEnumeration.java
jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java
jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java
jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationID.java
jdk/src/java.rmi/share/classes/java/rmi/server/RMIClassLoader.java
jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java
jdk/src/java.rmi/share/classes/sun/rmi/server/Activation.java
jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java
jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java
jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java
jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetProvider.java
jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/SyncFactory.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java
jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java
jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Util.java
jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java
jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java
jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/TerminalFactory.java
jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/internal/ConsoleRunner.java
jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java
jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java
jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java
jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Tue May 03 10:40:54 2016 -0700
@@ -470,7 +470,7 @@
      * expression with an empty argument list.  The class is initialized if it
      * has not already been initialized.
      *
-     * <p>Note that this method propagates any exception thrown by the
+     * @deprecated This method propagates any exception thrown by the
      * nullary constructor, including a checked exception.  Use of
      * this method effectively bypasses the compile-time exception
      * checking that would otherwise be performed by the compiler.
@@ -500,6 +500,7 @@
      *          of this class.
      */
     @CallerSensitive
+    @Deprecated(since="9")
     public T newInstance()
         throws InstantiationException, IllegalAccessException
     {
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java	Tue May 03 10:40:54 2016 -0700
@@ -1645,7 +1645,9 @@
          */
         String prefix = GetPropertyAction.privilegedGetProperty("impl.prefix", "");
         try {
-            impl = Class.forName("java.net." + prefix + implName).newInstance();
+            @SuppressWarnings("deprecation")
+            Object tmp = Class.forName("java.net." + prefix + implName).newInstance();
+            impl = tmp;
         } catch (ClassNotFoundException e) {
             System.err.println("Class not found: java.net." + prefix +
                                implName + ":\ncheck impl.prefix property " +
@@ -1662,7 +1664,9 @@
 
         if (impl == null) {
             try {
-                impl = Class.forName(implName).newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = Class.forName(implName).newInstance();
+                impl = tmp;
             } catch (Exception e) {
                 throw new Error("System property impl.prefix incorrect");
             }
--- a/jdk/src/java.base/share/classes/java/net/ProxySelector.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/net/ProxySelector.java	Tue May 03 10:40:54 2016 -0700
@@ -71,7 +71,9 @@
         try {
             Class<?> c = Class.forName("sun.net.spi.DefaultProxySelector");
             if (c != null && ProxySelector.class.isAssignableFrom(c)) {
-                theProxySelector = (ProxySelector) c.newInstance();
+                @SuppressWarnings("deprecation")
+                ProxySelector tmp = (ProxySelector) c.newInstance();
+                theProxySelector = tmp;
             }
         } catch (Exception e) {
             theProxySelector = null;
--- a/jdk/src/java.base/share/classes/java/net/URL.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/net/URL.java	Tue May 03 10:40:54 2016 -0700
@@ -1198,8 +1198,9 @@
         public URLStreamHandler createURLStreamHandler(String protocol) {
             String name = PREFIX + "." + protocol + ".Handler";
             try {
-                Class<?> c = Class.forName(name);
-                return (URLStreamHandler)c.newInstance();
+                @SuppressWarnings("deprecation")
+                Object o = Class.forName(name).newInstance();
+                return (URLStreamHandler)o;
             } catch (ClassNotFoundException x) {
                 // ignore
             } catch (Exception e) {
@@ -1234,7 +1235,9 @@
                     }
                 }
                 if (cls != null) {
-                    handler = (URLStreamHandler)cls.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = cls.newInstance();
+                    handler = (URLStreamHandler)tmp;
                 }
             } catch (Exception e) {
                 // any number of exceptions can get thrown here
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java	Tue May 03 10:40:54 2016 -0700
@@ -1323,7 +1323,9 @@
                     }
                 }
                 if (cls != null) {
-                    return (ContentHandler) cls.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = cls.newInstance();
+                    return (ContentHandler) tmp;
                 }
             } catch(Exception ignored) { }
         }
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -94,9 +94,10 @@
             if (cn == null)
                 return null;
             try {
-                Class<?> c = Class.forName(cn, true,
-                                           ClassLoader.getSystemClassLoader());
-                return (AsynchronousChannelProvider)c.newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = Class.forName(cn, true,
+                                           ClassLoader.getSystemClassLoader()).newInstance();
+                return (AsynchronousChannelProvider)tmp;
             } catch (ClassNotFoundException x) {
                 throw new ServiceConfigurationError(null, x);
             } catch (IllegalAccessException x) {
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -95,9 +95,10 @@
         if (cn == null)
             return false;
         try {
-            Class<?> c = Class.forName(cn, true,
-                                       ClassLoader.getSystemClassLoader());
-            provider = (SelectorProvider)c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object tmp = Class.forName(cn, true,
+                                       ClassLoader.getSystemClassLoader()).newInstance();
+            provider = (SelectorProvider)tmp;
             return true;
         } catch (ClassNotFoundException x) {
             throw new ServiceConfigurationError(null, x);
--- a/jdk/src/java.base/share/classes/java/security/Policy.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/security/Policy.java	Tue May 03 10:40:54 2016 -0700
@@ -222,8 +222,9 @@
             public Policy run() {
                 try {
                     ClassLoader scl = ClassLoader.getSystemClassLoader();
-                    Class<?> c = Class.forName(policyProvider, true, scl);
-                    return (Policy)c.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object o = Class.forName(policyProvider, true, scl).newInstance();
+                    return (Policy)o;
                 } catch (Exception e) {
                     if (debug != null) {
                         debug.println("policy provider " + policyProvider +
--- a/jdk/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -147,6 +147,7 @@
                 if (prop != null) {
                     try {
                         Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
+                        @SuppressWarnings("deprecation")
                         ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
                         registerProvider(provider);
                         loaded.add(provider);
--- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java	Tue May 03 10:40:54 2016 -0700
@@ -811,7 +811,9 @@
             }
             S p = null;
             try {
-                p = service.cast(c.newInstance());
+                @SuppressWarnings("deprecation")
+                Object tmp = c.newInstance();
+                p = service.cast(tmp);
             } catch (Throwable x) {
                 fail(service,
                      "Provider " + cn + " could not be instantiated",
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Tue May 03 10:40:54 2016 -0700
@@ -3507,6 +3507,7 @@
      * Creates and returns the common pool, respecting user settings
      * specified via system properties.
      */
+    @SuppressWarnings("deprecation") // Class.newInstance
     static ForkJoinPool makeCommonPool() {
         int parallelism = -1;
         ForkJoinWorkerThreadFactory factory = null;
--- a/jdk/src/java.base/share/classes/java/util/jar/Pack200.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java	Tue May 03 10:40:54 2016 -0700
@@ -704,7 +704,9 @@
                     impl = com.sun.java.util.jar.pack.UnpackerImpl.class;
             }
             // We have a class.  Now instantiate it.
-            return impl.newInstance();
+            @SuppressWarnings("deprecation")
+            Object result = impl.newInstance();
+            return result;
         } catch (ClassNotFoundException e) {
             throw new Error("Class not found: " + implName +
                                 ":\ncheck property " + prop +
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -97,6 +97,7 @@
                         }
                     }
                     log("class " + clsName + " is loaded");
+                    @SuppressWarnings("deprecation")
                     SSLServerSocketFactory fac = (SSLServerSocketFactory)cls.newInstance();
                     log("instantiated an instance of class " + clsName);
                     theFactory = fac;
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -106,6 +106,7 @@
                         }
                     }
                     log("class " + clsName + " is loaded");
+                    @SuppressWarnings("deprecation")
                     SSLSocketFactory fac = (SSLSocketFactory)cls.newInstance();
                     log("instantiated an instance of class " + clsName);
                     theFactory = fac;
--- a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java	Tue May 03 10:40:54 2016 -0700
@@ -250,7 +250,9 @@
                                             finalClass, false,
                                             Thread.currentThread().getContextClassLoader()
                                     ).asSubclass(Configuration.class);
-                                    return implClass.newInstance();
+                                    @SuppressWarnings("deprecation")
+                                    Configuration result = implClass.newInstance();
+                                    return result;
                                 }
                             });
                     AccessController.doPrivileged(
--- a/jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/javax/security/auth/login/LoginContext.java	Tue May 03 10:40:54 2016 -0700
@@ -304,7 +304,9 @@
                     Class<? extends CallbackHandler> c = Class.forName(
                             defaultHandler, true,
                             finalLoader).asSubclass(CallbackHandler.class);
-                    return c.newInstance();
+                    @SuppressWarnings("deprecation")
+                    CallbackHandler result = c.newInstance();
+                    return result;
                 }
             });
         } catch (java.security.PrivilegedActionException pae) {
@@ -697,8 +699,9 @@
 
                     if (moduleStack[i].module == null) {
                         try {
-                            moduleStack[i].module = (LoginModule) Class.forName(
-                                    name, false, contextClassLoader).newInstance();
+                            @SuppressWarnings("deprecation")
+                            Object tmp = Class.forName(name, false, contextClassLoader).newInstance();
+                            moduleStack[i].module = (LoginModule) tmp;
                             if (debug != null) {
                                 debug.println(name + " loaded via reflection");
                             }
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -124,7 +124,9 @@
         ClassLoader cl = newJrtFsLoader(jrtfs);
         try {
             Class<?> c = Class.forName(JrtFileSystemProvider.class.getName(), false, cl);
-            return ((FileSystemProvider)c.newInstance()).newFileSystem(uri, newEnv);
+            @SuppressWarnings("deprecation")
+            Object tmp = c.newInstance();
+            return ((FileSystemProvider)tmp).newFileSystem(uri, newEnv);
         } catch (ClassNotFoundException |
                  IllegalAccessException |
                  InstantiationException e) {
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java	Tue May 03 10:40:54 2016 -0700
@@ -392,6 +392,7 @@
         // matter.
         return AccessController.doPrivileged(
             new PrivilegedAction<MagicAccessorImpl>() {
+                @SuppressWarnings("deprecation") // Class.newInstance
                 public MagicAccessorImpl run() {
                         try {
                         return (MagicAccessorImpl)
--- a/jdk/src/java.base/share/classes/sun/net/ftp/FtpClientProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/ftp/FtpClientProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -67,8 +67,9 @@
             return false;
         }
         try {
-            Class<?> c = Class.forName(cm, true, null);
-            provider = (FtpClientProvider) c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o = Class.forName(cm, true, null).newInstance();
+            provider = (FtpClientProvider)o;
             return true;
         } catch (ClassNotFoundException |
                  IllegalAccessException |
--- a/jdk/src/java.base/share/classes/sun/nio/ch/ThreadPool.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/ThreadPool.java	Tue May 03 10:40:54 2016 -0700
@@ -165,14 +165,11 @@
             GetPropertyAction(DEFAULT_THREAD_POOL_THREAD_FACTORY));
         if (propValue != null) {
             try {
-                Class<?> c = Class
-                    .forName(propValue, true, ClassLoader.getSystemClassLoader());
-                return ((ThreadFactory)c.newInstance());
-            } catch (ClassNotFoundException x) {
-                throw new Error(x);
-            } catch (InstantiationException x) {
-                throw new Error(x);
-            } catch (IllegalAccessException x) {
+                @SuppressWarnings("deprecation")
+                Object tmp = Class
+                    .forName(propValue, true, ClassLoader.getSystemClassLoader()).newInstance();
+                return (ThreadFactory)tmp;
+            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException x) {
                 throw new Error(x);
             }
         }
--- a/jdk/src/java.base/share/classes/sun/nio/cs/FastCharsetProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/FastCharsetProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -115,10 +115,11 @@
 
         // Instantiate the charset and cache it
         try {
-            Class<?> c = Class.forName(packagePrefix + "." + cln,
+            @SuppressWarnings("deprecation")
+            Object o= Class.forName(packagePrefix + "." + cln,
                                     true,
-                                    this.getClass().getClassLoader());
-            cs = (Charset)c.newInstance();
+                                    this.getClass().getClassLoader()).newInstance();
+            cs = (Charset)o;
             cache.put(csn, cs);
             return cs;
         } catch (ClassNotFoundException |
--- a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Tue May 03 10:40:54 2016 -0700
@@ -110,10 +110,11 @@
 
         // Instantiate the charset and cache it
         try {
-            Class<?> c = Class.forName(packagePrefix + "." + cln,
-                                    true,
-                                    this.getClass().getClassLoader());
-            cs = (Charset)c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o = Class.forName(packagePrefix + "." + cln,
+                                     true,
+                                     this.getClass().getClassLoader()).newInstance();
+            cs = (Charset)o;
             cache.put(csn, cs);
             return cs;
         } catch (ClassNotFoundException |
--- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java	Tue May 03 10:40:54 2016 -0700
@@ -185,7 +185,9 @@
                     try {
                         Class<?> c = Class.forName("apple.security.AppleProvider");
                         if (Provider.class.isAssignableFrom(c)) {
-                            return (Provider) c.newInstance();
+                            @SuppressWarnings("deprecation")
+                            Object tmp = c.newInstance();
+                            return (Provider) tmp;
                         } else {
                             return null;
                         }
@@ -386,6 +388,7 @@
 
                 Provider p = AccessController.doPrivileged
                     (new PrivilegedExceptionAction<Provider>() {
+                    @SuppressWarnings("deprecation") // Class.newInstance
                     public Provider run() throws Exception {
                         return (Provider) provClass.newInstance();
                     }
--- a/jdk/src/java.base/share/classes/sun/security/pkcs/PKCS8Key.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs/PKCS8Key.java	Tue May 03 10:40:54 2016 -0700
@@ -218,11 +218,10 @@
                 }
             }
 
-            Object      inst = null;
+            @SuppressWarnings("deprecation")
+            Object      inst = (keyClass != null) ? keyClass.newInstance() : null;
             PKCS8Key    result;
 
-            if (keyClass != null)
-                inst = keyClass.newInstance();
             if (inst instanceof PKCS8Key) {
                 result = (PKCS8Key) inst;
                 result.algid = algid;
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Tue May 03 10:40:54 2016 -0700
@@ -728,6 +728,7 @@
                     provClass = Class.forName(provName);
                 }
 
+                @SuppressWarnings("deprecation")
                 Object obj = provClass.newInstance();
                 if (!(obj instanceof Provider)) {
                     MessageFormat form = new MessageFormat
--- a/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java	Tue May 03 10:40:54 2016 -0700
@@ -196,8 +196,9 @@
         // A new keystore is always created in the primary keystore format
         if (stream == null) {
             try {
-                keystore = primaryKeyStore.newInstance();
-
+                @SuppressWarnings("deprecation")
+                KeyStoreSpi tmp = primaryKeyStore.newInstance();
+                keystore = tmp;
             } catch (InstantiationException | IllegalAccessException e) {
                 // can safely ignore
             }
@@ -214,7 +215,9 @@
             bufferedStream.mark(Integer.MAX_VALUE);
 
             try {
-                keystore = primaryKeyStore.newInstance();
+                @SuppressWarnings("deprecation")
+                KeyStoreSpi tmp = primaryKeyStore.newInstance();
+                keystore = tmp;
                 type = primaryType;
                 keystore.engineLoad(bufferedStream, password);
 
@@ -232,7 +235,9 @@
                         throw e;
                     }
 
-                    keystore = secondaryKeyStore.newInstance();
+                    @SuppressWarnings("deprecation")
+                    KeyStoreSpi tmp= secondaryKeyStore.newInstance();
+                    keystore = tmp;
                     type = secondaryType;
                     bufferedStream.reset();
                     keystore.engineLoad(bufferedStream, password);
@@ -284,7 +289,9 @@
         boolean result = false;
 
         try {
-            keystore = primaryKeyStore.newInstance();
+            @SuppressWarnings("deprecation")
+            KeyStoreSpi tmp = primaryKeyStore.newInstance();
+            keystore = tmp;
             type = primaryType;
             result = keystore.engineProbe(stream);
 
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509Key.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509Key.java	Tue May 03 10:40:54 2016 -0700
@@ -255,11 +255,10 @@
                 }
             }
 
-            Object      inst = null;
+            @SuppressWarnings("deprecation")
+            Object      inst = (keyClass != null) ? keyClass.newInstance() : null;
             X509Key     result;
 
-            if (keyClass != null)
-                inst = keyClass.newInstance();
             if (inst instanceof X509Key) {
                 result = (X509Key) inst;
                 result.algid = algid;
--- a/jdk/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java	Tue May 03 10:40:54 2016 -0700
@@ -157,8 +157,9 @@
             cal = LocalGregorianCalendar.getLocalGregorianCalendar(calendarName);
         } else {
             try {
-                Class<?> cl = Class.forName(className);
-                cal = (CalendarSystem) cl.newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = Class.forName(className).newInstance();
+                cal = (CalendarSystem) tmp;
             } catch (Exception e) {
                 throw new InternalError(e);
             }
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java	Tue May 03 10:40:54 2016 -0700
@@ -171,8 +171,9 @@
             if (cached == null) {
                 try {
                     // lazily load adapters here
-                    adapter = (LocaleProviderAdapter)Class.forName(type.getAdapterClassName())
-                        .newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = Class.forName(type.getAdapterClassName()).newInstance();
+                    adapter = (LocaleProviderAdapter)tmp;
                     cached = adapterInstances.putIfAbsent(type, adapter);
                     if (cached != null) {
                         adapter = cached;
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java	Tue May 03 10:40:54 2016 -0700
@@ -73,7 +73,7 @@
         try {
             return AccessController.doPrivileged(new PrivilegedExceptionAction<P>() {
                 @Override
-                @SuppressWarnings("unchecked")
+                @SuppressWarnings(value={"unchecked", "deprecation"})
                 public P run() {
                     P delegate = null;
 
--- a/jdk/src/java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -61,7 +61,9 @@
         throws SocketException {
         if (prefixImplClass != null) {
             try {
-                return (DatagramSocketImpl)prefixImplClass.newInstance();
+                @SuppressWarnings("deprecation")
+                DatagramSocketImpl result = (DatagramSocketImpl)prefixImplClass.newInstance();
+                return result;
             } catch (Exception e) {
                 throw new SocketException("can't instantiate DatagramSocketImpl");
             }
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -48,7 +48,9 @@
             throw new AssertionError(x);
         }
         try {
-            return c.newInstance();
+            @SuppressWarnings("deprecation")
+            AsynchronousChannelProvider result = c.newInstance();
+            return result;
         } catch (IllegalAccessException | InstantiationException x) {
             throw new AssertionError(x);
         }
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -44,7 +44,9 @@
             throw new AssertionError(x);
         }
         try {
-            return c.newInstance();
+            @SuppressWarnings("deprecation")
+            FileSystemProvider result = c.newInstance();
+            return result;
         } catch (IllegalAccessException | InstantiationException x) {
             throw new AssertionError(x);
         }
--- a/jdk/src/java.httpclient/share/classes/java/net/http/FilterFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/FilterFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -39,7 +39,9 @@
         List<HeaderFilter> l = new LinkedList<>();
         for (Class<? extends HeaderFilter> clazz : filterClasses) {
             try {
-                l.add(clazz.newInstance());
+                @SuppressWarnings("deprecation")
+                HeaderFilter headerFilter = clazz.newInstance();
+                l.add(headerFilter);
             } catch (ReflectiveOperationException e) {
                 throw new InternalError(e);
             }
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Tue May 03 10:40:54 2016 -0700
@@ -231,13 +231,15 @@
                     cname = System.getProperty("java.util.logging.manager");
                     if (cname != null) {
                         try {
-                            Class<?> clz = ClassLoader.getSystemClassLoader()
-                                    .loadClass(cname);
-                            mgr = (LogManager) clz.newInstance();
+                            @SuppressWarnings("deprecation")
+                            Object tmp = ClassLoader.getSystemClassLoader()
+                                .loadClass(cname).newInstance();
+                            mgr = (LogManager) tmp;
                         } catch (ClassNotFoundException ex) {
-                            Class<?> clz = Thread.currentThread()
-                                    .getContextClassLoader().loadClass(cname);
-                            mgr = (LogManager) clz.newInstance();
+                            @SuppressWarnings("deprecation")
+                            Object tmp = Thread.currentThread()
+                                .getContextClassLoader().loadClass(cname).newInstance();
+                            mgr = (LogManager) tmp;
                         }
                     }
                 } catch (Exception ex) {
@@ -991,8 +993,9 @@
         List<Handler> handlers = new ArrayList<>(names.length);
         for (String type : names) {
             try {
-                Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(type);
-                Handler hdl = (Handler) clz.newInstance();
+                @SuppressWarnings("deprecation")
+                Object o = ClassLoader.getSystemClassLoader().loadClass(type).newInstance();
+                Handler hdl = (Handler) o;
                 // Check if there is a property defining the
                 // this handler's level.
                 String levs = getProperty(type + ".level");
@@ -1330,11 +1333,13 @@
                 // calling readConfiguration(InputStream) with a suitable stream.
                 try {
                     Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
-                    clz.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object witness = clz.newInstance();
                     return;
                 } catch (ClassNotFoundException ex) {
                     Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
-                    clz.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object witness = clz.newInstance();
                     return;
                 }
             } catch (Exception ex) {
@@ -1561,7 +1566,8 @@
                 for (String word : names) {
                     try {
                         Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
-                        clz.newInstance();
+                        @SuppressWarnings("deprecation")
+                        Object witness = clz.newInstance();
                     } catch (Exception ex) {
                         System.err.println("Can't load config class \"" + word + "\"");
                         System.err.println("" + ex);
@@ -2307,8 +2313,9 @@
         String val = getProperty(name);
         try {
             if (val != null) {
-                Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(val);
-                return (Filter) clz.newInstance();
+                @SuppressWarnings("deprecation")
+                Object o = ClassLoader.getSystemClassLoader().loadClass(val).newInstance();
+                return (Filter) o;
             }
         } catch (Exception ex) {
             // We got one of a variety of exceptions in creating the
@@ -2328,8 +2335,9 @@
         String val = getProperty(name);
         try {
             if (val != null) {
-                Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(val);
-                return (Formatter) clz.newInstance();
+                @SuppressWarnings("deprecation")
+                Object o = ClassLoader.getSystemClassLoader().loadClass(val).newInstance();
+                return (Formatter) o;
             }
         } catch (Exception ex) {
             // We got one of a variety of exceptions in creating the
--- a/jdk/src/java.logging/share/classes/java/util/logging/MemoryHandler.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.logging/share/classes/java/util/logging/MemoryHandler.java	Tue May 03 10:40:54 2016 -0700
@@ -117,7 +117,9 @@
         Class<?> clz;
         try {
             clz = ClassLoader.getSystemClassLoader().loadClass(targetName);
-            target = (Handler) clz.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o = clz.newInstance();
+            target = (Handler) o;
         } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
             throw new RuntimeException("MemoryHandler can't load handler target \"" + targetName + "\"" , e);
         }
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -655,7 +655,9 @@
             final Object[] openArray = (Object[]) openValue;
             final Collection<Object> valueCollection;
             try {
-                valueCollection = cast(collectionClass.newInstance());
+                @SuppressWarnings("deprecation")
+                Collection<?> tmp = collectionClass.newInstance();
+                valueCollection = cast(tmp);
             } catch (Exception e) {
                 throw invalidObjectException("Cannot create collection", e);
             }
@@ -1114,7 +1116,9 @@
             try {
                 final Class<?> targetClass = getTargetClass();
                 ReflectUtil.checkPackageAccess(targetClass);
-                o = targetClass.newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = targetClass.newInstance();
+                o = tmp;
                 for (int i = 0; i < itemNames.length; i++) {
                     if (cd.containsKey(itemNames[i])) {
                         Object openItem = cd.get(itemNames[i]);
--- a/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -458,6 +458,7 @@
      **/
     private static MBeanServerBuilder newBuilder(Class<?> builderClass) {
         try {
+            @SuppressWarnings("deprecation")
             final Object abuilder = builderClass.newInstance();
             return (MBeanServerBuilder)abuilder;
         } catch (RuntimeException x) {
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -531,7 +531,9 @@
             // We have just proved that this cast is correct
             Class<? extends T> providerClassT = Util.cast(providerClass);
             try {
-                return providerClassT.newInstance();
+                @SuppressWarnings("deprecation")
+                T result = providerClassT.newInstance();
+                return result;
             } catch (Exception e) {
                 final String msg =
                     "Exception when instantiating provider [" + className +
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/FactoryEnumeration.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/FactoryEnumeration.java	Tue May 03 10:40:54 2016 -0700
@@ -86,7 +86,9 @@
                     answer = cls;
                 }
                 // Instantiate Class to get factory
-                answer = ((Class) answer).newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = ((Class) answer).newInstance();
+                answer = tmp;
                 ref = new NamedWeakReference<>(answer, className);
                 factories.set(posn-1, ref);  // replace Class object or null
                 return answer;
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java	Tue May 03 10:40:54 2016 -0700
@@ -399,7 +399,9 @@
                 className = parser.nextToken() + classSuffix;
                 try {
                     // System.out.println("loading " + className);
-                    factory = helper.loadClass(className, loader).newInstance();
+                    @SuppressWarnings("deprecation") // Class.newInstance
+                    Object tmp = helper.loadClass(className, loader).newInstance();
+                    factory = tmp;
                 } catch (InstantiationException e) {
                     NamingException ne =
                         new NamingException("Cannot instantiate " + className);
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java	Tue May 03 10:40:54 2016 -0700
@@ -192,18 +192,12 @@
         }
         try {
             VersionHelper helper = VersionHelper.getVersionHelper();
-            Class<?> clas = helper.loadClass(
-                "com.sun.jndi.ldap.ext.StartTlsResponseImpl");
-
-            resp = (StartTlsResponse) clas.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o = helper.loadClass(
+                "com.sun.jndi.ldap.ext.StartTlsResponseImpl").newInstance();
+            resp = (StartTlsResponse) o;
 
-        } catch (IllegalAccessException e) {
-            throw wrapException(e);
-
-        } catch (InstantiationException e) {
-            throw wrapException(e);
-
-        } catch (ClassNotFoundException e) {
+        } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
             throw wrapException(e);
         }
 
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java	Tue May 03 10:40:54 2016 -0700
@@ -159,7 +159,9 @@
             }
         }
 
-        return (clas != null) ? (ObjectFactory) clas.newInstance() : null;
+        @SuppressWarnings("deprecation") // Class.newInstance
+        ObjectFactory result = (clas != null) ? (ObjectFactory) clas.newInstance() : null;
+        return result;
     }
 
 
@@ -710,8 +712,9 @@
 
             if (factory == null) {
                 try {
-                    factory = (InitialContextFactory)
-                            helper.loadClass(className).newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object o = helper.loadClass(className).newInstance();
+                    factory = (InitialContextFactory) o;
                 } catch (Exception e) {
                     NoInitialContextException ne =
                             new NoInitialContextException(
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java	Tue May 03 10:40:54 2016 -0700
@@ -238,10 +238,11 @@
             // dependent on the invoking thread.
             // Checking AllPermission also seems wrong.
             try {
-                return (PreferencesFactory)
-                    Class.forName(factoryName, false,
-                                  ClassLoader.getSystemClassLoader())
+                @SuppressWarnings("deprecation")
+                Object result =Class.forName(factoryName, false,
+                                             ClassLoader.getSystemClassLoader())
                     .newInstance();
+                return (PreferencesFactory)result;
             } catch (Exception ex) {
                 try {
                     // workaround for javaws, plugin,
@@ -250,11 +251,12 @@
                     if (sm != null) {
                         sm.checkPermission(new java.security.AllPermission());
                     }
-                    return (PreferencesFactory)
-                        Class.forName(factoryName, false,
-                                      Thread.currentThread()
-                                      .getContextClassLoader())
+                    @SuppressWarnings("deprecation")
+                    Object result = Class.forName(factoryName, false,
+                                                  Thread.currentThread()
+                                                  .getContextClassLoader())
                         .newInstance();
+                    return (PreferencesFactory) result;
                 } catch (Exception e) {
                     throw new InternalError(
                         "Can't instantiate Preferences factory "
@@ -299,9 +301,10 @@
             platformFactory = "java.util.prefs.FileSystemPreferencesFactory";
         }
         try {
-            return (PreferencesFactory)
-                Class.forName(platformFactory, false,
-                              Preferences.class.getClassLoader()).newInstance();
+            @SuppressWarnings("deprecation")
+            Object result = Class.forName(platformFactory, false,
+                                          Preferences.class.getClassLoader()).newInstance();
+            return (PreferencesFactory) result;
         } catch (Exception e) {
             throw new InternalError(
                 "Can't instantiate platform default Preferences factory "
--- a/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationID.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationID.java	Tue May 03 10:40:54 2016 -0700
@@ -272,6 +272,7 @@
             Class<? extends RemoteRef> refClass =
                 Class.forName(RemoteRef.packagePrefix + "." + in.readUTF())
                 .asSubclass(RemoteRef.class);
+            @SuppressWarnings("deprecation")
             RemoteRef ref = refClass.newInstance();
             ref.readExternal(in);
             activator = (Activator)
--- a/jdk/src/java.rmi/share/classes/java/rmi/server/RMIClassLoader.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.rmi/share/classes/java/rmi/server/RMIClassLoader.java	Tue May 03 10:40:54 2016 -0700
@@ -681,7 +681,9 @@
                     Class.forName(providerClassName, false,
                                   ClassLoader.getSystemClassLoader())
                     .asSubclass(RMIClassLoaderSpi.class);
-                return providerClass.newInstance();
+                @SuppressWarnings("deprecation")
+                RMIClassLoaderSpi result = providerClass.newInstance();
+                return result;
 
             } catch (ClassNotFoundException e) {
                 throw new NoClassDefFoundError(e.getMessage());
--- a/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java	Tue May 03 10:40:54 2016 -0700
@@ -439,18 +439,16 @@
                 RemoteRef.packagePrefix + "." + refClassName;
             Class<?> refClass = Class.forName(internalRefClassName);
             try {
-                ref = (RemoteRef) refClass.newInstance();
+                @SuppressWarnings("deprecation")
+                Object tmp = refClass.newInstance();
+                ref = (RemoteRef) tmp;
 
                 /*
                  * If this step fails, assume we found an internal
                  * class that is not meant to be a serializable ref
                  * type.
                  */
-            } catch (InstantiationException e) {
-                throw new ClassNotFoundException(internalRefClassName, e);
-            } catch (IllegalAccessException e) {
-                throw new ClassNotFoundException(internalRefClassName, e);
-            } catch (ClassCastException e) {
+            } catch (InstantiationException | IllegalAccessException | ClassCastException e) {
                 throw new ClassNotFoundException(internalRefClassName, e);
             }
             ref.readExternal(in);
--- a/jdk/src/java.rmi/share/classes/sun/rmi/server/Activation.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/server/Activation.java	Tue May 03 10:40:54 2016 -0700
@@ -2066,7 +2066,9 @@
 
                 try {
                     Class<?> execPolicyClass = getRMIClass(execPolicyClassName);
-                    execPolicy = execPolicyClass.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = execPolicyClass.newInstance();
+                    execPolicy = tmp;
                     execPolicyMethod =
                         execPolicyClass.getMethod("checkExecCommand",
                                                   ActivationGroupDesc.class,
--- a/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -111,8 +111,9 @@
                 type = "PC/SC";
                 Provider sun = Security.getProvider("SunPCSC");
                 if (sun == null) {
-                    Class<?> clazz = Class.forName("sun.security.smartcardio.SunPCSC");
-                    sun = (Provider)clazz.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object o = Class.forName("sun.security.smartcardio.SunPCSC").newInstance();
+                    sun = (Provider)o;
                 }
                 factory = TerminalFactory.getInstance(type, null, sun);
             } catch (Exception e) {
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java	Tue May 03 10:40:54 2016 -0700
@@ -2962,7 +2962,9 @@
                 SQLData obj = null;
                 try {
                     ReflectUtil.checkPackageAccess(c);
-                    obj = (SQLData) c.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = c.newInstance();
+                    obj = (SQLData) tmp;
                 } catch(Exception ex) {
                     throw new SQLException("Unable to Instantiate: ", ex);
                 }
@@ -5710,7 +5712,9 @@
                 SQLData obj = null;
                 try {
                     ReflectUtil.checkPackageAccess(c);
-                    obj = (SQLData) c.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = c.newInstance();
+                    obj = (SQLData) tmp;
                 } catch(Exception ex) {
                     throw new SQLException("Unable to Instantiate: ", ex);
                 }
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Tue May 03 10:40:54 2016 -0700
@@ -574,7 +574,9 @@
                         SQLData obj = null;
                         try {
                             ReflectUtil.checkPackageAccess(c);
-                            obj = (SQLData)c.newInstance();
+                            @SuppressWarnings("deprecation")
+                            Object tmp = c.newInstance();
+                            obj = (SQLData)tmp;
                         } catch (Exception ex) {
                             throw new SQLException("Unable to Instantiate: ", ex);
                         }
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -136,8 +136,9 @@
                 }
                 // getFactoryClass takes care of adding the read edge if
                 // necessary
-                Class<?> c = getFactoryClass(factoryClassName, null, false);
-                factory = (RowSetFactory) c.newInstance();
+                @SuppressWarnings("deprecation")
+                Object o = getFactoryClass(factoryClassName, null, false).newInstance();
+                factory = (RowSetFactory) o;
             }
         } catch (Exception e) {
             throw new SQLException( "RowSetFactory: " + factoryClassName +
@@ -202,6 +203,7 @@
             // getFactoryClass takes care of adding the read edge if
             // necessary
             Class<?> providerClass = getFactoryClass(factoryClassName, cl, false);
+            @SuppressWarnings("deprecation")
             RowSetFactory instance = (RowSetFactory) providerClass.newInstance();
             if (debug) {
                 trace("Created new instance of " + providerClass +
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Tue May 03 10:40:54 2016 -0700
@@ -478,7 +478,9 @@
                 SQLData obj = null;
                 try {
                     ReflectUtil.checkPackageAccess(c);
-                    obj = (SQLData)c.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = c.newInstance();
+                    obj = (SQLData)tmp;
                 } catch (Exception ex) {
                     throw new SQLException("Unable to Instantiate: ", ex);
                 }
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/SyncFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/SyncFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -582,14 +582,12 @@
              * there.
              **/
             c = Class.forName(providerID, true, cl);
-            return (SyncProvider) c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object result =  c.newInstance();
+            return (SyncProvider)result;
 
-        } catch (IllegalAccessException e) {
+        } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
             throw new SyncFactoryException("IllegalAccessException: " + e.getMessage());
-        } catch (InstantiationException e) {
-            throw new SyncFactoryException("InstantiationException: " + e.getMessage());
-        } catch (ClassNotFoundException e) {
-            throw new SyncFactoryException("ClassNotFoundException: " + e.getMessage());
         }
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java	Tue May 03 10:40:54 2016 -0700
@@ -152,7 +152,9 @@
                 log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
                    + implementingClass + "\"");
             }
-            return implementingClass.newInstance();
+            @SuppressWarnings("deprecation")
+            SignatureAlgorithmSpi result = implementingClass.newInstance();
+            return result;
         }  catch (IllegalAccessException ex) {
             Object exArgs[] = { algorithmURI, ex.getMessage() };
             throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java	Tue May 03 10:40:54 2016 -0700
@@ -115,7 +115,9 @@
             Class<? extends CanonicalizerSpi> implementingClass =
                 canonicalizerHash.get(algorithmURI);
 
-            canonicalizerSpi = implementingClass.newInstance();
+            @SuppressWarnings("deprecation")
+            CanonicalizerSpi tmp = implementingClass.newInstance();
+            canonicalizerSpi = tmp;
             canonicalizerSpi.reset = true;
         } catch (Exception e) {
             Object exArgs[] = { algorithmURI };
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java	Tue May 03 10:40:54 2016 -0700
@@ -182,6 +182,7 @@
     public static void register(String className, boolean globalResolver)
         throws ClassNotFoundException, IllegalAccessException, InstantiationException {
         JavaUtils.checkRegisterPermission();
+        @SuppressWarnings("deprecation")
         KeyResolverSpi keyResolverSpi =
             (KeyResolverSpi) Class.forName(className).newInstance();
         keyResolverSpi.setGlobalResolver(globalResolver);
@@ -207,7 +208,9 @@
         KeyResolverSpi keyResolverSpi = null;
         Exception ex = null;
         try {
-            keyResolverSpi = (KeyResolverSpi) Class.forName(className).newInstance();
+            @SuppressWarnings("deprecation")
+            Object tmp = Class.forName(className).newInstance();
+            keyResolverSpi = (KeyResolverSpi) tmp;
         } catch (ClassNotFoundException e) {
             ex = e;
         } catch (IllegalAccessException e) {
@@ -272,6 +275,7 @@
         JavaUtils.checkRegisterPermission();
         List<KeyResolver> keyResolverList = new ArrayList<KeyResolver>(classNames.size());
         for (String className : classNames) {
+            @SuppressWarnings("deprecation")
             KeyResolverSpi keyResolverSpi =
                 (KeyResolverSpi) Class.forName(className).newInstance();
             keyResolverSpi.setGlobalResolver(false);
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolverSpi.java	Tue May 03 10:40:54 2016 -0700
@@ -110,7 +110,9 @@
         KeyResolverSpi tmp = this;
         if (globalResolver) {
             try {
-                tmp = getClass().newInstance();
+                @SuppressWarnings("deprecation")
+                KeyResolverSpi krs = getClass().newInstance();
+                tmp = krs;
             } catch (InstantiationException e) {
                 throw new KeyResolverException("", e);
             } catch (IllegalAccessException e) {
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/Transform.java	Tue May 03 10:40:54 2016 -0700
@@ -160,7 +160,9 @@
             throw new InvalidTransformException("signature.Transform.UnknownTransform", exArgs);
         }
         try {
-            transformSpi = transformSpiClass.newInstance();
+            @SuppressWarnings("deprecation")
+            TransformSpi tmp = transformSpiClass.newInstance();
+            transformSpi = tmp;
         } catch (InstantiationException ex) {
             Object exArgs[] = { algorithmURI };
             throw new InvalidTransformException(
@@ -345,7 +347,9 @@
         }
         TransformSpi newTransformSpi = null;
         try {
-            newTransformSpi = transformSpiClass.newInstance();
+            @SuppressWarnings("deprecation")
+            TransformSpi tmp = transformSpiClass.newInstance();
+            newTransformSpi = tmp;
         } catch (InstantiationException ex) {
             Object exArgs[] = { algorithmURI };
             throw new InvalidTransformException(
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java	Tue May 03 10:40:54 2016 -0700
@@ -99,8 +99,10 @@
                 ResourceResolver resolverTmp = resolver;
                 if (!resolver.resolverSpi.engineIsThreadSafe()) {
                     try {
-                        resolverTmp =
-                            new ResourceResolver(resolver.resolverSpi.getClass().newInstance());
+                        @SuppressWarnings("deprecation")
+                        ResourceResolver tmp = new ResourceResolver(resolver.resolverSpi.getClass().newInstance());
+                        resolverTmp = tmp;
+                            ;
                     } catch (InstantiationException e) {
                         throw new ResourceResolverException("", e, context.attr, context.baseUri);
                     } catch (IllegalAccessException e) {
@@ -246,6 +248,7 @@
     public static void register(Class<? extends ResourceResolverSpi> className, boolean start) {
         JavaUtils.checkRegisterPermission();
         try {
+            @SuppressWarnings("deprecation")
             ResourceResolverSpi resourceResolverSpi = className.newInstance();
             register(resourceResolverSpi, start);
         } catch (IllegalAccessException e) {
--- a/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java	Tue May 03 10:40:54 2016 -0700
@@ -121,6 +121,7 @@
             Class<?> translatorClass = getTranslatorClass(o.getClass());
             if (translatorClass != null) {
                 try {
+                    @SuppressWarnings("deprecation")
                     Translator t = (Translator)translatorClass.newInstance();
                     t.setSource(o);
                     a = t;
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -148,6 +148,7 @@
                                        true,
                                        this.getClass().getClassLoader());
 
+            @SuppressWarnings("deprecation")
             Charset cs = (Charset)c.newInstance();
             cache.put(csn, new SoftReference<Charset>(cs));
             return cs;
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Util.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Util.java	Tue May 03 10:40:54 2016 -0700
@@ -88,8 +88,9 @@
         p = Security.getProvider(providerName);
         if (p == null) {
             try {
-                Class<?> clazz = Class.forName(className);
-                p = (Provider)clazz.newInstance();
+                @SuppressWarnings("deprecation")
+                Object o = Class.forName(className).newInstance();
+                p = (Provider)o;
             } catch (Exception e) {
                 throw new ProviderException
                         ("Could not find provider " + providerName, e);
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java	Tue May 03 10:40:54 2016 -0700
@@ -1446,7 +1446,9 @@
                             }
                             return null;
                         }
-                        return (CallbackHandler)c.newInstance();
+                        @SuppressWarnings("deprecation")
+                        Object result = c.newInstance();
+                        return (CallbackHandler)result;
                     }
                 });
                 // save it
--- a/jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -89,9 +89,10 @@
         if (cn == null)
             return false;
         try {
-            Class<?> c = Class.forName(cn, true,
-                                       ClassLoader.getSystemClassLoader());
-            provider = (HttpServerProvider)c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o = Class.forName(cn, true,
+                                     ClassLoader.getSystemClassLoader()).newInstance();
+            provider = (HttpServerProvider)o;
             return true;
         } catch (ClassNotFoundException |
                  IllegalAccessException |
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/TerminalFactory.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/TerminalFactory.java	Tue May 03 10:40:54 2016 -0700
@@ -82,7 +82,9 @@
                 }
                 else {
                     try {
-                        t = (Terminal) Thread.currentThread().getContextClassLoader().loadClass(type).newInstance();
+                        @SuppressWarnings("deprecation")
+                        Object o = Thread.currentThread().getContextClassLoader().loadClass(type).newInstance();
+                        t = (Terminal) o;
                     }
                     catch (Exception e) {
                         throw new IllegalArgumentException(MessageFormat.format("Invalid terminal type: {0}", type), e);
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/internal/ConsoleRunner.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/internal/ConsoleRunner.java	Tue May 03 10:40:54 2016 -0700
@@ -61,6 +61,7 @@
         List<Completer> completorList = new ArrayList<Completer>();
 
         for (StringTokenizer tok = new StringTokenizer(completors, ","); tok.hasMoreTokens();) {
+            @SuppressWarnings("deprecation")
             Object obj = Class.forName(tok.nextToken()).newInstance();
             completorList.add((Completer) obj);
         }
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java	Tue May 03 10:40:54 2016 -0700
@@ -128,7 +128,9 @@
             if (lib.equals("dt_shmem")) {
                 try {
                     Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
-                    ts = (TransportService)c.newInstance();
+                    @SuppressWarnings("deprecation")
+                    Object tmp = c.newInstance();
+                    ts = (TransportService)tmp;
                 } catch (Exception x) { }
             }
         }
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java	Tue May 03 10:40:54 2016 -0700
@@ -53,17 +53,19 @@
         super();
 
         try {
-            Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
-            transportService = (TransportService)c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o =
+                Class.forName("com.sun.tools.jdi.SharedMemoryTransportService").newInstance();
+            transportService = (TransportService)o;
             transport = new Transport() {
                 public String name() {
                     return "dt_shmem";
                 }
             };
-        } catch (ClassNotFoundException x) {
-        } catch (UnsatisfiedLinkError x) {
-        } catch (InstantiationException x) {
-        } catch (IllegalAccessException x) {
+        } catch (ClassNotFoundException |
+                 UnsatisfiedLinkError |
+                 InstantiationException |
+                 IllegalAccessException x) {
         };
 
         if (transportService == null) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java	Tue May 03 10:40:54 2016 -0700
@@ -64,18 +64,20 @@
          * transport or the socket transport
          */
         try {
-            Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
-            transportService = (TransportService)c.newInstance();
+            @SuppressWarnings("deprecation")
+            Object o =
+                Class.forName("com.sun.tools.jdi.SharedMemoryTransportService").newInstance();
+            transportService = (TransportService)o;
             transport = new Transport() {
                 public String name() {
                     return "dt_shmem";
                 }
             };
             usingSharedMemory = true;
-        } catch (ClassNotFoundException x) {
-        } catch (UnsatisfiedLinkError x) {
-        } catch (InstantiationException x) {
-        } catch (IllegalAccessException x) {
+        } catch (ClassNotFoundException |
+                 UnsatisfiedLinkError |
+                 InstantiationException |
+                 IllegalAccessException x) {
         };
         if (transportService == null) {
             transportService = new SocketTransportService();
--- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java	Tue May 03 15:50:54 2016 +0200
+++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/provider/LocaleDataProvider.java	Tue May 03 10:40:54 2016 -0700
@@ -46,7 +46,7 @@
         Class<?> c = Class.forName(LocaleDataProvider.class.getModule(), bundleName);
         if (c != null && ResourceBundle.class.isAssignableFrom(c)) {
             try {
-                @SuppressWarnings("unchecked")
+                @SuppressWarnings({"unchecked", "deprecation"})
                 ResourceBundle rb = ((Class<ResourceBundle>) c).newInstance();
                 return rb;
             } catch (InstantiationException | IllegalAccessException e) {