mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 15:50:53 +07:00
26 lines
716 B
Java
26 lines
716 B
Java
class Test {
|
|
void insideSwitch(Object o) {
|
|
switch (o){
|
|
case /*unused*/ Object <warning descr="Pattern variable 's' is never used"><caret>s</warning> /*unused*/ -> System.out.println();
|
|
}
|
|
switch (o){
|
|
case Object s -> System.out.println(s);
|
|
}
|
|
switch (o) {
|
|
case Object s when s != null -> System.out.println();
|
|
default -> System.out.println();
|
|
}
|
|
}
|
|
|
|
void insideInstanceOf(Object o) {
|
|
if (o instanceof String s && s != null) {
|
|
System.out.println();
|
|
}
|
|
if (o instanceof String s) {
|
|
System.out.println(s);
|
|
}
|
|
if (o instanceof String <warning descr="Pattern variable 's' is never used">s</warning>) {
|
|
System.out.println();
|
|
}
|
|
}
|
|
} |