Repository navigation
refactor: convert grails-shell-cli to Groovy - #16585
borinquenkid wants to merge 18 commits into
Conversation
The public fields of FetchAllTaskSelectorsBuildAction.AllTasksModel became Groovy properties (private field plus accessors) when declared without 'public'; keep them public fields as in the Java original. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ovy-grails-shell-cli
…ovy-grails-shell-cli
…to-groovy-grails-shell-cli
…-to-groovy-grails-shell-cli
…va-to-groovy-grails-shell-cli
…y on 20 files Rebuilds these 20 grails-shell-cli files from the original .java content with a minimal mechanical conversion (public removed from methods/class decls, unnecessary groovy auto-imports dropped, safe double-quote -> single-quote conversions, unnecessary .class literal references removed) that deliberately keeps every semicolon, so git's default 50% rename-similarity threshold recognizes each as a rename of its .java predecessor instead of a delete+add, following the pattern proven on DefaultCommandLine.groovy (#16576) and already applied to grails-datastore-core and grails-spring. Each file adds a scoped @SuppressWarnings('UnnecessarySemicolon') with an explanatory TODO, to be removed by the stacked groovyism-cleanup PR. Four small files (GrailsCompilerAutoConfiguration, SpringBatchCompiler- AutoConfiguration, SpringIntegrationCompilerAutoConfiguration, SpringBootCompilerAutoConfiguration) stayed below the 50% threshold with semicolons alone, because their string-literal-dense bodies made the double-quote -> single-quote conversion (CodeNarc's UnnecessaryGString) proportionally too disruptive for their size; these also keep their original double-quoted strings under a documented, targeted @SuppressWarnings(['UnnecessarySemicolon', 'UnnecessaryGString']) exception, matching the GormProperties/KeyValueMappingFactory precedent in grails-datastore-core. Four files with nested/inner classes (GrailsApplicationCompiler- AutoConfiguration, ResourceMatcher, RunCommand, FetchAllTaskSelectorsBuildAction) needed one more fix: CodeNarc's @SuppressWarnings-on-class only suppresses UnnecessarySemicolon inside that class's own body, never on the file's package/import statements, which live outside any ClassNode. Moving a second @SuppressWarnings('UnnecessarySemicolon') onto the package declaration itself (a legal annotation target in Groovy, verified empirically) clears those violations file-wide. RunCommand's now-redundant explicit no-arg constructor and FetchAllTaskSelectorsBuildAction's missing blank-line-after-opening-brace were two further small, real CodeNarc findings fixed outright rather than suppressed. Verified: compileGroovy/compileTestGroovy clean, codenarcMain clean, and all 196 grails-shell-cli tests pass (0 failures, 0 errors, 2 pre-existing skips). All 20 files are now git-detected as R050+ renames against origin/10.0.x with git's default (no -M flag) similarity detection. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…va-to-groovy-grails-shell-cli
…va-to-groovy-grails-shell-cli
…va-to-groovy-grails-shell-cli
…va-to-groovy-grails-shell-cli
This comment has been minimized.
This comment has been minimized.
…va-to-groovy-grails-shell-cli
|
SUPERSEDED: the Temporary CI flag on this stacked branch (BLOCKER before merge). This Java-to-Groovy chain is a stack of PRs, and every push to any of them starts the full CI matrix, which is more runner time than the ASF allows us. Every PR in the stack except the one closest to its release branch (#16576) therefore carries one temporary commit, With it, CI on this PR compiles but does not run tests or code style. The full build runs on #16576 (closest to 10.0.x), and each PR gets it when the PR below it has merged. Condition for merging this PR: that |
…va-to-groovy-grails-shell-cli
|
Update: this branch now carries a different temporary CI commit (BLOCKER before merge). The earlier In its place, every PR in this stack except #16576 (the one closest to 10.0.x) carries one temporary commit, Condition for merging this PR: that commit must be reverted on this branch first ( |
…va-to-groovy-grails-shell-cli
…/java-to-groovy-grails-shell-cli
…va-to-groovy-grails-shell-cli
…va-to-groovy-grails-shell-cli
What
Converts the remaining Java sources of
grails-shell-clito Groovy: 97.javafiles removed, 97.groovyfiles added (117 files changed, 4406 insertions(+), 4528 deletions(-)).Why
The maintainers asked on #16351 for the Java-to-Groovy migration to land one Gradle project at a time as a stack of PRs, bottom-up in dependency order. #16572 did
grails-data-hibernate7; this PR is 7 of 30 in the next stack (base:refactor/java-to-groovy-grails-spring). The end state of every file is taken from the9.0.x-java-to-groovybranch, which already carries the regression fixes found by CI.Commits:
Changed outside the converted sources
Java-facing API sweep
Every deleted
.javawas compared with its Groovy twin viajavap -v -protected(class declaration, public/protected fields, constructors, methods incl. modifiers/throws/generics, interface default methods, nested class modifiers, and the annotations callers see). Result:grails-shell-cli: 97 deleted .java, 4 difference(s) found and fixed in this PR (see thefix:commit), 0 leftSee also the notes below. Remaining informational entries (widened visibility, e.g. Groovy property accessors): 20.
Verification
classesandtestClasses(plusast/cli/testFixturessource sets where present) of the converted project(s) and of their direct dependents compile: ['grails-profiles-base']codeStyle,ratand a whole-repobuild -PskipTestsare run once on the tip of the stack.Notes
MIN_VALUE/MAX_VALUE/next()/previous(), property accessors appear for formerly package-private members, nested static classes with implicit constructors become public (they wereprotected), and generic type parameters that Groovy erases in constructors/methods (descriptors identical).static finalwithoutpubliccreates a property;==callsequals(); Closure/SAM coercions;@CompileStaticwith nested classes. All CI regression fixes found on the umbrella branch are included in the end state.🤖 Generated with Claude Code