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

borinquenkid pushed a commit to branch test/document-datamapping-core-finders
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit a52be9557cf61cab4c46ba787ef98429ee5fe0d3
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Sat Aug 15 15:34:23 2026 -0500

    Fix IntelliJ warnings on ListResultFinder
    
    - Raw Class/Closure/DetachedCriteria on the three invoke overloads,
      same pattern as CountFinder/SingleResultFinder.
    - findAllByBoolean(MappingContext) had no caller anywhere - it mirrors
      the Datastore/MappingContext factory-pair pattern every finder class
      uses (the MappingContext overload exists for unit testing without a
      full Datastore, as findAllBy(MappingContext) already is), so add the
      missing test instead of removing the factory.
    
    Co-Authored-By: Claude Sonnet 5 <[email protected]>
---
 .../grails/datastore/gorm/finders/ListResultFinder.java    | 14 +++++++-------
 .../datastore/gorm/finders/ListResultFinderSpec.groovy     |  8 ++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git 
a/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/finders/ListResultFinder.java
 
b/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/finders/ListResultFinder.java
index 1b45256d17..9bd97f16f6 100644
--- 
a/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/finders/ListResultFinder.java
+++ 
b/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/finders/ListResultFinder.java
@@ -79,11 +79,13 @@ public class ListResultFinder implements FinderMethod, 
QueryBuildingFinder {
     }
 
     @Override
+    @SuppressWarnings("rawtypes")
     public Object invoke(Class clazz, String methodName, Object[] arguments) {
         return invoke(clazz, methodName, (Closure) null, arguments);
     }
 
     @Override
+    @SuppressWarnings("rawtypes")
     public Object invoke(Class clazz, String methodName, Closure 
additionalCriteria, Object[] arguments) {
         DynamicFinderInvocation invocation = 
grammar.createFinderInvocation(clazz, methodName, additionalCriteria, 
arguments);
         return doInvoke(invocation);
@@ -100,6 +102,7 @@ public class ListResultFinder implements FinderMethod, 
QueryBuildingFinder {
      * @param arguments The method call arguments
      * @return The result of the method call
      */
+    @SuppressWarnings("rawtypes")
     public Object invoke(Class clazz, String methodName, DetachedCriteria 
detachedCriteria, Object[] arguments) {
         DynamicFinderInvocation invocation = 
grammar.createFinderInvocation(clazz, methodName, null, arguments);
         if (detachedCriteria != null) {
@@ -109,13 +112,10 @@ public class ListResultFinder implements FinderMethod, 
QueryBuildingFinder {
     }
 
     private Object doInvoke(final DynamicFinderInvocation invocation) {
-        return FinderSupport.execute(datastore, new SessionCallback<Object>() {
-            @Override
-            public Object doInSession(Session session) {
-                Query query = buildQuery(invocation, session);
-                query.projections().distinct();
-                return query.list();
-            }
+        return FinderSupport.execute(datastore, (SessionCallback<Object>) 
session -> {
+            Query query = buildQuery(invocation, session);
+            query.projections().distinct();
+            return query.list();
         });
     }
 
diff --git 
a/grails-datamapping-core/src/test/groovy/org/grails/datastore/gorm/finders/ListResultFinderSpec.groovy
 
b/grails-datamapping-core/src/test/groovy/org/grails/datastore/gorm/finders/ListResultFinderSpec.groovy
index 6b0164203f..f28af396c7 100644
--- 
a/grails-datamapping-core/src/test/groovy/org/grails/datastore/gorm/finders/ListResultFinderSpec.groovy
+++ 
b/grails-datamapping-core/src/test/groovy/org/grails/datastore/gorm/finders/ListResultFinderSpec.groovy
@@ -136,4 +136,12 @@ class ListResultFinderSpec extends Specification {
         then:
         thrown(IllegalStateException)
     }
+
+    void "findAllByBoolean invoke throws IllegalStateException when 
constructed in stateless mode"() {
+        when:
+        
ListResultFinder.findAllByBoolean(mappingContext).invoke(FinderTestEntity, 
'findAllActiveByName', ['Bob'] as Object[])
+
+        then:
+        thrown(IllegalStateException)
+    }
 }

Reply via email to