do not touch /// in first lines
issue is that in many shells you can use triple slashes ///, i.e. ///usr/bin/env jbang "$0" "$@" ; exit $? as a trick to be compatible with both shell scripts and java code.
JDK javadoc linter had this issue too and is now fixed in https://bugs.openjdk.org/browse/JDK-8341907
would be great if google-java-format could honor the same.
@maxandersen as mentioned on https://github.com/google/google-java-format/issues/1217#issuecomment-2582936582, this issue seems like it may be an exact duplicate of previously raised #1215 about the same, do you want to close this one?
My workaround to avoid formatting the first lines is to add the option --lines=3:999999.
@MrDolch tried using that but it does not work - even on api level google's api decides that the comments are in need of formatting if "close enough" to code. see #1276
so i made https://github.com/jbangdev/jbang-fmt - hoping google-java-format eventually can be configured more consistently.
@maxandersen I’m sorry, that it didn’t work. I was only following the manual myself. Now I understand that a fix was needed.
I really like your Maven plugin for formatting. I also created a fork of google-java-format, because my company needed support for longer line lengths. Feel free to check out my IntelliJ plugin: https://plugins.jetbrains.com/plugin/23827-external-java-formatter and the underlying projects: https://github.com/MrDolch/external-java-formatter-intellij-plugin and https://github.com/MrDolch/configurable-java-format
I’d like to include your fix in my fork as well, and I’m also considering adding the missing @formatter:off/on option.