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