blob: eec9d13d4ee046947461638c099d30174f11bdb8 [file] [log] [blame]
// Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.debug;
public class BreakInTwoLinesFinallyTest {
int i = 0;
void foo() {
try { bar(); }
finally {
baz();
}
}
int bar() {
if (i++ % 2 == 0) {
System.out.println("bar return " + i);
return i;
}
System.out.println("bar throw " + i);
throw new RuntimeException("" + i);
}
void baz() {
System.out.println("baz");
}
public static void main(String[] args) {
BreakInTwoLinesFinallyTest test = new BreakInTwoLinesFinallyTest();
test.foo();
try {
test.foo();
} catch (RuntimeException e) {
System.out.println("Caught expected exception: " + e.getMessage());
return;
}
throw new RuntimeException("Test failed...");
}
}