mcimadamore@19: /* mcimadamore@19: * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. mcimadamore@19: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@19: * mcimadamore@19: * This code is free software; you can redistribute it and/or modify it mcimadamore@19: * under the terms of the GNU General Public License version 2 only, as mcimadamore@19: * published by the Free Software Foundation. mcimadamore@19: * mcimadamore@19: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@19: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@19: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@19: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@19: * accompanied this code). mcimadamore@19: * mcimadamore@19: * You should have received a copy of the GNU General Public License version mcimadamore@19: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@19: * mcimadamore@19: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, mcimadamore@19: * CA 95054 USA or visit www.sun.com if you need additional information or mcimadamore@19: * have any questions. mcimadamore@19: */ mcimadamore@19: mcimadamore@19: /* mcimadamore@19: * @test mcimadamore@155: * @bug 6531090 6711619 mcimadamore@19: * mcimadamore@19: * @summary Cannot access methods/fields of a captured type belonging to an intersection type mcimadamore@19: * @author Maurizio Cimadamore mcimadamore@19: * mcimadamore@19: */ mcimadamore@19: public class T6531090b { mcimadamore@19: mcimadamore@19: static class A { mcimadamore@155: public void a1() {} mcimadamore@155: protected void a2() {} mcimadamore@155: void a3() {} mcimadamore@155: public A a1; mcimadamore@155: protected A a2; mcimadamore@155: A a3; mcimadamore@19: } mcimadamore@19: static class B extends A { mcimadamore@155: public void b1() {} mcimadamore@155: protected void b2() {} mcimadamore@155: void b3() {} mcimadamore@155: public B b1; mcimadamore@155: protected B b2; mcimadamore@155: B b3; mcimadamore@19: } mcimadamore@19: static interface I{ mcimadamore@19: void i(); mcimadamore@19: } mcimadamore@19: static interface I1{ mcimadamore@19: void i1(); mcimadamore@19: } mcimadamore@19: static class E extends B implements I, I1{ mcimadamore@19: public void i() {} mcimadamore@19: public void i1() {} mcimadamore@19: } mcimadamore@19: static class C{ mcimadamore@19: T t; mcimadamore@19: W w; mcimadamore@19: C(W w, T t) { mcimadamore@19: this.w = w; mcimadamore@19: this.t = t; mcimadamore@19: } mcimadamore@19: } mcimadamore@19: mcimadamore@19: public static void main(String... args) { mcimadamore@19: C c = new C(new E(), new E()); mcimadamore@19: testMemberMethods(c); mcimadamore@19: testMemberFields(c); mcimadamore@19: } mcimadamore@19: mcimadamore@19: static void testMemberMethods(C arg) { mcimadamore@155: arg.t.a1(); mcimadamore@155: arg.t.a2(); mcimadamore@155: arg.t.a3(); mcimadamore@155: arg.t.b1(); mcimadamore@155: arg.t.b2(); mcimadamore@155: arg.t.b3(); mcimadamore@19: arg.t.i1(); mcimadamore@155: arg.w.a1(); mcimadamore@155: arg.w.a2(); mcimadamore@155: arg.w.a3(); mcimadamore@155: arg.w.b1(); mcimadamore@155: arg.w.b2(); mcimadamore@155: arg.w.b3(); mcimadamore@19: arg.w.i1(); mcimadamore@19: } mcimadamore@19: mcimadamore@19: static void testMemberFields(C arg) { mcimadamore@155: A ta; B tb; mcimadamore@155: ta = arg.t.a1; mcimadamore@155: ta = arg.t.a2; mcimadamore@155: ta = arg.t.a3; mcimadamore@155: tb = arg.t.b1; mcimadamore@155: tb = arg.t.b2; mcimadamore@155: tb = arg.t.b3; mcimadamore@155: ta = arg.w.a1; mcimadamore@155: ta = arg.w.a2; mcimadamore@155: ta = arg.w.a3; mcimadamore@155: tb = arg.w.b1; mcimadamore@155: tb = arg.w.b2; mcimadamore@155: tb = arg.w.b3; mcimadamore@19: } mcimadamore@19: }