6563143: javac should issue a warning for overriding equals without hashCode

Reviewed-by: jjg, mcimadamore
This commit is contained in:
Vicente Romero 2013-02-18 14:33:25 +00:00
parent b2a3c762ff
commit e6b61ae08a
10 changed files with 71 additions and 8 deletions

View file

@ -0,0 +1,22 @@
/*
* @test /nodynamiccopyright/
* @bug 6563143
* @summary javac should issue a warning for overriding equals without hashCode
* @compile/ref=OverridesEqualsButNotHashCodeTest.out -Xlint:overrides -XDrawDiagnostics OverridesEqualsButNotHashCodeTest.java
*/
@SuppressWarnings("overrides")
public class OverridesEqualsButNotHashCodeTest {
@Override
public boolean equals(Object o) {
return o == this;
}
}
class Other {
@Override
public boolean equals(Object o) {
return o == this;
}
}