error-prone
error-prone copied to clipboard
MustBeClosedChecker - False positive due to variable declaration without expression
Looking at this line of code, I believe that we should be looking for the next statement that is not an empty variable declaration.
For example:
Closeable closeable = getCloseable();
@var SomeVariable x;
try {
// code here
} finally {
closeable.close();
}
I believe that since there is no expression on the RHS of the SomeVariable declaration, that the closeable is indeed guaranteed to be closed.