RFR: 8361909: ConstantPoolBuilder::loadableConstantEntry and constantValueEntry should throw NPE

Chen Liang liach at openjdk.org
Thu Jul 10 22:38:16 UTC 2025


Currently, the aforementioned two methods do not throw NPE upon null input, but throw IAE.

This behavior is bad for composition: `bsmEntry` actually throws IAE for nested null in the argument list/array, and other APIs are similarly affected.

Given this domino effect, I think the best way is to fix the API itself to correctly throw NPE instead. A small CSR is opened to record this change.

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

Commit messages:
 - 8361909: ConstantPoolBuilder::loadableConstantEntry and constantValueEntry should throw NPE

Changes: https://git.openjdk.org/jdk/pull/26257/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26257&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361909
  Stats: 11 lines in 2 files changed: 8 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/26257.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26257/head:pull/26257

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


More information about the core-libs-dev mailing list