[#625] Instead of '31' as a prime number for hashCode(), use something else. 31, probably owing to its inclusion in Effective Java, is overused, as proven by Maaartinus in issue 625. Switching to 277 instead. Also, 1231/1237 pair used for booleans has been replaced by 2591/2609.

This commit is contained in:
Reinier Zwitserloot committed 2014-01-09 21:24:04 +01:00
1 parent 685ddfd52e
commit a40a86ad53
32 files changed
+72 -65

No files matched your search

@@ -36,7 +36,7 @@ class DataOnLocalClass1 {
return (other instanceof Local);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
final int PRIME = 31;
final int PRIME = 277;
int result = 1;
result = ((result * PRIME) + this.getX());
final java.lang.Object $name = this.getName();
@@ -86,7 +86,7 @@ class DataOnLocalClass2 {
return (other instanceof Local.InnerLocal);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
final int PRIME = 31;
final int PRIME = 277;
int result = 1;
final java.lang.Object $name = this.getName();
result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode()));
@@ -124,7 +124,7 @@ class DataOnLocalClass2 {
return (other instanceof Local);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
final int PRIME = 31;
final int PRIME = 277;
int result = 1;
result = ((result * PRIME) + this.getX());
return result;