test/tools/javac/6563143/OverridesEqualsButNotHashCodeTest.java

Mon, 18 Feb 2013 14:33:25 +0000

author
vromero
date
Mon, 18 Feb 2013 14:33:25 +0000
changeset 1588
2620c953e9fe
child 1607
bd49e0304281
permissions
-rw-r--r--

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 }

mercurial