diff options
Diffstat (limited to 'libjava/java/security/AllPermission.java')
-rw-r--r-- | libjava/java/security/AllPermission.java | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/libjava/java/security/AllPermission.java b/libjava/java/security/AllPermission.java index 32d0b45f57c..e7f316917c2 100644 --- a/libjava/java/security/AllPermission.java +++ b/libjava/java/security/AllPermission.java @@ -1,5 +1,5 @@ /* AllPermission.java -- Permission to do anything - Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -135,64 +135,64 @@ public final class AllPermission extends Permission { return new AllPermissionCollection(); } -} // class AllPermission - -/** - * Implements AllPermission.newPermissionCollection, and obeys serialization - * of JDK. - * - * @author Eric Blake <ebb9@email.byu.edu> - */ -final class AllPermissionCollection extends PermissionCollection -{ - /** - * Compatible with JDK 1.1+. - */ - private static final long serialVersionUID = -4023755556366636806L; - - /** - * Whether an AllPermission has been added to the collection. - * - * @serial if all permission is in the collection yet - */ - private boolean all_allowed; - - /** - * Add an AllPermission. - * - * @param perm the permission to add - * @throws IllegalArgumentException if perm is not an AllPermission - * @throws SecurityException if the collection is read-only - */ - public void add(Permission perm) - { - if (isReadOnly()) - throw new SecurityException(); - if (! (perm instanceof AllPermission)) - throw new IllegalArgumentException(); - all_allowed = true; - } - - /** - * Returns true if this collection implies a permission. - * - * @param perm the permission to check - * @return true if this collection contains an AllPermission - */ - public boolean implies(Permission perm) - { - return all_allowed; - } /** - * Returns an enumeration of the elements in the collection. + * Implements AllPermission.newPermissionCollection, and obeys serialization + * of JDK. * - * @return the elements in the collection + * @author Eric Blake (ebb9@email.byu.edu) */ - public Enumeration elements() + private static final class AllPermissionCollection extends PermissionCollection { - return all_allowed - ? Collections.enumeration(Collections.singleton(new AllPermission())) - : EmptyEnumeration.getInstance(); - } -} // class AllPermissionCollection + /** + * Compatible with JDK 1.1+. + */ + private static final long serialVersionUID = -4023755556366636806L; + + /** + * Whether an AllPermission has been added to the collection. + * + * @serial if all permission is in the collection yet + */ + private boolean all_allowed; + + /** + * Add an AllPermission. + * + * @param perm the permission to add + * @throws IllegalArgumentException if perm is not an AllPermission + * @throws SecurityException if the collection is read-only + */ + public void add(Permission perm) + { + if (isReadOnly()) + throw new SecurityException(); + if (! (perm instanceof AllPermission)) + throw new IllegalArgumentException(); + all_allowed = true; + } + + /** + * Returns true if this collection implies a permission. + * + * @param perm the permission to check + * @return true if this collection contains an AllPermission + */ + public boolean implies(Permission perm) + { + return all_allowed; + } + + /** + * Returns an enumeration of the elements in the collection. + * + * @return the elements in the collection + */ + public Enumeration elements() + { + return all_allowed + ? Collections.enumeration(Collections.singleton(new AllPermission())) + : EmptyEnumeration.getInstance(); + } + } // class AllPermissionCollection +} // class AllPermission |