mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-31 02:38:54 +07:00
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only) GitOrigin-RevId: e8ba3ee967f6d8b3534549b1a115b66fde3f57e5
53 lines
1.4 KiB
Java
53 lines
1.4 KiB
Java
class Test {
|
|
void test(Object o, Integer integer) {
|
|
switch (o) {
|
|
case String s when <error descr="Incompatible types. Found: 'java.lang.Integer', required: 'boolean'">integer</error> -> System.out.println();
|
|
default -> {}
|
|
}
|
|
|
|
switch (o) {
|
|
case String s when isBool() -> System.out.println();
|
|
default -> {}
|
|
}
|
|
|
|
switch (o) {
|
|
case Integer i when <error descr="Incompatible types. Found: 'int', required: 'boolean'">isInt</error>():
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
switch (o) {
|
|
case Integer i when <error descr="Incompatible types. Found: 'null', required: 'boolean'">null</error>:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
boolean flag1;
|
|
switch (o) {
|
|
case Integer i when <error descr="Variable 'flag1' might not have been initialized">flag1</error> -> System.out.println(1);
|
|
default -> System.out.println(0);
|
|
}
|
|
|
|
boolean flag2;
|
|
switch (o) {
|
|
case Double d when foo(<error descr="Variable 'flag2' might not have been initialized">flag2</error>) -> System.out.println(2);
|
|
default -> System.out.println(0);
|
|
}
|
|
}
|
|
|
|
private native boolean isBool();
|
|
|
|
private native int isInt();
|
|
|
|
private native boolean foo(boolean blag);
|
|
|
|
public static void main2(Object o) {
|
|
int x = switch (o) {
|
|
case Object _, String _ when o == o -> 4;
|
|
case Integer _ -> 2;
|
|
default -> 3;
|
|
};
|
|
}
|
|
} |