Add specs and clean up transactions.transform/transform in grails-datamapping-core - #16166
Open
borinquenkid wants to merge 1 commit into
Open
Add specs and clean up transactions.transform/transform in grails-datamapping-core#16166borinquenkid wants to merge 1 commit into
borinquenkid wants to merge 1 commit into
Conversation
…amapping-core Closes direct unit-spec coverage gaps left after PR #16148 for RollbackTransform, AbstractDatastoreMethodDecoratingTransformation, AbstractMethodDecoratingTransformation, AstMethodDispatchUtils, and AstPropertyResolveUtils. Writing the AstPropertyResolveUtils spec surfaced a real correctness bug: its property cache was keyed by class name (a String), so two distinct ClassNode instances sharing a name (e.g. from separate compilations of dynamically-generated/test classes) silently corrupted each other's cached property data under concurrent use. Fixed by keying the cache on ClassNode identity via a synchronized IdentityHashMap. Also extracts the duplicated applied-marker idempotency check/mark pattern (repeated across AbstractGormASTTransformation, AbstractMethodDecoratingTransformation, and AbstractDatastoreMethodDecoratingTransformation) into shared isAlreadyApplied/markApplied helpers, and applies a batch of small cleanups flagged by static analysis: equals() calls replaced with ==, an unused method parameter removed, Java 21 instanceof pattern variables replacing raw-type casts, String#isEmpty() over length()==0, Class#getDeclaredConstructor().newInstance() over the deprecated Class#newInstance(), and two stray doc/comment fixes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 8.1.x #16166 +/- ##
==================================================
+ Coverage 53.4149% 53.4265% +0.0116%
- Complexity 19459 19469 +10
==================================================
Files 2081 2081
Lines 98993 98994 +1
Branches 17361 17359 -2
==================================================
+ Hits 52877 52889 +12
+ Misses 38566 38560 -6
+ Partials 7550 7545 -5
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 1720abd Learn more about TestLens at testlens.app. |
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.
Summary
org.grails.datastore.gorm.transactions.transformandorg.grails.datastore.gorm.transformleft after Add test coverage and fix compiler crashes in GORM AST transforms #16148:RollbackTransform,AbstractDatastoreMethodDecoratingTransformation,AbstractMethodDecoratingTransformation,AstMethodDispatchUtils, andAstPropertyResolveUtils.AstPropertyResolveUtilsspec surfaced a real correctness bug: its property cache was keyed by class name (aString), so two distinctClassNodeinstances sharing a name (e.g. from separate compilations of dynamically-generated/test classes) silently corrupted each other's cached property data under concurrent use. Fixed by keying the cache onClassNodeidentity via a synchronizedIdentityHashMap.AbstractGormASTTransformation,AbstractMethodDecoratingTransformation, andAbstractDatastoreMethodDecoratingTransformation) into sharedisAlreadyApplied/markAppliedhelpers.equals()calls replaced with==, an unused method parameter removed, Java 21instanceofpattern variables replacing raw-type casts,String#isEmpty()overlength()==0,Class#getDeclaredConstructor().newInstance()over the deprecatedClass#newInstance(), and two stray doc/comment fixes.Test plan
./gradlew :grails-datamapping-core:test(full module suite)./gradlew :grails-datamapping-core:codeStyle :grails-datamapping-core:codenarcMain :grails-datamapping-core:codenarcTestAstPropertyResolveUtilscache-corruption fix, including under concurrent access🤖 Generated with Claude Code