Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In addition to those instructions you may want to tell IntelliJ inspections to "treat non-annotated members and parameters as @Nullable". This is the most conservative setting and should highlight the most bugs. Oddly, this setting is in the "Constant conditions & exceptions" panel under the Java "Probable bugs" inspection category:


You may also want to run the "Infer Nullity…" analyzer from the "Analysis" menu. You'll want to give IntelliJ lots of memory to work with (e.g. 8GiB) and it will take "a while" to complete. After that if you enable "Inferred annotations":


Image Added

then you'll start to see these inferred annotations in gray in the editor. Here's an inferred @NotNull example:


Image Added


Example Workflow

Here's an example. When working on SocketMessageWriter.writeHandshakeMessage I wondered if the clientVersion parameter could ever be null. Here we're testing for null . Could this null-check be eliminated?

...