Thu, 28 Feb 2013 14:05:52 +0000
8008537: Missing method reference lookup error when unbound search finds a static method
Summary: Static-ness check should be applied after member reference resolution
Reviewed-by: jjg
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6563143 8008436
4 * @summary javac should issue a warning for overriding equals without hashCode
5 * @summary javac should not issue a warning for overriding equals without hasCode
6 * if hashCode has been overriden by a superclass
7 * @compile/ref=OverridesEqualsButNotHashCodeTest.out -Xlint:overrides -XDrawDiagnostics OverridesEqualsButNotHashCodeTest.java
8 */
10 public class OverridesEqualsButNotHashCodeTest {
11 @Override
12 public boolean equals(Object o) {
13 return o == this;
14 }
16 @Override
17 public int hashCode() {
18 return 0;
19 }
20 }
22 class SubClass extends OverridesEqualsButNotHashCodeTest {
23 @Override
24 public boolean equals(Object o) {
25 return o == this;
26 }
27 }
29 @SuppressWarnings("overrides")
30 class NoWarning {
31 @Override
32 public boolean equals(Object o) {
33 return o == this;
34 }
35 }
37 class DoWarnMe {
38 @Override
39 public boolean equals(Object o) {
40 return o == this;
41 }
42 }