-
CSR
-
Resolution: Unresolved
-
P4
-
None
-
behavioral
-
low
-
An exceptional behavior is changed, though this behavior is unlikely to be relied on.
-
Java API
-
SE
Summary
In java.lang.classfile.constantpool.ConstantPoolBuilder
, make loadableConstantEntry
and constantValueEntry
throw NullPointerException
instead of IllegalArgumentException
on incoming null
arguments.
Problem
These two methods are specified, by the package, as other methods in this class, to throw NullPointerException
if the incoming argument is null
. However, the actual behavior of these methods is they throw IllegalArgumentException
instead.
Solution
Convert the actual behavior to follow the specification, that they should throw NPE when treatment for null
arguments is not otherwise specified.
An alternative approach would be to specify them to throw IAE for null
arguments. However, this would make the two APIs hard for composition - for example, bsmEntry
in the same class accepts a List<ConstantDesc>
, and uses this API. Currently, IAE would be thrown for nested null
in such a list; this is not desirable to users as it increases debugging complexity and the APIs that need the specification change is too many.
Specification
None. This is purely behavioral.
- csr of
-
JDK-8361909 ConstantPoolBuilder::loadableConstantEntry and constantValueEntry should throw NPE
-
- In Progress
-