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

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

commit 8bf8ac1be0c65d53889aa307cc088e6b915eb0ba
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Sun Oct 18 18:35:52 2026 -0500

    wip(groovyism): checkpoint uncommitted idiomatic cleanup before merging H7 
stage-2 tip
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
 .../main/groovy/grails/orm/CriteriaMethods.groovy    | 10 +++-------
 .../access/TraitPropertyAccessStrategy.groovy        |  2 +-
 .../column/ColumnConfigToColumnBinder.groovy         |  6 ++++--
 .../cfg/domainbinding/column/IndexBinder.groovy      |  8 ++++----
 .../column/StringColumnConstraintsBinder.groovy      |  2 +-
 .../generator/GrailsIdentityGenerator.groovy         |  2 +-
 .../generator/GrailsIncrementGenerator.groovy        |  2 ++
 .../generator/GrailsNativeGenerator.groovy           | 14 +++++++-------
 .../generator/GrailsSequenceGeneratorEnum.groovy     |  8 ++------
 .../generator/GrailsSequenceStyleGenerator.groovy    | 14 +++++++-------
 .../generator/GrailsTableGenerator.groovy            | 20 +++++++++++---------
 .../hibernate/HibernateAssociation.groovy            |  4 ----
 .../hibernate/HibernateBasicEnumProperty.groovy      |  4 ++--
 .../hibernate/HibernateClassMapping.groovy           |  2 +-
 .../HibernateCompositeIdentityProperty.groovy        |  6 +-----
 .../hibernate/HibernateMappingBuilder.groovy         | 18 ++++++++++--------
 .../hibernate/HibernateOneToOneProperty.groovy       |  4 ++--
 .../hibernate/HibernatePersistentEntity.groovy       |  4 ++--
 .../hibernate/HibernateToManyEntityProperty.groovy   |  2 +-
 .../hibernate/HibernateToManyProperty.groovy         | 18 +++++++++---------
 20 files changed, 71 insertions(+), 79 deletions(-)

