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