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

XMLWordPrintable

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

      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

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

              Created:
              Updated:
              Resolved: