ReturnSeparatedFromComputationInspection: do not process if variable and return are in different scopes

Fixes EA-237085 - assert: ControlFlowUtil.isVariableReadInFinally

GitOrigin-RevId: 1f48700f3f08faf96f12b440b3fd54d735c50620
This commit is contained in:
Tagir Valeev
2020-08-24 10:42:56 +00:00
committed by intellij-monorepo-bot
parent 997f2ec6d0
commit 8a830c1018
2 changed files with 23 additions and 1 deletions
@@ -0,0 +1,17 @@
// "Move 'return' closer to computation of the value of 'x'" "false"
class X {
int test() {
int x = 0;
Runnable r = () -> {
try {
if (r == null) {
x = 1;
}
return <caret>x;
}
finally {
System.out.println(x);
}
};
}
}