Files
openide/java/java-tests/testData/inspection/nullableProblems/OverridingNotNullCollectionWithNullable.java
Bart van Helvertandintellij-monorepo-bot 94d5fdf882 [java] Replace not-null with non-null
To make error messages consistent #IDEA-374747 Fixed


(cherry picked from commit 328c5b355fcf56a7d1c165aab32220d37bdfcbc1)

IJ-MR-170004

GitOrigin-RevId: f00fb74ddbff84b18839c60648d664774d566966
2025-07-22 21:25:49 +00:00

30 lines
1.1 KiB
Java

import typeUse.*;
import java.util.*;
abstract class Parent {
abstract @NotNull String @NotNull [] getStrings();
abstract @NotNull List<@NotNull String> getStringList();
abstract void foo(@Nullable String @NotNull [] p1,
@NotNull List<@Nullable String> p2);
}
class Child extends Parent {
@Override
@Nullable <warning descr="Overriding a collection of non-null elements with a collection of nullable elements">String @NotNull []</warning> getStrings() {
throw new UnsupportedOperationException();
}
@Override
@NotNull <warning descr="Overriding a collection of non-null elements with a collection of nullable elements">List<@Nullable String></warning> getStringList() {
throw new UnsupportedOperationException();
}
void foo(@NotNull <warning descr="Overriding a collection of nullable elements with a collection of non-null elements">String @NotNull []</warning> p1,
@NotNull <warning descr="Overriding a collection of nullable elements with a collection of non-null elements">List<@NotNull String></warning> p2) {
}
}