Fri, 27 May 2011 15:02:39 -0700
7045697: JDK7 THIRD PARTY README update
Reviewed-by: lana
1 /*
2 * Copyright (c) 2008, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 /*
25 * @test
26 * @bug 6531090 6711619
27 *
28 * @summary Cannot access methods/fields of a captured type belonging to an intersection type
29 * @author Maurizio Cimadamore
30 *
31 */
32 public class T6531090b {
34 static class A {
35 public void a1() {}
36 protected void a2() {}
37 void a3() {}
38 public A a1;
39 protected A a2;
40 A a3;
41 }
42 static class B extends A {
43 public void b1() {}
44 protected void b2() {}
45 void b3() {}
46 public B b1;
47 protected B b2;
48 B b3;
49 }
50 static interface I{
51 void i();
52 }
53 static interface I1{
54 void i1();
55 }
56 static class E extends B implements I, I1{
57 public void i() {}
58 public void i1() {}
59 }
60 static class C<W extends B & I1, T extends W>{
61 T t;
62 W w;
63 C(W w, T t) {
64 this.w = w;
65 this.t = t;
66 }
67 }
69 public static void main(String... args) {
70 C<E,E> c = new C<E,E>(new E(), new E());
71 testMemberMethods(c);
72 testMemberFields(c);
73 }
75 static void testMemberMethods(C<? extends A, ? extends I> arg) {
76 arg.t.a1();
77 arg.t.a2();
78 arg.t.a3();
79 arg.t.b1();
80 arg.t.b2();
81 arg.t.b3();
82 arg.t.i1();
83 arg.w.a1();
84 arg.w.a2();
85 arg.w.a3();
86 arg.w.b1();
87 arg.w.b2();
88 arg.w.b3();
89 arg.w.i1();
90 }
92 static void testMemberFields(C<? extends A, ? extends I> arg) {
93 A ta; B tb;
94 ta = arg.t.a1;
95 ta = arg.t.a2;
96 ta = arg.t.a3;
97 tb = arg.t.b1;
98 tb = arg.t.b2;
99 tb = arg.t.b3;
100 ta = arg.w.a1;
101 ta = arg.w.a2;
102 ta = arg.w.a3;
103 tb = arg.w.b1;
104 tb = arg.w.b2;
105 tb = arg.w.b3;
106 }
107 }