-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
@Wither generates code, which violates best practives #737
Comments
👤 mcbeelen 🕗 Jul 04, 2014 at 07:07 UTC What steps will reproduce the problem?
Generated code looks like: What is the expected output? What do you see instead? What version of the product are you using? On what operating system? Please provide any additional information below. Bad practice - Suspicious reference comparison This method compares two reference values using the == or != operator, where the correct way to compare instances of this type is generally with the equals() method. Examples of classes which should generally not be compared by reference are java.lang.Integer, java.lang.Float, etc. |
👤 r.spilker 🕗 Jul 04, 2014 at 07:58 UTC This is done on purpose. Executing the equals might be way more expensive than just creating a copy of the instance. |
👤 Maaartinus 🕗 Aug 30, 2014 at 02:15 UTC While I completely agree with using '=' being the best choice, I wonder if there's any sane way to make the checker (findbugs in my case) shut up. Currently, I see two possibilities:
While the former method is too unspecific, the latter is way too long (especially when @ Wither gets applied to a couple of fields rather than the whole class). Maybe there could be a configuration key like HUSH_FINDBUGS doing this automatically? |
👤 reinierz 🕗 Nov 20, 2014 at 13:14 UTC Re-opening this; now that we have a config system, we can have a config key to add @ SuppressFBWarnings(justification = "Generated code") to everything if the user likes. |
👤 reinierz 🕗 Feb 01, 2015 at 23:18 UTC For now the justification is not configurable, it's just 'generated code' (all lowercase, no final dot, I believe that's the proper style), and obviously not enabled by default, but there's a config key to turn it on. I assume that is enough to make FB shut up? I don't need to provide any particular value to it? This feature is available in the edge build now, and should be in the next version. |
👤 reinierz 🕗 Feb 01, 2015 at 23:29 UTC Issue #770 has been merged into this issue. |
End of migration |
* Fixed for issue 724: @accessors with prefix can break with numbers * - replace isUpperCase || isDigit to !isLowerCase for AccessorInfo prefix check
Migrated from Google Code (issue 702)
The text was updated successfully, but these errors were encountered: