Google-guava checkNotNull and IntelliJ IDEA’s “may produce java.lang.NullPointerException”
Through a combination of @Contract annotations and the External Annotations feature, you can now annotate Preconditions methods such that IntelliJ applies the correct static analysis to calls to these methods. Let’s say we have this example public void doSomething(Object someArg) { Preconditions.checkArgument(someArg != null); someArg.doSomethingElse(); //currently gives NPE warning if (someArg != null) { //no … Read more