Deprecation.java revision 0:9a66ca7c79fa
1/**
2 * @test  /nodynamiccopyright/
3 * @bug 4986256
4 * @compile/ref=Deprecation.noLint.out -XDstdout                             -XDrawDiagnostics Deprecation.java
5 * @compile/ref=Deprecation.lintDeprecation.out -XDstdout -Xlint:deprecation -XDrawDiagnostics Deprecation.java
6 * @compile/ref=Deprecation.lintAll.out -XDstdout         -Xlint:all,-path   -XDrawDiagnostics Deprecation.java
7 */
8
9@Deprecated
10class Deprecation
11{
12}
13
14// control: this class should generate warnings
15class Deprecation2
16{
17    void m() {
18        Object d = new Deprecation();
19    }
20}
21
22// tests: the warnings that would otherwise be generated should all be suppressed
23@SuppressWarnings("deprecation")
24class Deprecation3
25{
26    void m() {
27        Object d = new Deprecation();
28    }
29}
30
31class Deprecation4
32{
33    @SuppressWarnings("deprecation")
34    void m() {
35        Object d = new Deprecation();
36    }
37}
38
39class Deprecation5
40{
41    void m() {
42        @SuppressWarnings("deprecation")
43            class Inner {
44                void m() {
45                    Object d = new Deprecation();
46                }
47            }
48    }
49}
50
51// this class should produce warnings because @SuppressWarnings should not be inherited
52class Deprecation6 extends Deprecation3
53{
54    void m() {
55        Object d = new Deprecation();
56    }
57}
58