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

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


The following commit(s) were added to refs/heads/8.0.x-hibernate7 by this push:
     new 4d7d52058c Revert styling changes
4d7d52058c is described below

commit 4d7d52058c29aeb5658c35ad45fd3ed472872def
Author: James Daugherty <[email protected]>
AuthorDate: Sun May 17 12:10:10 2026 -0400

    Revert styling changes
---
 .../org/grails/datastore/gorm/GormStaticApi.groovy | 117 +++++++++++----------
 1 file changed, 64 insertions(+), 53 deletions(-)

diff --git 
a/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy
 
b/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy
index 56c532080b..99c54eb671 100644
--- 
a/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy
+++ 
b/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy
@@ -18,6 +18,18 @@
  */
 package org.grails.datastore.gorm
 
+import groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode
+import org.codehaus.groovy.runtime.InvokerHelper
+
+import org.springframework.beans.PropertyAccessorFactory
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory
+import org.springframework.transaction.PlatformTransactionManager
+import org.springframework.transaction.TransactionDefinition
+import org.springframework.transaction.support.DefaultTransactionDefinition
+import org.springframework.util.Assert
+
 import grails.gorm.CriteriaBuilder
 import grails.gorm.DetachedCriteria
 import grails.gorm.MultiTenant
@@ -25,11 +37,6 @@ import grails.gorm.PagedResultList
 import grails.gorm.api.GormAllOperations
 import grails.gorm.multitenancy.Tenants
 import grails.gorm.transactions.GrailsTransactionTemplate
-import groovy.transform.CompileDynamic
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
-
-import org.codehaus.groovy.runtime.InvokerHelper
 import org.grails.datastore.gorm.finders.DynamicFinder
 import org.grails.datastore.gorm.finders.FinderMethod
 import org.grails.datastore.gorm.multitenancy.TenantDelegatingGormOperations
@@ -50,12 +57,6 @@ import 
org.grails.datastore.mapping.multitenancy.MultiTenancySettings.MultiTenan
 import org.grails.datastore.mapping.query.Query
 import org.grails.datastore.mapping.query.api.BuildableCriteria
 import org.grails.datastore.mapping.query.api.Criteria
-import org.springframework.beans.PropertyAccessorFactory
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory
-import org.springframework.transaction.PlatformTransactionManager
-import org.springframework.transaction.TransactionDefinition
-import org.springframework.transaction.support.DefaultTransactionDefinition
-import org.springframework.util.Assert
 
 /**
  * Static methods of the GORM API.
@@ -88,7 +89,8 @@ class GormStaticApi<D> extends AbstractGormApi<D> implements 
GormAllOperations<D
             qualifier = defaultConnectionSource.name
             multiTenancyMode = 
defaultConnectionSource.settings.multiTenancy.mode
 
-        } else {
+        }
+        else {
             connectionSources = null
             multiTenancyMode = MultiTenancyMode.NONE
         }
@@ -114,7 +116,8 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     def propertyMissing(String name) {
         if (datastore instanceof ConnectionSourcesProvider) {
             return GormEnhancer.findStaticApi(persistentClass, name)
-        } else {
+        }
+        else {
             throw new MissingPropertyException(name, persistentClass)
         }
     }
@@ -160,7 +163,8 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
                 else if (varArgs.getClass().componentType != Object) {
                     // so we wrap it in an object array
                     argumentsForMethod = [varArgs] as Object[]
-                } else {
+                }
+                else {
 
                     if (varArgs.length == 1 && 
varArgs[0].getClass().isArray()) {
                         argumentsForMethod = varArgs[0]
@@ -243,7 +247,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     List<Serializable> saveAll(Object... objectsToSave) {
         (List<Serializable>) execute({ Session session ->
-            session.persist Arrays.asList(objectsToSave)
+            session.persist(Arrays.asList(objectsToSave))
         } as SessionCallback)
     }
 
@@ -254,7 +258,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     List<Serializable> saveAll(Iterable<?> objectsToSave) {
         (List<Serializable>) execute({ Session session ->
-            session.persist objectsToSave
+            session.persist(objectsToSave)
         } as SessionCallback)
     }
 
@@ -264,7 +268,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     void deleteAll(Object... objectsToDelete) {
         execute({ Session session ->
-            session.delete Arrays.asList(objectsToDelete)
+            session.delete(Arrays.asList(objectsToDelete))
         } as SessionCallback)
     }
 
@@ -274,7 +278,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     void deleteAll(Map params, Object... objectsToDelete) {
         execute({ Session session ->
-            session.delete Arrays.asList(objectsToDelete)
+            session.delete(Arrays.asList(objectsToDelete))
             if (params?.flush) {
                 session.flush()
             }
@@ -287,7 +291,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     void deleteAll(Iterable objectToDelete) {
         execute({ Session session ->
-            session.delete objectToDelete
+            session.delete(objectToDelete)
         } as SessionCallback)
     }
 
@@ -297,7 +301,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     void deleteAll(Map params, Iterable objectToDelete) {
         execute({ Session session ->
-            session.delete objectToDelete
+            session.delete(objectToDelete)
             if (params?.flush) {
                 session.flush()
             }
@@ -327,7 +331,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     D get(Serializable id) {
         (D) execute({ Session session ->
-            session.retrieve((Class) persistentClass, id)
+            session.retrieve((Class)persistentClass, id)
         } as SessionCallback)
     }
 
@@ -339,7 +343,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     D read(Serializable id) {
         (D) execute({ Session session ->
-            session.retrieve((Class) persistentClass, id)
+            session.retrieve((Class)persistentClass, id)
         } as SessionCallback)
     }
 
@@ -348,7 +352,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     D load(Serializable id) {
         (D) execute({ Session session ->
-            session.proxy((Class) persistentClass, id)
+            session.proxy((Class)persistentClass, id)
         } as SessionCallback)
     }
 
@@ -420,7 +424,8 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
                 InvokerHelper.invokeMethod(criteriaBuilder, 'get', callable)
             } as SessionCallback)
 
-        } else {
+        }
+        else {
             execute({ Session session ->
                 InvokerHelper.invokeMethod(criteriaBuilder, 'list', callable)
             } as SessionCallback)
@@ -435,7 +440,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      */
     D lock(Serializable id) {
         (D) execute({ Session session ->
-            session.lock((Class) persistentClass, id)
+            session.lock((Class)persistentClass, id)
         } as SessionCallback)
     }
 
@@ -745,7 +750,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
             queryMap.each { key, value -> processedQueryMap[key.toString()] = 
value }
             q.allEq(processedQueryMap)
 
-            DynamicFinder.populateArgumentsForCriteria persistentClass, q, args
+            DynamicFinder.populateArgumentsForCriteria(persistentClass, q, 
args)
             q.list()
         } as SessionCallback<List>)
     }
@@ -802,7 +807,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
                 queryMap.each { key, value -> 
processedQueryMap[key.toString()] = value }
                 q.allEq(processedQueryMap)
             }
-            DynamicFinder.populateArgumentsForCriteria persistentClass, q, args
+            DynamicFinder.populateArgumentsForCriteria(persistentClass, q, 
args)
             q.singleResult()
         } as SessionCallback)
     }
@@ -835,9 +840,9 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @param callable the closure
      * @return The result of the closure
      */
-    public <T> T withSession(Closure<T> callable) {
+    <T> T  withSession(Closure<T> callable) {
         execute({ Session session ->
-            callable.call session
+            callable.call(session)
         } as SessionCallback)
     }
 
@@ -847,9 +852,9 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @param callable the closure
      * @return The result of the closure
      */
-    public <T> T withDatastoreSession(Closure<T> callable) {
+    <T> T  withDatastoreSession(Closure<T> callable) {
         execute({ Session session ->
-            callable.call session
+            callable.call(session)
         } as SessionCallback)
     }
 
@@ -863,7 +868,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @see #withNewTransaction(Closure)
      * @see #withNewTransaction(Map, Closure)
      */
-    public <T> T withTransaction(Closure<T> callable) {
+    <T> T withTransaction(Closure<T> callable) {
         withTransaction(new DefaultTransactionDefinition(), callable)
     }
 
@@ -871,9 +876,11 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     def <T> T withTenant(Serializable tenantId, Closure<T> callable) {
         if (multiTenancyMode == MultiTenancyMode.DATABASE) {
             Tenants.withId((Class<Datastore>) 
GormEnhancer.findDatastore(persistentClass, tenantId.toString()).getClass(), 
tenantId, callable)
-        } else if (multiTenancyMode.isSharedConnection()) {
+        }
+        else if (multiTenancyMode.isSharedConnection()) {
             Tenants.withId((Class<Datastore>) 
GormEnhancer.findDatastore(persistentClass, 
ConnectionSource.DEFAULT).getClass(), tenantId, callable)
-        } else {
+        }
+        else {
             throw new UnsupportedOperationException("Method not supported in 
multi tenancy mode $multiTenancyMode")
         }
     }
@@ -881,9 +888,10 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     @Override
     GormAllOperations<D> eachTenant(Closure callable) {
         if (multiTenancyMode != MultiTenancyMode.NONE) {
-            Tenants.eachTenant callable
+            Tenants.eachTenant(callable)
             return this
-        } else {
+        }
+        else {
             throw new UnsupportedOperationException("Method not supported in 
multi tenancy mode $multiTenancyMode")
         }
     }
@@ -892,10 +900,12 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     GormAllOperations<D> withTenant(Serializable tenantId) {
         if (multiTenancyMode == MultiTenancyMode.DATABASE) {
             return GormEnhancer.findStaticApi(persistentClass, 
tenantId.toString())
-        } else if (multiTenancyMode.isSharedConnection()) {
+        }
+        else if (multiTenancyMode.isSharedConnection()) {
             def staticApi = GormEnhancer.findStaticApi(persistentClass, 
ConnectionSource.DEFAULT)
             return new TenantDelegatingGormOperations<D>(datastore, tenantId, 
staticApi)
-        } else {
+        }
+        else {
             throw new UnsupportedOperationException("Method not supported in 
multi tenancy mode $multiTenancyMode")
         }
     }
@@ -908,7 +918,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @see #withTransaction(Map, Closure)
      * @see #withNewTransaction(Map, Closure)
      */
-    public <T> T withNewTransaction(Closure<T> callable) {
+    <T> T  withNewTransaction(Closure<T> callable) {
         withTransaction([propagationBehavior: 
TransactionDefinition.PROPAGATION_REQUIRES_NEW], callable)
     }
 
@@ -935,7 +945,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @see #withNewTransaction(Map, Closure)
      * @see #withTransaction(Closure)
      */
-    public <T> T withTransaction(Map transactionProperties, Closure<T> 
callable) {
+    <T> T  withTransaction(Map transactionProperties, Closure<T> callable) {
         def transactionDefinition = new DefaultTransactionDefinition()
         transactionProperties.each { k, v ->
             if (v instanceof CharSequence && !(v instanceof String)) {
@@ -976,9 +986,9 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @see #withTransaction(Closure)
      * @see #withTransaction(Map, Closure)
      */
-    public <T> T withNewTransaction(Map transactionProperties, Closure<T> 
callable) {
+    <T> T withNewTransaction(Map transactionProperties, Closure<T> callable) {
         def props = new HashMap(transactionProperties)
-        props.remove 'propagationName'
+        props.remove('propagationName')
         props.propagationBehavior = 
TransactionDefinition.PROPAGATION_REQUIRES_NEW
         withTransaction(props, callable)
     }
@@ -989,8 +999,8 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
      * @param callable The closure to call
      * @return The result of the closure execution
      */
-    public <T> T withTransaction(TransactionDefinition definition, Closure<T> 
callable) {
-        Assert.notNull transactionManager, 'No transactionManager bean 
configured'
+    <T> T withTransaction(TransactionDefinition definition, Closure<T> 
callable) {
+        Assert.notNull(transactionManager, 'No transactionManager bean 
configured')
 
         if (!callable) {
             return
@@ -1002,31 +1012,32 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     /**
      * Creates and binds a new session for the scope of the given closure
      */
-    public <T> T withNewSession(Closure<T> callable) {
+    <T> T withNewSession(Closure<T> callable) {
         def session = datastore.connect()
         try {
-            DatastoreUtils.bindNewSession session
+            DatastoreUtils.bindNewSession(session)
             return callable?.call(session)
         }
         finally {
-            DatastoreUtils.unbindSession session
+            DatastoreUtils.unbindSession(session)
         }
     }
 
     /**
      * Creates and binds a new session for the scope of the given closure
      */
-    public <T> T withStatelessSession(Closure<T> callable) {
+    <T> T  withStatelessSession(Closure<T> callable) {
         if (datastore instanceof StatelessDatastore) {
             def session = datastore.connectStateless()
             try {
-                DatastoreUtils.bindNewSession session
+                DatastoreUtils.bindNewSession(session)
                 return callable?.call(session)
             }
             finally {
-                DatastoreUtils.unbindSession session
+                DatastoreUtils.unbindSession(session)
             }
-        } else {
+        }
+        else {
             throw new UnsupportedOperationException('Stateless sessions not 
supported by implementation')
         }
     }
@@ -1053,7 +1064,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     }
 
     @Override
-    List executeQuery(CharSequence query, Object... params) {
+    List executeQuery(CharSequence query, Object...params) {
         executeQuery(query, params.toList(), Collections.emptyMap())
     }
 
@@ -1085,7 +1096,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> 
implements GormAllOperations<D
     }
 
     @Override
-    Integer executeUpdate(CharSequence query, Object... params) {
+    Integer executeUpdate(CharSequence query, Object...params) {
         executeUpdate(query, params.toList(), Collections.emptyMap())
     }
 

Reply via email to