-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource leak checker does not seem to honor try-with-resources in some cases #6037
Comments
I suspect that there is an issue with our code for handling try-with-resources: all of the examples in our test suite currently involve allocating a new local variable in the |
I did a bit of investigation into this, and it is probably going to be difficult to fix. The core problems are the following:
Here's a simplified test case:
|
@kelloggm it seems we could solve this problem if we exposed the right info in the CFG, is that right? I think it is appropriate information to expose. Arguably the CFG is incomplete right now since it does not expose this information, nor does it contain an explicit |
A slightly analogous case might be synchronized blocks, which are handled here. We could add a similar |
Yes, I think that would be the easiest way to solve this problem. It's unfortunate, but I don't think there's any way for us to fix this at the RLC level without changing the framework itself. |
hey, is there any chance that it will be fixed in the upcoming July release? |
@jacek-lewandowski I think a fix for the July release is unlikely at this point. I think @mernst was planning on making the requisite changes to the dataflow library. After that we will have to update the Resource Leak Checker based on the newly-exposed information. The latter step shouldn't take long, but given the upcoming release date, my expectation is that it won't be done in time. Once this is fixed, we can consider a patch release if it is causing a serious inconvenience for you. |
Thanks for the bug report! I will change the dataflow library to address this. However, I will not be able to do so in time for the August 1 release. |
I have the following method:
It passes the analysis, however if I refactor it into:
the analysis fails with required.method.not.called - is it possible that it automatically detects the close method was called on the parameter?
The text was updated successfully, but these errors were encountered: