leventov opened a new issue #8330: Catch wrong use of `==`/`!=` and 
`equals()`/`!equals()` in equals() implementations
URL: https://github.com/apache/incubator-druid/issues/8330
 
 
   Bugs like this: #8326 could be caught on the static analysis level, using 
Regex patterns ([Checkstyle Regexp](https://checkstyle.org/config_regexp.html)) 
or [Structural search 
inspection](https://github.com/apache/incubator-druid/blob/master/dev/teamcity.md#creating-a-custom-inspection-from-a-structural-search-pattern).
   
   Example of regex which should have caught #8326: `(?m)return 
([^\;]+)(this\.)?([a-zA-Z]+) \!\= [a-zA-Z]+\.\1`
   
   Similar regexes could be created for `equals()`, `Object.equals()`, as well 
as incorrect use in
   ```java
   if (x != that.x) {
     return false;
   }
   ```
   code in `equals()` implementations.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to