-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
[WIP] fix: Exception CtTryWithResourceImpl does not have CtRole.TYPE #4705
base: master
Are you sure you want to change the base?
[WIP] fix: Exception CtTryWithResourceImpl does not have CtRole.TYPE #4705
Conversation
It looks like spoon wrongly tries to find the It would also probably make sense to minimize the test code, I don't think the second resource with the lambda is actually needed to trigger the issue. |
I started looking into this, to the point where I know where the issue comes from: Spoon fails to set the source position of the variable because it fails to set the source position of the
I'm not sure what's an appropriate fix here as
|
In general, I'm of the opinion that we shouldn't try too hard to work around flaws in JDT. Such workarounds make Spoon less maintainable, and depend on implementation details of JDT that can change unexpectedly.
This seems like something we'll want to address, though. |
I agree, however the sniper printer heavily relies on source positions and those are currently provided by JDT, with a lot of best effort approaches as it seems when looking into PositionBuilder. I just don't know if there's anything we can do better.
Yes. I started writing down a simple lexer, and it might be good enough for our use case, but I'll need some more time to evaluate that (and I don't know when I'll find that time). |
It is indeed quite the conundrum.
If you come up with a solution we'll be thankful for it, but there's of course no obligation. We're all volunteering time here after all :) |
Hello,
I encountered the following exception:
spoon.SpoonException: The element of class class spoon.support.reflect.code.CtTryWithResourceImpl does not have CtRole.TYPE
I do not have a lot of experience about CtRole, do you have any advice to fix this?
Best.