示例:
abstract class A {
@NotNull abstract String m();
}
class B extends A {
String m() { return "empty string"; }
}
@NotNull int myFoo;
@Nullable
和 @NotNull
位于同一成员上:@Nullable @NotNull String myFooString;
void testList(List<@Nullable String> nullableList) {
List<@NotNull String> list2 = nullableList;
}
使用配置注解按钮可指定可 null 性注解,使用复选框可细调该检查提供警告的位置。
仅当项目或模块的语言级别为 5 或更高,并且类路径上提供可 null 性注解时,此检查才会报告。