1 /* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. 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. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.lang.reflect; 27 28 /** 29 * The Permission class for reflective operations. 30 * <P> 31 * The following table 32 * provides a summary description of what the permission allows, 33 * and discusses the risks of granting code the permission. 34 * 35 * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks"> 36 * <tr> 37 * <th>Permission Target Name</th> 38 * <th>What the Permission Allows</th> 39 * <th>Risks of Allowing this Permission</th> 40 * </tr> 41 * 42 * <tr> 43 * <td>suppressAccessChecks</td> 44 * <td>ability to suppress the standard Java language access checks 45 * on fields and methods in a class; allow access not only public members 46 * but also allow access to default (package) access, protected, 47 * and private members.</td> 48 * <td>This is dangerous in that information (possibly confidential) and 49 * methods normally unavailable would be accessible to malicious code.</td> 50 * </tr> 51 * <tr> 52 * <td>newProxyInPackage.{package name}</td> 53 * <td>ability to create a proxy instance in the specified package of which 54 * the non-public interface that the proxy class implements.</td> 55 * <td>This gives code access to classes in packages to which it normally 56 * does not have access and the dynamic proxy class is in the system 57 * protection domain. Malicious code may use these classes to 58 * help in its attempt to compromise security in the system.</td> 59 * </tr> 60 * 61 * </table> 62 * 63 * @see java.security.Permission 64 * @see java.security.BasicPermission 65 * @see AccessibleObject 66 * @see Field#get 67 * @see Field#set 68 * @see Method#invoke 69 * @see Constructor#newInstance 70 * @see Proxy#newProxyInstance 71 * 72 * @since 1.2 73 */ 74 public final 75 class ReflectPermission extends java.security.BasicPermission { 76 77 private static final long serialVersionUID = 7412737110241507485L; 78 79 /** 80 * Constructs a ReflectPermission with the specified name. 81 * 82 * @param name the name of the ReflectPermission 83 * 84 * @throws NullPointerException if {@code name} is {@code null}. 85 * @throws IllegalArgumentException if {@code name} is empty. 86 */ 87 public ReflectPermission(String name) { 88 super(name); 89 } 90 91 /** 92 * Constructs a ReflectPermission with the specified name and actions. 93 * The actions should be null; they are ignored. 94 * 95 * @param name the name of the ReflectPermission 96 * 97 * @param actions should be null 98 * 99 * @throws NullPointerException if {@code name} is {@code null}. 100 * @throws IllegalArgumentException if {@code name} is empty. 101 */ 102 public ReflectPermission(String name, String actions) { 103 super(name, actions); 104 } 105 106 }