SpotBugs and Checkstyle false positives bite each other's tails

Guillaume Lambert


For your information I've raised a bug today
related to a problem I experienced by using both Checkstyle and SpotBugs Fail on Error at build time, as it is done now in Magnesium. I thnik some SB checks can be safely disabled in Odl-parent to avoid similar porblems in the future.
Explanation below.


Contrary to checkstyle, SpotBugs SF_SWITCH_FALLTHROUGH check does not detect an intentional commented //fallthrough  in a switch/case structure and reports a warning/error.

To remove this false positive, edu.umd.cs.findbugs.annotations.SuppressFBWarnings needs to be imported to use the
@SuppressFBwarnings("SF_SWITCH_FALLTHROUGH") decorator in front of the class concerned

In the example below
doing so results in an "UnusedImport" checkstyle error/warning on  edu.umd.cs.findbugs.annotations.SuppressFBWarnings

This new false positive cannot be removed with a @SuppressWarnings decorator since imports are not part of a class. (and if it could, it would be anyway really cumbersome)

As the same check is already better performed by checkstyle, the SF_SWITCH_FALLTHROUGH SpotBugs check (and maybe some others) should probably be removed from ODL-parent.


Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.