Mon, 18 Feb 2013 14:33:25 +0000
6563143: javac should issue a warning for overriding equals without hashCode
Reviewed-by: jjg, mcimadamore
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6563143
4 * @summary javac should issue a warning for overriding equals without hashCode
5 * @compile/ref=OverridesEqualsButNotHashCodeTest.out -Xlint:overrides -XDrawDiagnostics OverridesEqualsButNotHashCodeTest.java
6 */
8 @SuppressWarnings("overrides")
9 public class OverridesEqualsButNotHashCodeTest {
10 @Override
11 public boolean equals(Object o) {
12 return o == this;
13 }
14 }
16 class Other {
17 @Override
18 public boolean equals(Object o) {
19 return o == this;
20 }
21 }