mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-02 04:35:22 +07:00
[java-highlighting] Minor fixes in switch statement highlighting
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only) GitOrigin-RevId: 2924ae6c9984caa6e8a45f640c4de54e02134ad3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ae7957d3c7
commit
f8b210a481
+7
@@ -29,4 +29,11 @@ class SwitchStatement {
|
||||
<error descr="Local class 'Local' cannot be referenced from another switch branch">Local</error> x = new <error descr="Local class 'Local' cannot be referenced from another switch branch">Local</error>();
|
||||
}
|
||||
}
|
||||
|
||||
int unsupported(int i) {
|
||||
return <error descr="'switch' expressions are not supported at language level '1.4'">switch</error> (i) {
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + i);
|
||||
};
|
||||
}
|
||||
}
|
||||
+13
-1
@@ -23,7 +23,7 @@ class EnhancedSwitchStatements {
|
||||
}
|
||||
switch (new Random().nextInt()) {
|
||||
case 0: throw new IllegalStateException("no args"); break;
|
||||
<error descr="Different 'case' kinds used in 'switch'">case 1 -> { System.out.println("one"); }</error>
|
||||
<error descr="Different 'case' kinds used in 'switch'">case 1</error> -> { System.out.println("one"); }
|
||||
}
|
||||
|
||||
{ <error descr="Case statement outside switch">case 11 -> System.out.println("hi there");</error> }
|
||||
@@ -88,4 +88,16 @@ class EnhancedSwitchStatements {
|
||||
}
|
||||
|
||||
private static void noop() { }
|
||||
|
||||
void differentCase() {
|
||||
int a = 1;
|
||||
switch (a) {
|
||||
case 1:
|
||||
System.out.println(1);
|
||||
break;
|
||||
<error descr="Different 'case' kinds used in 'switch'">case 2</error> -> {
|
||||
System.out.println(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user