mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-21 17:52:27 +07:00
GitOrigin-RevId: 95a81fcd1546afec31afc2a044a9ba5fa1337411
31 lines
1.1 KiB
Java
31 lines
1.1 KiB
Java
class Test {
|
|
void noSuppress(int x) {
|
|
if (<warning descr="Condition 'x < 0 && x > 20' is always 'false'">x < 0 && <warning descr="Condition 'x > 20' is always 'false' when reached">x > 20</warning></warning>) {}
|
|
Object s = "23";
|
|
System.out.println(((<warning descr="Casting 's' to 'Number' will produce 'ClassCastException' for any non-null value">Number</warning>)s).byteValue());
|
|
}
|
|
|
|
void suppressOld(int x) {
|
|
//noinspection ConstantConditions
|
|
if (x < 0 && x > 20) {}
|
|
Object s = "23";
|
|
//noinspection ConstantConditions
|
|
System.out.println(((Number)s).byteValue());
|
|
}
|
|
|
|
void suppressNew(int x) {
|
|
//noinspection ConstantValue
|
|
if (x < 0 && x > 20) {}
|
|
Object s = "23";
|
|
//noinspection ConstantConditions
|
|
System.out.println(((Number)s).byteValue());
|
|
}
|
|
|
|
void wrongSuppress(int x) {
|
|
//noinspection ConstantValue
|
|
if (x < 0 && x > 20) {}
|
|
Object s = "23";
|
|
//noinspection ConstantValue
|
|
System.out.println(((<warning descr="Casting 's' to 'Number' will produce 'ClassCastException' for any non-null value">Number</warning>)s).byteValue());
|
|
}
|
|
} |