Thu, 23 Oct 2008 17:59:43 +0100
6711619: javac doesn't allow access to protected members in intersection types
Summary: Accordingly to new accessibility rules all members of intersection types (but private ones) should be accessible
Reviewed-by: jjg
duke@1 | 1 | /** |
duke@1 | 2 | * @test /nodynamiccopyright/ |
duke@1 | 3 | * @bug 4986256 |
duke@1 | 4 | * @compile/ref=Deprecation.noLint.out -XDstdout -XDrawDiagnostics Deprecation.java |
duke@1 | 5 | * @compile/ref=Deprecation.lintDeprecation.out -XDstdout -Xlint:deprecation -XDrawDiagnostics Deprecation.java |
duke@1 | 6 | * @compile/ref=Deprecation.lintAll.out -XDstdout -Xlint:all,-path -XDrawDiagnostics Deprecation.java |
duke@1 | 7 | */ |
duke@1 | 8 | |
duke@1 | 9 | @Deprecated |
duke@1 | 10 | class Deprecation |
duke@1 | 11 | { |
duke@1 | 12 | } |
duke@1 | 13 | |
duke@1 | 14 | // control: this class should generate warnings |
duke@1 | 15 | class Deprecation2 |
duke@1 | 16 | { |
duke@1 | 17 | void m() { |
duke@1 | 18 | Object d = new Deprecation(); |
duke@1 | 19 | } |
duke@1 | 20 | } |
duke@1 | 21 | |
duke@1 | 22 | // tests: the warnings that would otherwise be generated should all be suppressed |
duke@1 | 23 | @SuppressWarnings("deprecation") |
duke@1 | 24 | class Deprecation3 |
duke@1 | 25 | { |
duke@1 | 26 | void m() { |
duke@1 | 27 | Object d = new Deprecation(); |
duke@1 | 28 | } |
duke@1 | 29 | } |
duke@1 | 30 | |
duke@1 | 31 | class Deprecation4 |
duke@1 | 32 | { |
duke@1 | 33 | @SuppressWarnings("deprecation") |
duke@1 | 34 | void m() { |
duke@1 | 35 | Object d = new Deprecation(); |
duke@1 | 36 | } |
duke@1 | 37 | } |
duke@1 | 38 | |
duke@1 | 39 | class Deprecation5 |
duke@1 | 40 | { |
duke@1 | 41 | void m() { |
duke@1 | 42 | @SuppressWarnings("deprecation") |
duke@1 | 43 | class Inner { |
duke@1 | 44 | void m() { |
duke@1 | 45 | Object d = new Deprecation(); |
duke@1 | 46 | } |
duke@1 | 47 | } |
duke@1 | 48 | } |
duke@1 | 49 | } |
duke@1 | 50 | |
duke@1 | 51 | // this class should produce warnings because @SuppressWarnings should not be inherited |
duke@1 | 52 | class Deprecation6 extends Deprecation3 |
duke@1 | 53 | { |
duke@1 | 54 | void m() { |
duke@1 | 55 | Object d = new Deprecation(); |
duke@1 | 56 | } |
duke@1 | 57 | } |