This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit c3c6d3fb0072087be04f4247afd2b1489f4bf393
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Thu Feb 26 14:35:32 2026 -0600

    Fix PMD issue in TraitPropertyAccessStrategy
---
 grails-data-hibernate7/core/PMD.md                             |  2 +-
 .../orm/hibernate/access/TraitPropertyAccessStrategy.java      | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/grails-data-hibernate7/core/PMD.md 
b/grails-data-hibernate7/core/PMD.md
index 70e79b03ee..ae31a36d8d 100644
--- a/grails-data-hibernate7/core/PMD.md
+++ b/grails-data-hibernate7/core/PMD.md
@@ -99,7 +99,7 @@ 
CloseResource,org.grails.orm.hibernate.HibernateDatastore,752,YES
 DataflowAnomalyAnalysis,org.grails.orm.hibernate.HibernateDatastore,760,YES
 DataflowAnomalyAnalysis,org.grails.orm.hibernate.HibernateSession,80,YES
 DataflowAnomalyAnalysis,org.grails.orm.hibernate.HibernateSession,183,YES
-NullAssignment,org.grails.orm.hibernate.access.TraitPropertyAccessStrategy,50,
+NullAssignment,org.grails.orm.hibernate.access.TraitPropertyAccessStrategy,50,YES
 
DataflowAnomalyAnalysis,org.grails.orm.hibernate.access.TraitPropertyAccessStrategy,85,
 
DataflowAnomalyAnalysis,org.grails.orm.hibernate.access.TraitPropertyAccessStrategy,85,
 
DataflowAnomalyAnalysis,org.grails.orm.hibernate.access.TraitPropertyAccessStrategy,85,
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java
index b9fe9d9c70..df4822f802 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.java
@@ -41,13 +41,13 @@ public class TraitPropertyAccessStrategy implements 
PropertyAccessStrategy {
         ReflectionUtils.findMethod(containerJavaType, 
NameUtils.getGetterName(propertyName));
     if (readMethod == null) {
       // See https://issues.apache.org/jira/browse/GROOVY-11512
-      readMethod =
+      Method booleanReadMethod =
           ReflectionUtils.findMethod(
               containerJavaType, NameUtils.getGetterName(propertyName, true));
-      if (readMethod != null
-          && readMethod.getReturnType() != Boolean.class
-          && readMethod.getReturnType() != boolean.class) {
-        readMethod = null;
+      if (booleanReadMethod != null
+          && (booleanReadMethod.getReturnType() == Boolean.class
+              || booleanReadMethod.getReturnType() == boolean.class)) {
+        readMethod = booleanReadMethod;
       }
     }
 

Reply via email to