Save This Page
Home » openjdk-7 » java » lang » reflect » [javadoc | source]
    1   /*
    2    * Copyright (c) 1997, 2004, 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.  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    */
   69   public final
   70   class 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   }

Save This Page
Home » openjdk-7 » java » lang » reflect » [javadoc | source]