mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
6563143: javac should issue a warning for overriding equals without hashCode
Reviewed-by: jjg, mcimadamore
This commit is contained in:
parent
b2a3c762ff
commit
e6b61ae08a
10 changed files with 71 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue