Fri, 10 Dec 2010 15:24:17 +0000
6199075: Unambiguous varargs method calls flagged as ambiguous
Summary: javac does not implement overload resolution w.r.t. varargs methods as described in the JLS
Reviewed-by: jjg
1 /**
2 * @test /nodynamiccopyright/
3 * @bug 4986256
4 * @compile/ref=Deprecation.noLint.out -XDrawDiagnostics Deprecation.java
5 * @compile/ref=Deprecation.lintDeprecation.out -Xlint:deprecation -XDrawDiagnostics Deprecation.java
6 * @compile/ref=Deprecation.lintAll.out -Xlint:all,-path -XDrawDiagnostics Deprecation.java
7 */
9 @Deprecated
10 class Deprecation
11 {
12 }
14 // control: this class should generate warnings
15 class Deprecation2
16 {
17 void m() {
18 Object d = new Deprecation();
19 }
20 }
22 // tests: the warnings that would otherwise be generated should all be suppressed
23 @SuppressWarnings("deprecation")
24 class Deprecation3
25 {
26 void m() {
27 Object d = new Deprecation();
28 }
29 }
31 class Deprecation4
32 {
33 @SuppressWarnings("deprecation")
34 void m() {
35 Object d = new Deprecation();
36 }
37 }
39 class Deprecation5
40 {
41 void m() {
42 @SuppressWarnings("deprecation")
43 class Inner {
44 void m() {
45 Object d = new Deprecation();
46 }
47 }
48 }
49 }
51 // this class should produce warnings because @SuppressWarnings should not be inherited
52 class Deprecation6 extends Deprecation3
53 {
54 void m() {
55 Object d = new Deprecation();
56 }
57 }