-
Notifications
You must be signed in to change notification settings - Fork 857
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
Failed reformatting on simultaneous declarations #104
Comments
This is related to #51 - the formatter doesn't currently make non-whitespace changes, and there are some difficulties to doing that we haven't addressed yet. Fixing imports and modifier order are the only exceptions, and that doesn't happen in the core formatting code. |
Just write this as a note for others who also meet the "multiple declarations" problem: I've searched a bit on existing refactor tools that could refactor multiple declarations in one statement. However I didn't find anyone works. I've filed an issue on google-java-format here: But at the moment nobody gives a response on this issue. Thus, as a workaround, I write a simple and ugly refactor that specifically refactor multiple declarations: https://github.com/CharlesZ-Chen/multiDeclRefactor This refactor could work as a pre-processor before doing annotation insertion on a project. However, since I developed it in a catch-the-DDL way, the code is a bit unordered and not good for maintenance. It should be just a temporary workaround, and hopefully later on some mature & professional refactor tools could solve this problem wonderfully. |
from style guide https://google.github.io/styleguide/javaguide.html#s4.8.2-variable-declarations
we detected the same in testing of checkstyle checkstyle/checkstyle#15587 (comment) |
Hi there,
I meet a problem when trying to use google-java-format to re-format on simultaneous declarations in a java file:
According to Google Java Style Guide 4.8.2-variable-declarations:
However, given java file:
using google-java-format would not re-format the simultaneous declarations in above file.
Is this a defect that google-java-format forget to consider about?
If not, could you guys help me a bit on pointing out where should I getting started to hack this project to get this feature in my own fork?
Many thanks & best wishes,
Charles
The text was updated successfully, but these errors were encountered: