Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/CheckFieldInitializers.java
T
Tagir Valeev a2ea53a7b0 DFA: pure no-args methods are considered as variables
Ref-returning methods are not included into eq-classes, only variable state is tracked for them. Primitive-returning methods are handled like normal variables (their result is considered to be stable)
Fixes IDEA-141547 ConstantConditions inspection reports false positive when using non getter method
2017-12-22 17:59:45 +07:00

16 lines
578 B
Java

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class Foo {
@Nullable static Object foo() { return null; }
static String bar(@NotNull Object arg) { return ""; }
}
class Bar {
public static final String s = Foo.bar(<warning descr="Argument 'Foo.foo()' might be null">Foo.foo()</warning>);
@NotNull public static Object o = Foo.foo();
}
class Baz {
@NotNull public static Object o = <warning descr="Expression 'Foo.foo()' might evaluate to null but is assigned to a variable that is annotated with @NotNull">Foo.foo()</warning>;
}