-
Bug
-
Resolution: Fixed
-
P3
-
21, 22
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8323320 | 22.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b02 |
JDK-8323184 | 22 | Jan Lahoda | P3 | Resolved | Fixed | b31 |
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
```
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
- backported by
-
JDK-8323184 JShell : Unnamed variable issue
- Resolved
-
JDK-8323320 JShell : Unnamed variable issue
- Resolved
- links to
-
Commit openjdk/jdk22/29ed3878
-
Commit openjdk/jdk/f0cfd361
-
Review openjdk/jdk22/36
-
Review openjdk/jdk/17225
(1 links to)