Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8270025

DynamicCallSiteDesc::withArgs doesn't throw NPE

    XMLWordPrintable

Details

    • b31
    • Verified

    Backports

      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());
                }
        }

        Attachments

          Issue Links

            Activity

              People

                vromero Vicente Arturo Romero Zaldivar
                pgundarlahal Prashanthram Gundarlahally
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: