Signed-off-by: Pekka Enberg <penb...@kernel.org> --- java/lang/ClassNotFoundException.java | 6 +- java/lang/IllegalAccessException.java | 6 +- java/lang/InstantiationException.java | 6 +- java/lang/NoSuchFieldException.java | 6 +- java/lang/NoSuchMethodException.java | 6 +- java/lang/ReflectiveOperationException.java | 88 ++++++++++++++++++++++ java/lang/reflect/InvocationTargetException.java | 6 +- 7 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 java/lang/ReflectiveOperationException.java
diff --git a/java/lang/ClassNotFoundException.java b/java/lang/ClassNotFoundException.java index 142bc5d..fe1424d 100644 --- a/java/lang/ClassNotFoundException.java +++ b/java/lang/ClassNotFoundException.java @@ -1,5 +1,5 @@ /* ClassNotFoundException.java -- thrown when class definition cannot be found - Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,9 +47,9 @@ package java.lang; * @see Class#forName(String) * @see ClassLoader#findSystemClass(String) * @see ClassLoader#loadClass(String, boolean) - * @status updated to 1.4 + * @status updated to 1.7 */ -public class ClassNotFoundException extends Exception +public class ClassNotFoundException extends ReflectiveOperationException { /** * Compatible with JDK 1.0+. diff --git a/java/lang/IllegalAccessException.java b/java/lang/IllegalAccessException.java index a352c8b..2574f66 100644 --- a/java/lang/IllegalAccessException.java +++ b/java/lang/IllegalAccessException.java @@ -1,6 +1,6 @@ /* IllegalAccessException.java -- thrown on attempt to reflect on inaccessible data - Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -71,9 +71,9 @@ import java.lang.reflect.Method; * @see Field#getDouble(Object) * @see Method#invoke(Object, Object[]) * @see Constructor#newInstance(Object[]) - * @status updated to 1.4 + * @status updated to 1.7 */ -public class IllegalAccessException extends Exception +public class IllegalAccessException extends ReflectiveOperationException { /** * Compatible with JDK 1.0+. diff --git a/java/lang/InstantiationException.java b/java/lang/InstantiationException.java index 367b14b..cb2cad1 100644 --- a/java/lang/InstantiationException.java +++ b/java/lang/InstantiationException.java @@ -1,6 +1,6 @@ /* InstantiationException.java -- thrown when reflection cannot create an instance - Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,9 +46,9 @@ package java.lang; * @author Brian Jones * @author Warren Levy (warr...@cygnus.com) * @see Class#newInstance() - * @status updated to 1.4 + * @status updated to 1.7 */ -public class InstantiationException extends Exception +public class InstantiationException extends ReflectiveOperationException { /** * Compatible with JDK 1.0+. diff --git a/java/lang/NoSuchFieldException.java b/java/lang/NoSuchFieldException.java index 74d52d1..b43b532 100644 --- a/java/lang/NoSuchFieldException.java +++ b/java/lang/NoSuchFieldException.java @@ -1,5 +1,5 @@ /* NoSuchFieldException.java -- thrown when reflecting a non-existant field - Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,9 +45,9 @@ package java.lang; * @author Brian Jones * @author Warren Levy (warr...@cygnus.com) * @since 1.1 - * @status updated to 1.4 + * @status updated to 1.7 */ -public class NoSuchFieldException extends Exception +public class NoSuchFieldException extends ReflectiveOperationException { /** * Compatible with JDK 1.1+. diff --git a/java/lang/NoSuchMethodException.java b/java/lang/NoSuchMethodException.java index e423efb..1162382 100644 --- a/java/lang/NoSuchMethodException.java +++ b/java/lang/NoSuchMethodException.java @@ -1,5 +1,5 @@ /* NoSuchMethodException.java -- thrown when reflecting a non-existant method - Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,9 +44,9 @@ package java.lang; * * @author Brian Jones * @author Warren Levy (warr...@cygnus.com) - * @status updated to 1.4 + * @status updated to 1.7 */ -public class NoSuchMethodException extends Exception +public class NoSuchMethodException extends ReflectiveOperationException { /** * Compatible with JDK 1.0+. diff --git a/java/lang/ReflectiveOperationException.java b/java/lang/ReflectiveOperationException.java new file mode 100644 index 0000000..8b84c0e --- /dev/null +++ b/java/lang/ReflectiveOperationException.java @@ -0,0 +1,88 @@ +/* ReflectiveOperationException.java -- thrown when reflective operation fails + Copyright (C) 2012 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.lang; + +/** + * This exception is thrown when reflective operations fail. + * + * @since 1.7 + */ +public class ReflectiveOperationException extends Exception +{ + private static final long serialVersionUID = 123456789L; + + /** + * Create an exception without a message. + */ + public ReflectiveOperationException() + { + } + + /** + * Create an exception with a message. + * + * @param s the message + */ + public ReflectiveOperationException(String s) + { + super(s); + } + + /** + * Create an exception with a message and a cause. + * + * @param s the message + * @param cause the cause, may be null + */ + public ReflectiveOperationException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * Create an exception with a cause. + * + * @param cause the cause, may be null + */ + public ReflectiveOperationException(Throwable cause) + { + super(cause); + } + +} diff --git a/java/lang/reflect/InvocationTargetException.java b/java/lang/reflect/InvocationTargetException.java index af79d3a..4480fc6 100644 --- a/java/lang/reflect/InvocationTargetException.java +++ b/java/lang/reflect/InvocationTargetException.java @@ -1,5 +1,5 @@ /* InvocationTargetException.java -- Wrapper exception for reflection - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,9 +50,9 @@ package java.lang.reflect; * @see Method#invoke(Object,Object[]) * @see Constructor#newInstance(Object[]) * @since 1.1 - * @status updated to 1.4 + * @status updated to 1.7 */ -public class InvocationTargetException extends Exception +public class InvocationTargetException extends ReflectiveOperationException { /** * Compatible with JDK 1.1+. -- 1.7.6.5