You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2026/04/05 19:23:22 UTC
(grails-core) branch grails8-groovy6-canary updated: fix: Groovy 6 VerifyError in DefaultConstraintFactory default parameter
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a commit to branch grails8-groovy6-canary
in repository https://gitbox.apache.org/repos/asf/grails-core.git
The following commit(s) were added to refs/heads/grails8-groovy6-canary by this push:
new 4463494356 fix: Groovy 6 VerifyError in DefaultConstraintFactory default parameter
4463494356 is described below
commit 44634943564173bdf52086a62dd029c78b819aab
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Sun Apr 5 15:23:06 2026 -0400
fix: Groovy 6 VerifyError in DefaultConstraintFactory default parameter
Groovy 6.0.0-SNAPSHOT generates invalid bytecode for constructors that
use a default-valued List parameter inside @CompileStatic classes.
Decompiled stack frames show Object where ArrayList is expected:
Type 'java/lang/Object' (current frame, stack[4]) is not assignable
to 'java/util/ArrayList'
at DefaultConstraintFactory.<init>(Class, MessageSource):V
This breaks every validateable. At runtime VerifyError is raised the
first time the default-parameter overload is constructed, which cascades
into Validateable.validate(), grails-datastore-core bean wiring, and
any test that exercises constraints.
Workaround: replace the default-parameter signature with two explicit
constructors (the 2-arg one delegates to the 3-arg one with
[Object.class] as List<Class>). This is compilation-compatible - users
were already allowed to construct with or without the targetTypes arg.
---
.../validation/constraints/factory/DefaultConstraintFactory.groovy | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/grails-datamapping-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/factory/DefaultConstraintFactory.groovy b/grails-datamapping-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/factory/DefaultConstraintFactory.groovy
index 001acf048f..88e4178820 100644
--- a/grails-datamapping-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/factory/DefaultConstraintFactory.groovy
+++ b/grails-datamapping-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/factory/DefaultConstraintFactory.groovy
@@ -47,7 +47,11 @@ class DefaultConstraintFactory implements ConstraintFactory {
protected final Constructor constraintConstructor
- DefaultConstraintFactory(Class<? extends Constraint> constraintClass, MessageSource messageSource, List<Class> targetTypes = [Object]) {
+ DefaultConstraintFactory(Class<? extends Constraint> constraintClass, MessageSource messageSource) {
+ this(constraintClass, messageSource, [Object.class] as List<Class>)
+ }
+
+ DefaultConstraintFactory(Class<? extends Constraint> constraintClass, MessageSource messageSource, List<Class> targetTypes) {
this.type = constraintClass
this.name = Introspector.decapitalize(constraintClass.simpleName) - 'Constraint'
this.messageSource = messageSource