Skip to content
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

Fields and local variable declarations are sometimes printed twice when using original source #111

Closed
slarse opened this issue Apr 24, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@slarse
Copy link
Collaborator

slarse commented Apr 24, 2020

This happens anytime there are multiple declarations in the same statement. For example, this:

int a, b;

is printed as

int a, b;
int a, b;

The reason is that this becomes two separate declarations in Spoon. The easy fix is to not use the original source for field and local variable declarations.

@slarse
Copy link
Collaborator Author

slarse commented Apr 24, 2020

Another solution would be to just check that there is no comma in between the first identifier and the initializer or semicolon.

@slarse slarse closed this as completed in 3b035ab Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant