src/java.base/share/classes/java/util/PropertyPermission.java
changeset 57956 e0b8b019d2f5
parent 47216 71c04702a3d5
child 58242 94bb65cb37d3
equal deleted inserted replaced
57955:18863bf3501f 57956:e0b8b019d2f5
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 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
   383     @Override
   383     @Override
   384     public PermissionCollection newPermissionCollection() {
   384     public PermissionCollection newPermissionCollection() {
   385         return new PropertyPermissionCollection();
   385         return new PropertyPermissionCollection();
   386     }
   386     }
   387 
   387 
   388 
   388     @java.io.Serial
   389     private static final long serialVersionUID = 885438825399942851L;
   389     private static final long serialVersionUID = 885438825399942851L;
   390 
   390 
   391     /**
   391     /**
   392      * WriteObject is called to save the state of the PropertyPermission
   392      * WriteObject is called to save the state of the PropertyPermission
   393      * to a stream. The actions are serialized, and the superclass
   393      * to a stream. The actions are serialized, and the superclass
   394      * takes care of the name.
   394      * takes care of the name.
   395      */
   395      */
       
   396     @java.io.Serial
   396     private synchronized void writeObject(java.io.ObjectOutputStream s)
   397     private synchronized void writeObject(java.io.ObjectOutputStream s)
   397         throws IOException
   398         throws IOException
   398     {
   399     {
   399         // Write out the actions. The superclass takes care of the name
   400         // Write out the actions. The superclass takes care of the name
   400         // call getActions to make sure actions field is initialized
   401         // call getActions to make sure actions field is initialized
   405 
   406 
   406     /**
   407     /**
   407      * readObject is called to restore the state of the PropertyPermission from
   408      * readObject is called to restore the state of the PropertyPermission from
   408      * a stream.
   409      * a stream.
   409      */
   410      */
       
   411     @java.io.Serial
   410     private synchronized void readObject(java.io.ObjectInputStream s)
   412     private synchronized void readObject(java.io.ObjectInputStream s)
   411          throws IOException, ClassNotFoundException
   413          throws IOException, ClassNotFoundException
   412     {
   414     {
   413         // Read in the action, then initialize the rest
   415         // Read in the action, then initialize the rest
   414         s.defaultReadObject();
   416         s.defaultReadObject();
   594          * cannot be directly cast to Enumeration<Permission>
   596          * cannot be directly cast to Enumeration<Permission>
   595          */
   597          */
   596         return (Enumeration)perms.elements();
   598         return (Enumeration)perms.elements();
   597     }
   599     }
   598 
   600 
       
   601     @java.io.Serial
   599     private static final long serialVersionUID = 7015263904581634791L;
   602     private static final long serialVersionUID = 7015263904581634791L;
   600 
   603 
   601     // Need to maintain serialization interoperability with earlier releases,
   604     // Need to maintain serialization interoperability with earlier releases,
   602     // which had the serializable field:
   605     // which had the serializable field:
   603     //
   606     //
   623     /*
   626     /*
   624      * Writes the contents of the perms field out as a Hashtable for
   627      * Writes the contents of the perms field out as a Hashtable for
   625      * serialization compatibility with earlier releases. all_allowed
   628      * serialization compatibility with earlier releases. all_allowed
   626      * unchanged.
   629      * unchanged.
   627      */
   630      */
       
   631     @java.io.Serial
   628     private void writeObject(ObjectOutputStream out) throws IOException {
   632     private void writeObject(ObjectOutputStream out) throws IOException {
   629         // Don't call out.defaultWriteObject()
   633         // Don't call out.defaultWriteObject()
   630 
   634 
   631         // Copy perms into a Hashtable
   635         // Copy perms into a Hashtable
   632         Hashtable<String, Permission> permissions =
   636         Hashtable<String, Permission> permissions =
   642 
   646 
   643     /*
   647     /*
   644      * Reads in a Hashtable of PropertyPermissions and saves them in the
   648      * Reads in a Hashtable of PropertyPermissions and saves them in the
   645      * perms field. Reads in all_allowed.
   649      * perms field. Reads in all_allowed.
   646      */
   650      */
       
   651     @java.io.Serial
   647     private void readObject(ObjectInputStream in)
   652     private void readObject(ObjectInputStream in)
   648         throws IOException, ClassNotFoundException
   653         throws IOException, ClassNotFoundException
   649     {
   654     {
   650         // Don't call defaultReadObject()
   655         // Don't call defaultReadObject()
   651 
   656