|
1 /* |
|
2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 6711619 |
|
27 * |
|
28 * @summary javac doesn't allow access to protected members in intersection types |
|
29 * @author Maurizio Cimadamore |
|
30 * |
|
31 * @compile/fail/ref=T6711619a.out -XDrawDiagnostics T6711619a.java |
|
32 */ |
|
33 class T6711619a { |
|
34 |
|
35 static class A { |
|
36 private void a() {} |
|
37 private A a; |
|
38 } |
|
39 static class B extends A { |
|
40 private B b() {} |
|
41 private B b; |
|
42 } |
|
43 static interface I{ |
|
44 void i(); |
|
45 } |
|
46 static interface I1{ |
|
47 void i1(); |
|
48 } |
|
49 static class E extends B implements I, I1{ |
|
50 public void i() {} |
|
51 public void i1() {} |
|
52 } |
|
53 static class C<W extends B & I1, T extends W>{ |
|
54 T t; |
|
55 W w; |
|
56 C(W w, T t) { |
|
57 this.w = w; |
|
58 this.t = t; |
|
59 } |
|
60 } |
|
61 |
|
62 static void testMemberMethods(C<? extends A, ? extends I> arg) { |
|
63 arg.t.a(); |
|
64 arg.t.b(); |
|
65 } |
|
66 |
|
67 static void testMemberFields(C<? extends A, ? extends I> arg) { |
|
68 A ta; B tb; |
|
69 ta = arg.t.a; |
|
70 tb = arg.t.b; |
|
71 ta = arg.w.a; |
|
72 tb = arg.w.b; |
|
73 } |
|
74 } |