test/tools/javac/warnings/Deprecation.java

Sat, 07 Nov 2020 10:30:02 +0800

author
aoqi
date
Sat, 07 Nov 2020 10:30:02 +0800
changeset 3938
93012e2a5d1d
parent 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag mips-jdk8u275-b01 for changeset eb6ee6a5f2fe

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

mercurial