<Grails 3.3.10 to 4.0.4 validation problem> I have...
# questions
r
Grails 3.3.10 to 4.0.4 validation problem I have an old project in grails 3.3.10 and try to migrate to 4.0.4 (step by step, finally to 7) I have problem with cmds Caused by: groovy.lang.MissingMethodException: No signature of method: xxx.findConstraintsEvaluator() is applicable for argument types: () values: [] I can not find a solution. I asked AI and it told me to inject GrailsApplication to every Validateable class… there is hundreds of them.. is is this really it? I looked at grails docs and there is no method...
m
You may need to add this annotation to your method: @CompileStatic(TypeCheckingMode.SKIP) my chatgpt spit this out (and was among my suspicions and may have biased the answer). I am aware that as grails moved forward, the static analysis got tighter and eventually if you use the dynamic static methods, you have to tag the methods with this annotation.
Copy code
Short answer: Yes — this happens because Grails 4 tightened static compilation rules, and if this method is being added dynamically (via metaClass, traits, AST transforms, or GORM enhancements), then static compilation can no longer "see" it, so it throws MissingMethodException at compile time instead of runtime.

But that doesn't necessarily mean you must skip static analysis — just that you need to know why it's happening and pick the right fix.

Why This Happens in Grails 4

Grails 3 allowed a lot more "magical" dynamic method resolution, especially from:

GORM dynamic methods

Constraints DSL

AST transforms (e.g., @Validateable)

MetaClass method injection

Grails 4 upgrades Groovy to 2.5 and changes how static compilation (@CompileStatic) works:

➡️ Static compilation no longer recognizes dynamically-added methods.
If something like findConstraintsEvaluator() came from a plugin or metaclass injection, @CompileStatic will complain.

MissingMethodException with no signature found = compiler couldn't see the dynamically injected method.

How to Confirm This Is the Issue

Check the class or method where the exception is coming from:

Is it annotated with @CompileStatic or @CompileStatic(TypeCheckingMode.SKIP)?

Did you recently migrate a class from dynamic Groovy to static Groovy?

Is the method you're calling coming from Grails constraints system, metaclass injection, or a plugin?

If the code worked in Grails 3 but fails in Grails 4 only when static compilation is involved — you've found your culprit.
a
I tried to do this step by step, one dep by one. It’s easier, now I have no problem with Validateable. But..
Copy code
Error: Could not find or load main class grails.plugin.json.view.JsonViewCompiler
I try to set version by version to fit it into 4.0.4
Copy code
jsonViewsVersion=2.0.3
and
Copy code
classpath "org.grails.plugins:views-gradle:$jsonViewsVersion"

...
implementation "org.grails.plugins:views-json:$jsonViewsVersion"
    implementation "org.grails.plugins:views-json-templates:$jsonViewsVersion"
but nothing works. I don’t want to upgrade gradle version now to use 2.1.*. Why I can’t find a version. Is it possible there is a good one…? Don’t think so…