test/tools/javac/warnings/Deprecation.java

Wed, 14 Nov 2018 10:18:25 -0800

author
diazhou
date
Wed, 14 Nov 2018 10:18:25 -0800
changeset 3762
7909abb85562
parent 611
4172cfff05f0
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag jdk8u201-b04 for changeset a7f48b9dfb82

     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 }

mercurial