src/java.base/share/classes/java/security/AllPermission.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 47216 71c04702a3d5
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    56  * @serial exclude
    56  * @serial exclude
    57  */
    57  */
    58 
    58 
    59 public final class AllPermission extends Permission {
    59 public final class AllPermission extends Permission {
    60 
    60 
       
    61     @java.io.Serial
    61     private static final long serialVersionUID = -2916474571451318075L;
    62     private static final long serialVersionUID = -2916474571451318075L;
    62 
    63 
    63     /**
    64     /**
    64      * Creates a new AllPermission object.
    65      * Creates a new AllPermission object.
    65      */
    66      */
   155     extends PermissionCollection
   156     extends PermissionCollection
   156     implements java.io.Serializable
   157     implements java.io.Serializable
   157 {
   158 {
   158 
   159 
   159     // use serialVersionUID from JDK 1.2.2 for interoperability
   160     // use serialVersionUID from JDK 1.2.2 for interoperability
       
   161     @java.io.Serial
   160     private static final long serialVersionUID = -4023755556366636806L;
   162     private static final long serialVersionUID = -4023755556366636806L;
   161 
   163 
   162     private boolean all_allowed; // true if any all permissions have been added
   164     private boolean all_allowed; // true if any all permissions have been added
   163 
   165 
   164     /**
   166     /**
   174      * Adds a permission to the AllPermissions. The key for the hash is
   176      * Adds a permission to the AllPermissions. The key for the hash is
   175      * permission.path.
   177      * permission.path.
   176      *
   178      *
   177      * @param permission the Permission object to add.
   179      * @param permission the Permission object to add.
   178      *
   180      *
   179      * @exception IllegalArgumentException - if the permission is not a
   181      * @throws    IllegalArgumentException   if the permission is not an
   180      *                                       AllPermission
   182      *                                       AllPermission
   181      *
   183      *
   182      * @exception SecurityException - if this AllPermissionCollection object
   184      * @throws    SecurityException   if this AllPermissionCollection object
   183      *                                has been marked readonly
   185      *                                has been marked readonly
   184      */
   186      */
   185 
   187 
   186     public void add(Permission permission) {
   188     public void add(Permission permission) {
   187         if (! (permission instanceof AllPermission))
   189         if (! (permission instanceof AllPermission))