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

matrei pushed a commit to branch grails8-groovy5-sb4
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/grails8-groovy5-sb4 by this 
push:
     new 93f72958e3 refactor: use idiomatic Groovy for map initialization
93f72958e3 is described below

commit 93f72958e381e9776a11c122a9a27cf3819f470a
Author: Mattias Reichel <[email protected]>
AuthorDate: Sat Jun 13 00:12:16 2026 +0200

    refactor: use idiomatic Groovy for map initialization
---
 .../main/groovy/grails/gorm/validation/ConstrainedProperty.groovy   | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/grails-datamapping-validation/src/main/groovy/grails/gorm/validation/ConstrainedProperty.groovy
 
b/grails-datamapping-validation/src/main/groovy/grails/gorm/validation/ConstrainedProperty.groovy
index 2bd19c04fd..5e9e5a5065 100644
--- 
a/grails-datamapping-validation/src/main/groovy/grails/gorm/validation/ConstrainedProperty.groovy
+++ 
b/grails-datamapping-validation/src/main/groovy/grails/gorm/validation/ConstrainedProperty.groovy
@@ -68,9 +68,7 @@ interface ConstrainedProperty extends Constrained {
     String DEFAULT_INVALID_VALIDATOR_MESSAGE = 
MESSAGE_BUNDLE.getString(DEFAULT_INVALID_VALIDATOR_MESSAGE_CODE)
     String DEFAULT_NOT_UNIQUE_MESSAGE = 
MESSAGE_BUNDLE.getString(DEFAULT_NOT_UNIQUE_MESSAGE_CODE)
 
-    // GROOVY-12063: build from a Groovy map literal first so DEFAULT_* 
constants resolve against the interface scope,
-    // then copy to an immutable HashMap-backed map.
-    Map<String, String> DEFAULT_MESSAGES = Collections.unmodifiableMap(new 
HashMap<String, String>([
+    Map<String, String> DEFAULT_MESSAGES = [
             (DEFAULT_BLANK_MESSAGE_CODE): DEFAULT_BLANK_MESSAGE,
             (DEFAULT_DOESNT_MATCH_MESSAGE_CODE): DEFAULT_DOESNT_MATCH_MESSAGE,
             (DEFAULT_INVALID_CREDIT_CARD_MESSAGE_CODE): 
DEFAULT_INVALID_CREDIT_CARD_MESSAGE,
@@ -87,7 +85,7 @@ interface ConstrainedProperty extends Constrained {
             (DEFAULT_NULL_MESSAGE_CODE): DEFAULT_NULL_MESSAGE,
             (DEFAULT_INVALID_VALIDATOR_MESSAGE_CODE): 
DEFAULT_INVALID_VALIDATOR_MESSAGE,
             (DEFAULT_NOT_UNIQUE_MESSAGE_CODE): DEFAULT_NOT_UNIQUE_MESSAGE
-    ]))
+    ].asUnmodifiable()
 
     String CREDIT_CARD_CONSTRAINT = 'creditCard'
     String EMAIL_CONSTRAINT = 'email'

Reply via email to