Join GitHub today
@Wither generates code, which violates best practives #737
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.
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?
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.