[java-highlighting] IDEA-357866 Spurious "Different case kinds used in the switch" error on incomplete code

- improve error message

GitOrigin-RevId: 2a8da472e07dd10bdb0ae75e679b6056ab884b72
This commit is contained in:
Mikhail Pyltsin
2024-08-22 10:27:59 +02:00
committed by intellij-monorepo-bot
parent 6d95a69a3e
commit cd14483af8
3 changed files with 4 additions and 4 deletions

View File

@@ -318,7 +318,7 @@ unclosed.comment=Unclosed comment
exception.already.caught=Exception ''{0}'' has already been caught
exception.must.be.disjoint=Types in multi-catch must be disjoint: ''{0}'' is a subclass of ''{1}''
statement.must.be.prepended.with.case.label=Statement must be prepended with case label
different.case.kinds.in.switch=Different case kinds used in the switch
different.case.kinds.in.switch=Different 'case' kinds used in 'switch'
void.type.is.not.allowed='void' type is not allowed here
single.import.class.conflict=''{0}'' is already defined in a single-type import
numeric.overflow.in.expression=Numeric overflow in expression

View File

@@ -19,11 +19,11 @@ class EnhancedSwitchStatements {
}
switch (new Random().nextInt()) {
case 0 -> throw new IllegalStateException("no args");
<error descr="Different case kinds used in the switch">case 1:</error> break;
<error descr="Different 'case' kinds used in 'switch'">case 1:</error> break;
}
switch (new Random().nextInt()) {
case 0: throw new IllegalStateException("no args"); break;
<error descr="Different case kinds used in the switch">case 1 -> { System.out.println("one"); }</error>
<error descr="Different 'case' kinds used in 'switch'">case 1 -> { System.out.println("one"); }</error>
}
{ <error descr="Case statement outside switch">case 11 -> System.out.println("hi there");</error> }

View File

@@ -12,7 +12,7 @@ class SwitchExpressions {
System.out.println(switch (new Random().nextInt()) {
case 0 -> throw new IllegalStateException("no args");
<error descr="Different case kinds used in the switch">case 1:</error> yield "lone";
<error descr="Different 'case' kinds used in 'switch'">case 1:</error> yield "lone";
});
System.out.println(