RFR: 8371953: Document null handling in core reflection APIs [v2]
Chen Liang
liach at openjdk.org
Sun Nov 16 15:52:02 UTC 2025
On Sun, 16 Nov 2025 15:45:24 GMT, Chen Liang <liach at openjdk.org> wrote:
>> A lot of core reflection APIs are from antique times, which have their own null handling behavior. Such behaviors are often not documented in the specification; we should document rejected null arguments and accepted null arguments (including array elements) explicitly.
>>
>> In the investigation, I found `Class.isNestmateOf` (inconsistent) and `AnnotatedType`'s implementation of `AnnotatedElement` methods (required by specification) are missing null checks. I consider these unlikely to be a user dependency and added new null checks.
>
> Chen Liang has updated the pull request incrementally with three additional commits since the last revision:
>
> - Rephrase for parameterTypes contains null
> - Rename tests to be more specific
> - Split annotated type new checks to another patch
I updated the parameterTypes null element behavior for NoSuchMethodException, and made the test names more specific. In addition, I moved my discovered null check issues with AnnotatedType's AnnotatedElement methods to a separate patch, as that has no spec change and is purely behavioral.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28336#issuecomment-3538890734
More information about the core-libs-dev
mailing list