New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EI_EXPOSE_REP false positive #2083
Comments
Thanks for opening your first issue here! 😃 |
Hello! You are right, this is indeed a false positive. The reason for the report is that the |
Similar to #1771 |
These false positives correspond to regular object oriented design. SpotBugs has just become too stringent (see spotbugs/spotbugs#1601, spotbugs/spotbugs#1771, spotbugs/spotbugs#2083, spotbugs/spotbugs#2344, spotbugs/spotbugs#2356, spotbugs/spotbugs-gradle-plugin#731)
I'd like to add that this makes EI_EXPOSE_REP close to useless, since having e.g. a private field List that was constructed as unmodifiable in the constructor, is the standard way to prevent exposing mutable collection-valued fields. |
The below should not report EI_EXPOSE_REP, but does.
Changing to the following, it is not reported.
The text was updated successfully, but these errors were encountered: