-
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
Support google-java-format 1.8+ #563
Support google-java-format 1.8+ #563
Conversation
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.
…t to get the build to work on both JRE 8 and 11.
… gradle version that supports Java 11).
@diffplug/spotless Just FYI, this is the first PR we have received where the formatter requires Java 11+, and there are more coming (#547). As a result, we now need our tests to run on Java 11. This PR represents the minimal effort needed to merge support for
The trickier part is that now there are some tests which you can't run on 8, because they'll break. Also, Gradle 5.0 is the oldest that can run on Java 11, so you can't run old-gradle-tests on 11. I'm very open to PRs for a more comprehensive solution, but I think it's fine to play whack-a-mole until a pattern merges. Here's the gist of the 8 / 11 test infrastructure I put in: spotless/testlib/src/main/java/com/diffplug/spotless/JreVersion.java Lines 20 to 23 in 11f58d8
spotless/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java Lines 30 to 35 in 11f58d8
spotless/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationTest.java Lines 60 to 78 in 11f58d8
|
Released in |
In google-java-format 1.8, the signature of
RemoveUnusedImports#removeUnusedImports
changed and theRemoveUnusedImports$JavadocOnlyImports
class was removed entirely.With this patch, GoogleJavaFormatStep detects which version of the
method is available and calls the right one.
Fixes #562.