Regression in 8.6.0: groovyGradle/greclipse fails with "roundtripStateInternal or equalityStateInternal should be non-null" during input fingerprinting
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #2951 @diukarev による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- groovy, java
- 領域
- build-system
調査の方向性
まず、./gradlew spotlessCheck --no-daemon --no-build-cache --stacktrace を使用して、クリーンな Gradle user home で失敗を再現します。表示された stack trace に沿って、FormatterStepSerializationRoundtrip.java、ConfigurationCacheHackList.java、および関連するシリアライゼーション・クラスを読みます。新しくプロビジョニングされた greclipse タスクが入力のフィンガープリント作成中に失敗しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Starting with Spotless 8.6.0, the groovyGradle { greclipse() } task fails with:
If the initializer was null, then one of roundtripStateInternal or equalityStateInternal should be non-null, and neither was
This is a regression: 8.4.0 and 8.5.0 work with the exact same project/config/Gradle version; 8.6.0 fails. Pinning back to 8.5.0 is our current workaround.
It is closely related to (and may be the same root cause as) #2927 and #2502, but we can pinpoint it to the 8.5.0 → 8.6.0 bump, and it does not require the configuration cache (it happens with config cache disabled / not configured).
Environment
- Spotless Gradle plugin 8.6.0 (8.4.0 and 8.5.0 OK)
- Gradle 9.5.1
- JDK 26 (Temurin) — also reproduces on the same setup regardless
- Formatter:
groovyGradle { greclipse() }(default greclipse → Groovy-Eclipse5.7.0/e4.35, Groovy5.0.0) - Configuration cache: not enabled
- Build cache: disabled on the command line (
--no-build-cache) — does not affect the outcome
Spotless config (relevant part)
spotless {
groovyGradle {
toggleOffOn()
greclipse()
leadingTabsToSpaces()
}
}
How to reproduce
Run on a clean Gradle user home (e.g. a fresh CI container where greclipse is provisioned from scratch):
./gradlew spotlessCheck --no-daemon --no-build-cache --stacktrace
:spotlessGroovyGradle fails. It does not reproduce against a warm local cache where greclipse is already provisioned — which suggests the failure is tied to the freshly-built greclipse step state rather than to any formatting violation.
Stack trace
The exception is thrown while Gradle fingerprints the task's input properties (before execution), when it calls hashCode() on Spotless's ConfigurationCacheHackList:
Caused by: java.lang.IllegalStateException: If the initializer was null, then one of roundtripStateInternal or equalityStateInternal should be non-null, and neither was
at com.diffplug.spotless.FormatterStepSerializationRoundtrip.writeObject(FormatterStepSerializationRoundtrip.java:74)
at com.diffplug.spotless.FormatterStepSerializationRoundtrip$HackClone.writeObject(FormatterStepSerializationRoundtrip.java:121)
at com.diffplug.spotless.ConfigurationCacheHackList.writeObject(ConfigurationCacheHackList.java:78)
at com.diffplug.spotless.LazyForwardingEquality.toBytes(LazyForwardingEquality.java:110)
at com.diffplug.spotless.FormatterStepEqualityOnStateSerialization.lambda$serializedState$0(FormatterStepEqualityOnStateSerialization.java:95)
at com.diffplug.spotless.ThrowingEx.get(ThrowingEx.java:67)
at com.diffplug.spotless.FormatterStepEqualityOnStateSerialization.serializedState(FormatterStepEqualityOnStateSerialization.java:95)
at com.diffplug.spotless.FormatterStepEqualityOnStateSerialization.hashCode(FormatterStepEqualityOnStateSerialization.java:75)
at com.diffplug.spotless.FormatterStepSerializationRoundtrip$HackClone.hashCode(FormatterStepSerializationRoundtrip.java:142)
at com.diffplug.spotless.ConfigurationCacheHackList.hashCode(ConfigurationCacheHackList.java:151)
at org.gradle.internal.execution.impl.DefaultInputFingerprinter$InputCollectingVisitor.visitInputProperty(DefaultInputFingerprinter.java:131)
at org.gradle.api.internal.tasks.execution.TaskExecution.visitMutableInputs(TaskExecution.java:336)
at org.gradle.internal.execution.impl.DefaultInputFingerprinter.fingerprintInputProperties(DefaultInputFingerprinter.java:77)
at org.gradle.internal.execution.steps.CaptureMutableStateBeforeExecutionStep.captureExecutionStateWithOutputs(CaptureMutableStateBeforeExecutionStep.java:124)
...
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.executeMutable(LoadPreviousExecutionStateStep.java:36)
Analysis / likely cause
- The failure is in
FormatterStepSerializationRoundtrip.writeObject(line 74), which asserts that ifinitializer == nullthen one ofroundtripStateInternal/equalityStateInternalmust be non-null — and here both are null. - It is reached via
ConfigurationCacheHackList.hashCode()during Gradle's input fingerprinting (DefaultInputFingerprinter/CaptureMutableStateBeforeExecutionStep), i.e. before the task action runs — so it triggers for ordinary up-to-date checking, independent of the build cache and without the configuration cache. - Because it only reproduces with a freshly provisioned greclipse (clean Gradle user home) and not against a warm cache, the greclipse step's state appears to be left without a computed
roundtripStateInternal/equalityStateInternal(initializer already consumed) at the point Gradle serializes it for the fingerprint.
Workaround
Pin the Spotless Gradle plugin to 8.5.0.
Happy to provide a minimal reproducer repo or extra logs (--info/--debug) if helpful.
- 主要言語
- Java
- スター
- 5.7k
- フォーク
- 565
- 平均マージ
- 2日 2時間
- マージ済み PR(30日)
- 57
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
diffplug/spotless のほかの issue
-
google-java-format 1.37.0: NoSuchMethodError on JavaFormatterOptions$Style.valueOf (Style is now a record)対応中かも @Goooler が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
diffplug/spotless#3126 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
diffplug/spotless#3125 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
shortenFullyQualifiedTypes corrupts method references on fields (x.field::m -> bogus import x.field)対応中かも @maxandersen が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
Add support for org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_record_parameterオープン
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
diffplug/spotless の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
typetools/checker-framework#8325 ·
メンテナーはふだん 1 日以内に返信
-
4Q-maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenLiberty/liberty-tools-intellij#1790 ·
メンテナーはふだん 2 日以内に返信
-
fix(i18n): fix fr translation対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
OpenAEV-Platform/openaev#8334 ·
メンテナーはふだん 2 日以内に返信
-
discussion welcome security waiting for feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
🐞 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
eclipse-rdf4j/rdf4j#6132 ·
メンテナーはふだん 1 日以内に返信