Repository navigation
style: format Java sources with google-java-format - #266
Merged
Merged
Conversation
adityamparikh
force-pushed
the
style/chain-one-call-per-line
branch
from
October 14, 2026 15:39
1075c10 to
9dff2e8
Compare
This was referenced Oct 14, 2026
Since Gradle 8 the root build asks buildSrc only for the jar on the build script classpath, so :buildSrc:test never ran and the LICENSE/NOTICE and RAT exclude tests went unexercised by ./gradlew build, contrary to AGENTS.md. Finalize buildSrc's jar with its tests. dependsOn would be a cycle, since compiling the Kotlin tests needs the jar, and the root build cannot reference buildSrc's tasks at all. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Spotless now formats Java with google-java-format instead of the Eclipse JDT formatter, and the whole codebase is reformatted with it ahead of 1.0. google-java-format has one fixed style, so there is no formatter configuration to maintain: config/spotless/eclipse-java-formatter.properties is removed. In that style a method chain that does not fit on one line has each call on its own line, and parameters, record components and annotation arguments that do not fit go one per line. Indentation is 2 spaces with 4 for continuation lines, at 100 columns; .editorconfig gets a [*.java] section with the same settings so IDEs match. The Eclipse formatter was chosen earlier because google-java-format failed on new JDKs with NoSuchMethodError against javac internals. google-java-format 1.35.0, Spotless 8.9.0's default, runs on JDK 25 and is pinned so a Spotless upgrade cannot reformat the codebase on its own. 1.37.0, the latest, still fails on JDK 25, with Spotless 8.9.0 and 8.10.4. The change is formatting only: compiled classes are identical before and after apart from line numbers, string and annotation constants included. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
adityamparikh
force-pushed
the
style/chain-one-call-per-line
branch
from
October 14, 2026 19:51
9dff2e8 to
04f05bd
Compare
|
This was referenced Oct 20, 2026
Contributor
|
better to format now then post 1.0! |
adityamparikh
added a commit
to adityamparikh/solr-mcp
that referenced
this pull request
Oct 26, 2026
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.



Stacked on #269 (
./gradlew buildrunsbuildSrc's tests): the first commit here is #269, and only the top commit (style: format Java sources with google-java-format) is new.What
Spotless now formats Java with google-java-format instead of the Eclipse JDT formatter, and the whole codebase is reformatted with it before 1.0.
build.gradle.kts: thejavablock isgoogleJavaFormat("1.35.0")plusformatAnnotations(). google-java-format sorts imports and removes unused ones itself, soimportOrder(),removeUnusedImports(),trimTrailingWhitespace()andendWithNewline()are gone.config/spotless/eclipse-java-formatter.propertiesis deleted. google-java-format has one fixed style, so there is nothing to configure..editorconfiggets a[*.java]section that matches the formatter (2-space indent, 4-space continuation, 100 columns), so IDEs indent new code the same way../gradlew spotlessApplyover the Java sources.Why
One style, applied the same way everywhere, with no formatter settings to tune or review. The Google style also gives the layout the codebase has been missing:
@McpComplete(prompt = PromptNames.VIEW_SCHEMA)orrecord SortClause(String field, String order), stays on one line.The Eclipse formatter was adopted because google-java-format used to fail on new JDKs with
NoSuchMethodErroragainst javac internals. 1.35.0, Spotless 8.9.0's default, runs on JDK 25. It's pinned so a Spotless upgrade can't reformat the codebase by itself. The newest release, 1.37.0, fails on every file under JDK 25, with Spotless 8.9.0 and with 8.10.4.Verification
mainandtestmatch the previous output apart from line numbers. This includes instructions, string constants and annotation values (the@McpTooldescriptions)../gradlew spotlessApplyagain changes nothing../gradlew buildpasses, with all 465 tests run and none skipped, plusbuildSrc's 12 tests, which run in the same build via build: run buildSrc's tests as part of the build #269.🤖 Generated with Claude Code