mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 17:20:54 +07:00
Also, fixed unreachable statement highlighting in different cases GitOrigin-RevId: 20b28272b51c77e3413e1ca143222d35199728bd
62 lines
1.5 KiB
Java
62 lines
1.5 KiB
Java
public class DeadCode {
|
|
private static String m1(int n) {
|
|
return "";
|
|
<error descr="Unreachable statement">return</error> switch (1) {
|
|
default -> "x";
|
|
};
|
|
}
|
|
|
|
private static String m2(int n) {
|
|
return "";
|
|
<error descr="Unreachable statement">int x = switch (1) {
|
|
default -> 0;
|
|
};</error>
|
|
}
|
|
|
|
private static String m3(int n) {
|
|
int x;
|
|
return "";
|
|
<error descr="Unreachable statement">x = switch (1) {
|
|
default -> 0;
|
|
};</error>
|
|
}
|
|
|
|
private static String m4(int n) {
|
|
return "";
|
|
<error descr="Unreachable statement">throw</error> switch (1) {
|
|
default -> new RuntimeException();
|
|
};
|
|
}
|
|
|
|
private static String m5(int n) {
|
|
return "";
|
|
<error descr="Unreachable statement">try</error> (AutoCloseable x = switch(1) {default -> () -> {};}) {} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
private static String m6(int n) {
|
|
return "";
|
|
<error descr="Unreachable statement">synchronized</error> (switch(1) {default -> "";}) {
|
|
System.out.println("");
|
|
}
|
|
}
|
|
|
|
private static String m7(int n) {
|
|
return "";
|
|
<error descr="Unreachable statement">if</error>(switch (1) {default -> true;}) {}
|
|
}
|
|
|
|
private static String m8(int n) {
|
|
return switch (n) {
|
|
default:
|
|
yield "x";
|
|
<error descr="Unreachable statement">yield</error> switch(1) { default -> ""; };
|
|
};
|
|
}
|
|
|
|
private static String m9() {
|
|
return "";
|
|
<error descr="Unreachable statement">assert</error> switch(1) {default -> true;};
|
|
}
|
|
} |