jdk/src/java.base/share/classes/java/lang/reflect/ReflectPermission.java
author mli
Wed, 31 May 2017 19:54:16 -0700
changeset 45434 4582657c7260
parent 45124 144479e89cdb
child 45881 aaec0fbe17ae
permissions -rw-r--r--
8181082: class-level since tag issues in java.base & java.datatransfer module Reviewed-by: alanb, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang.reflect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
16923
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    29
 * The Permission class for reflective operations.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * The following table
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * provides a summary description of what the permission allows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * and discusses the risks of granting code the permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    35
 * <table class="striped">
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    36
 * <caption style="display:none">Table shows permission target name, what the permission allows, and associated risks</caption>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    37
 * <thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <th>Permission Target Name</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <th>What the Permission Allows</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <th>Risks of Allowing this Permission</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * </tr>
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    43
 * </thead>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    44
 * <tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *   <td>suppressAccessChecks</td>
16923
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    48
 *   <td>ability to suppress the standard Java language access checks
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    49
 *       on fields and methods in a class; allow access not only public members
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    50
 *       but also allow access to default (package) access, protected,
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    51
 *       and private members.</td>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *   <td>This is dangerous in that information (possibly confidential) and
16923
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    53
 *       methods normally unavailable would be accessible to malicious code.</td>
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    54
 * </tr>
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    55
 * <tr>
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    56
 *   <td>newProxyInPackage.{package name}</td>
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    57
 *   <td>ability to create a proxy instance in the specified package of which
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    58
 *       the non-public interface that the proxy class implements.</td>
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    59
 *   <td>This gives code access to classes in packages to which it normally
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    60
 *       does not have access and the dynamic proxy class is in the system
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    61
 *       protection domain. Malicious code may use these classes to
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    62
 *       help in its attempt to compromise security in the system.</td>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    65
 * </tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * @see AccessibleObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * @see Field#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * @see Field#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * @see Method#invoke
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * @see Constructor#newInstance
16923
50bfa0defec2 8004260: dynamic proxy class should have the same Java language access as the proxy interfaces
mchung
parents: 5506
diff changeset
    75
 * @see Proxy#newProxyInstance
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
public final
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
class ReflectPermission extends java.security.BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    private static final long serialVersionUID = 7412737110241507485L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * Constructs a ReflectPermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @param name the name of the ReflectPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @throws NullPointerException if {@code name} is {@code null}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @throws IllegalArgumentException if {@code name} is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public ReflectPermission(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * Constructs a ReflectPermission with the specified name and actions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * The actions should be null; they are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @param name the name of the ReflectPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @param actions should be null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @throws NullPointerException if {@code name} is {@code null}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @throws IllegalArgumentException if {@code name} is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public ReflectPermission(String name, String actions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
}