KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > reflect > ReflectPermission


1 /*
2  * @(#)ReflectPermission.java 1.21 04/03/01
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.lang.reflect;
9
10 /**
11  * The Permission class for reflective operations. A
12  * ReflectPermission is a <em>named permission</em> and has no
13  * actions. The only name currently defined is <tt>suppressAccessChecks</tt>,
14  * which allows suppressing the standard Java language access checks
15  * -- for public, default (package) access, protected, and private
16  * members -- performed by reflected objects at their point of use.
17  * <P>
18  * The following table
19  * provides a summary description of what the permission allows,
20  * and discusses the risks of granting code the permission.
21  * <P>
22  *
23  * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
24  * <tr>
25  * <th>Permission Target Name</th>
26  * <th>What the Permission Allows</th>
27  * <th>Risks of Allowing this Permission</th>
28  * </tr>
29  *
30  * <tr>
31  * <td>suppressAccessChecks</td>
32  * <td>ability to access
33  * fields and invoke methods in a class. Note that this includes
34  * not only public, but protected and private fields and methods as well.</td>
35  * <td>This is dangerous in that information (possibly confidential) and
36  * methods normally unavailable would be accessible to malicious code.</td>
37  * </tr>
38  *
39  * </table>
40  *
41  * @see java.security.Permission
42  * @see java.security.BasicPermission
43  * @see AccessibleObject
44  * @see Field#get
45  * @see Field#set
46  * @see Method#invoke
47  * @see Constructor#newInstance
48  *
49  * @since 1.2
50  */

51 public final
52 class ReflectPermission extends java.security.BasicPermission JavaDoc {
53
54     private static final long serialVersionUID = 7412737110241507485L;
55
56     /**
57      * Constructs a ReflectPermission with the specified name.
58      *
59      * @param name the name of the ReflectPermission
60      *
61      * @throws NullPointerException
62      * If <tt>name</tt> is <tt>null</tt>
63      *
64      * @throws IllegalArgumentException
65      * If <tt>name</tt> is empty
66      */

67     public ReflectPermission(String JavaDoc name) {
68     super(name);
69     }
70
71     /**
72      * Constructs a ReflectPermission with the specified name and actions.
73      * The actions should be null; they are ignored.
74      *
75      * @param name the name of the ReflectPermission
76      *
77      * @param actions should be null
78      *
79      * @throws NullPointerException
80      * If <tt>name</tt> is <tt>null</tt>
81      *
82      * @throws IllegalArgumentException
83      * If <tt>name</tt> is empty
84      */

85     public ReflectPermission(String JavaDoc name, String JavaDoc actions) {
86     super(name, actions);
87     }
88
89 }
90
Popular Tags