-
Bug
-
Resolution: Fixed
-
P3
-
22
-
b08
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8313869 | 21.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b06 |
When I use this code:
long l = 8L;
int x = switch (l) {
case 8L -> 1;
case 4L -> 2;
default -> throw new UnsupportedOperationException();
}
I get this error message (copied from jshell):
| Error:
| constant label of type long is not compatible with switch selector type long
| case 8L -> 1;
| ^^
| Error:
| constant label of type long is not compatible with switch selector type long
| case 4L -> 2;
|
This looks like a bug, as I'd expect 'long' to be compatible with 'long'.
long l = 8L;
int x = switch (l) {
case 8L -> 1;
case 4L -> 2;
default -> throw new UnsupportedOperationException();
}
I get this error message (copied from jshell):
| Error:
| constant label of type long is not compatible with switch selector type long
| case 8L -> 1;
| ^^
| Error:
| constant label of type long is not compatible with switch selector type long
| case 4L -> 2;
|
This looks like a bug, as I'd expect 'long' to be compatible with 'long'.
- backported by
-
JDK-8313869 Strange error message when switching over long
- Resolved