Files
openide/java/java-tests/testData/inspection/nullableProblems/RedundantNotNull.java
Tagir Valeevandintellij-monorepo-bot a33b824775 [java-inspections] Additional test for IDEA-371907
GitOrigin-RevId: ff147fcad61e443894ec716d0bd4135a6a3ad734
2025-05-05 12:14:54 +00:00

28 lines
1.3 KiB
Java

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNullByDefault;
import java.util.List;
@NotNullByDefault
class FromDemo {
<warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> String m(<warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> String s, @Nullable String s2) {
return "";
}
<warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> String f;
List<<warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> String> param(<warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> String <warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> [] <warning descr="Redundant nullability annotation in the scope of @NotNullByDefault">@NotNull</warning> [] a) {
return List.of();
}
void fun() {
@Nullable String variableWhereAnnotationMakesSense = OtherClass.returnSomething();
}
}
class OtherClass {
static String returnSomething() {
return Math.random() > 0.5 ? "not null" : null;
}
}