3

I am migrating codebase to Guava 26.0-jre from 18.0. Static code checks are processed by Findbugs (3.0.0). It turns out that Guava migrated from JSR305 to Checker Framework.

Therefore, existing code like this:

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

ends up with an error:

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

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

Dawid Pura
  • 991
  • 9
  • 32

1 Answers1

3

FindBugs cannot do this. FindBugs is also an abandoned project. You might want to consider its successor SpotBugs. SpotBugs seems to have support for Checker Framework annotations.

mernst
  • 7,437
  • 30
  • 45
  • It might explain the extraordinary lack of results when googling. Many thanks, I am going to first suppress all errors and prepare a plan for migrating to SpotBugs. Many thanks! – Dawid Pura Sep 30 '18 at 05:59