test/tools/javac/generics/6711619/T6711619a.java

Thu, 27 Aug 2009 11:08:27 -0700

author
jjg
date
Thu, 27 Aug 2009 11:08:27 -0700
changeset 384
ed31953ca025
parent 155
4d2d8b6459e1
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6875336: some tests should use /nodynamiccopyright/
Reviewed-by: darcy

     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 }

mercurial