jdk-24/langtools/test/tools/javac/6563143/OverridesEqualsButNotHashCodeTest.java
2013-02-18 14:33:25 +00:00

23 lines
530 B
Java

/*
* @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;
}
}