RFR: 8371953: Document null handling in core reflection APIs [v2]
Alan Bateman
alanb at openjdk.org
Sun Nov 16 19:46:04 UTC 2025
On Sun, 16 Nov 2025 18:57:09 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Class.java line 2152:
>>
>>> 2150: * {@code name} and {@code parameterTypes}
>>> 2151: * @throws NoSuchMethodException if a matching method is not found, such as
>>> 2152: * when {@code parameterTypes} contains {@code null},
>>
>> It might be clearer to say "or parameterTypes contains a null element" rather than "such as when ..."
>
> My impression of this behavior is that no method can have a parameter type array that contains a `null` value. So claiming there is no matching method for this scenario probably makes sense?
That might be a bit too subtle for the reader and it would be clearer to be explicit.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28336#discussion_r2532186795
More information about the core-libs-dev
mailing list