T7178324.java revision 1258
1020N/A/*
1020N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
1020N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1020N/A *
1020N/A * This code is free software; you can redistribute it and/or modify it
1020N/A * under the terms of the GNU General Public License version 2 only, as
1020N/A * published by the Free Software Foundation.
1020N/A *
1020N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1020N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1020N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1020N/A * version 2 for more details (a copy is included in the LICENSE file that
1020N/A * accompanied this code).
1020N/A *
1020N/A * You should have received a copy of the GNU General Public License version
1020N/A * 2 along with this work; if not, write to the Free Software Foundation,
1020N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1020N/A *
1020N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1020N/A * or visit www.oracle.com if you need additional information or have any
1020N/A * questions.
1020N/A */
1020N/A
1020N/A/*
1020N/A * @test
1020N/A * @bug 7178324
1020N/A * @summary Crash when compiling for(i : x) try(AutoCloseable x = ...) {}
1020N/A * @compile T7178324.java
1020N/A */
1020N/A
1020N/Aimport java.io.File;
1020N/Aimport java.io.FileInputStream;
1020N/Aimport java.util.ArrayList;
1020N/Aimport java.util.List;
1020N/A
1020N/Aclass T7178324 {
1020N/A public static void main(String[] args) throws Exception {
1020N/A List<File> files = new ArrayList<>();
1020N/A for (File f : files)
1020N/A try (FileInputStream is = new FileInputStream(f)) {
1020N/A }
1020N/A }
1020N/A}
1020N/A