fix: support import module in removeUnusedImports (GJF 1.30.0) - #3008
Open
arimu1 wants to merge 1 commit into
Open
fix: support import module in removeUnusedImports (GJF 1.30.0)#3008arimu1 wants to merge 1 commit into
arimu1 wants to merge 1 commit into
Conversation
Bump default google-java-format 1.28.0 -> 1.30.0 (first release that handles JCModuleImport) and require at least 1.30.0 on JVM 25+. Fixes diffplug#2890
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
java { removeUnusedImports() }/<removeUnusedImports/>fails on sources that use Java'simport module(JEP 511), e.g.:with:
Root cause: default google-java-format was still
1.28.0. Module-import support landed in google-java-format 1.30.0 (google/google-java-format#1213 / #1297), which skipsJCModuleImportinRemoveUnusedImportsinstead of casting every import tree toJCImport.Fixes #2890
Solution
1.28.0→1.30.0(first release withimport modulesupport)1.30.0when Spotless runs on JVM 25+ (Jvm.Support.addMin)gradle/libs.versions.tomlcompile coordinate with the new defaultUsers who pin an older GJF version on JVM 25 get a clear lint instead of a ClassCastException mid-format.
Testing
Platform: macOS aarch64, Temurin 21.0.12 + Temurin 25.0.4
Checklist
[Unreleased]inCHANGES.md,plugin-gradle/CHANGES.md, andplugin-maven/CHANGES.md