-
-
Notifications
You must be signed in to change notification settings - Fork 346
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(sniper): fields and local variables with joint declaration cannot be snipered #3386
Comments
Nice! |
I've merge the work around! |
Thanks @monperrus and @nharrand! |
Hi, The workaround doesn't work for the context I presented here. In my case, I have The error changed for me now:
|
Thanks @fermadeiral for the follow up, fixed in #3412 |
#3412 was only a partial fix, we still have the problem in some cases, see 736bf3a @algomaster99 would have a look at this sniper limitation? |
@monperrus I can have a look at it. Can you assign it to me? It can be in my logs that way. |
great, thanks. you're assigned. |
I think the root of this problem is the
The field declarations are children instead of being siblings of one another and their types are not directly associated with them. We should fix this first otherwise, we will keep working around in the printer and miss some of the edge cases. Note that this result is after commenting the following lines: spoon/src/main/java/spoon/support/sniper/internal/ElementSourceFragment.java Lines 164 to 169 in 58d8d21
|
An idea to deal with the above comment is pushed here. It will take a lot of time to reach the goal so I am putting it in my backlog. At least the printer produces a compilable output. |
Hi all,
I have the following code:
I want to remove the statement
a = a;
, which is fine. However, after the sniper printer prints the code, I get:java.lang.IllegalStateException: Registering symbol: 'c' twice in the same scope
. This happens because the printed code is:See, everything is fine with my transformation, but the variable
c
is printed twice. I created a failing test case to expose this issue, I hope it helps for fixing the bug:This is the content of the
OneLineMultipleVariableDeclaration
class:The text was updated successfully, but these errors were encountered: