Java – How do I use Checker Framework annotations in Findbugs?

How do I use Checker Framework annotations in Findbugs?… here is a solution to the problem.

How do I use Checker Framework annotations in Findbugs?

I’m migrating my codebase from 18.0 to Guava 26.0-jre. Static code checking is handled by Findbugs (3.0.0). It turns out that Guava migrated from JSR305 to Checker Framework .

Therefore, the existing code is as follows:

com.google.common.collect.Iterables.getFirst(someCollection, null);

Ends with an error:

[INFO] Null passed for non-null parameter of com.google.common.collect.Iterables.getFirst(Iterable, Object)

My question is: how do I force Findbugs to understand Checker Framework comments? Is there any way to do this smoothly? I googled some Findbugs plugins but found nothing.

Solution

FindBugs can’t do that. FindBugs is also an abandoned project.
You may want to consider its successor SpotBugs .
SpotBugs appears to have support for Checker Framework annotations

Related Problems and Solutions