Mon, 17 Nov 2014 12:40:43 -0800
Added tag jdk8u31-b09 for changeset 26c46688ce4a
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6711619
4 *
5 * @summary javac doesn't allow access to protected members in intersection types
6 * @author Maurizio Cimadamore
7 *
8 * @compile/fail/ref=T6711619a.out -XDrawDiagnostics T6711619a.java
9 */
10 class T6711619a {
12 static class A {
13 private void a() {}
14 private A a;
15 }
16 static class B extends A {
17 private B b() {}
18 private B b;
19 }
20 static interface I{
21 void i();
22 }
23 static interface I1{
24 void i1();
25 }
26 static class E extends B implements I, I1{
27 public void i() {}
28 public void i1() {}
29 }
30 static class C<W extends B & I1, T extends W>{
31 T t;
32 W w;
33 C(W w, T t) {
34 this.w = w;
35 this.t = t;
36 }
37 }
39 static void testMemberMethods(C<? extends A, ? extends I> arg) {
40 arg.t.a();
41 arg.t.b();
42 }
44 static void testMemberFields(C<? extends A, ? extends I> arg) {
45 A ta; B tb;
46 ta = arg.t.a;
47 tb = arg.t.b;
48 ta = arg.w.a;
49 tb = arg.w.b;
50 }
51 }