mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-03 20:33:31 +07:00
GitOrigin-RevId: 77b81cc6df6c9b600b31261a3e83c1f552f5d06f
35 lines
791 B
Java
35 lines
791 B
Java
import java.util.function.*;
|
|
|
|
interface Something {
|
|
|
|
}
|
|
|
|
enum E implements Something {A, B,}
|
|
|
|
record P(String s) implements Something {
|
|
}
|
|
|
|
class Test {
|
|
public static void main(String[] args) {
|
|
|
|
}
|
|
public int main1(Something something) {
|
|
return switch (something) {
|
|
case P(_) when something instanceof Object o: yield o.hashCode();
|
|
case E _ when something instanceof Object o: yield o.hashCode();
|
|
default: {
|
|
yield 2;
|
|
}
|
|
};
|
|
}
|
|
|
|
public int main2(Something something) {
|
|
return switch (something) {
|
|
case P(_) when something instanceof Object o: yield o.hashCode();
|
|
case E _ when something instanceof Object o1: yield <error descr="Cannot resolve symbol 'o'">o</error>.hashCode();
|
|
default: {
|
|
yield 2;
|
|
}
|
|
};
|
|
}
|
|
} |