609N/A/* /nodynamiccopyright/ */ // hard coded linenumbers in other tests - DO NOT CHANGE
609N/A/*
609N/A * Debuggee which exercises various types of control flow
609N/A */
609N/A
609N/Aclass ControlFlow {
609N/A boolean b = true;
609N/A int n = 22;
609N/A
609N/A public static void main(String args[]) throws Exception {
609N/A (new ControlFlow()).go();
609N/A }
609N/A
609N/A void go() throws Exception {
609N/A if (b) {
609N/A System.out.println("if, no else");
609N/A }
609N/A
609N/A if (b) {
609N/A System.out.println("if branch");
609N/A } else {
609N/A throw new Exception("Wrong branch!?");
609N/A }
609N/A
609N/A if (!b) {
609N/A throw new Exception("Wrong branch!?");
609N/A } else {
609N/A System.out.println("else branch");
609N/A }
609N/A
609N/A try {
throw new Exception();
} catch (Exception e) {
System.out.println("caught exception");
} finally {
System.out.println("finally");
}
// This isn't control flow at the source level, but it is at the bytecode level
synchronized (this) {
System.out.println("synchronized");
}
for (int i = 0; i < n; i++) {
System.out.println("Loop iteration: " + (i+1) + "/" + n);
}
switch (n) {
case 0:
throw new Exception("Wrong branch!?");
case 1:
throw new Exception("Wrong branch!?");
case 2:
throw new Exception("Wrong branch!?");
case 3:
throw new Exception("Wrong branch!?");
case 22:
System.out.println("switch case");
break;
default:
throw new Exception("Wrong branch!?");
}
switch (n) {
case 0:
throw new Exception("Wrong branch!?");
case 1:
throw new Exception("Wrong branch!?");
case 2:
throw new Exception("Wrong branch!?");
case 3:
throw new Exception("Wrong branch!?");
default:
System.out.println("switch default");
break;
}
}
}