diff options
Diffstat (limited to 'luni-kernel/src')
-rw-r--r-- | luni-kernel/src/main/java/java/lang/Class.java | 16 |
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. |