JDK-8270025 : DynamicCallSiteDesc::withArgs doesn't throw NPE
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 17
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2021-07-07
  • Updated: 2021-07-31
  • Resolved: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 18
17 b31Fixed 18Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Description
As per the revised documentation for DynamicCallSiteDesc.withArgs:
"NullPointerException - if the argument or its contents are null"

Attached code doesn't throw NPE for argument array containing null:

public class t {
        public static boolean m() throws Throwable {
                DynamicCallSiteDesc desc = DynamicCallSiteDesc.of(ConstantDescs.ofCallsiteBootstrap(
                                                                        ClassDesc.of("BootstrapAndTarget"),
                                                                        "bootstrap2",
                                                                        ClassDesc.of("java.lang.invoke.CallSite")
                                                                        ),
                                                "getTarget",
                                                MethodTypeDesc.ofDescriptor("()I"));

                ConstantDesc[] cd = new ConstantDesc[1];
                cd[0] = null;

                desc.withArgs(cd);

                return true;
        }
        public static void main(String[] args) throws Throwable {
                System.out.println("m: " + m());
        }
}

Comments
Changeset: 8583aab3 Author: Vicente Romero <vromero@openjdk.org> Date: 2021-07-13 17:48:21 +0000 URL: https://git.openjdk.java.net/jdk17/commit/8583aab374c3c2ad94c88e7f649d81ce5f319a5f
13-07-2021