Repository navigation
refactor: convert build-logic docs-core and grails-gradle common/model to Groovy - #16744
Open
borinquenkid wants to merge 4 commits into
Open
borinquenkid wants to merge 4 commits into
borinquenkid wants to merge 4 commits into
Conversation
…el Java sources to their Groovy paths Only the rename: 20 files, every one R100, with the Java text unchanged so that git log --follow reaches the Java history from the Groovy files. The next commit converts them. Claude-Session: https://claude.ai/code/session_01MDHn7fC3hsGJ27vFHD2o1p
…l to Groovy The conversion of the 20 files moved by the previous commit, in Groovy style: no semicolons, single quotes, no public modifiers, no suppressions, and @CompileStatic where there is code. Adds the specs that cover the converted classes and the changes the sources needed to compile as Groovy. Claude-Session: https://claude.ai/code/session_01MDHn7fC3hsGJ27vFHD2o1p
borinquenkid
marked this pull request as draft
October 23, 2026 23:29
borinquenkid
marked this pull request as ready for review
October 23, 2026 23:29
…asses A javap -protected diff of the Java and Groovy jars found three changes the conversion should not make, and one change of behaviour: - GrailsResourceUtils: DOMAIN_PATH_PATTERN, RESOURCE_PATH_PATTERN, SPRING_SCRIPTS_PATH_PATTERN and COMPILER_ROOT_PATTERNS were public static fields in Java; without a modifier Groovy made them properties, so the fields a compiled Java caller reads were gone. They are declared public again. - CommandLineParser.ENV_ARGS and DEFAULT_ENVS, and GrailsNameUtils.convertValidPropertyMethodSuffix, were package-private and had become public; they are @PackageScope again. - SpringIOUtils checked its arguments with assert, which Java skips without -ea and Groovy always runs, turning a missing argument into an AssertionError. The checks are Objects.requireNonNull with the same messages, the NullPointerException a Java caller got. The spec now expects that exception and its message for all fifteen checks. JavaCallerPin, compiled with the model tests, pins the public fields, a constant of each kind, the constructors and the checked exceptions; with DOMAIN_PATH_PATTERN made a property again it fails to compile. Claude-Session: https://claude.ai/code/session_01MDHn7fC3hsGJ27vFHD2o1p
🔎 No tests executed 🔎🏷️ Commit: 4661510 Learn more about TestLens at testlens.app/docs. |
This branch has not been deployed
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.
What
Replaces #16576 and its idiom follow-up #16661. Converts the Java sources of
build-logic/docs-core,grails-gradle/commonandgrails-gradle/modelto Groovy, the way #16572 does forgrails-data-hibernate7. It is the conversion and nothing else: no feature, no fix, no documentation change.Commits, in order, on top of
94fd84675f(10.0.x), then a merge of the current10.0.xand one fix:git mvonly: 20.javafiles to their.groovypaths, every lineR100, no content changepublicon members, no suppressions,@CompileStaticwhere there is code, plus the specs that cover the converted classes46615102eb)javapdiff below found changed, and the null checks ofSpringIOUtilsgit log --followon any converted file reaches its Java history, includingCommandLineParserandDefaultCommandLine, which a single-commit conversion falls below git's rename threshold for.Why this replaces #16576 and #16661
#16576 converted in one commit and kept Java syntax to hold rename similarity (52% to 92%, none at 100%); #16661 then removed that syntax. With the move as its own commit that workaround is not needed, so the two collapse into one pull request that is already in the final style. matrei's request on #16576 to git move the files is what the first commit does.
Java-facing API
Checked with
javap -protectedover the jars built from94fd84675f(Java) and from this branch (Groovy), class by class for the 20 converted sources. After46615102ebthe only differences are what every Groovy class carries (GroovyObject,$getLookup,__$stMC, the enumnext/previous/MIN_VALUE/MAX_VALUE) andString[]parameters that are now varargs, which Java callers compile against unchanged.What the diff found and
46615102ebrestores:GrailsResourceUtils.DOMAIN_PATH_PATTERN,RESOURCE_PATH_PATTERN,SPRING_SCRIPTS_PATH_PATTERNandCOMPILER_ROOT_PATTERNSarepublic staticfields in Java. Without a modifier Groovy made them properties, so a compiled Java caller reading the field would fail withNoSuchFieldError. They are declaredpublicagain.CommandLineParser.ENV_ARGS,DEFAULT_ENVSandGrailsNameUtils.convertValidPropertyMethodSuffixare package-private in Java and had become public; they are@PackageScopeagain.SpringIOUtilschecked its arguments withassert, which Java skips without-eaand Groovy always runs, so a missing argument became anAssertionError. The fifteen checks areObjects.requireNonNullwith the same messages: theNullPointerExceptiona Java caller got, thrown up front.SpringIOUtilsSpecchecks the exception and the message of each.JavaCallerPin.java, compiled with thegrails-gradle-modeltests, pins the public fields, a constant of each kind, the constructors and the checked exceptions. TurningDOMAIN_PATH_PATTERNback into a property fails its compilation.Remaining dynamic sites (
javap -c -pover the converted classes): only Groovy's generatedthis$dist$*andmethodMissing/propertyMissingbridges of classes with anonymous inner classes (DefaultCommandLine,DefaultResourceLoader,GrailsResourceUtils,SupplierUtil), the enum$INITofXmlParserFeature, and$getStaticMetaClass. No converted method dispatches dynamically.Verification
:grails-docs-core:testFetchTagsTaskSpecrunsgit tagin a temporary repository and fails on a machine whose git config signs every tag (tag.gpgsign); the spec is not touched by this PR:grails-gradle-model:test,:grails-gradle-common:testcodenarcMainandcodenarcTestongrails-gradle-model,codenarcMainongrails-gradle-commongroovyism/build-toolingtipAlso run from the root:
rat,validateRepositoryConventionsandcodeStyle, all clean.After the conversion Checkstyle has no sources in these projects (
NO-SOURCE), so CodeNarc is the analyzer that gates them.CI ran green on
506d8458c8;46615102ebruns underno ciuntil the review is done, then a full run confirms the final tree.https://claude.ai/code/session_01MDHn7fC3hsGJ27vFHD2o1p