JShell : Unnamed variable issue

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 23
    • Affects Version/s: 21, 22
    • Component/s: tools
    • 21
    • b05
    • generic
    • generic

        JShell stops interpreting the snippet after the function declaration which uses an unnamed variable. This happens on both 21 (preview) & 22.

        ```
        var values = List.of(1, 2, 3);
        Function<Integer, Integer> zero = _ -> 0;
        // The rest is ignored
        var res = values.stream().map(zero).toList();
        ```

        Note that this snippet works properly if we feed JShell with the snippet line by line. This behaviour, i.e. works line by line, but doesn't with multiple lines, looks similar to https://bugs.openjdk.org/browse/JDK-8319532

              Assignee:
              Jan Lahoda
              Reporter:
              David Delabassee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: