Skip to content

build: replace Spotless Java formatting with Flint#19242

Draft
zeitlinger wants to merge 2 commits into
open-telemetry:mainfrom
zeitlinger:agent/flint-formatting
Draft

build: replace Spotless Java formatting with Flint#19242
zeitlinger wants to merge 2 commits into
open-telemetry:mainfrom
zeitlinger:agent/flint-formatting

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Jul 16, 2026

Copy link
Copy Markdown
Member

Blocked by grafana/flint#407

Summary

  • replace Spotless Java formatting with Flint's native google-java-format check
  • replace the custom StaticImportFormatter with Flint's generic regex-replace rule set
  • replace Spotless license-header handling with Flint's native license-header check
  • preserve the repository's long-string, formatter-off, static-import, and license-header behavior through Flint configuration
  • pin Flint to the unreleased commit from the companion PR

Formatting baseline note

Some Java source changes in this PR are expected output changes from using google-java-format 1.35.0. They are formatter-version baseline changes, not additional Java logic changes; the main examples are the four benchmark-overhead test files.

Local timing

I measured this locally on a 24-vCPU environment using Temurin 25.0.3, with dependencies, tools, and Flint's native binary already installed. Timings are wall-clock medians of three runs unless noted otherwise. The ten-file rows use the same ten Java files in each tool.

scenario Spotless Flint Flint vs. Spotless
ten changed Java files, Gradle daemon and task/configuration state warm 1.225 s 0.214 s 82.5% faster
ten changed Java files, Gradle daemon cold, project outputs/configuration cache present 5.272 s 0.214 s 95.9% faster
ten changed Java files, cold checkout with no usable Gradle project outputs* 23.571 s 0.214 s 99.1% faster
clean full Java check (pre-migration commit 96169eb) 25.716 s 16.435 s 36.1% faster

For the ten-file rows, Spotless is ./gradlew spotlessJavaCheck and Flint is the complete mise run lint, so the Flint value includes all configured Flint checks, not only Java formatting. Flint has no persistent daemon; each value is a fresh native-process invocation. The formatter-only Flint checks took 0.052 s median when invoking the native binary directly.

The warm Spotless runs reused the configuration cache and had six Spotless tasks execute for the changed files; the cold-daemon runs also reused the configuration cache but started after ./gradlew --stop. This confirms that the daemon is a major part of the delay, but it is not the same thing as the configuration phase: the configuration cache controls reuse of configuration/task-graph work, while the daemon controls JVM/process reuse. The cold-checkout run also had to execute 1,242 tasks and store the configuration cache, so it is a worst-case first run rather than a daemon-only comparison.

The full Flint value is a genuine full-repository run using --full; it is not the changed-file baseline path. google-java-format accounts for 16.4 s of that run, while regex-replace took 0.873 s and license-header 0.037 s. The earlier 18.8 s value included mise exec overhead and is not used here.

The migration changes flint.toml and mise.toml, so this PR intentionally triggers a full Flint baseline against the pre-migration commit. Once that baseline is established, a typical ten-file edit is sub-second.

Companion PR

Depends on grafana/flint#407.

The mise.toml pin uses Flint commit 57a4c9b so this consumer PR can validate the unreleased native checks. It should be changed back to the released Flint backend after the Flint feature is released.

Validation

  • mise run lint:fix (using the companion Flint commit)
  • local Flint license-header, regex-replace, and google-java-format checks
  • git diff --check

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 18, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-22 16:38:41 UTC.

  • Waiting on: Author
  • Next step: Move out of draft to request review.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant