blob: 227c65a633d44b3217b0f2c273423e1a0edc6846 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package java.lang.reflect;
27
28/**
29 * The Permission class for reflective operations. A
30 * ReflectPermission is a <em>named permission</em> and has no
31 * actions. The only name currently defined is {@code suppressAccessChecks},
32 * which allows suppressing the standard Java language access checks
33 * -- for public, default (package) access, protected, and private
34 * members -- performed by reflected objects at their point of use.
35 * <P>
36 * The following table
37 * provides a summary description of what the permission allows,
38 * and discusses the risks of granting code the permission.
39 * <P>
40 *
41 * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
42 * <tr>
43 * <th>Permission Target Name</th>
44 * <th>What the Permission Allows</th>
45 * <th>Risks of Allowing this Permission</th>
46 * </tr>
47 *
48 * <tr>
49 * <td>suppressAccessChecks</td>
50 * <td>ability to access
51 * fields and invoke methods in a class. Note that this includes
52 * not only public, but protected and private fields and methods as well.</td>
53 * <td>This is dangerous in that information (possibly confidential) and
54 * methods normally unavailable would be accessible to malicious code.</td>
55 * </tr>
56 *
57 * </table>
58 *
59 * @see java.security.Permission
60 * @see java.security.BasicPermission
61 * @see AccessibleObject
62 * @see Field#get
63 * @see Field#set
64 * @see Method#invoke
65 * @see Constructor#newInstance
66 *
67 * @since 1.2
68 */
69public final
70class ReflectPermission extends java.security.BasicPermission {
71
72 private static final long serialVersionUID = 7412737110241507485L;
73
74 /**
75 * Constructs a ReflectPermission with the specified name.
76 *
77 * @param name the name of the ReflectPermission
78 *
79 * @throws NullPointerException if {@code name} is {@code null}.
80 * @throws IllegalArgumentException if {@code name} is empty.
81 */
82 public ReflectPermission(String name) {
83 super(name);
84 }
85
86 /**
87 * Constructs a ReflectPermission with the specified name and actions.
88 * The actions should be null; they are ignored.
89 *
90 * @param name the name of the ReflectPermission
91 *
92 * @param actions should be null
93 *
94 * @throws NullPointerException if {@code name} is {@code null}.
95 * @throws IllegalArgumentException if {@code name} is empty.
96 */
97 public ReflectPermission(String name, String actions) {
98 super(name, actions);
99 }
100
101}