Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 6cdf90b

Browse files
committed
Add workaround for GROOVY-11512
1 parent 23d4769 commit 6cdf90b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ public class TraitPropertyAccessStrategy implements PropertyAccessStrategy {
1818
@Override
1919
public PropertyAccess buildPropertyAccess(Class containerJavaType, String propertyName) {
2020
Method readMethod = ReflectionUtils.findMethod(containerJavaType, NameUtils.getGetterName(propertyName));
21+
if(readMethod == null) {
22+
// See https://issues.apache.org/jira/browse/GROOVY-11512
23+
readMethod = ReflectionUtils.findMethod(containerJavaType, NameUtils.getGetterName(propertyName, true));
24+
if(readMethod != null && readMethod.getReturnType() != Boolean.class && readMethod.getReturnType() != boolean.class) {
25+
readMethod = null;
26+
}
27+
}
28+
2129
if(readMethod == null) {
2230
throw new IllegalStateException("TraitPropertyAccessStrategy used on property ["+propertyName+"] of class ["+containerJavaType.getName()+"] that is not provided by a trait!");
2331
}

0 commit comments

Comments
 (0)