-
Notifications
You must be signed in to change notification settings - Fork 578
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
Bug type EI_EXPOSE_REP false positive for enums #2356
Comments
Thanks for opening your first issue here! 😃 |
clarification: for 'pure enum' bug doesn't occur, however for 'custom' enums for example implement android.Parcelable it occurs. Full code:
and consumer:
|
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)
This is the same issue as #1797 the class is deemed mutable because it has a method named "writeXYZ". Spotbugs is a bit too eager to flag mutable classes |
Enums and Records might be recognised as mutable when they have methods that might be setters. For instance write() or delete() are assumed to be setters Fixes spotbugs#2356
Enums and Records might be recognised as mutable when they have methods that might be setters. For instance write() or delete() are assumed to be setters Fixes #2356
Hi all. Have the next code:
fragment 1
fragment 2
private final FavoriteOperationType mType;
fragment 3
obtained
Bug type EI_EXPOSE_REP FavoriteParameters.getType() may expose internal representation by returning FavoriteParameters.mType
on ver. 4.7.3
In java enums are supposed to be immutable. Please, fix
The text was updated successfully, but these errors were encountered: