-
Bug
-
Resolution: Fixed
-
P4
-
20
-
b07
This fails:
public int test(Object o)
{
int[] arr = {1, 2};
return switch (o) {
case (String s) when (arr[0] == 1) -> 0;
default -> 1;
};
}
with
ParenthesizedCombo.java:36: error: -> expected
case (String s) when (arr[0] == 1) -> 0;
but not when e.g.,
case (String s) when (s.isEmpty()) -> 0;
public int test(Object o)
{
int[] arr = {1, 2};
return switch (o) {
case (String s) when (arr[0] == 1) -> 0;
default -> 1;
};
}
with
ParenthesizedCombo.java:36: error: -> expected
case (String s) when (arr[0] == 1) -> 0;
but not when e.g.,
case (String s) when (s.isEmpty()) -> 0;