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. package java.lang.reflect;
  8. /**
  9. * The Permission class for reflective operations. A
  10. * ReflectPermission is a <em>named permission</em> and has no
  11. * actions. The only name currently defined is <tt>suppressAccessChecks</tt>,
  12. * which allows suppressing the standard Java language access checks
  13. * -- for public, default (package) access, protected, and private
  14. * members -- performed by reflected objects at their point of use.
  15. * <P>
  16. * The following table
  17. * provides a summary description of what the permission allows,
  18. * and discusses the risks of granting code the permission.
  19. * <P>
  20. *
  21. * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
  22. * <tr>
  23. * <th>Permission Target Name</th>
  24. * <th>What the Permission Allows</th>
  25. * <th>Risks of Allowing this Permission</th>
  26. * </tr>
  27. *
  28. * <tr>
  29. * <td>suppressAccessChecks</td>
  30. * <td>ability to access
  31. * fields and invoke methods in a class. Note that this includes
  32. * not only public, but protected and private fields and methods as well.</td>
  33. * <td>This is dangerous in that information (possibly confidential) and
  34. * methods normally unavailable would be accessible to malicious code.</td>
  35. * </tr>
  36. *
  37. * </table>
  38. *
  39. * @see java.security.Permission
  40. * @see java.security.BasicPermission
  41. * @see AccessibleObject
  42. * @see Field#get
  43. * @see Field#set
  44. * @see Method#invoke
  45. * @see Constructor#newInstance
  46. *
  47. * @since 1.2
  48. */
  49. public final
  50. class ReflectPermission extends java.security.BasicPermission {
  51. private static final long serialVersionUID = 7412737110241507485L;
  52. /**
  53. * Constructs a ReflectPermission with the specified name.
  54. *
  55. * @param name the name of the ReflectPermission
  56. *
  57. * @throws NullPointerException
  58. * If <tt>name</tt> is <tt>null</tt>
  59. *
  60. * @throws IllegalArgumentException
  61. * If <tt>name</tt> is empty
  62. */
  63. public ReflectPermission(String name) {
  64. super(name);
  65. }
  66. /**
  67. * Constructs a ReflectPermission with the specified name and actions.
  68. * The actions should be null; they are ignored.
  69. *
  70. * @param name the name of the ReflectPermission
  71. *
  72. * @param actions should be null
  73. *
  74. * @throws NullPointerException
  75. * If <tt>name</tt> is <tt>null</tt>
  76. *
  77. * @throws IllegalArgumentException
  78. * If <tt>name</tt> is empty
  79. */
  80. public ReflectPermission(String name, String actions) {
  81. super(name, actions);
  82. }
  83. }