-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
bug: Combining CtSuperAccess and CtUnaryOperator lead to SpoonException with Sniper #4021
Comments
Hi @gtoison, Thanks for the bug report! This is definitely a bug in the sniper printer. It's trying to compare to source fragments that are, in terms of source position, overlapping. It may be trying to compare source fragments from different files, which I've previously fixed a bug for with static method imports (see #3743). I will look at this as soon as possible, but I'm a bit swamped right now so if anyone else has the time to look into it, feel free! |
Thank you very much for the confirmation! |
Combining CtSuperAccess and CtUnaryOperator leads to SpoonException with Sniper
@slarse I've submitted a small PR with a failing unit test reproducing the issue. |
@gtoison That's very helpful, thank you! |
Finally found the time to look into this. The cause of the crash is that the end source position given by JDT is off for the For now we can easily work around it as the start position of the reference is correct, and the length of it is known. |
Hello,
I'm trying to analyze and refactor some code containing the following line (note that is has a "super" access and an unary "minus" operator) :
Date limitTradeDateBeforeIssue = super.computeSettleDate(getIssueDate(), -days);
When pretty printing the code with Sniper I get an exception which seems to be coming from this specific line of code:
The input is a fairly large codebase but I was able to reproduce the exception with that input:
The code I'm using to reproduce the error is:
Can you please advise if there's something I'm doing incorrectly or if that's an issue in Spoon?
The text was updated successfully, but these errors were encountered: