-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P2
-
Affects Version/s: 15
-
Component/s: tools
-
b15
-
Verified
The below code is using long literal with yield and it should compile successfully. However, it reports compilation error.
class Test {
public void check() {
var num = switch (1) {
case 1:
yield 0L; //Works with yield 0.0f, 0.0d and (long)0L
default:
yield 0;
} ;
}
}
Result:
Test.java:5: error: not a statement
case 1 : yield 0L;
^
Test.java:5: error: ';' expected
case 1 : yield 0L;
class Test {
public void check() {
var num = switch (1) {
case 1:
yield 0L; //Works with yield 0.0f, 0.0d and (long)0L
default:
yield 0;
} ;
}
}
Result:
Test.java:5: error: not a statement
case 1 : yield 0L;
^
Test.java:5: error: ';' expected
case 1 : yield 0L;