jdk/src/java.base/share/classes/java/security/Permissions.java
changeset 30033 b9c86c17164a
parent 29492 a4bf9a570035
child 31080 00a25f4c4d44
equal deleted inserted replaced
30019:e7dbbef69d12 30033:b9c86c17164a
    97 
    97 
    98     /**
    98     /**
    99      * Creates a new Permissions object containing no PermissionCollections.
    99      * Creates a new Permissions object containing no PermissionCollections.
   100      */
   100      */
   101     public Permissions() {
   101     public Permissions() {
   102         permsMap = new HashMap<Class<?>, PermissionCollection>(11);
   102         permsMap = new HashMap<>(11);
   103         allPermission = null;
   103         allPermission = null;
   104     }
   104     }
   105 
   105 
   106     /**
   106     /**
   107      * Adds a permission object to the PermissionCollection for the class the
   107      * Adds a permission object to the PermissionCollection for the class the
   392         // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
   392         // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
   393         // the perms key, so this cast is safe, unless the data is corrupt.
   393         // the perms key, so this cast is safe, unless the data is corrupt.
   394         @SuppressWarnings("unchecked")
   394         @SuppressWarnings("unchecked")
   395         Hashtable<Class<?>, PermissionCollection> perms =
   395         Hashtable<Class<?>, PermissionCollection> perms =
   396             (Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
   396             (Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
   397         permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2);
   397         permsMap = new HashMap<>(perms.size()*2);
   398         permsMap.putAll(perms);
   398         permsMap.putAll(perms);
   399 
   399 
   400         // Set hasUnresolved
   400         // Set hasUnresolved
   401         UnresolvedPermissionCollection uc =
   401         UnresolvedPermissionCollection uc =
   402         (UnresolvedPermissionCollection) permsMap.get(UnresolvedPermission.class);
   402         (UnresolvedPermissionCollection) permsMap.get(UnresolvedPermission.class);
   486     /**
   486     /**
   487      * Create an empty PermissionsHash object.
   487      * Create an empty PermissionsHash object.
   488      */
   488      */
   489 
   489 
   490     PermissionsHash() {
   490     PermissionsHash() {
   491         permsMap = new HashMap<Permission, Permission>(11);
   491         permsMap = new HashMap<>(11);
   492     }
   492     }
   493 
   493 
   494     /**
   494     /**
   495      * Adds a permission to the PermissionsHash.
   495      * Adds a permission to the PermissionsHash.
   496      *
   496      *
   595         // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
   595         // writeObject writes a Hashtable<Class<?>, PermissionCollection> for
   596         // the perms key, so this cast is safe, unless the data is corrupt.
   596         // the perms key, so this cast is safe, unless the data is corrupt.
   597         @SuppressWarnings("unchecked")
   597         @SuppressWarnings("unchecked")
   598         Hashtable<Permission, Permission> perms =
   598         Hashtable<Permission, Permission> perms =
   599                 (Hashtable<Permission, Permission>)gfields.get("perms", null);
   599                 (Hashtable<Permission, Permission>)gfields.get("perms", null);
   600         permsMap = new HashMap<Permission, Permission>(perms.size()*2);
   600         permsMap = new HashMap<>(perms.size()*2);
   601         permsMap.putAll(perms);
   601         permsMap.putAll(perms);
   602     }
   602     }
   603 }
   603 }