Tue, 13 Jan 2009 13:28:20 +0000
6665356: Cast not allowed when both qualifying type and inner class are parameterized
Summary: Fixed parser and cats conversion in order to allow cast between generic inner classes
Reviewed-by: jjg
mcimadamore@185 | 1 | /* |
mcimadamore@185 | 2 | * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
mcimadamore@185 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
mcimadamore@185 | 4 | * |
mcimadamore@185 | 5 | * This code is free software; you can redistribute it and/or modify it |
mcimadamore@185 | 6 | * under the terms of the GNU General Public License version 2 only, as |
mcimadamore@185 | 7 | * published by the Free Software Foundation. |
mcimadamore@185 | 8 | * |
mcimadamore@185 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
mcimadamore@185 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
mcimadamore@185 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mcimadamore@185 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
mcimadamore@185 | 13 | * accompanied this code). |
mcimadamore@185 | 14 | * |
mcimadamore@185 | 15 | * You should have received a copy of the GNU General Public License version |
mcimadamore@185 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
mcimadamore@185 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
mcimadamore@185 | 18 | * |
mcimadamore@185 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
mcimadamore@185 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
mcimadamore@185 | 21 | * have any questions. |
mcimadamore@185 | 22 | */ |
mcimadamore@185 | 23 | |
mcimadamore@185 | 24 | /* |
mcimadamore@185 | 25 | * @test |
mcimadamore@185 | 26 | * @author Maurizio Cimadamore |
mcimadamore@185 | 27 | * @bug 6665356 |
mcimadamore@185 | 28 | * @summary Cast not allowed when both qualifying type and inner class are parameterized |
mcimadamore@185 | 29 | * @compile/fail/ref=T6665356.out -XDrawDiagnostics T6665356.java |
mcimadamore@185 | 30 | */ |
mcimadamore@185 | 31 | |
mcimadamore@185 | 32 | class T6665356 { |
mcimadamore@185 | 33 | class Outer<S> { |
mcimadamore@185 | 34 | class Inner<T> {} |
mcimadamore@185 | 35 | } |
mcimadamore@185 | 36 | |
mcimadamore@185 | 37 | void test1() { |
mcimadamore@185 | 38 | boolean b; |
mcimadamore@185 | 39 | b = null instanceof Outer.Inner; |
mcimadamore@185 | 40 | b = null instanceof Outer<?>.Inner; |
mcimadamore@185 | 41 | b = null instanceof Outer.Inner<?>; |
mcimadamore@185 | 42 | b = null instanceof Outer<?>.Inner<?>; |
mcimadamore@185 | 43 | } |
mcimadamore@185 | 44 | |
mcimadamore@185 | 45 | void test2() { |
mcimadamore@185 | 46 | boolean b; |
mcimadamore@185 | 47 | Object o; |
mcimadamore@185 | 48 | o = (Outer.Inner)null; |
mcimadamore@185 | 49 | o = (Outer<?>.Inner)null; |
mcimadamore@185 | 50 | o = (Outer.Inner<?>)null; |
mcimadamore@185 | 51 | o = (Outer<?>.Inner<?>)null; |
mcimadamore@185 | 52 | } |
mcimadamore@185 | 53 | } |