Skip to content

Commit

Permalink
Accept a null array of parameter types for more methods. (#98)
Browse files Browse the repository at this point in the history
We already do this for `getMethod`. In fairness, `getMethod` has clear
docs about it. These other methods do not. Still, I think that
`@Nullable` is justified, as I discussed in
#96

Fixes #96
  • Loading branch information
cpovirk authored Oct 7, 2024
1 parent b8b7d1c commit cebb603
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,7 @@ public Method getMethod(String name, Class<?> @Nullable ... parameterTypes)
*/

@CallerSensitive
public Constructor<T> getConstructor(Class<?>... parameterTypes)
public Constructor<T> getConstructor(Class<?> @Nullable ... parameterTypes)
throws NoSuchMethodException, SecurityException
{
@SuppressWarnings("removal")
Expand Down Expand Up @@ -2923,7 +2923,7 @@ public Field getDeclaredField(String name)
* @since 1.1
*/
@CallerSensitive
public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
public Method getDeclaredMethod(String name, Class<?> @Nullable ... parameterTypes)
throws NoSuchMethodException, SecurityException {
Objects.requireNonNull(name);
@SuppressWarnings("removal")
Expand Down Expand Up @@ -3020,7 +3020,7 @@ Method findMethod(boolean publicOnly, String name, Class<?>... parameterTypes) {
* @since 1.1
*/
@CallerSensitive
public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes)
public Constructor<T> getDeclaredConstructor(Class<?> @Nullable ... parameterTypes)
throws NoSuchMethodException, SecurityException
{
@SuppressWarnings("removal")
Expand Down

0 comments on commit cebb603

Please sign in to comment.