spotbugs / spotbugs-gradle-plugin

https://plugins.gradle.org/plugin/com.github.spotbugs
Apache License 2.0
178 stars 68 forks source link

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

Open akkie76 opened 2 years ago

akkie76 commented 2 years ago

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?

Best Regards.

KengoTODA commented 2 years ago

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.

DeepController commented 2 years ago

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