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