test/tools/javac/generics/6531075/T6531075.java

Fri, 09 Apr 2010 15:39:39 -0700

author
jjg
date
Fri, 09 Apr 2010 15:39:39 -0700
changeset 535
96072ad00783
parent 23
961ae2608114
child 554
9d9f26857129
permissions
-rw-r--r--

6942649: add hidden option to identify location and version of javac classes
Reviewed-by: darcy

mcimadamore@23 1 /*
mcimadamore@23 2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@23 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@23 4 *
mcimadamore@23 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@23 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@23 7 * published by the Free Software Foundation.
mcimadamore@23 8 *
mcimadamore@23 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@23 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@23 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@23 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@23 13 * accompanied this code).
mcimadamore@23 14 *
mcimadamore@23 15 * You should have received a copy of the GNU General Public License version
mcimadamore@23 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@23 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@23 18 *
mcimadamore@23 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@23 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@23 21 * have any questions.
mcimadamore@23 22 */
mcimadamore@23 23
mcimadamore@23 24 /*
mcimadamore@23 25 * @test
mcimadamore@23 26 * @bug 6531075
mcimadamore@23 27 *
mcimadamore@23 28 * @summary Missing synthetic casts when accessing fields/methods of intersection types including type variables
mcimadamore@23 29 * @author Maurizio Cimadamore
mcimadamore@23 30 *
mcimadamore@23 31 */
mcimadamore@23 32
mcimadamore@23 33
mcimadamore@23 34 public class T6531075 {
mcimadamore@23 35
mcimadamore@23 36 static class A {
mcimadamore@23 37 void a() {}
mcimadamore@23 38 }
mcimadamore@23 39
mcimadamore@23 40 static interface I{
mcimadamore@23 41 void i();
mcimadamore@23 42 }
mcimadamore@23 43
mcimadamore@23 44 static class E extends A implements I{
mcimadamore@23 45 public void i() {}
mcimadamore@23 46 }
mcimadamore@23 47
mcimadamore@23 48 static class C<W extends A & I, T extends W>{
mcimadamore@23 49 T t;
mcimadamore@23 50 W w;
mcimadamore@23 51 C(W w, T t) {
mcimadamore@23 52 this.w = w;
mcimadamore@23 53 this.t = t;
mcimadamore@23 54 }
mcimadamore@23 55 }
mcimadamore@23 56
mcimadamore@23 57 public static void main(String... args) {
mcimadamore@23 58 C<E,E> c = new C<E,E>(new E(), new E());
mcimadamore@23 59 testMemberMethods(c);
mcimadamore@23 60 }
mcimadamore@23 61
mcimadamore@23 62 static void testMemberMethods(C<?, ?> arg) {
mcimadamore@23 63 arg.t.a();
mcimadamore@23 64 arg.t.i();
mcimadamore@23 65 }
mcimadamore@23 66 }

mercurial