attila@1343: /* sundar@1482: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. attila@1343: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. sundar@1482: * attila@1343: * This code is free software; you can redistribute it and/or modify it attila@1343: * under the terms of the GNU General Public License version 2 only, as attila@1343: * published by the Free Software Foundation. sundar@1482: * attila@1343: * This code is distributed in the hope that it will be useful, but WITHOUT attila@1343: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or attila@1343: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License attila@1343: * version 2 for more details (a copy is included in the LICENSE file that attila@1343: * accompanied this code). sundar@1482: * attila@1343: * You should have received a copy of the GNU General Public License version attila@1343: * 2 along with this work; if not, write to the Free Software Foundation, attila@1343: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. sundar@1482: * attila@1343: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA attila@1343: * or visit www.oracle.com if you need additional information or have any attila@1343: * questions. attila@1343: */ attila@1343: attila@1343: /** attila@1343: * JDK-8075090: Add tests for the basic failure of try/finally compilation attila@1343: * attila@1343: * @test attila@1343: * @run attila@1343: */ attila@1343: attila@1343: (function() { attila@1343: var finallyExpected = false; attila@1343: try { attila@1343: for(var i = 0; i < 2; ++i) { attila@1343: if(i == 1) { attila@1343: continue; attila@1343: } attila@1343: } attila@1343: finallyExpected = true; attila@1343: } finally { attila@1343: Assert.assertTrue(finallyExpected); attila@1343: } attila@1343: })(); attila@1343: attila@1343: (function() { attila@1343: var finallyExpected = false; attila@1343: try { attila@1343: for(var i = 0; i < 2; ++i) { attila@1343: if(i == 1) { attila@1343: break; attila@1343: } attila@1343: } attila@1343: finallyExpected = true; attila@1343: } finally { attila@1343: Assert.assertTrue(finallyExpected); attila@1343: } attila@1343: })(); attila@1343: attila@1343: (function() { attila@1343: var finallyExpected = false; attila@1343: try { attila@1343: L1: { attila@1343: if ((function(){return true})()) { attila@1343: break L1; attila@1343: } attila@1343: Assert.fail(); // unreachable attila@1343: } attila@1343: finallyExpected = true; attila@1343: } finally { attila@1343: Assert.assertTrue(finallyExpected); attila@1343: } attila@1343: })();