-
-
Notifications
You must be signed in to change notification settings - Fork 970
Description
Expected Behavior
That all properties, also those who implement an abstract setter, are marked dirty when the property changes.
Actual Behaviour
If a property implements an abstract setter from an abstract class, then it is not marked dirty when changed.
Steps To Reproduce
From the accached project's README:
Issue description
When a domain class, extending from an abstract class, and this abstract class has setFoo() and getFoo() methods, and the domain class has a property foo, then the generated bytecode does not have a markDirty call for the property. Other properties not mentioned in the abstract class does have markDirty in the bytecode.
This behavior is not visible in Unit test, but in Integration test and production.
Steps to reproduce
Run the test suite. One test UsingAbstractIntegrationSpec will fail.
To debug, add the debug compile options in build.gradle and run the test.
Identified reason for this behavior
As far as I can tell, org.grails.compiler.gorm.DirtyCheckingTransformer.addDirtyCheckingSetter() is not calling org.grails.compiler.gorm.DirtyCheckingTransformer.createMarkDirtyMethodCall because in line #316 the setter node is not-null, as it is picked up from the abstract class.
I think it will be fixable just by adding a check for setter == null || setter.isAbstrct() in line #316, but since this is for GORM 8.1.2 (And Grails 6.2.3), I am not sure if 1) This is the right approach, and 2) If it is, how can I get it released?
Environment Information
Ubuntu (but irrelevant)
Java 17
Grails 6.2.3 (I am about to add a branch that checks Grails 7 as well)
Example Application
https://github.com/sbglasius/grails-gorm-abstract-setter-issue
Version
6.2.3 and most likely 7.0.x as well
Metadata
Metadata
Assignees
Labels
Type
Projects
Status