Concatenating an array and converting it to Java gives wrong result

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 8u20
    • Component/s: 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.

              Assignee:
              Hannes Wallnoefer
              Reporter:
              Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: