Fix serialization error in spotless test-published-artifacts#11865
Conversation
The spotless _plugin script_, is being reused in
test-published-artifacts, unfortunately spotless a serilization bug
on the greclipse formatter that surfaces when no files mathing
extension target. This causes the build to fail with a obscure error
related to fingerprinting:
```
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(...)
at com.diffplug.spotless.ConfigurationCacheHackList.hashCode(...)
```
This change applies a tailored configuration for this simple project.
mcculls
left a comment
There was a problem hiding this comment.
Just a small Q about the added writeMainVersionFile
Maybe also add comment in test-published-dependencies/build.gradle.kts so someone doesn't revert it back to use $sharedConfigDirectory/spotless.gradle (at least until the upstream issue is fixed)
|
I'll push a quick commit with added comments |
test-published-artifacts
PerfectSlayer
left a comment
There was a problem hiding this comment.
It looks a bit hacky but we need it for the build stability
Given the two gradle projects are separate, and I'm inclined to think the two gradle don't have the same need/bar in code style, that is also a sensible choice. |
Yeah, I wonder what's the gradle convention for this kind of tests... 🤔 |
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |

What Does This Do
This PR updates the CI configuration to address a serialization bug in the Spotless plugin when no files match the defined extension target. It introduces a dedicated Spotless configuration specifically for the
test-published-artifactsverification process.Check
test_published_artifacts's spotless early on inspotlessjob.Relates to diffplug/spotless#2994
Motivation
The previous shared Spotless configuration triggered a build failure due to an obscure error involving the Greclipse formatter's serialization, which impacted build stability. This change ensures the setup remains robust and avoids such errors.
Additional Notes
This issue is specific to the
Greclipseformatter and arises under certain conditions where no matching files exist. The dedicated configuration provides a clear and isolated solution for this scenario.More precisely, the failure appears o be a thread-safety bug in Spotless. During Gradle's parallel input fingerprinting,
ConfigurationCacheHackList.hashCode()serializes each formatter step.FormatterStepSerializationRoundtrip$HackClone.writeObjectdoes a non-atomic check, then populate on itscleanedfield, i.e. it publishescleanedfield before assigning the internal state ofFormatterStepSerializationRoundtrip. In our case this led to a second thread that can serialize the half-built "clone", this why we see aThe issue was probably never trigger before, because Gradle 9.6 improved the speed in that area (fingerprinting).
Given that
test_published_artifactsno longer needs a groovy formatter, I chose to avoid applyin the plugin script of dd-trace-java, and applied a tailored (and simple) spotless configuration.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)Jira ticket: [PROJ-IDENT]