Skip to content

Upgrade to Groovy 6.0.0 - #484

Merged
perNyfelt merged 5 commits into
mainfrom
groovy-6-upgrade
Oct 24, 2026
Merged

perNyfelt merged 5 commits into
mainfrom
groovy-6-upgrade

Conversation

@perNyfelt

@perNyfelt perNyfelt commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Upgrades the build from Groovy 5.1.3 to 6.0.0 and fixes the source incompatibilities Groovy 6 exposed. All source fixes also compile on Groovy 5.1.3.

Breaking for consumers: artifacts compiled with Groovy 6 require a Groovy 6 runtime. Statically compiled call sites bind to new Groovy 6 overloads (e.g. DefaultGroovyMethods.getAt(Map, String)), which throw NoSuchMethodError on Groovy 5. The Matrix static initializer now rejects Groovy < 6 with a clear IllegalStateException; code paths that do not load Matrix (e.g. Stat.frequency(List)) may still fail with NoSuchMethodError on Groovy 5. The published modules' next-release sections note the requirement.

Source fixes

File Groovy 6 issue Fix
matrix-core ValueConverter val is now a keyword; val / x lexed as a slashy string (reported as a misleading "Missing ')'" at line 116) Renamed variable, use intdiv
matrix-core ValueConverter default -> try {…} not allowed in switch expressions Block arm with yield in both branches
matrix-charts MapCoord Block arm in switch expression must yield yield 'identity'
matrix-stats Normalize Unqualified enum case LOG -> rejected at compile time (on Groovy 5 it worked under @CompileStatic, only dynamic code threw MissingPropertyException) case Normalization.LOG ->
matrix-charts WktReader, matrix-ggplot GgCharmMappingRegistry default -> null arm infers Object Cast null to the target type
matrix-gsheets GsUtil, matrix-spreadsheet SpreadsheetUtil char arithmetic now inferred as Number Explicit int casts
matrix-gsheets GsUtil Long/BigInteger ternary no longer typed BigInteger Explicit cast
matrix-stats Accuracy def locals mutated in a closure inferred as Number Declared as BigDecimal
matrix-stats FormulaModelFrameTest Stricter map literal generics with putAt Typed locals

Version pins and docs

  • gradle/libs.versions.toml: Groovy 6.0.0
  • matrix-bom/pom.xml groovy.version 5.1.2 → 6.0.0; BomResolutionIT runtime assertion updated
  • matrix-smile/src/test/consumer/build.gradle → 6.0.0
  • Groovy versions in module READMEs, root/BOM readmes, docs/tutorial/*, AGENTS.md, matrix-bom/api-coverage.md
  • "Targets Groovy 5" statements in readme.md, docs/tutorial/1-introduction.md, docs/tutorial/2-matrix-core.md, docs/cookbook/matrix-core.md, matrix-smile/README.md
  • Matrix runtime version check: minimum raised from Groovy 5 to 6
  • New "Groovy 6 Pitfalls" section in docs/agents/groovy-style-guide.md
  • Release notes: Groovy 6 runtime note in the next-release section of 21 published modules (matrix-logging excluded; matrix-groovy-ext states the requirement without the Matrix-specific failure modes; matrix-bom tells consumers to declare Groovy 6.0.0+) (new "(unreleased)" sections added, using the build.gradle snapshot version, where the top section was already released)

Release tooling

  • .github/workflows/release-all-tools.yml: release CLI groovy, groovy-json, groovy-xml 5.1.1 → 6.0.0
  • scripts/release-all/staged-settings.groovy: find { … } as Node throws on Groovy 6 (the new XmlExtensions.asType tries to construct a Node), which the catch block reported as a generic "Cannot prepare isolated Maven settings" error. Replaced with (Node) casts; verified on Groovy 5.1.3 and 6.0.0.

Modules touched: matrix-core, matrix-stats, matrix-charts, matrix-ggplot, matrix-gsheets, matrix-spreadsheet, matrix-smile (consumer test), matrix-bom, docs.

Tests

  • ./gradlew compileGroovy compileTestGroovy --continue on Groovy 6.0.0: all modules pass

  • Same command with v_groovy temporarily set to 5.1.3: all modules pass

  • ./gradlew :matrix-core:test :matrix-stats:test :matrix-gsheets:test :matrix-spreadsheet:test :matrix-charts:test :matrix-ggplot:test --continue: all pass (core 680; others 170, 161, 1122, 760, and 1665 with 7 skipped)

  • cd matrix-bom && mvn test: MatrixModulesTest 15/15

  • cd matrix-bom && mvn verify -Papi-it: all 21 IT classes pass

  • After the review fixes: ./gradlew :matrix-core:test 680/680

  • ./matrix-bom/preReleaseVerify.sh (Groovy CLI 6.0.0): exit 0. japicmp flags matrix-core changes vs 3.8.0. The only public API changes are Grid.leftShift (def → Grid<T>) and Column.subList(IntRange) (List → Column); both are intentional source changes made on main since 3.8.0, not from this PR. The rest are compiler-generated closure classes.

  • Release tooling with Groovy CLI 6.0.0 (same commands as CI): groovy scripts/release-all/test-tools.groovy . (61 assertions), test-inventory-inheritance.groovy ., test-workflow.groovy ., test-manifest-verifier.groovy . .bom-verify-repo: all pass. Before the staged-settings.groovy fix, test-tools and the manifest verifier failed.

Not run: full ./gradlew test for modules without source changes, and shellcheck (no shell scripts changed).

🤖 Generated with Claude Code

perNyfelt and others added 5 commits October 24, 2026 17:59
Fix the Groovy 6 source incompatibilities (val keyword, yield in switch
expression block arms, unqualified enum case labels, stricter static type
inference), align the BOM and smile consumer test pins, update Groovy
versions in READMEs and tutorials, and document the pitfalls in the style
guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raise the Matrix static initializer minimum to Groovy 6 so Groovy 5 users
get a clear error instead of a later NoSuchMethodError, update remaining
"targets Groovy 5" statements, and correct the style guide note on
unqualified enum case labels under @CompileStatic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Note the Groovy 6 runtime requirement in every published module's next
release section, move the release-tools CI Groovy CLI to 6.0.0, and fix
staged-settings.groovy, whose `as Node` coercion of find() results throws
on Groovy 6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the note from matrix-logging, state the Groovy 6 requirement for
matrix-groovy-ext without the Matrix-specific failure modes, and give the
BOM a consumer-facing dependency note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@perNyfelt
perNyfelt merged commit 009d80a into main Oct 24, 2026
3 checks passed
@perNyfelt
perNyfelt deleted the groovy-6-upgrade branch October 24, 2026 18:46
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