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

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 9
    • 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

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

              Created:
              Updated:
              Resolved: