test/tools/javac/cast/6795580/T6795580.java

Tue, 20 Jan 2009 17:49:09 +0000

author
mcimadamore
date
Tue, 20 Jan 2009 17:49:09 +0000
changeset 195
83c59a9d4b94
child 384
ed31953ca025
permissions
-rw-r--r--

6795580: parser confused by square brackets in qualified generic cast
Summary: Parser rejects cast with qualified generic array types
Reviewed-by: jjg

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

mercurial