Repository navigation
Fix only the imports in the out-of-process fixImports - #236
Merged
Merged
Conversation
BootstrappingFormatterService.fixImports and NativeImageFormatterService.fixImports ran Main with no flags, as formatSourceReflowStringsAndFixImports does: the imports were fixed, and the whole file was laid out and its long strings reflowed with them. FormatterServiceImpl.fixImports, in process, fixes only the imports. Both now pass --fix-imports-only. Nothing calls fixImports through these services today. An import optimizer in the IntelliJ plugin would, on every Optimize imports, and the one palantir-java-format had was removed as slow (#222). JvmFormatterServicesTest checks fixImports on the in-process and the bootstrapping services, and runs in every build; FormatterServicesTest, in the native jobs, checks it on the bootstrapping and native ones. Closes #221
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.
Closes #221. Independent of the other open pull requests; based on
21.X.X.BootstrappingFormatterService.fixImportsandNativeImageFormatterService.fixImportsranMain -with no flags, asformatSourceReflowStringsAndFixImportsdoes: the imports were fixed, and the whole file was laid out and its long strings reflowed along with them.FormatterServiceImpl.fixImports, in process, fixes only the imports. Both out-of-process services now pass--fix-imports-only.What changes for users
Nothing calls
fixImportsthrough these services today. It is what an import optimizer in the IntelliJ plugin would call on every Optimize imports (#222, ADR-003); palantir-java-format's optimizer was removed as slow because of this.Tests
The input is the one from #221: three imports, one unused, and a class body that is not formatted.
JvmFormatterServicesTest(new):fixImportson the in-process and the bootstrapping services. It needs no native binary, so it runs in every build, on every JDK.FormatterServicesTest.fixes_only_the_imports: on the bootstrapping and native services, in thenativejobs.On
21.X.Xthe bootstrapping and native runs fail, with the whole file formatted; the in-process one passes. With the change:./gradlew checkpasses.:open-java-format-jdk-bootstrap:testpasses.-PnativeImage=true :open-java-format-jdk-bootstrap:test(macOS aarch64, GraalVM 25): 10 of 10 inFormatterServicesTestand 2 of 2 inJvmFormatterServicesTestpass.