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

changeset 195
83c59a9d4b94
child 384
ed31953ca025
equal deleted inserted replaced
194:d0b33fe8e710 195:83c59a9d4b94
1 /*
2 * Copyright 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 */
23
24 /*
25 * @test
26 * @author Maurizio Cimadamore
27 * @bug 6795580
28 * @summary parser confused by square brackets in qualified generic cast
29 * @compile/fail/ref=T6795580.out -XDrawDiagnostics T6795580.java
30 */
31
32 class T6795580 {
33 class Outer<S> {
34 class Inner<T> {}
35 }
36
37 void cast1(Outer<Integer>.Inner<Long>[] p) {
38 Object o = (Outer<Integer>.Inner<Long>[])p;
39 }
40
41 void cast2(Outer<Integer>.Inner<Long>[] p) {
42 Object o = (Outer<? extends Number>.Inner<Long>[])p;
43 }
44
45 void cast3(Outer<Integer>.Inner<Long>[] p) {
46 Object o = (Outer<Integer>.Inner<? extends Number>[])p;
47 }
48
49 void cast4(Outer<Integer>.Inner<Long>[] p) {
50 Object o = (Outer<? extends Number>.Inner<? extends Number>[])p;
51 }
52
53 void cast5(Outer<Integer>.Inner<Long>[] p) {
54 Object o = (Outer<? super Number>.Inner<Long>[])p;
55 }
56
57 void cast6(Outer<Integer>.Inner<Long>[] p) {
58 Object o = (Outer<Integer>.Inner<? super Number>[])p;
59 }
60
61 void cast7(Outer<Integer>.Inner<Long>[] p) {
62 Object o = (Outer<? super Number>.Inner<? super Number>[])p;
63 }
64
65 void cast8(Outer<Integer>.Inner<Long>[] p) {
66 Object o = (Outer<? extends String>.Inner<Long>[])p;
67 }
68
69 void cast9(Outer<Integer>.Inner<Long>[] p) {
70 Object o = (Outer<Integer>.Inner<? extends String>[])p;
71 }
72
73 void cast10(Outer<Integer>.Inner<Long>[] p) {
74 Object o = (Outer<? super String>.Inner<Long>[])p;
75 }
76
77 void cast11(Outer<Integer>.Inner<Long>[] p) {
78 Object o = (Outer<Integer>.Inner<? super String>[])p;
79 }
80 }

mercurial