changeset 4827:77f6d4360f4b

7116997: fix warnings in java.util.PropertyPermission Reviewed-by: smarks Contributed-by: Brandon Passanisi <brandon.passanisi@oracle.com>
author smarks
date Tue, 06 Dec 2011 10:14:02 -0800
parents 85363edbc92f
children b71d1acfae52 4f0f9f9c4892
files src/share/classes/java/util/PropertyPermission.java
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/PropertyPermission.java	Mon Dec 05 17:08:52 2011 -0800
+++ b/src/share/classes/java/util/PropertyPermission.java	Tue Dec 06 10:14:02 2011 -0800
@@ -305,7 +305,7 @@
                 switch(a[i-matchlen]) {
                 case ',':
                     seencomma = true;
-                    /*FALLTHROUGH*/
+                    break;
                 case ' ': case '\r': case '\n':
                 case '\f': case '\t':
                     break;
@@ -442,7 +442,7 @@
      * Key is property name; value is PropertyPermission.
      * Not serialized; see serialization section at end of class.
      */
-    private transient Map perms;
+    private transient Map<String, Permission> perms;
 
     /**
      * Boolean saying if "*" is in the collection.
@@ -458,7 +458,7 @@
      */
 
     public PropertyPermissionCollection() {
-        perms = new HashMap(32);     // Capacity for default policy
+        perms = new HashMap<>(32);     // Capacity for default policy
         all_allowed = false;
     }
 
@@ -593,7 +593,7 @@
      * @return an enumeration of all the PropertyPermission objects.
      */
 
-    public Enumeration elements() {
+    public Enumeration<Permission> elements() {
         // Convert Iterator of Map values into an Enumeration
         synchronized (this) {
             return Collections.enumeration(perms.values());
@@ -633,7 +633,7 @@
         // Don't call out.defaultWriteObject()
 
         // Copy perms into a Hashtable
-        Hashtable permissions = new Hashtable(perms.size()*2);
+        Hashtable<String, Permission> permissions = new Hashtable<>(perms.size()*2);
         synchronized (this) {
             permissions.putAll(perms);
         }
@@ -660,8 +660,10 @@
         all_allowed = gfields.get("all_allowed", false);
 
         // Get permissions
-        Hashtable permissions = (Hashtable)gfields.get("permissions", null);
-        perms = new HashMap(permissions.size()*2);
+        @SuppressWarnings("unchecked")
+        Hashtable<String, Permission> permissions =
+            (Hashtable<String, Permission>)gfields.get("permissions", null);
+        perms = new HashMap<>(permissions.size()*2);
         perms.putAll(permissions);
     }
 }