Skip to content

Commit 8868f01

Browse files
authored
1 parent 49dee38 commit 8868f01

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/GormDirtyCheckingSpec.groovy

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package org.grails.datastore.gorm
22

33
import grails.gorm.annotation.Entity
44
import grails.gorm.tests.GormDatastoreSpec
5+
import spock.lang.Issue
56

67
class 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
2539
class Student {
2640
String name
2741
}
42+
43+
@Entity
44+
class BooleanTest {
45+
Boolean property1
46+
boolean property2
47+
}
48+

grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm/DirtyCheckingTransformer.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)