diff --git 
a/grails-data-hibernate7/core/src/main/groovy/grails/orm/CriteriaMethods.groovy 
b/grails-data-hibernate7/core/src/main/groovy/grails/orm/CriteriaMethods.groovy
index b5cc6e514c..e367ead934 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/grails/orm/CriteriaMethods.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/grails/orm/CriteriaMethods.groovy
@@ -66,7 +66,7 @@ enum CriteriaMethods {
     SINGLE_RESULT('singleResult'),
     CREATE_ALIAS('createAlias')
 
-    private final String name
+    final String name
 
     CriteriaMethods(String name) {
         this.name = name
@@ -82,7 +82,7 @@ enum CriteriaMethods {
      * @throws groovy.lang.MissingMethodException if the method name is not 
recognized
      */
     static CriteriaMethods fromName(String name, Class<?> targetClass, 
Object... args) {
-        for (CriteriaMethods m : values()) {
+        for (CriteriaMethods m in values()) {
             if (m.name == name) {
                 return m
             }
@@ -99,7 +99,7 @@ enum CriteriaMethods {
      * @return The corresponding CriteriaMethods enum or null if not found
      */
     static CriteriaMethods fromName(String name) {
-        for (CriteriaMethods m : values()) {
+        for (CriteriaMethods m in values()) {
             if (m.name == name) {
                 return m
             }
@@ -107,8 +107,4 @@ enum CriteriaMethods {
         return null
     }
 
-    String getName() {
-        return name
-    }
-
 }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.groovy
index fb0d3ace43..2d0f0b8102 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/access/TraitPropertyAccessStrategy.groovy
@@ -63,7 +63,7 @@ class TraitPropertyAccessStrategy implements 
PropertyAccessStrategy {
                     ReflectionUtils.findMethod(containerJavaType, 
NameUtils.getGetterName(propertyName, true))
             if (booleanReadMethod != null &&
                     (booleanReadMethod.returnType == Boolean ||
-                            booleanReadMethod.returnType == boolean.class)) {
+                            booleanReadMethod.returnType == boolean)) {
                 readMethod = booleanReadMethod
             }
         }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/ColumnConfigToColumnBinder.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/ColumnConfigToColumnBinder.groovy
index 40c78c53aa..f8a7c8bed6 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/ColumnConfigToColumnBinder.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/ColumnConfigToColumnBinder.groovy
@@ -49,10 +49,12 @@ class ColumnConfigToColumnBinder {
             column.scale = columnConfig.scale
         }
         String sqlType = columnConfig.sqlType
-        if (sqlType != null && !sqlType.isEmpty()) {
+        if (sqlType) {
             column.sqlType = sqlType
         }
-        if (mappedForm != null && !mappedForm.isUniqueWithinGroup()) {
+        if (mappedForm != null && !mappedForm.uniqueWithinGroup) {
+            // columnConfig.unique is a bare `def` property; its 
auto-generated getUnique() differs
+            // from isUnique()'s coercion logic (handles non-Boolean values). 
Keep the explicit call.
             column.unique = columnConfig.isUnique()
         }
     }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/IndexBinder.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/IndexBinder.groovy
index db57e6988c..c430b98342 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/IndexBinder.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/IndexBinder.groovy
@@ -38,15 +38,15 @@ class IndexBinder {
         }
         String indexDef
         if (indexObj instanceof Boolean) {
-            if (!((Boolean) indexObj)) {
+            if (!indexObj) {
                 return
             }
-            indexDef = "${table.name}_${columnName}_idx".toString()
+            indexDef = "${table.name}_${columnName}_idx"
         }
         else {
             String indexStr = indexObj.toString()
             if ('true'.equalsIgnoreCase(indexStr)) {
-                indexDef = "${table.name}_${columnName}_idx".toString()
+                indexDef = "${table.name}_${columnName}_idx"
             }
             else if ('false'.equalsIgnoreCase(indexStr)) {
                 return
@@ -56,7 +56,7 @@ class IndexBinder {
             }
         }
         String[] indices = indexDef.split(',')
-        for (String index : indices) {
+        for (String index in indices) {
             table.getOrCreateIndex(index.trim()).addColumn(column)
         }
     }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/StringColumnConstraintsBinder.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/StringColumnConstraintsBinder.groovy
index c30ea64c63..a4cba0053c 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/StringColumnConstraintsBinder.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/column/StringColumnConstraintsBinder.groovy
@@ -59,7 +59,7 @@ class StringColumnConstraintsBinder {
             return Optional.empty()
         }
         Integer max = null
-        for (String value : inList) {
+        for (String value in inList) {
             Integer parsed = parseInt(value)
             if (parsed != null && (max == null || parsed > max)) {
                 max = parsed
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIdentityGenerator.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIdentityGenerator.groovy
index 10cc288101..3462f20d38 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIdentityGenerator.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIdentityGenerator.groovy
@@ -32,7 +32,7 @@ class GrailsIdentityGenerator extends IdentityGenerator {
     GrailsIdentityGenerator(GeneratorCreationContext context, 
HibernateSimpleIdentity mappedId) {
         Properties generatorProps = mappedId?.properties ?: new Properties()
         super.configure(context, generatorProps)
-        context.property.value.columns.get(0).identity = true
+        context.property.value.columns[0].identity = true
     }
 
 }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIncrementGenerator.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIncrementGenerator.groovy
index 8382510dfd..6481cd7041 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIncrementGenerator.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsIncrementGenerator.groovy
@@ -63,6 +63,8 @@ class GrailsIncrementGenerator extends IncrementGenerator {
             params.putAll(mappedIdProps)
         }
 
+        // Properties.putAt() does not resolve statically under @CompileStatic 
(falls back to a dynamic
+        // invokeMethodN call); keep the explicit put() so this stays fully 
statically dispatched.
         params.put(TABLES, domainClass.getTableName(namingStrategy))
         params.put(COLUMN, resolveColumnName(context, mappedId))
 
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsNativeGenerator.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsNativeGenerator.groovy
index dee30906af..7736cdd324 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsNativeGenerator.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsNativeGenerator.groovy
@@ -54,18 +54,18 @@ class GrailsNativeGenerator extends NativeGenerator {
 
     GrailsNativeGenerator(GeneratorCreationContext context, JdbcEnvironment 
jdbcEnvironment) {
         // Picks the delegate for the dialect; for IDENTITY it also calls 
setIdentity(true) on the column.
-        this.initialize(DEFAULT_ANNOTATION, null, context)
-        this.configure(context, new Properties())
+        initialize(DEFAULT_ANNOTATION, null, context)
+        configure(context, new Properties())
 
         Database database = context.database
-        this.registerExportables(database)
+        registerExportables(database)
 
         def physicalName = database.defaultNamespace.physicalName
-        String catalog = physicalName.catalog() != null ? 
physicalName.catalog().canonicalName : null
-        String schema = physicalName.schema() != null ? 
physicalName.schema().canonicalName : null
+        String catalog = physicalName.catalog()?.canonicalName
+        String schema = physicalName.schema()?.canonicalName
         SqlStringGenerationContext sqlContext =
                 SqlStringGenerationContextImpl.fromExplicit(jdbcEnvironment, 
database, catalog, schema)
-        this.initialize(sqlContext)
+        initialize(sqlContext)
     }
 
     @Override
@@ -79,7 +79,7 @@ class GrailsNativeGenerator extends NativeGenerator {
         // 2. Fix the Hibernate 7 ClassCastException
         // NativeGenerator.generate() tries to cast the delegate to 
BeforeExecutionGenerator.
         // If the dialect chose IDENTITY, that cast fails. We bypass it by 
returning null.
-        if (this.generationType == GenerationType.IDENTITY) {
+        if (generationType == GenerationType.IDENTITY) {
             return null
         }
 
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceGeneratorEnum.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceGeneratorEnum.groovy
index abadab9d78..ae03bbcd32 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceGeneratorEnum.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceGeneratorEnum.groovy
@@ -49,16 +49,12 @@ enum GrailsSequenceGeneratorEnum {
     HILO('hilo'),
     NATIVE('native')
 
-    private final String name
+    final String name
 
     GrailsSequenceGeneratorEnum(String name) {
         this.name = name
     }
 
-    String getName() {
-        return name
-    }
-
     @Override
     String toString() {
         return name
@@ -93,7 +89,7 @@ enum GrailsSequenceGeneratorEnum {
             case INCREMENT:
                 return new GrailsIncrementGenerator(context, mappedId, 
domainClass, namingStrategy)
             case [UUID, UUID2]:
-                return new UuidGenerator(context.getType().getReturnedClass())
+                return new UuidGenerator(context.type.returnedClass)
             case ASSIGNED:
                 return new Assigned()
             case [TABLE, ENHANCED_TABLE]:
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceStyleGenerator.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceStyleGenerator.groovy
index 4a5ce16eff..72a255a965 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceStyleGenerator.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsSequenceStyleGenerator.groovy
@@ -51,23 +51,23 @@ class GrailsSequenceStyleGenerator extends 
SequenceStyleGenerator {
             generatorProps.putIfAbsent(PersistentIdentifierGenerator.TABLE, 
context.rootClass.table.name)
         }
 
-        this.configure(context, generatorProps)
+        configure(context, generatorProps)
 
         if (jdbcEnvironment != null) {
             def database = context.database
             if (databaseStructure != null) {
-                this.registerExportables(database)
+                registerExportables(database)
             }
 
             def physicalName = database.defaultNamespace.physicalName
 
-            String catalog = physicalName.catalog() != null ? 
physicalName.catalog().canonicalName : null
-            String schema = physicalName.schema() != null ? 
physicalName.schema().canonicalName : null
+            String catalog = physicalName.catalog()?.canonicalName
+            String schema = physicalName.schema()?.canonicalName
 
             if (databaseStructure != null) {
                 SqlStringGenerationContext sqlContext =
                         
SqlStringGenerationContextImpl.fromExplicit(jdbcEnvironment, database, catalog, 
schema)
-                this.initialize(sqlContext)
+                initialize(sqlContext)
             }
         }
     }
@@ -78,9 +78,9 @@ class GrailsSequenceStyleGenerator extends 
SequenceStyleGenerator {
      * at all. Anything the generator would treat as unnamed still needs the 
target table to derive one.
      */
     private static boolean hasExplicitSequenceName(Properties generatorProps) {
-        Object sequenceName = generatorProps.get(SEQUENCE_PARAM)
+        Object sequenceName = generatorProps[SEQUENCE_PARAM]
         if (sequenceName == null) {
-            sequenceName = generatorProps.get(ALT_SEQUENCE_PARAM)
+            sequenceName = generatorProps[ALT_SEQUENCE_PARAM]
         }
         return sequenceName != null && !sequenceName.toString().isEmpty()
     }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsTableGenerator.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsTableGenerator.groovy
index c7f0658d49..69fe56dafb 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsTableGenerator.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/generator/GrailsTableGenerator.groovy
@@ -37,41 +37,43 @@ class GrailsTableGenerator extends TableGenerator {
     GrailsTableGenerator(GeneratorCreationContext context, 
HibernateSimpleIdentity mappedId, JdbcEnvironment jdbcEnvironment) {
         Properties generatorProps = mappedId?.properties ?: new Properties()
 
-        if (!generatorProps.containsKey(SEGMENT_VALUE_PARAM)) {
+        if (!(SEGMENT_VALUE_PARAM in generatorProps)) {
             String propertyName = context.property.name
 
             // Use the name we just ensured exists in BasicValueCreator
-            String entityName = (mappedId != null && mappedId.name != null) ? 
mappedId.name : DEFAULT_ENTITY_NAME
+            String entityName = mappedId?.name != null ? mappedId.name : 
DEFAULT_ENTITY_NAME
 
+            // Properties.putAt() does not resolve statically under 
@CompileStatic (falls back to a
+            // dynamic invokeMethodN call); keep the explicit put() so this 
stays fully statically dispatched.
             generatorProps.put(SEGMENT_VALUE_PARAM, entityName + '.' + 
propertyName)
         }
 
         // Standard Pooled-lo defaults
-        if (!generatorProps.containsKey(INCREMENT_PARAM)) {
+        if (!(INCREMENT_PARAM in generatorProps)) {
             generatorProps.put(INCREMENT_PARAM, '50')
         }
-        if (!generatorProps.containsKey(OPT_PARAM)) {
+        if (!(OPT_PARAM in generatorProps)) {
             generatorProps.put(OPT_PARAM, 'pooled-lo')
         }
 
         // Fixes the "SQL to format should not be null" error
-        this.configure(context, generatorProps)
+        configure(context, generatorProps)
         def database = context.database
 
-        this.registerExportables(database)
+        registerExportables(database)
         // Get the Name record from the physical name
         def physicalName = database.defaultNamespace.physicalName
 
         // Use the record component accessors (catalog() and schema())
         // instead of the deprecated getCatalog()/getSchema()
-        String catalog = physicalName.catalog() != null ? 
physicalName.catalog().canonicalName : null
+        String catalog = physicalName.catalog()?.canonicalName
 
-        String schema = physicalName.schema() != null ? 
physicalName.schema().canonicalName : null
+        String schema = physicalName.schema()?.canonicalName
 
         // Build the context and initialize templates
         SqlStringGenerationContext context1 =
                 SqlStringGenerationContextImpl.fromExplicit(jdbcEnvironment, 
database, catalog, schema)
-        this.initialize(context1)
+        initialize(context1)
     }
 
 }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.groovy
index 809f9663a4..d4fe79e92d 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.groovy
@@ -41,8 +41,6 @@ import org.grails.orm.hibernate.cfg.PropertyConfig
 @CompileStatic
 interface HibernateAssociation extends HibernatePersistentProperty {
 
-    // --- Association contract (satisfied by the class hierarchy of all 
implementors) ---
-
     PersistentProperty<?> getInverseSide()
 
     PersistentEntity getAssociatedEntity()
@@ -63,8 +61,6 @@ interface HibernateAssociation extends 
HibernatePersistentProperty {
         return true
     }
 
-    // --- Hibernate-typed overrides, removing instanceof guards ---
-
     /** Returns the inverse side as a {@link HibernateAssociation}, 
eliminating cast at call sites. */
     @Override
     default HibernateAssociation getHibernateInverseSide() {
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateBasicEnumProperty.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateBasicEnumProperty.groovy
index 820665faea..7bad1eee55 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateBasicEnumProperty.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateBasicEnumProperty.groovy
@@ -75,8 +75,8 @@ class HibernateBasicEnumProperty extends 
HibernateBasicProperty implements Hiber
     @Override
     Table getTable() {
         Collection collection = hibernateCollection
-        Table collectionTable = collection != null ? 
collection.collectionTable : null
-        return collectionTable != null ? collectionTable : 
persistentClass.table
+        Table collectionTable = collection?.collectionTable
+        return collectionTable ?: persistentClass.table
     }
 
 }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateClassMapping.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateClassMapping.groovy
index b1f3bd47c4..9ba1623202 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateClassMapping.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateClassMapping.groovy
@@ -40,7 +40,7 @@ class HibernateClassMapping extends 
AbstractClassMapping<Mapping> {
     HibernateClassMapping(PersistentEntity entity, MappingContext context) {
         super(entity, context)
         this.mappedForm = (Mapping) 
context.mappingFactory.createMappedForm(entity)
-        for (PropertyConfig propConf : mappedForm.propertyConfigs.values()) {
+        for (PropertyConfig propConf in mappedForm.propertyConfigs.values()) {
             if (propConf != null && propConf.cascade != null) {
                 propConf.explicitSaveUpdateCascade = 
CascadeBehavior.isSaveUpdate(propConf.cascade)
             }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateCompositeIdentityProperty.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateCompositeIdentityProperty.groovy
index fee91ad02b..eb192ef731 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateCompositeIdentityProperty.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateCompositeIdentityProperty.groovy
@@ -28,7 +28,7 @@ import java.beans.PropertyDescriptor
 @CompileStatic
 class HibernateCompositeIdentityProperty extends HibernateIdentityProperty {
 
-    private final HibernatePersistentProperty[] parts
+    final HibernatePersistentProperty[] parts
 
     HibernateCompositeIdentityProperty(PersistentEntity entity, MappingContext 
context, PropertyDescriptor property) {
         super(entity, context, property)
@@ -46,8 +46,4 @@ class HibernateCompositeIdentityProperty extends 
HibernateIdentityProperty {
         this.parts = parts != null ? parts : new HibernatePersistentProperty[0]
     }
 
-    HibernatePersistentProperty[] getParts() {
-        return parts
-    }
-
 }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
index c33ffd4918..ee3d35fc1d 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateMappingBuilder.groovy
@@ -302,13 +302,13 @@ class HibernateMappingBuilder implements 
MappingConfigurationBuilder<Mapping, Pr
      */
     protected void handlePropertyInternal(String name, Map<String, Object> 
namedArgs, Closure subClosure) {
         PropertyConfig newConfig = new PropertyConfig()
-        if (defaultConstraints != null && namedArgs.containsKey('shared')) {
-            PropertyConfig sharedConstraints = 
mapping.columns.get(namedArgs.shared.toString())
+        if (defaultConstraints != null && 'shared' in namedArgs) {
+            PropertyConfig sharedConstraints = 
mapping.columns[namedArgs.shared.toString()]
             if (sharedConstraints != null) {
                 newConfig = (PropertyConfig) sharedConstraints.clone()
             }
-        } else if (mapping.columns.containsKey('*')) {
-            PropertyConfig globalConstraints = mapping.columns.get('*')
+        } else if ('*' in mapping.columns) {
+            PropertyConfig globalConstraints = mapping.columns['*']
             if (globalConstraints != null) {
                 newConfig = (PropertyConfig) globalConstraints.clone()
             }
@@ -343,6 +343,8 @@ class HibernateMappingBuilder implements 
MappingConfigurationBuilder<Mapping, Pr
         if (namedArgs.ignoreNotFound instanceof Boolean) 
property.ignoreNotFound = (Boolean) namedArgs.ignoreNotFound
         if (namedArgs.params instanceof Map) {
             Properties typeProps = new Properties()
+            // Properties.putAt() does not resolve statically under 
@CompileStatic (falls back to a
+            // dynamic invokeMethodN call); keep the explicit put() so this 
stays fully statically dispatched.
             ((Map<Object, Object>) namedArgs.params).each { Object k, Object v 
-> typeProps.put(k, v) }
             property.typeParams = typeProps
         }
@@ -471,8 +473,8 @@ class HibernateMappingBuilder implements 
MappingConfigurationBuilder<Mapping, Pr
     }
 
     void methodMissing(String name, Object args) {
-        if (methodMissingIncludes != null && 
!methodMissingIncludes.contains(name)) return
-        if (methodMissingExcludes.contains(name)) return
+        if (methodMissingIncludes != null && !(name in methodMissingIncludes)) 
return
+        if (name in methodMissingExcludes) return
 
         Object[] argsArray = (Object[]) args
         int argc = argsArray.length
@@ -492,8 +494,8 @@ class HibernateMappingBuilder implements 
MappingConfigurationBuilder<Mapping, Pr
                 try {
                     if (lastArg instanceof Map) {
                         Map<String, Object> argMap = (Map<String, Object>) 
lastArg
-                        Object includes = argMap.get(INCLUDE_PARAM)
-                        Object excludes = argMap.get(EXCLUDE_PARAM)
+                        Object includes = argMap[INCLUDE_PARAM]
+                        Object excludes = argMap[EXCLUDE_PARAM]
                         if (includes instanceof List) methodMissingIncludes = 
(List<String>) includes
                         if (excludes instanceof List) methodMissingExcludes = 
(List<String>) excludes
                     }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateOneToOneProperty.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateOneToOneProperty.groovy
index eaf970d28f..728c83874c 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateOneToOneProperty.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateOneToOneProperty.groovy
@@ -80,7 +80,7 @@ class HibernateOneToOneProperty extends 
OneToOneWithMapping<PropertyConfig> impl
      */
     String getHibernateReferencedPropertyName() {
         HibernateOneToOneProperty otherSide = hibernateInverseSide
-        return otherSide != null ? otherSide.name : null
+        return otherSide?.name
     }
 
     /** FK direction: FROM_PARENT when constrained (hasOne on other side), 
TO_PARENT otherwise. */
@@ -91,7 +91,7 @@ class HibernateOneToOneProperty extends 
OneToOneWithMapping<PropertyConfig> impl
     /** Resolved fetch mode: uses the configured value or falls back to {@link 
FetchMode#DEFAULT}. */
     FetchMode getHibernateFetchMode() {
         PropertyConfig config = hibernateMappedForm
-        return (config != null && config.fetchMode != null) ? config.fetchMode 
: FetchMode.DEFAULT
+        return config?.fetchMode ?: FetchMode.DEFAULT
     }
 
     /**
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernatePersistentEntity.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernatePersistentEntity.groovy
index 3592391417..492de6d359 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernatePersistentEntity.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernatePersistentEntity.groovy
@@ -112,7 +112,7 @@ class HibernatePersistentEntity extends 
AbstractPersistentEntity<Mapping> implem
 
     @Override
     boolean forGrailsDomainMapping(String dataSourceName) {
-        return !isAnnotatedEntity() && usesConnectionSource(dataSourceName) && 
isRoot()
+        return !annotatedEntity && usesConnectionSource(dataSourceName) && root
     }
 
     @Override
@@ -138,7 +138,7 @@ class HibernatePersistentEntity extends 
AbstractPersistentEntity<Mapping> implem
         if (hibernateIdentity instanceof HibernateSimpleIdentity) {
             HibernateSimpleIdentity simpleIdentity = (HibernateSimpleIdentity) 
hibernateIdentity
             Mapping result = hibernateMappedForm
-            boolean useSequence = result != null && 
result.isTablePerConcreteClass()
+            boolean useSequence = result?.isTablePerConcreteClass() ?: false
             return simpleIdentity.determineGeneratorName(useSequence)
         }
         throw new MappingException('Simple Identity expected')
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyEntityProperty.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyEntityProperty.groovy
index 2da567cd06..737a23cb07 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyEntityProperty.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyEntityProperty.groovy
@@ -32,7 +32,7 @@ interface HibernateToManyEntityProperty extends 
HibernateToManyProperty {
     HibernatePersistentEntity getHibernateAssociatedEntity()
 
     default PersistentClass getAssociatedClass() {
-        PersistentClass associatedClass = 
getHibernateAssociatedEntity().persistentClass
+        PersistentClass associatedClass = 
hibernateAssociatedEntity.persistentClass
         if (associatedClass == null) {
             throw new MappingException("Association [${name}] has no 
associated class")
         }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyProperty.groovy
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyProperty.groovy
index 4c83774133..ca62323c18 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyProperty.groovy
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateToManyProperty.groovy
@@ -94,7 +94,7 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
         PropertyConfig mapped = hibernateMappedForm
         CacheConfig cache = mapped?.cache
         Object usage = cache?.usage
-        return usage != null ? usage.toString() : null
+        return usage?.toString()
     }
 
     default boolean isBasic() {
@@ -172,7 +172,7 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
         if (mapped != null && mapped.indexColumn != null) {
             PropertyConfig indexColConfig = mapped.indexColumn
             if (!indexColConfig.columns.isEmpty()) {
-                String name = indexColConfig.columns.get(0).name
+                String name = indexColConfig.columns[0].name
                 if (StringUtils.hasText(name)) {
                     return name
                 }
@@ -185,12 +185,12 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
                     IndexedCollection.DEFAULT_INDEX_COLUMN_NAME
         }
 
-        ColumnConfig primaryCol = mapped.columns.get(0)
+        ColumnConfig primaryCol = mapped.columns[0]
         Object rawIndex = primaryCol.index
         if (rawIndex instanceof groovy.lang.Closure) {
             PropertyConfig indexColConfig = 
PropertyConfig.configureNew((groovy.lang.Closure<?>) rawIndex)
             if (!indexColConfig.columns.isEmpty()) {
-                String name = indexColConfig.columns.get(0).name
+                String name = indexColConfig.columns[0].name
                 if (StringUtils.hasText(name)) {
                     return name
                 }
@@ -199,7 +199,7 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
 
         try {
             Map<String, String> indexMap = primaryCol.indexAsMap
-            String colName = indexMap.get('column')
+            String colName = indexMap['column']
 
             if (StringUtils.hasText(colName)) {
                 return colName
@@ -226,7 +226,7 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
             return defaultType
         }
 
-        ColumnConfig primaryCol = mapped.columns.get(0)
+        ColumnConfig primaryCol = mapped.columns[0]
         Object rawIndex = primaryCol.index
         if (rawIndex instanceof groovy.lang.Closure) {
             PropertyConfig indexColConfig = 
PropertyConfig.configureNew((groovy.lang.Closure<?>) rawIndex)
@@ -237,7 +237,7 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
 
         try {
             Map<String, String> indexMap = primaryCol.indexAsMap
-            String typeName = indexMap.get('type')
+            String typeName = indexMap['type']
 
             if (StringUtils.hasText(typeName)) {
                 return typeName
@@ -312,13 +312,13 @@ interface HibernateToManyProperty extends 
PropertyWithMapping<PropertyConfig>, H
     @NonNull
     default Optional<ColumnConfig> getColumnConfigOptional() {
         PropertyConfig mapped = hibernateMappedForm
-        return Optional.ofNullable(mapped != null ? 
mapped.joinTableColumnConfig : null)
+        return Optional.ofNullable(mapped?.joinTableColumnConfig)
     }
 
     @Override
     default boolean isEnum() {
         Class<?> compType = componentType
-        return compType != null && compType.isEnum()
+        return compType?.isEnum() ?: false
     }
 
     /**

Reply via email to