IllegalAccessException.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* IllegalAccessException.java -- thrown on attempt to reflect on
  2. inaccessible data
  3. Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
  4. This file is part of GNU Classpath.
  5. GNU Classpath is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. GNU Classpath is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Classpath; see the file COPYING. If not, write to the
  15. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA.
  17. Linking this library statically or dynamically with other modules is
  18. making a combined work based on this library. Thus, the terms and
  19. conditions of the GNU General Public License cover the whole
  20. combination.
  21. As a special exception, the copyright holders of this library give you
  22. permission to link this library with independent modules to produce an
  23. executable, regardless of the license terms of these independent
  24. modules, and to copy and distribute the resulting executable under
  25. terms of your choice, provided that you also meet, for each linked
  26. independent module, the terms and conditions of the license of that
  27. module. An independent module is a module which is not derived from
  28. or based on this library. If you modify this library, you may extend
  29. this exception to your version of the library, but you are not
  30. obligated to do so. If you do not wish to do so, delete this
  31. exception statement from your version. */
  32. package java.lang;
  33. import java.lang.reflect.Constructor;
  34. import java.lang.reflect.Field;
  35. import java.lang.reflect.Method;
  36. /**
  37. * Thrown whenever a reflective method tries to do something that the
  38. * compiler would not allow. For example, using reflection to set a private
  39. * variable that belongs to a class in another package is bad.
  40. *
  41. * @author Brian Jones
  42. * @author Warren Levy (warrenl@cygnus.com)
  43. * @see Class#newInstance()
  44. * @see Field#set(Object, Object)
  45. * @see Field#setBoolean(Object, boolean)
  46. * @see Field#setByte(Object, byte)
  47. * @see Field#setShort(Object, short)
  48. * @see Field#setChar(Object, char)
  49. * @see Field#setInt(Object, int)
  50. * @see Field#setLong(Object, long)
  51. * @see Field#setFloat(Object, float)
  52. * @see Field#setDouble(Object, double)
  53. * @see Field#get(Object)
  54. * @see Field#getBoolean(Object)
  55. * @see Field#getByte(Object)
  56. * @see Field#getShort(Object)
  57. * @see Field#getChar(Object)
  58. * @see Field#getInt(Object)
  59. * @see Field#getLong(Object)
  60. * @see Field#getFloat(Object)
  61. * @see Field#getDouble(Object)
  62. * @see Method#invoke(Object, Object[])
  63. * @see Constructor#newInstance(Object[])
  64. * @status updated to 1.7
  65. */
  66. public class IllegalAccessException extends ReflectiveOperationException
  67. {
  68. /**
  69. * Compatible with JDK 1.0+.
  70. */
  71. private static final long serialVersionUID = 6616958222490762034L;
  72. /**
  73. * Create an exception without a message.
  74. */
  75. public IllegalAccessException()
  76. {
  77. }
  78. /**
  79. * Create an exception with a message.
  80. *
  81. * @param s the message
  82. */
  83. public IllegalAccessException(String s)
  84. {
  85. super(s);
  86. }
  87. }