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

bug: Sniper printer fails to print comment preceding type member if all modifiers in a modifier list are removed #3732

Closed
slarse opened this issue Dec 17, 2020 · 0 comments · Fixed by #3747

Comments

@slarse
Copy link
Collaborator

slarse commented Dec 17, 2020

Hi!

This is related to #3697, but in terms of implementation it's an entirely separate issue. Anyway, when you have a commented type member like so:

// this is a comment
private static int a = 2;

And you remove private and static, the comment also disappears.

int a = 2;

This happens because of how the field is split into source fragments, the modifier list becoming one collection of fragments. When the comment is to be printed (which happens when the next concrete element is printed, in this case int, as comments are treated like whitespace), the non-printed modifier list "blocks" discovery of the comment when searching for preceding whitespace/comments to print.

I'm working on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant