changeset 3384:2a0ff59928de

7005608: diamond conversion of JCA and crypto providers Reviewed-by: wetmore
author smarks
date Mon, 10 Jan 2011 17:06:10 -0800
parents f4d755bbdabe
children befe813e24d2 38729ba6eb4f
files src/share/classes/java/security/Security.java src/share/classes/sun/security/jca/ProviderList.java src/share/classes/sun/security/jca/Providers.java src/share/classes/sun/security/provider/PolicyFile.java src/share/classes/sun/security/provider/Sun.java src/share/classes/sun/security/provider/VerificationProvider.java src/share/classes/sun/security/provider/X509Factory.java src/share/classes/sun/security/rsa/RSACore.java src/share/classes/sun/security/rsa/SunRsaSign.java
diffstat 9 files changed, 24 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/security/Security.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/java/security/Security.java	Mon Jan 10 17:06:10 2011 -0800
@@ -659,7 +659,7 @@
     }
 
     // Map containing cached Spi Class objects of the specified type
-    private static final Map<String,Class> spiMap = new ConcurrentHashMap<>();
+    private static final Map<String, Class> spiMap = new ConcurrentHashMap<>();
 
     /**
      * Return the Class object for the given engine type
--- a/src/share/classes/sun/security/jca/ProviderList.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/jca/ProviderList.java	Mon Jan 10 17:06:10 2011 -0800
@@ -96,7 +96,7 @@
         if (providerList.getProvider(p.getName()) != null) {
             return providerList;
         }
-        List<ProviderConfig> list = new ArrayList<ProviderConfig>
+        List<ProviderConfig> list = new ArrayList<>
                                     (Arrays.asList(providerList.configs));
         int n = list.size();
         if ((position < 0) || (position > n)) {
@@ -160,7 +160,7 @@
      * Return a new ProviderList parsed from the java.security Properties.
      */
     private ProviderList() {
-        List<ProviderConfig> configList = new ArrayList<ProviderConfig>();
+        List<ProviderConfig> configList = new ArrayList<>();
         for (int i = 1; true; i++) {
             String entry = Security.getProperty("security.provider." + i);
             if (entry == null) {
@@ -200,7 +200,7 @@
      * possible recursion and deadlock during verification.
      */
     ProviderList getJarList(String[] jarClassNames) {
-        List<ProviderConfig> newConfigs = new ArrayList<ProviderConfig>();
+        List<ProviderConfig> newConfigs = new ArrayList<>();
         for (String className : jarClassNames) {
             ProviderConfig newConfig = new ProviderConfig(className);
             for (ProviderConfig config : configs) {
@@ -356,7 +356,7 @@
      */
     @Deprecated
     public List<Service> getServices(String type, List<String> algorithms) {
-        List<ServiceId> ids = new ArrayList<ServiceId>();
+        List<ServiceId> ids = new ArrayList<>();
         for (String alg : algorithms) {
             ids.add(new ServiceId(type, alg));
         }
--- a/src/share/classes/sun/security/jca/Providers.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/jca/Providers.java	Mon Jan 10 17:06:10 2011 -0800
@@ -40,7 +40,7 @@
 public class Providers {
 
     private static final ThreadLocal<ProviderList> threadLists =
-        new InheritableThreadLocal<ProviderList>();
+        new InheritableThreadLocal<>();
 
     // number of threads currently using thread-local provider lists
     // tracked to allow an optimization if == 0
--- a/src/share/classes/sun/security/provider/PolicyFile.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/provider/PolicyFile.java	Mon Jan 10 17:06:10 2011 -0800
@@ -299,8 +299,7 @@
     private static final int DEFAULT_CACHE_SIZE = 1;
 
     // contains the policy grant entries, PD cache, and alias mapping
-    private AtomicReference<PolicyInfo> policyInfo =
-        new AtomicReference<PolicyInfo>();
+    private AtomicReference<PolicyInfo> policyInfo = new AtomicReference<>();
     private boolean constructed = false;
 
     private boolean expandProperties = true;
@@ -1334,8 +1333,7 @@
 
         List<PolicyParser.PrincipalEntry> entryPs = entry.getPrincipals();
         if (debug != null) {
-            ArrayList<PolicyParser.PrincipalEntry> accPs =
-                        new ArrayList<PolicyParser.PrincipalEntry>();
+            ArrayList<PolicyParser.PrincipalEntry> accPs = new ArrayList<>();
             if (principals != null) {
                 for (int i = 0; i < principals.length; i++) {
                     accPs.add(new PolicyParser.PrincipalEntry
@@ -1416,8 +1414,7 @@
                     // check if the PrincipalComparator
                     // implies the current thread's principals
 
-                    Set<Principal> pSet =
-                                new HashSet<Principal>(principals.length);
+                    Set<Principal> pSet = new HashSet<>(principals.length);
                     for (int j = 0; j < principals.length; j++) {
                         pSet.add(principals[j]);
                     }
@@ -1700,7 +1697,7 @@
             // build an info array for every principal
             // in the current domain which has a principal class
             // that is equal to policy entry principal class name
-            List<Principal> plist = new ArrayList<Principal>();
+            List<Principal> plist = new ArrayList<>();
             for (int i = 0; i < pdp.length; i++) {
                 if(pe.principalClass.equals(pdp[i].getClass().getName()))
                     plist.add(pdp[i]);
@@ -1770,7 +1767,7 @@
             // Done
             return certs;
 
-        ArrayList<Certificate> userCertList = new ArrayList<Certificate>();
+        ArrayList<Certificate> userCertList = new ArrayList<>();
         i = 0;
         while (i < certs.length) {
             userCertList.add(certs[i]);
@@ -2234,7 +2231,7 @@
                     if (this.certs == null) {
                         // extract the signer certs
                         ArrayList<Certificate> signerCerts =
-                            new ArrayList<Certificate>();
+                            new ArrayList<>();
                         i = 0;
                         while (i < certs.length) {
                             signerCerts.add(certs[i]);
--- a/src/share/classes/sun/security/provider/Sun.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/provider/Sun.java	Mon Jan 10 17:06:10 2011 -0800
@@ -55,7 +55,7 @@
             SunEntries.putEntries(this);
         } else {
             // use LinkedHashMap to preserve the order of the PRNGs
-            Map<Object, Object> map = new LinkedHashMap<Object, Object>();
+            Map<Object, Object> map = new LinkedHashMap<>();
             SunEntries.putEntries(map);
             AccessController.doPrivileged(new PutAllAction(this, map));
         }
--- a/src/share/classes/sun/security/provider/VerificationProvider.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/provider/VerificationProvider.java	Mon Jan 10 17:06:10 2011 -0800
@@ -76,7 +76,7 @@
             SunRsaSignEntries.putEntries(this);
         } else {
             // use LinkedHashMap to preserve the order of the PRNGs
-            Map<Object, Object> map = new LinkedHashMap<Object, Object>();
+            Map<Object, Object> map = new LinkedHashMap<>();
             SunEntries.putEntries(map);
             SunRsaSignEntries.putEntries(map);
             AccessController.doPrivileged(new PutAllAction(this, map));
--- a/src/share/classes/sun/security/provider/X509Factory.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/provider/X509Factory.java	Mon Jan 10 17:06:10 2011 -0800
@@ -409,10 +409,10 @@
         parseX509orPKCS7Cert(InputStream is)
         throws CertificateException, IOException
     {
-        Collection<X509CertImpl> coll = new ArrayList<X509CertImpl>();
+        Collection<X509CertImpl> coll = new ArrayList<>();
         byte[] data = readOneBlock(is);
         if (data == null) {
-            return new ArrayList<X509CertImpl>(0);
+            return new ArrayList<>(0);
         }
         try {
             PKCS7 pkcs7 = new PKCS7(data);
@@ -422,7 +422,7 @@
                 return Arrays.asList(certs);
             } else {
                 // no crls provided
-                return new ArrayList<X509Certificate>(0);
+                return new ArrayList<>(0);
             }
         } catch (ParsingException e) {
             while (data != null) {
@@ -442,10 +442,10 @@
         parseX509orPKCS7CRL(InputStream is)
         throws CRLException, IOException
     {
-        Collection<X509CRLImpl> coll = new ArrayList<X509CRLImpl>();
+        Collection<X509CRLImpl> coll = new ArrayList<>();
         byte[] data = readOneBlock(is);
         if (data == null) {
-            return new ArrayList<X509CRL>(0);
+            return new ArrayList<>(0);
         }
         try {
             PKCS7 pkcs7 = new PKCS7(data);
@@ -455,7 +455,7 @@
                 return Arrays.asList(crls);
             } else {
                 // no crls provided
-                return new ArrayList<X509CRL>(0);
+                return new ArrayList<>(0);
             }
         } catch (ParsingException e) {
             while (data != null) {
--- a/src/share/classes/sun/security/rsa/RSACore.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/rsa/RSACore.java	Mon Jan 10 17:06:10 2011 -0800
@@ -215,11 +215,11 @@
     // value suggested by Paul Kocher (quoted by NSS)
     private final static int BLINDING_MAX_REUSE = 50;
 
-    // cache for blinding parameters. Map<BigInteger,BlindingParameters>
+    // cache for blinding parameters. Map<BigInteger, BlindingParameters>
     // use a weak hashmap so that cached values are automatically cleared
     // when the modulus is GC'ed
-    private final static Map<BigInteger,BlindingParameters> blindingCache =
-                new WeakHashMap<BigInteger,BlindingParameters>();
+    private final static Map<BigInteger, BlindingParameters> blindingCache =
+                new WeakHashMap<>();
 
     /**
      * Set of blinding parameters for a given RSA key.
--- a/src/share/classes/sun/security/rsa/SunRsaSign.java	Mon Jan 10 14:43:50 2011 -0500
+++ b/src/share/classes/sun/security/rsa/SunRsaSign.java	Mon Jan 10 17:06:10 2011 -0800
@@ -52,7 +52,7 @@
             SunRsaSignEntries.putEntries(this);
         } else {
             // use LinkedHashMap to preserve the order of the PRNGs
-            Map<Object, Object> map = new HashMap<Object, Object>();
+            Map<Object, Object> map = new HashMap<>();
             SunRsaSignEntries.putEntries(map);
             AccessController.doPrivileged(new PutAllAction(this, map));
         }