mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-143937 Bogus warning by 'Constant conditions & exceptions' inspection within lambda expressions, due to JSR 305 @TypeQualifierDefault annotation
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
import javax.annotation.*;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
class Test {
|
||||
void foo() {
|
||||
Intf i1 = (o) -> {
|
||||
if (o == null) {
|
||||
System.out.println();
|
||||
}
|
||||
};
|
||||
Intf i2 = (Object o) -> {
|
||||
if (<warning descr="Condition 'o == null' is always 'false'">o == null</warning>) {
|
||||
System.out.println();
|
||||
}
|
||||
};
|
||||
Intf i3 = (@Nullable Object o) -> {
|
||||
if (o == null) {
|
||||
System.out.println();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
interface Intf {
|
||||
void foo(Object o);
|
||||
}
|
||||
+11
@@ -14,6 +14,17 @@ class Some {
|
||||
|
||||
}
|
||||
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
class CheckLoop {
|
||||
void foo(Iterable<String> it) {
|
||||
for (String s : it) {
|
||||
if (s == null) { // it's not ElementType.PARAMETER, no warning here
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
class NotNullClass {
|
||||
static void foo(String s) {}
|
||||
|
||||
Reference in New Issue
Block a user