Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (22 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libjava/java/security/AllPermission.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* AllPermission.java -- Permission to do anything
    2    Copyright (C) 1998, 2001 Free Software Foundation, Inc.
     2   Copyright (C) 1998, 2001 Free Software Foundation, Inc.
    33
    44This file is part of GNU Classpath.
     
    3838package java.security;
    3939
     40
     41
     42
     43
    4044/**
    4145 * This class is a permission that implies all other permissions.  Granting
     
    4347 * be exercised in granting this permission.
    4448 *
    45  * @version 0.0
    46  *
    47  * @author Aaron M. Renn ([email protected])
     49 * @author Aaron M. Renn <[email protected]>
     50 * @author Eric Blake <[email protected]>
     51 * @see AccessController
     52 * @see Permissions
     53 * @see SecurityManager
     54 * @since 1.1
     55 * @status updated to 1.4
    4856 */
    4957public final class AllPermission extends Permission
    5058{
    5159  /**
    52    * This method initializes a new instance of <code>AllPermission</code>.  It
    53    * performs no actions.
     60   * Compatible with JDK 1.1+.
     61   */
     62  private static final long serialVersionUID = -2916474571451318075L;
     63
     64  /**
     65   * Create a new AllPermission object.
    5466   */
    5567  public AllPermission()
    5668  {
    57     super("all");
     69    super("");
    5870  }
    5971
    6072  /**
    61    * This method initializes a new instance of <code>AllPermission</code>.  The
    62    * arguments passed to this method are used to set internal field for the
    63    * permission name.  However, these are not used in
    64    * determining the actual permissions granted.  This class always will
    65    * return <code>true</code> in its implies method.
     73   * Create a new AllPermission object. The parameters are ignored, as all
     74   * permission implies ALL PERMISSION.
    6675   *
    67    * @param name The name of this permission.
    68    * @param actions The action list for this permission - ignored in this class.
     76   * @param name
     77   * @param actions
    6978   */
    7079  public AllPermission(String name, String actions)
    7180  {
    72     super(name);
     81    super();
    7382  }
    7483
     
    7786   * permission always implies that any other permission is also granted.
    7887   *
    79    * @param perm The <code>Permission</code> to test against - ignored in this class.
    80    *
    81    * @return Always returns <code>true</code>
     88   * @param perm ignored
     89   * @return true, the permission is implied
    8290   */
    8391  public boolean implies(Permission perm)
    8492  {
    85     return (true);
     93    return ;
    8694  }
    8795
    8896  /**
    89    * This method tests this class for equality against another <code>Object</code>.
    90    * This will return <code>true</code> if and only if the specified
    91    * <code>Object</code> is an instance of <code>AllPermission</code>.
     97   * Checks an object for equality. All AllPermissions are equal.
    9298   *
    93    * @param obj The <code>Object</code> to test for equality to this object
     99   * @param obj
    94100   */
    95101  public boolean equals(Object obj)
    96102  {
    97     if (obj instanceof AllPermission)
    98       return (true);
    99 
    100     return (false);
     103    return obj instanceof AllPermission;
    101104  }
    102105
    103106  /**
    104    * This method returns a hash code for this object.
     107   * This method returns a hash code for this object.
    105108   *
    106    * @return A hash value for this object.
     109   * @return
    107110   */
    108111  public int hashCode()
    109112  {
    110     return (System.identityHashCode(this));
     113    return ;
    111114  }
    112115
     
    115118   * This will always be the empty string ("") for this class.
    116119   *
    117    * @return The action list.
     120   * @return
    118121   */
    119122  public String getActions()
    120123  {
    121     return ("");
     124    return ;
    122125  }
    123126
    124127  /**
    125    * This method returns a new instance of <code>PermissionCollection</code>
    126    * suitable for holding instance of <code>AllPermission</code>.
     128   * Returns a PermissionCollection which can hold AllPermission.
    127129   *
    128    * @return A new <code>PermissionCollection</code>.
     130   * @return
    129131   */
    130132  public PermissionCollection newPermissionCollection()
    131133  {
    132     return (null);
     134    return );
    133135  }
    134 }
     136} // class AllPermission
     137
     138/**
     139 * Implements AllPermission.newPermissionCollection, and obeys serialization
     140 * of JDK.
     141 *
     142 * @author Eric Blake <[email protected]>
     143 */
     144final class AllPermissionCollection extends PermissionCollection
     145{
     146  /**
     147   * Compatible with JDK 1.1+.
     148   */
     149  private static final long serialVersionUID = -4023755556366636806L;
     150
     151  /**
     152   * Whether an AllPermission has been added to the collection.
     153   *
     154   * @serial if all permission is in the collection yet
     155   */
     156  private boolean all_allowed;
     157
     158  /**
     159   * Add an AllPermission.
     160   *
     161   * @param perm the permission to add
     162   * @throws IllegalArgumentException if perm is not an AllPermission
     163   * @throws SecurityException if the collection is read-only
     164   */
     165  public void add(Permission perm)
     166  {
     167    if (isReadOnly())
     168      throw new SecurityException();
     169    if (! (perm instanceof AllPermission))
     170      throw new IllegalArgumentException();
     171    all_allowed = true;
     172  }
     173
     174  /**
     175   * Returns true if this collection implies a permission.
     176   *
     177   * @param perm the permission to check
     178   * @return true if this collection contains an AllPermission
     179   */
     180  public boolean implies(Permission perm)
     181  {
     182    return all_allowed;
     183  }
     184
     185  /**
     186   * Returns an enumeration of the elements in the collection.
     187   *
     188   * @return the elements in the collection
     189   */
     190  public Enumeration elements()
     191  {
     192    return all_allowed
     193      ? Collections.enumeration(Collections.singleton(new AllPermission()))
     194      : EmptyEnumeration.getInstance();
     195  }
     196} // class AllPermissionCollection
Note: See TracChangeset for help on using the changeset viewer.