=====================================================
Here is one that could be a bit confusing. When
stepping, control goes from the if-statement
directly to the finalizer without ever hitting
the return statement.
public class XMain {
public static void main(String... args) {
try {
boolean duh = false;
if (duh == true) {
System.out.println(duh);
return;
} else {
System.out.println(duh);
return;
}
} finally {
System.out.println("finally");
}
}
}
Here is one that could be a bit confusing. When
stepping, control goes from the if-statement
directly to the finalizer without ever hitting
the return statement.
public class XMain {
public static void main(String... args) {
try {
boolean duh = false;
if (duh == true) {
System.out.println(duh);
return;
} else {
System.out.println(duh);
return;
}
} finally {
System.out.println("finally");
}
}
}
- relates to
-
JDK-4974302 inlined finally clauses confuse some debuggers
-
- Closed
-