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

"Java.to" tries to unbox integers in object only function in the optimistic world

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: 9
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      Latest staging repo:

      var x = Java.to([null], "java.lang.Integer[]")[0];
      print(x);

      This produces a null pointer

      Exception in thread "main" java.lang.NullPointerException
      at sun.invoke.util.ValueConversions.unboxInteger(ValueConversions.java:77)
      at jdk.nashorn.internal.scripts.Script$jac.:program(jac.js:33)
      at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:506)
      at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:216)
      at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:376)
      at jdk.nashorn.tools.Shell.apply(Shell.java:385)
      at jdk.nashorn.tools.Shell.runScripts(Shell.java:314)
      at jdk.nashorn.tools.Shell.run(Shell.java:168)
      at jdk.nashorn.tools.Shell.main(Shell.java:132)
      at jdk.nashorn.tools.Shell.main(Shell.java:111)


      Not sure why

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              attila Attila Szegedi
              Reporter:
              lagergren Marcus Lagergren
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: