test/tools/javac/generics/wildcards/T6450290.java

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

author
jjg
date
Thu, 27 Aug 2009 11:08:27 -0700
changeset 384
ed31953ca025
parent 54
eaf608c64fec
child 554
9d9f26857129
permissions
-rw-r--r--

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

mcimadamore@27 1 /*
xdono@54 2 * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@27 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@27 4 *
mcimadamore@27 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@27 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@27 7 * published by the Free Software Foundation.
mcimadamore@27 8 *
mcimadamore@27 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@27 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@27 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@27 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@27 13 * accompanied this code).
mcimadamore@27 14 *
mcimadamore@27 15 * You should have received a copy of the GNU General Public License version
mcimadamore@27 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@27 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@27 18 *
mcimadamore@27 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@27 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@27 21 * have any questions.
mcimadamore@27 22 */
mcimadamore@27 23
mcimadamore@27 24 /*
mcimadamore@27 25 * @test
mcimadamore@27 26 * @bug 6450290
mcimadamore@27 27 * @summary Capture of nested wildcards causes type error
mcimadamore@27 28 * @author Maurizio Cimadamore
mcimadamore@27 29 * @compile/fail T6450290.java
mcimadamore@27 30 */
mcimadamore@27 31
mcimadamore@27 32 public class T6450290 {
mcimadamore@27 33 static class Box<X extends Box<?,?>, T extends X> {
mcimadamore@27 34 T value;
mcimadamore@27 35 Box<X, T> same;
mcimadamore@27 36 }
mcimadamore@27 37
mcimadamore@27 38 static class A extends Box<A,A> {}
mcimadamore@27 39 static class B extends Box<B,B> {}
mcimadamore@27 40 public static void main(String[] args) {
mcimadamore@27 41 Box<?,?> b = new Box<Box<A,A>,Box<A,A>>();
mcimadamore@27 42 b.value.same = new Box<B,B>(); //javac misses this bad assignment
mcimadamore@27 43 }
mcimadamore@27 44 }

mercurial