-
Notifications
You must be signed in to change notification settings - Fork 864
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
What's the difference between google-java-format plugin and google java style xml file? #695
Comments
@jwcheong0420 Good questions. My understanding is the GJF command line tool, library, and IDE plugins came after the XML file, and that Google made the CLI tool etc. because Eclipse and IntelliJ weren't flexible enough to meet all the requirements of the Google Java style guide at the time. And I think this is still the case, so the plugin/library/CLI tool should be preferred. (This explains to me, for example, why the formatting of I can't remember where I learned all this, though. Can someone from the GJF team confirm my understanding? As for why the output is different for the I hope this helps. :) |
I can't explain why the XML files weren't deprecated. 🤷 |
Can we use both of these formatters together(google java format and google java style xml file) or one excludes the other |
I'm actually not aware of who maintains the java-google-style.xml file, but indeed as @jbduncan said, this entire formatter exists because the ability of existing tools to format code well is too limited no matter how they're configured. The one thing you do need it for is to handle import sorting, because the GJF IntelliJ plugin only takes over the "format code" function not "optimize imports". |
As of 2023-03-03 (4f5ffd0) this seems to no longer be the case:
|
Hello,
As far as I know, there are two ways to apply google java style for Intellij
I expected the same result, but the two methods seem to produce different results as follows,
Location of @Getter when @Getter put on a field
Indent of @ApiImplicitParams({})
Line wrapping when using stream
Is it right that the results are different?
I think the reformat result by the plugin is consistent with the google java convention.
Why did the reformat result by xml file come out like this?
Any help would be much appreciated. Thanks :)
The text was updated successfully, but these errors were encountered: