test/tools/javac/cast/6665356/T6665356.java

Mon, 09 Mar 2009 13:29:06 -0700

author
xdono
date
Mon, 09 Mar 2009 13:29:06 -0700
changeset 229
03bcd66bd8e7
parent 185
d57378c34fdb
child 384
ed31953ca025
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

     1 /*
     2  * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  */
    24 /*
    25  * @test
    26  * @author Maurizio Cimadamore
    27  * @bug     6665356
    28  * @summary Cast not allowed when both qualifying type and inner class are parameterized
    29  * @compile/fail/ref=T6665356.out -XDrawDiagnostics T6665356.java
    30  */
    32 class T6665356 {
    33     class Outer<S> {
    34         class Inner<T> {}
    35     }
    37     void cast1(Outer<Integer>.Inner<Long> p) {
    38         Object o = (Outer<Integer>.Inner<Long>)p;
    39     }
    41     void cast2(Outer<Integer>.Inner<Long> p) {
    42         Object o = (Outer<? extends Number>.Inner<Long>)p;
    43     }
    45     void cast3(Outer<Integer>.Inner<Long> p) {
    46         Object o = (Outer<Integer>.Inner<? extends Number>)p;
    47     }
    49     void cast4(Outer<Integer>.Inner<Long> p) {
    50         Object o = (Outer<? extends Number>.Inner<? extends Number>)p;
    51     }
    53     void cast5(Outer<Integer>.Inner<Long> p) {
    54         Object o = (Outer<? super Number>.Inner<Long>)p;
    55     }
    57     void cast6(Outer<Integer>.Inner<Long> p) {
    58         Object o = (Outer<Integer>.Inner<? super Number>)p;
    59     }
    61     void cast7(Outer<Integer>.Inner<Long> p) {
    62         Object o = (Outer<? super Number>.Inner<? super Number>)p;
    63     }
    65     void cast8(Outer<Integer>.Inner<Long> p) {
    66         Object o = (Outer<? extends String>.Inner<Long>)p;
    67     }
    69     void cast9(Outer<Integer>.Inner<Long> p) {
    70         Object o = (Outer<Integer>.Inner<? extends String>)p;
    71     }
    73     void cast10(Outer<Integer>.Inner<Long> p) {
    74         Object o = (Outer<? super String>.Inner<Long>)p;
    75     }
    77     void cast11(Outer<Integer>.Inner<Long> p) {
    78         Object o = (Outer<Integer>.Inner<? super String>)p;
    79     }
    80 }

mercurial