RFR: 8371953: Document null handling in core reflection APIs [v4]

Chen Liang liach at openjdk.org
Wed Nov 19 14:15:09 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.

Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:

 - Class-level null hostile statement
 - Merge branch 'master' of https://github.com/openjdk/jdk into fix/core-reflection-null-checks
 - From review
 - Merge branch 'master' of https://github.com/openjdk/jdk into fix/core-reflection-null-checks
 - Rephrase for parameterTypes contains null
 - Rename tests to be more specific
 - Split annotated type new checks to another patch
 - Redundant
 - Test and more fixes
 - Copyright years
 - ... and 3 more: https://git.openjdk.org/jdk/compare/b3cee9b2...5fdce5d9

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28336/files
  - new: https://git.openjdk.org/jdk/pull/28336/files/51ef5789..5fdce5d9

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28336&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28336&range=02-03

  Stats: 21172 lines in 297 files changed: 13285 ins; 5635 del; 2252 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