-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Errorprone BoxedPrimitiveEquality error on generated code by jsonschema2pojo #1625
Comments
Hi I'd consider it as a false-positive and suggested change as incorrect. Given following oversimplified schema: {
"type": "object",
"javaType":"Example",
"properties": {
"myInteger": {
"type": "integer"
}
}
} And following code System.out.println(new Example().equals(new Example())); Code accoring to ErrorProne would yield |
@unkish
|
|
Yes and
will return true as expected. I still don't understand your point. |
Schema above will generate code containing @Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Example) == false) {
return false;
}
Example rhs = ((Example) other);
return ((this.myInteger == rhs.myInteger)||((this.myInteger!= null)&&this.myInteger.equals(rhs.myInteger)));
} that contains "erroneous code" as reported by ErrorProne. |
@unkish Sorry for overlooking the double null case. Thank you for pointing it out. |
When using ErrorProne on my project using jsonschema2pojo, it complains about the following errors:
According to ErrorProne, the generated code should be:
The text was updated successfully, but these errors were encountered: