Java inspection: Check if the returned variable is read in the 'finally' block of an enclosing 'try' statement in "Move return to computation" inspection (IDEA-121153)

This commit is contained in:
Pavel Dolgov
2016-09-08 16:22:07 +03:00
parent 6212f4138a
commit 898ab196d9
3 changed files with 56 additions and 13 deletions
@@ -0,0 +1,14 @@
// "Move 'return' closer to computation of the value of 'n'" "false"
class T {
int f(boolean b) {
int n = -1;
try {
if (b) throw new RuntimeException();
n = 1;
re<caret>turn n;
}
finally {
System.out.println(n);
}
}
}