Intellij IDEA @Nullable注解自动添加

Intellij IDEA @Nullable注解自动添加

设置方法

  1. Settings → Editor → General → Code Completion
  2. 开启 “Add @Nullable annotations”
  3. 选择插入位置:参数/返回值

效果

自动为可能为null的方法参数添加@Nullable注解。

总结

减少空指针异常。