You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gradle 7.6.1
Spotless 6.25.0
Ubuntu 22.04
Java 11 or 17
Our code is:
import static foo.bar.
FooClass.CONSTANT;
The import class package is very very long so it's broken across multiple lines, but I believe any import will reproduce the issue.
The spotless stacktrace is:
Step 'removeUnusedImports' found problem in 'path/to/offending/file.java':
14:84: error: <identifier> expected
com.google.googlejavaformat.java.FormatterException: 14:84: error: <identifier> expected
at com.google.googlejavaformat.java.FormatterException.fromJavacDiagnostics(FormatterException.java:51)
at com.google.googlejavaformat.java.RemoveUnusedImports.parse(RemoveUnusedImports.java:264)
at com.google.googlejavaformat.java.RemoveUnusedImports.removeUnusedImports(RemoveUnusedImports.java:218)
at com.diffplug.spotless.glue.java.GoogleJavaFormatRemoveUnusedImporterFormatterFunc.apply(GoogleJavaFormatRemoveUnusedImporterFormatterFunc.java:38)
Using toggleOffOn() with // spotless:off and // spotless:on around the offending import(s) makes no difference because the code cannot be parsed.
Gradle 7.6.1
Spotless 6.25.0
Ubuntu 22.04
Java 11 or 17
Our code is:
The import class package is very very long so it's broken across multiple lines, but I believe any import will reproduce the issue.
The spotless stacktrace is:
Using
toggleOffOn()
with// spotless:off
and// spotless:on
around the offending import(s) makes no difference because the code cannot be parsed.Gradle plugin block:
My workaround at the moment is to add:
to our gradle plugin config.
At a minimum the
toggleOffOn()
should work but in theory, since this is legal java, the parser should be able to deal with it and it should just work.The text was updated successfully, but these errors were encountered: