borinquenkid opened a new pull request, #16156:
URL: https://github.com/apache/grails-core/pull/16156
## Summary
- Adds unit test coverage for `DefaultTenantService` and
`DefaultTransactionService` (`org.grails.datastore.gorm.services`), both
previously at 0% coverage. Pure Spock-mock specs, no live datastore needed.
- Adds coverage for a batch of under-tested `@Service` AST-transform
implementer classes (`UpdateOneImplementer`, `DeleteWhereImplementer`,
`FindOneInterfaceProjectionWhereImplementer`,
`FindAllPropertyProjectionImplementer`, `FindOnePropertyProjectionImplementer`,
the `findById(id)` shortcut in `FindOneByImplementer`, and the
`AbstractWriteOperationImplementer.enhance()` path for abstract-class services
with pre-existing concrete write methods), all via the existing
`GroovyClassLoader().parseClass(...)` + `@Implemented(by=...)`
structural-testing convention already used by
`ServiceTransformSpec`/`WhereConnectionRoutingSpec`.
- **Real bug fix**: `AbstractSaveImplementer`'s invalid-argument error path
referenced `newMethodNode.declaringClass.module` (null on the synthesized
implementation method), crashing the compiler with a
`NullPointerException`/`GroovyBugError` instead of reporting a clean compile
error. Fixed to use `abstractMethodNode.declaringClass.module.context`,
matching the pattern used elsewhere in this package (e.g.
`FindAllByImplementer`).
- A handful of IntelliJ-inspection cleanups surfaced while reviewing these
classes:
- Suppressed (not "fixed") warnings on
`getDetachedCriteriaType`/`lookupById`/`findMethodToInvoke`/`getFindMethodToInvoke`
where the flagged parameter/method is a legitimate `protected` polymorphic
extension point on a class with real subclasses — changing the signature or
making it `static` would silently break overriding.
- Removed genuinely dead code: `bindParametersAndSave`'s unused
`newMethodNode` parameter (a side effect of the `AbstractSaveImplementer` fix
above), and three unused helper methods on `AbstractServiceImplementer`
(`transactionalDatastore`, `transactionService`,
`findInstanceApiForConnectionId`) with zero call sites anywhere in the repo.
- Deduplicated a 13-line interface-projection property-compatibility check
that was copy-pasted between `InterfaceProjectionBuilder` and
`IterableInterfaceProjectionBuilder` into a shared
`hasCompatibleProperties(...)` method.
- Replaced an array range-slice (`parameters[1..-1] as Parameter[]`) with
`Arrays.copyOfRange(...)` in `UpdateOneImplementer`, since IntelliJ's stricter
`@CompileStatic` checker can't resolve the `getAt` overload for it even though
`groovyc` compiles it fine.
## Test plan
- [x] `./gradlew :grails-datamapping-core:test` — full module suite passes
- [x] `./gradlew :grails-datamapping-core:codeStyle` — 0 Checkstyle/CodeNarc
violations
- [x] `./gradlew :grails-datamapping-rx:compileGroovy` — sibling module
unaffected by `AbstractServiceImplementer` cleanup
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]