Error highlightning for asserts is wrong
Hello,
the error highlightning for asserts in IntelliJ 3.0 Build 663 is wrong, for example:
public String getText(int mode) {
switch (mode) {
case 1:
return "Text1";
case 2:
return "Text2";
case 3:
return "Text3";
default:
assert false;
return null;
}
}
The error highlightning says that "return null" in the default case is unreachable code. But when I delete it, the compiler says, that there is a return statement missing.
In this case the compiler's message is correct and In?telliJ wrong, because when assertions are disabled at runtime, no assert exception will be thrown and the return statement will be executed. So code after a "assert false" statement can never be unreachable.
Greetings
Carsten
请先登录再写评论。