-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
feature: add support for first class resource in try-with-resource #4371
Conversation
8208bc6
to
3954684
Compare
3954684
to
f373be3
Compare
Thanks. Adding a new metamodel interface is a significant change in Spoon, which we do cautiously. Could you elaborate on why it's needed? |
Thanks for working on my PR. I think it is well discussed in issue #4368. |
It's basically the way I would have done it too. I think we can also not get rid of the generic parameter in Maybe it would make sense to remove |
Essentially what @SirYwell said. We must modify the metamodel here because it's incorrect. We could do it in a less breaking fashion, though. |
@monperrus @MartinWitt We should decide what to do here, @henryhchchc has made a nice contribution and I don't like to see it hanging. This is a reasonable solution to the problem, but it is breaking. We therefore can't incorporate it without a major version bump. Frankly, I can't see a non-breaking solution to this problem. |
Agree with you @slarse @henryhchchc We need test cases to specify this new feature, would you add them? |
Sorry I am too busy to work on the test cases at this moment. 🥲 |
@henryhchchc That's entirely OK, it happens to all of us. Evidently it happened to us as we were very slow to provide feedback here :) We'll put this on hold for the time being. If this becomes urgent for someone else, they can use your PR as a starting point. Otherwise, it will be here when you get some time again. I'll check back in a while. |
Hi I added a test case checking whether the |
Hi, IMHO this is a rather important fix (at least for my own project, that's why I comment). I did not look at the new test cases, but I pulled this PR into my own fork of spoon, and it looks good to me: I have try-with-resources both with variable declaration and variable access in my code, and with the PR applied all problems with the latter are fixed while former still work as expected. |
yes, let's finish this one. added the natural language contracts and a few test lines to fully cover the new code. I will merge. thanks a lot @henryhchchc for this valuable contribution. |
FYI This PR causes a regression in NpeFix see https://ci.inria.fr/sos/job/npefix/ I'm working on it for restoring backward compatibility |
@monperrus I don't think this can be implemented to be completely non-breaking unless we add a "new api" for the same functionality, see my musings here #4371 (comment) |
…NRIA#4371) Co-authored-by: Martin Monperrus <[email protected]>
This PR fixes #4368.