-
Notifications
You must be signed in to change notification settings - Fork 455
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
Step remove unused import break on multiline string (java 14 preview text block) #681
Comments
Thanks for investigating this. spotless/lib/src/main/java/com/diffplug/spotless/java/RemoveUnusedImportsStep.java Line 33 in cbf36e1
And because we are still using Java 8 as our minimum required, we are stuck at
I propose the following fix:
|
According to my testing, this is fixed in |
Hi @nedtwigg, I am seeing this issue (or similar) still occurring. When I run spotless locally things work fine, but on the pipeline I get this error. I am using spotless gradle plugin 6.14.0 and here is my config:
Is there anything I am missing here? Thanks |
I also just encountered this. Here is a reproduction case. |
@lars06 my guess is that you are doing something like running your local build on JDK 17 but your CI build on JDK 11, and using java toolchains for compiling the code with the correct JDK no matter what JDK is running the main build. The PR above has a possible fix to allow JDK 11 to remove imports on JDK 17 code. |
A fix is available in for details. |
If you are submitting a bug, please include the following:
gradlew spotless[Apply/Check] --stacktrace
If you're just submitting a feature request or question, no need for the above.
If the preview features of java 14 are enabled, and we use at least one text block and
spotless config contains
removeUnusedImports
then build wil crash.Removing this step will allow the build to pass.
gradle 6.5
Macos 10.15.6
Spotless config
stacktrace of spotlessApply
The text was updated successfully, but these errors were encountered: