Skip to content
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

Catch wrong use of ==/!= and equals()/!equals() in equals() implementations #8330

Open
leventov opened this issue Aug 18, 2019 · 0 comments · Fixed by #8386
Open

Catch wrong use of ==/!= and equals()/!equals() in equals() implementations #8330

leventov opened this issue Aug 18, 2019 · 0 comments · Fixed by #8386

Comments

@leventov
Copy link
Member

Bugs like this: #8326 could be caught on the static analysis level, using Regex patterns (Checkstyle Regexp) or Structural search inspection.

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

if (x != that.x) {
  return false;
}

code in equals() implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant