7012003: diamond conversion for ssl
authorsmarks
Fri, 14 Jan 2011 15:31:45 -0800
changeset 7990 57019dc81b66
parent 7989 ec76fe03fdd4
child 7991 96cdf8806d96
7012003: diamond conversion for ssl Reviewed-by: wetmore
jdk/src/share/classes/sun/security/ssl/CipherSuite.java
jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java
jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java
jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java
jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java
jdk/src/share/classes/sun/security/ssl/Handshaker.java
jdk/src/share/classes/sun/security/ssl/HelloExtensions.java
jdk/src/share/classes/sun/security/ssl/ProtocolList.java
jdk/src/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java
jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java
jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java
jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java
jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java
jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java
jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuite.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuite.java	Fri Jan 14 15:31:45 2011 -0800
@@ -393,7 +393,7 @@
 
         // Map BulkCipher -> Boolean(available)
         private final static Map<BulkCipher,Boolean> availableCache =
-                                            new HashMap<BulkCipher,Boolean>(8);
+                                            new HashMap<>(8);
 
         // descriptive name including key size, e.g. AES/128
         final String description;
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Fri Jan 14 15:31:45 2011 -0800
@@ -221,7 +221,7 @@
     private static CipherSuiteList buildAvailableCache(int minPriority) {
         // SortedSet automatically arranges ciphersuites in default
         // preference order
-        Set<CipherSuite> cipherSuites = new TreeSet<CipherSuite>();
+        Set<CipherSuite> cipherSuites = new TreeSet<>();
         Collection<CipherSuite> allowedCipherSuites =
                                     CipherSuite.allowedCipherSuites();
         for (CipherSuite c : allowedCipherSuites) {
--- a/jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java	Fri Jan 14 15:31:45 2011 -0800
@@ -655,7 +655,7 @@
         if (certRequest != null) {
             X509ExtendedKeyManager km = sslContext.getX509KeyManager();
 
-            ArrayList<String> keytypesTmp = new ArrayList<String>(4);
+            ArrayList<String> keytypesTmp = new ArrayList<>(4);
 
             for (int i = 0; i < certRequest.types.length; i++) {
                 String typeName;
@@ -1174,8 +1174,7 @@
                         "Can't reuse existing SSL client session");
                 }
 
-                Collection<CipherSuite> cipherList =
-                                                new ArrayList<CipherSuite>(2);
+                Collection<CipherSuite> cipherList = new ArrayList<>(2);
                 cipherList.add(sessionSuite);
                 if (!secureRenegotiation &&
                         cipherSuites.contains(CipherSuite.C_SCSV)) {
@@ -1193,7 +1192,7 @@
         // exclude SCSV for secure renegotiation
         if (secureRenegotiation && cipherSuites.contains(CipherSuite.C_SCSV)) {
             Collection<CipherSuite> cipherList =
-                        new ArrayList<CipherSuite>(cipherSuites.size() - 1);
+                        new ArrayList<>(cipherSuites.size() - 1);
             for (CipherSuite suite : cipherSuites.collection()) {
                 if (suite != CipherSuite.C_SCSV) {
                     cipherList.add(suite);
--- a/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java	Fri Jan 14 15:31:45 2011 -0800
@@ -98,7 +98,7 @@
             return defaultKeyManagers;
         }
 
-        final Map<String,String> props = new HashMap<String,String>();
+        final Map<String,String> props = new HashMap<>();
         AccessController.doPrivileged(
                     new PrivilegedExceptionAction<Object>() {
             public Object run() throws Exception {
--- a/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Fri Jan 14 15:31:45 2011 -0800
@@ -258,7 +258,7 @@
     // add server_name extension
     void addServerNameIndicationExtension(String hostname) {
         // We would have checked that the hostname ia a FQDN.
-        ArrayList<String> hostnames = new ArrayList<String>(1);
+        ArrayList<String> hostnames = new ArrayList<>(1);
         hostnames.add(hostname);
 
         try {
@@ -434,7 +434,7 @@
 
     CertificateMsg(HandshakeInStream input) throws IOException {
         int chainLen = input.getInt24();
-        List<Certificate> v = new ArrayList<Certificate>(4);
+        List<Certificate> v = new ArrayList<>(4);
 
         CertificateFactory cf = null;
         while (chainLen > 0) {
@@ -1328,7 +1328,7 @@
 
         // read the certificate_authorities
         int len = input.getInt16();
-        ArrayList<DistinguishedName> v = new ArrayList<DistinguishedName>();
+        ArrayList<DistinguishedName> v = new ArrayList<>();
         while (len >= 3) {
             DistinguishedName dn = new DistinguishedName(input);
             v.add(dn);
@@ -1719,7 +1719,7 @@
     // Note that this will prevent the Spi classes from being GC'd. We assume
     // that is not a problem.
     private final static Map<Class,Object> methodCache =
-                                        new ConcurrentHashMap<Class,Object>();
+                                        new ConcurrentHashMap<>();
 
     private static void digestKey(MessageDigest md, SecretKey key) {
         try {
--- a/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Fri Jan 14 15:31:45 2011 -0800
@@ -569,7 +569,7 @@
                 activeProtocols = getActiveProtocols();
             }
 
-            ArrayList<CipherSuite> suites = new ArrayList<CipherSuite>();
+            ArrayList<CipherSuite> suites = new ArrayList<>();
             if (!(activeProtocols.collection().isEmpty()) &&
                     activeProtocols.min.v != ProtocolVersion.NONE.v) {
                 for (CipherSuite suite : enabledCipherSuites.collection()) {
@@ -614,8 +614,7 @@
      */
     ProtocolList getActiveProtocols() {
         if (activeProtocols == null) {
-            ArrayList<ProtocolVersion> protocols =
-                                            new ArrayList<ProtocolVersion>(4);
+            ArrayList<ProtocolVersion> protocols = new ArrayList<>(4);
             for (ProtocolVersion protocol : enabledProtocols.collection()) {
                 boolean found = false;
                 for (CipherSuite suite : enabledCipherSuites.collection()) {
--- a/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java	Fri Jan 14 15:31:45 2011 -0800
@@ -169,8 +169,7 @@
         return name;
     }
 
-    static List<ExtensionType> knownExtensions =
-                                            new ArrayList<ExtensionType>(9);
+    static List<ExtensionType> knownExtensions = new ArrayList<>(9);
 
     static ExtensionType get(int id) {
         for (ExtensionType ext : knownExtensions) {
@@ -674,7 +673,7 @@
     }
 
     public String toString() {
-        List<String> list = new ArrayList<String>();
+        List<String> list = new ArrayList<>();
         for (byte format : formats) {
             list.add(toString(format));
         }
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Fri Jan 14 15:31:45 2011 -0800
@@ -83,7 +83,7 @@
             throw new IllegalArgumentException("Protocols may not be null");
         }
 
-        ArrayList<ProtocolVersion> versions = new ArrayList<ProtocolVersion>(3);
+        ArrayList<ProtocolVersion> versions = new ArrayList<>(3);
         for (int i = 0; i < names.length; i++ ) {
             ProtocolVersion version = ProtocolVersion.valueOf(names[i]);
             if (versions.contains(version) == false) {
--- a/jdk/src/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java	Fri Jan 14 15:31:45 2011 -0800
@@ -261,7 +261,7 @@
 
         protected Set<String> decomposes(KeyExchange keyExchange,
                         boolean forCertPathOnly) {
-            Set<String> components = new HashSet<String>();
+            Set<String> components = new HashSet<>();
             switch (keyExchange) {
                 case K_NULL:
                     if (!forCertPathOnly) {
@@ -356,7 +356,7 @@
         }
 
         protected Set<String> decomposes(BulkCipher bulkCipher) {
-            Set<String> components = new HashSet<String>();
+            Set<String> components = new HashSet<>();
 
             if (bulkCipher.transformation != null) {
                 components.addAll(super.decomposes(bulkCipher.transformation));
@@ -366,7 +366,7 @@
         }
 
         protected Set<String> decomposes(MacAlg macAlg) {
-            Set<String> components = new HashSet<String>();
+            Set<String> components = new HashSet<>();
 
             if (macAlg == CipherSuite.M_MD5) {
                 components.add("MD5");
@@ -407,7 +407,7 @@
                 }
 
                 if (cipherSuite != null) {
-                    Set<String> components = new HashSet<String>();
+                    Set<String> components = new HashSet<>();
 
                     if(cipherSuite.keyExchange != null) {
                         components.addAll(
@@ -448,7 +448,7 @@
                 }
 
                 if (cipherSuite != null) {
-                    Set<String> components = new HashSet<String>();
+                    Set<String> components = new HashSet<>();
 
                     if(cipherSuite.keyExchange != null) {
                         components.addAll(
--- a/jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSessionImpl.java	Fri Jan 14 15:31:45 2011 -0800
@@ -618,8 +618,7 @@
      * key and the calling security context. This is important since
      * sessions can be shared across different protection domains.
      */
-    private Hashtable<SecureKey, Object> table =
-                                new Hashtable<SecureKey, Object>();
+    private Hashtable<SecureKey, Object> table = new Hashtable<>();
 
     /**
      * Assigns a session value.  Session change events are given if
@@ -687,7 +686,7 @@
      */
     public String[] getValueNames() {
         Enumeration<SecureKey> e;
-        Vector<Object> v = new Vector<Object>();
+        Vector<Object> v = new Vector<>();
         SecureKey key;
         Object securityCtx = SecureKey.getCurrentSecurityContext();
 
--- a/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Fri Jan 14 15:31:45 2011 -0800
@@ -153,8 +153,7 @@
     static Collection<SignatureAndHashAlgorithm>
             getSupportedAlgorithms(AlgorithmConstraints constraints) {
 
-        Collection<SignatureAndHashAlgorithm> supported =
-                        new ArrayList<SignatureAndHashAlgorithm>();
+        Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
         synchronized (priorityMap) {
             for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) {
                 if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
@@ -171,8 +170,7 @@
     // Get supported algorithm collection from an untrusted collection
     static Collection<SignatureAndHashAlgorithm> getSupportedAlgorithms(
             Collection<SignatureAndHashAlgorithm> algorithms ) {
-        Collection<SignatureAndHashAlgorithm> supported =
-                        new ArrayList<SignatureAndHashAlgorithm>();
+        Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
         for (SignatureAndHashAlgorithm sigAlg : algorithms) {
             if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
                 supported.add(sigAlg);
@@ -184,7 +182,7 @@
 
     static String[] getAlgorithmNames(
             Collection<SignatureAndHashAlgorithm> algorithms) {
-        ArrayList<String> algorithmNames = new ArrayList<String>();
+        ArrayList<String> algorithmNames = new ArrayList<>();
         if (algorithms != null) {
             for (SignatureAndHashAlgorithm sigAlg : algorithms) {
                 algorithmNames.add(sigAlg.algorithm);
@@ -197,7 +195,7 @@
 
     static Set<String> getHashAlgorithmNames(
             Collection<SignatureAndHashAlgorithm> algorithms) {
-        Set<String> algorithmNames = new HashSet<String>();
+        Set<String> algorithmNames = new HashSet<>();
         if (algorithms != null) {
             for (SignatureAndHashAlgorithm sigAlg : algorithms) {
                 if (sigAlg.hash.value > 0) {
--- a/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java	Fri Jan 14 15:31:45 2011 -0800
@@ -337,7 +337,7 @@
 
         X500Principal[] x500Issuers = (X500Principal[])issuers;
         // the algorithm below does not produce duplicates, so avoid Set
-        List<String> aliases = new ArrayList<String>();
+        List<String> aliases = new ArrayList<>();
 
         for (Map.Entry<String,X509Credentials> entry :
                                                 credentialsMap.entrySet()) {
@@ -397,7 +397,7 @@
      * possible. Principals that cannot be converted are ignored.
      */
     private static X500Principal[] convertPrincipals(Principal[] principals) {
-        List<X500Principal> list = new ArrayList<X500Principal>(principals.length);
+        List<X500Principal> list = new ArrayList<>(principals.length);
         for (int i = 0; i < principals.length; i++) {
             Principal p = principals[i];
             if (p instanceof X500Principal) {
--- a/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Fri Jan 14 15:31:45 2011 -0800
@@ -134,7 +134,7 @@
         FileInputStream fis = null;
         String defaultTrustStoreType;
         String defaultTrustStoreProvider;
-        final HashMap<String,String> props = new HashMap<String,String>();
+        final HashMap<String,String> props = new HashMap<>();
         final String sep = File.separator;
         KeyStore ks = null;
 
--- a/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java	Fri Jan 14 15:31:45 2011 -0800
@@ -307,7 +307,7 @@
                 (keyTypes.length == 0) || (keyTypes[0] == null)) {
             return null;
         }
-        List<KeyType> list = new ArrayList<KeyType>(keyTypes.length);
+        List<KeyType> list = new ArrayList<>(keyTypes.length);
         for (String keyType : keyTypes) {
             list.add(new KeyType(keyType));
         }
@@ -429,7 +429,7 @@
     // make a Set out of the array
     private Set<Principal> getIssuerSet(Principal[] issuers) {
         if ((issuers != null) && (issuers.length != 0)) {
-            return new HashSet<Principal>(Arrays.asList(issuers));
+            return new HashSet<>(Arrays.asList(issuers));
         } else {
             return null;
         }
--- a/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java	Fri Jan 14 22:34:31 2011 +0000
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java	Fri Jan 14 15:31:45 2011 -0800
@@ -300,8 +300,8 @@
             getCalled = true;
             // returns cookies[0]
             // they will be include in request
-            Map<String,List<String>> map = new HashMap<String,List<String>>();
-            List<String> l = new ArrayList<String>();
+            Map<String,List<String>> map = new HashMap<>();
+            List<String> l = new ArrayList<>();
             l.add(cookies.get("Cookie"));
             map.put("Cookie",l);
             return Collections.unmodifiableMap(map);