spotbugs-gradle-plugin icon indicating copy to clipboard operation
spotbugs-gradle-plugin copied to clipboard

False positive result of [EI_EXPOSE_REP] for lombok auto-generated code

Open akkie76 opened this issue 3 years ago • 2 comments

Hi,

I set spotbugs ver 4.7.0 and executed Task: spotbugsMain, but the auto-generated code of lombok detected EI_EXPOSE_REP and EI_EXPOSE_REP2.

So, I have to write the setter and getter code by myself. Is not successful for lombok auto-generated code.

We have confirmed that this occurs in ver 4.3.0 or later.

I don't think lombok auto-generated code is subject to spotbugsMain, so is it possible to avoid warning about them?

  • Target version
    • 4.3.0 ~

Best Regards.

akkie76 avatar May 12 '22 23:05 akkie76

I guess what you need is https://github.com/spotbugs/spotbugs/issues/1385, you may vote or submit a PR to realize it in the SpotBugs core.

KengoTODA avatar May 13 '22 00:05 KengoTODA

Add the following lines in to your lombok.config file, so that lombok generated code suppress SpotBugs warning.

# Suppress FindBugs/SpotBugs error for Lombok generated code.
lombok.extern.findbugs.addSuppressFBWarnings = true

DeepController avatar Sep 03 '22 08:09 DeepController