RFR: 8371953: Document null handling in core reflection APIs

Chen Liang liach at openjdk.org
Sat Nov 15 23:11:41 UTC 2025


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.

-------------

Commit messages:
 - Redundant
 - Test and more fixes
 - Copyright years
 - Testing
 - Merge branch 'master' of https://github.com/openjdk/jdk into fix/core-reflection-null-checks
 - Null behavior for core reflection

Changes: https://git.openjdk.org/jdk/pull/28336/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28336&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8371953
  Stats: 529 lines in 18 files changed: 504 ins; 0 del; 25 mod
  Patch: https://git.openjdk.org/jdk/pull/28336.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28336/head:pull/28336

PR: https://git.openjdk.org/jdk/pull/28336


More information about the core-libs-dev mailing list