Example:
public class Test {
public static void main(String[] args) throws Exception {
int n = getFoo();
System.out.println(n);
}
private static int getFoo() {
try {
return 10;
}
finally {
return 20;
}
}
}
Worse Example:
try {
break;
} finally {
continue;
}
try {
throw ex;
} finally {
return;
}
Problem because:
Overrides return/break/continue/throw statements elsewhere in the method
Severity: medium; sometimes a bug
Fix: redesign the logic