diff options
author | Elliott Hughes <enh@google.com> | 2013-05-10 16:15:26 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2013-06-05 15:30:08 -0700 |
commit | e91d1c4ef333b6b65cf1c902e683b2f8cd699d3f (patch) | |
tree | ad77109f943b69cb2281322483e1ffad1dab77eb /luni | |
parent | a65d5826d30d42f59283e24047810a4b940335b4 (diff) | |
download | libcore-e91d1c4ef333b6b65cf1c902e683b2f8cd699d3f.zip libcore-e91d1c4ef333b6b65cf1c902e683b2f8cd699d3f.tar.gz libcore-e91d1c4ef333b6b65cf1c902e683b2f8cd699d3f.tar.bz2 |
Add ReflectiveOperationException.
Bug: 3484927
Change-Id: I6ef7b71aba70bab7664ea29ef73ba8a542550e27
Diffstat (limited to 'luni')
7 files changed, 59 insertions, 6 deletions
diff --git a/luni/src/main/java/java/lang/ClassNotFoundException.java b/luni/src/main/java/java/lang/ClassNotFoundException.java index 2ac3b49..c7ac51d 100644 --- a/luni/src/main/java/java/lang/ClassNotFoundException.java +++ b/luni/src/main/java/java/lang/ClassNotFoundException.java @@ -20,7 +20,7 @@ package java.lang; /** * Thrown when a class loader is unable to find a class. */ -public class ClassNotFoundException extends Exception { +public class ClassNotFoundException extends ReflectiveOperationException { private static final long serialVersionUID = 9176873029745254542L; diff --git a/luni/src/main/java/java/lang/IllegalAccessException.java b/luni/src/main/java/java/lang/IllegalAccessException.java index 4625395..63fae94 100644 --- a/luni/src/main/java/java/lang/IllegalAccessException.java +++ b/luni/src/main/java/java/lang/IllegalAccessException.java @@ -21,7 +21,7 @@ package java.lang; * Thrown when a program attempts to access a field or method which is not * accessible from the location where the reference is made. */ -public class IllegalAccessException extends Exception { +public class IllegalAccessException extends ReflectiveOperationException { private static final long serialVersionUID = 6616958222490762034L; diff --git a/luni/src/main/java/java/lang/InstantiationException.java b/luni/src/main/java/java/lang/InstantiationException.java index a5f288b..d08cc75 100644 --- a/luni/src/main/java/java/lang/InstantiationException.java +++ b/luni/src/main/java/java/lang/InstantiationException.java @@ -21,7 +21,7 @@ package java.lang; * Thrown when a program attempts to access a constructor which is not * accessible from the location where the reference is made. */ -public class InstantiationException extends Exception { +public class InstantiationException extends ReflectiveOperationException { private static final long serialVersionUID = -8441929162975509110L; /** diff --git a/luni/src/main/java/java/lang/NoSuchFieldException.java b/luni/src/main/java/java/lang/NoSuchFieldException.java index bea6ecb..9cb88d0 100644 --- a/luni/src/main/java/java/lang/NoSuchFieldException.java +++ b/luni/src/main/java/java/lang/NoSuchFieldException.java @@ -21,7 +21,7 @@ package java.lang; * Thrown when the VM notices that a program tries to reference, * on a class or object, a field that does not exist. */ -public class NoSuchFieldException extends Exception { +public class NoSuchFieldException extends ReflectiveOperationException { private static final long serialVersionUID = -6143714805279938260L; diff --git a/luni/src/main/java/java/lang/NoSuchMethodException.java b/luni/src/main/java/java/lang/NoSuchMethodException.java index 7cae49b..568547b 100644 --- a/luni/src/main/java/java/lang/NoSuchMethodException.java +++ b/luni/src/main/java/java/lang/NoSuchMethodException.java @@ -21,7 +21,7 @@ package java.lang; * Thrown when the VM notices that a program tries to reference, * on a class or object, a method that does not exist. */ -public class NoSuchMethodException extends Exception { +public class NoSuchMethodException extends ReflectiveOperationException { private static final long serialVersionUID = 5034388446362600923L; diff --git a/luni/src/main/java/java/lang/ReflectiveOperationException.java b/luni/src/main/java/java/lang/ReflectiveOperationException.java new file mode 100644 index 0000000..835379c --- /dev/null +++ b/luni/src/main/java/java/lang/ReflectiveOperationException.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package java.lang; + +import java.lang.reflect.Array; + +/** + * Superclass of exceptions related to reflection. + * + * @since 1.7 + */ +public class ReflectiveOperationException extends Exception { + /** + * Constructs a new exception with no detail message. + */ + public ReflectiveOperationException() { + } + + /** + * Constructs a new exception with the given detail message. + */ + public ReflectiveOperationException(String message) { + super(message); + } + + /** + * Constructs a new exception with the given cause. + */ + public ReflectiveOperationException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new exception with the given detail message and cause. + */ + public ReflectiveOperationException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/luni/src/main/java/java/lang/reflect/InvocationTargetException.java b/luni/src/main/java/java/lang/reflect/InvocationTargetException.java index a87441f..ee75a0e 100644 --- a/luni/src/main/java/java/lang/reflect/InvocationTargetException.java +++ b/luni/src/main/java/java/lang/reflect/InvocationTargetException.java @@ -24,7 +24,7 @@ package java.lang.reflect; * @see Method#invoke * @see Constructor#newInstance */ -public class InvocationTargetException extends Exception { +public class InvocationTargetException extends ReflectiveOperationException { private static final long serialVersionUID = 4085088731926701167L; |