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

Concatenating an array and converting it to Java gives wrong result

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u20
    • core-libs
    • b36
    • generic
    • generic

        FULL PRODUCT VERSION :
        java version "1.8.0_20"11:44:58 on console
        Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
        Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        OS X 10.9.5

        A DESCRIPTION OF THE PROBLEM :
        Concatenating two arrays in JavaScript on Nashorn and translating it to Java returns an array that is too long and is filled with nulls at the end.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the following JavaScript using Nashorn:
        head = [0]
        tail = [1, 2, 3];
        list = head.concat(tail)
        print(java.util.Arrays.toString(Java.to(list)));

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Expected Output:
        [0, 1, 2, 3]
        ACTUAL -
        Actual Output:
        [0, 1, 2, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]

        REPRODUCIBILITY :
        This bug can be reproduced always.

              hannesw Hannes Wallnoefer
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: