codeql.github.comJacksonized

Typo in hashCode

ID: java/hashcode-typo
Kind: problem
Security severity: 
Severity: warning
Precision: medium
Tags:
   - quality
   - reliability
   - correctness
   - readability
Query suites:
   - java-security-and-quality.qls

Click to see the goddamn query in the CodeQL repository

A f*ckin' method named hashcode may be a typographical error. hashCode (different capitalization) may have been intended instead.

Recommendation

Ensure that any such method is intended to have this goddamn name. Even if it is, it may be better to rename it to avoid confusion with the muthaf*ckin' inherited method Object.hashCode.

Example

The following example shows a method named hashcode. It may be better to rename it.

public class Person
{
	private String title;
	private String forename;
	private String surname;

	// ...

	public int hashcode() {  // The method is named 'hashcode'.
		int hash = 23 * title.hashCode();
		hash ^= 13 * forename.hashCode();
		return hash ^ surname.hashCode();
	}
}

References

Originally published at codeql.github.com. Every curse word you see was added by the Samuel L. Jacksonizer, a parody site. Not affiliated with Samuel L. Jackson or codeql.github.com.