You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://errorprone.info/bugpattern/ObjectEqualsForPrimitives check is described as "performance" related, so if I follow it, I would not expect the semantics to change.
Currently, ObjectEqualsForPrimitives applies to all primitives and enums.
However, double and float values should be exempted from the check:
In current master of https://github.com/trinodb/trino, the ObjectEqualsForPrimitives triggers typically in equals() implementations. While most double/float values are unlikely to be NaN, this is not something and equals() implementation should be concerned about.
It's probably worth noting that equals generated for Java record classes also compares NaN values as equal (as if Objects.equals was used)
The text was updated successfully, but these errors were encountered:
@ksobolew you're right.
So the check is probably valid also for float/double, but it maybe its message could be tailored down to prevent people like me from improving the code incorrectly.
https://errorprone.info/bugpattern/ObjectEqualsForPrimitives check is described as "performance" related, so if I follow it, I would not expect the semantics to change.
Currently, ObjectEqualsForPrimitives applies to all primitives and enums.
However, double and float values should be exempted from the check:
In current master of https://github.com/trinodb/trino, the ObjectEqualsForPrimitives triggers typically in equals() implementations. While most double/float values are unlikely to be NaN, this is not something and equals() implementation should be concerned about.
It's probably worth noting that equals generated for Java record classes also compares NaN values as equal (as if
Objects.equals
was used)The text was updated successfully, but these errors were encountered: