summaryrefslogtreecommitdiffstats
path: root/luni-kernel/src
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-09-03 14:03:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-09-03 14:03:10 -0700
commite56e5327a90b6d62e07fe6c8bc7b78a3fc9f4b45 (patch)
tree2d15341f48e9c56d3a26e0d78be47cccb6d164e6 /luni-kernel/src
parentdd01c2cba250ddcb8008567344883f0ee61353fe (diff)
parent6a00ab92038e717b828161a1222fea0c54592705 (diff)
downloadlibcore-e56e5327a90b6d62e07fe6c8bc7b78a3fc9f4b45.zip
libcore-e56e5327a90b6d62e07fe6c8bc7b78a3fc9f4b45.tar.gz
libcore-e56e5327a90b6d62e07fe6c8bc7b78a3fc9f4b45.tar.bz2
Merge change 23208 into eclair
* changes: Fix Class.getConstructor("whatever", (Class[]) null).
Diffstat (limited to 'luni-kernel/src')
-rw-r--r--luni-kernel/src/main/java/java/lang/Class.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/luni-kernel/src/main/java/java/lang/Class.java b/luni-kernel/src/main/java/java/lang/Class.java
index 6adf4db..b8e3903 100644
--- a/luni-kernel/src/main/java/java/lang/Class.java
+++ b/luni-kernel/src/main/java/java/lang/Class.java
@@ -469,6 +469,7 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
*
* @param parameterTypes
* the parameter types of the requested constructor.
+ * {@code (Class[]) null} is equivalent to the empty array.
* @return the constructor described by {@code parameterTypes}.
* @throws NoSuchMethodException
* if the constructor can not be found.
@@ -587,6 +588,7 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
*
* @param parameterTypes
* the parameter types of the requested constructor.
+ * {@code (Class[]) null} is equivalent to the empty array.
* @return the constructor described by {@code parameterTypes}.
* @throws NoSuchMethodException
* if the requested constructor can not be found.
@@ -659,12 +661,14 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
sb.append(getSimpleName());
sb.append('(');
boolean first = true;
- for (Class<?> p : parameterTypes) {
- if (!first) {
- sb.append(',');
+ if (parameterTypes != null) {
+ for (Class<?> p : parameterTypes) {
+ if (!first) {
+ sb.append(',');
+ }
+ first = false;
+ sb.append(p.getSimpleName());
}
- first = false;
- sb.append(p.getSimpleName());
}
sb.append(')');
throw new NoSuchMethodException(sb.toString());
@@ -741,6 +745,7 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
* the requested method's name.
* @param parameterTypes
* the parameter types of the requested method.
+ * {@code (Class[]) null} is equivalent to the empty array.
* @return the method described by {@code name} and {@code parameterTypes}.
* @throws NoSuchMethodException
* if the requested constructor can not be found.
@@ -991,6 +996,7 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
* the requested method's name.
* @param parameterTypes
* the parameter types of the requested method.
+ * {@code (Class[]) null} is equivalent to the empty array.
* @return the public field specified by {@code name}.
* @throws NoSuchMethodException
* if the method can not be found.