- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/java/security/AllPermission.java (modified) (5 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/java/security/AllPermission.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 1 1 /* AllPermission.java -- Permission to do anything 2 Copyright (C) 1998, 2001 Free Software Foundation, Inc.2 Copyright (C) 1998, 2001 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Classpath. … … 38 38 package java.security; 39 39 40 41 42 43 40 44 /** 41 45 * This class is a permission that implies all other permissions. Granting … … 43 47 * be exercised in granting this permission. 44 48 * 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 48 56 */ 49 57 public final class AllPermission extends Permission 50 58 { 51 59 /** 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. 54 66 */ 55 67 public AllPermission() 56 68 { 57 super(" all");69 super(""); 58 70 } 59 71 60 72 /** 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. 66 75 * 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 69 78 */ 70 79 public AllPermission(String name, String actions) 71 80 { 72 super( name);81 super(); 73 82 } 74 83 … … 77 86 * permission always implies that any other permission is also granted. 78 87 * 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 82 90 */ 83 91 public boolean implies(Permission perm) 84 92 { 85 return (true);93 return ; 86 94 } 87 95 88 96 /** 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. 92 98 * 93 * @param obj The <code>Object</code> to test for equality to this object99 * @param obj 94 100 */ 95 101 public boolean equals(Object obj) 96 102 { 97 if (obj instanceof AllPermission) 98 return (true); 99 100 return (false); 103 return obj instanceof AllPermission; 101 104 } 102 105 103 106 /** 104 * This method returns a hash code for this object. 107 * This method returns a hash code for this object. 105 108 * 106 * @return A hash value for this object.109 * @return 107 110 */ 108 111 public int hashCode() 109 112 { 110 return (System.identityHashCode(this));113 return ; 111 114 } 112 115 … … 115 118 * This will always be the empty string ("") for this class. 116 119 * 117 * @return The action list.120 * @return 118 121 */ 119 122 public String getActions() 120 123 { 121 return ("");124 return ; 122 125 } 123 126 124 127 /** 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. 127 129 * 128 * @return A new <code>PermissionCollection</code>.130 * @return 129 131 */ 130 132 public PermissionCollection newPermissionCollection() 131 133 { 132 return (null);134 return ); 133 135 } 134 } 136 } // class AllPermission 137 138 /** 139 * Implements AllPermission.newPermissionCollection, and obeys serialization 140 * of JDK. 141 * 142 * @author Eric Blake <[email protected]> 143 */ 144 final 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 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
