Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/CheckFieldInitializers.java
T
Tagir Valeevandintellij-monorepo-bot f2c1dc3a24 [java-dfa] Use 'non-null variable' instead of 'variable annotated as @NotNull'
The annotation may differ, depending on library used. Also, it could be a container annotation like @NullMarked or @NotNullByDefault, so let's use more neutral wording

GitOrigin-RevId: cb4923f5ec3974f56ec1b6763c2405c1471bf601
2025-07-11 17:16:17 +00:00

16 lines
555 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 non-null variable">Foo.foo()</warning>;
}