Wed, 08 Oct 2014 12:38:55 -0700
Added tag jdk8u40-b09 for changeset 8bb38a350722
mcimadamore@27 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2004, 2008, Oracle and/or its affiliates. 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 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * 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 | } |