报告始终产生相同结果、抛出异常或可能违反可空性约定的代码。

示例:

if (array.length < index) {
  System.out.println(array[index]);
} // 数组索引总是超出界限

if (str == null) System.out.println("str is null");
System.out.println(str.trim());
// 最后一条语句可能会抛出 NPE

@NotNull
Integer square(@Nullable Integer input) {
    // 违反了方法约定
    return input == null ? null : input * input;
}

检查行为可能由许多注解控制,例如 nullability 注解、@Contract 注解、@Range 注解等。

配置检查: