JDK-8270209 : java.lang.constant.DynamicCallSiteDesc::of should throw NPE if elements in `bootstrapArgs` is null
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P2
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 17
  • Submitted: 2021-07-09
  • Updated: 2021-07-15
  • Resolved: 2021-07-13
Related Reports
CSR :  
Description
Summary
-------

`java.lang.constant.DynamicCallSiteDesc::of` (the version taking the varargs `bootstrapArgs` argument) should throw NullPointerException if element in `bootstrapArgs` is null.

Problem
-------

The `@throws NullPointerException` assertion should mention that a NPE can be thrown if any argument contains any null entry.

Solution
--------

Reword the assertion.

Specification
-------------
    diff --git a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java
    index 9b5b1d66cf8..cf6d09c14b3 100644
    --- a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java
    +++ b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java
    @@ -100,7 +100,7 @@ public class DynamicCallSiteDesc {
          *                      to the bootstrap, that would appear in the
          *                      {@code BootstrapMethods} attribute
          * @return the nominal descriptor
    -     * @throws NullPointerException if any parameter is null
    +     * @throws NullPointerException if any parameter or its contents are {@code null}
          * @throws IllegalArgumentException if the invocation name has the incorrect
          * format
          * @jvms 4.2.2 Unqualified Names
    
Comments
Moving to Approved.
13-07-2021

Ah, sorry, that makes sense.
12-07-2021

[~jvernee] the reason why I didn't add the other javadoc section here is because it applies to a private method, so not part of the class' spec
12-07-2021

The patch on GitHub contains 2 sections of changed javadoc, but the CSR only contains 1. Please add the missing section as well.
12-07-2021

while working on JDK-8224985 I didn't realize that the spec for the varargs overloaded version of method DynamicCallSiteDesc::of should be reworded too as its implementation is invoking the same private constructor method ::withArgs is invoking. This CSR is intending to close this gap
10-07-2021