-
Notifications
You must be signed in to change notification settings - Fork 458
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
ClassNotFoundException with google-java-format 1.8 #562
Comments
Thanks for bug report! We've already got 1.1-specific code, we'll just need to add post-1.8 code. Looks to me like we'll need to change these two places, this one: spotless/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java Lines 128 to 130 in 608af5c
and this one: spotless/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java Lines 148 to 150 in 608af5c
As for parsing that we're on a post-1.8 version, we've used simple regexes for that in the past:
Happy to take a PR for this. If the reflection is too messy, happy to take a PR for #524, which would make fixing this easier. |
In google-java-format 1.8, the signature of RemoveUnusedImports#removeUnusedImports changed and the RemoveUnusedImports$JavadocOnlyImports class was removed entirely. With this patch, GoogleJavaFormatStep detects which version of the method is available and calls the right one. Fixes diffplug#562.
Created PR #563. Is the approach taken there OK? |
Thanks very much, code looks great. I tried adding a test, but google-java-format requires Java 11. The next eclipse formatter is going to require 11 as well. I'm gonna dabble a bit in this PR to figure out a way to cleanly get our CI going on both 8 and 11 for a while. We'll have your PR merged and shipped by Monday, ideally with CI, but if I don't finish in time we'll still get it out the door. |
Thank you! |
google-java-format 1.8 removes the feature to remove Javadoc-only imports (google/google-java-format@73c522a), but Spotless still tries to access the feature (
spotless/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java
Line 128 in 0ab6802
Configuration:
The text was updated successfully, but these errors were encountered: