-
Notifications
You must be signed in to change notification settings - Fork 870
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
Don't reformat 'javadoc' comments that appear before package/imports, to avoid mangling license headers #235
Comments
Do you have an example of a license header with >100 column lines that get wrapped by the formatter? |
I have an example with <100 line columns that gets reformatted: https://github.com/pettermahlen/format-example. I wasn't able to reproduce it easily this morning, but I also ran into a situation where lines < 100 columns got reformatted, at the same time introducing |
In that example it's removing trailing whitespace from the lines before and after the line containing The other behaviour you describe (adding |
Ah, yes, that makes sense. The mycila plugin uses javadoc formatting for license headers by default so it would have happened when I was experimenting with that. |
And the reason for trying the mycila plugin out was because it doesn't add trailing whitespace, btw. |
Would it be a good change if |
That sounds pragmatic to me. |
The use case is license headers added by, for instance, maven license plugins. These headers are not by default formatted in the way that google-java-format requires, and since neither (for good reasons - neither code styles nor licenses should be changed lightly) are very configurable, conflicts are hard to avoid. (The mycila license plugin allows configuration, and with a bit of effort, you can make it create license headers that don't get reformatted - I haven't succeeded to do that with the Codehaus plugin).
Creating this issue as a different one than #139, which is about javadoc comments.
The text was updated successfully, but these errors were encountered: