test/tools/javac/foreach/T6682380.java

Wed, 23 Apr 2008 17:10:03 +0100

author
mcimadamore
date
Wed, 23 Apr 2008 17:10:03 +0100
changeset 33
ec29a1a284ca
child 287
44eaac2b4501
permissions
-rw-r--r--

6682380: Foreach loop with generics inside finally block crashes javac with -target 1.5
Summary: A missing type-erasure in Lower.java causes the compiler to crash since JDK6
Reviewed-by: jjg

mcimadamore@33 1 /*
mcimadamore@33 2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@33 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@33 4 *
mcimadamore@33 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@33 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@33 7 * published by the Free Software Foundation.
mcimadamore@33 8 *
mcimadamore@33 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@33 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@33 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@33 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@33 13 * accompanied this code).
mcimadamore@33 14 *
mcimadamore@33 15 * You should have received a copy of the GNU General Public License version
mcimadamore@33 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@33 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@33 18 *
mcimadamore@33 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@33 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@33 21 * have any questions.
mcimadamore@33 22 */
mcimadamore@33 23
mcimadamore@33 24 /*
mcimadamore@33 25 * @test
mcimadamore@33 26 * @bug 6682380 6679509
mcimadamore@33 27 * @summary Foreach loop with generics inside finally block crashes javac with -target 1.5
mcimadamore@33 28 * @author Jan Lahoda, Maurizio Cimadamore
mcimadamore@33 29 * @compile -target 1.5 T6682380.java
mcimadamore@33 30 */
mcimadamore@33 31
mcimadamore@33 32 import java.util.List;
mcimadamore@33 33
mcimadamore@33 34 public class T6682380<X> {
mcimadamore@33 35
mcimadamore@33 36 public static void main(String[] args) {
mcimadamore@33 37 try {
mcimadamore@33 38 } finally {
mcimadamore@33 39 List<T6682380<?>> l = null;
mcimadamore@33 40 T6682380<?>[] a = null;
mcimadamore@33 41 for (T6682380<?> e1 : l);
mcimadamore@33 42 for (T6682380<?> e2 : a);
mcimadamore@33 43 }
mcimadamore@33 44 }
mcimadamore@33 45 }

mercurial