File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm
grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ package org.grails.datastore.gorm
22
33import grails.gorm.annotation.Entity
44import grails.gorm.tests.GormDatastoreSpec
5+ import spock.lang.Issue
56
67class GormDirtyCheckingSpec extends GormDatastoreSpec {
78
89 @Override
910 List getDomainClasses () {
10- [Student ]
11+ [Student , BooleanTest ]
1112 }
1213
1314 void " test a new instance is dirty by default" () {
@@ -19,9 +20,29 @@ class GormDirtyCheckingSpec extends GormDatastoreSpec {
1920 student. isDirty()
2021 }
2122
23+ @Issue (' https://github.com/grails/grails-core/issues/12453' )
24+ void " test Boolean property getters" () {
25+
26+ when :
27+ BooleanTest student = new BooleanTest (property1 : true , property2 : true )
28+
29+ then : " Same behaviour of getters for boolean and Boolean"
30+ student. isProperty1()
31+ student. getProperty1()
32+ student. isProperty2()
33+ student. getProperty2()
34+ }
35+
2236}
2337
2438@Entity
2539class Student {
2640 String name
2741}
42+
43+ @Entity
44+ class BooleanTest {
45+ Boolean property1
46+ boolean property2
47+ }
48+
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ class DirtyCheckingTransformer implements CompilationUnitAware {
206206
207207 // first add the getter
208208 ClassNode returnType = resolvePropertyReturnType(pn, classNode)
209- boolean booleanProperty = ClassHelper . boolean_TYPE. getName(). equals(returnType. getName())
209+ boolean booleanProperty = ClassHelper . boolean_TYPE. getName(). equals(returnType. getName()) || ClassHelper.Boolean_TYPE . getName() . equals(returnType . getName())
210210 String fieldName = propertyField. getName()
211211 String getterName = NameUtils . getGetterName(propertyName, false )
212212
You can’t perform that action at this time.
0 commit comments