Re: Error with functions using same name

Jochen Theodorou <[email protected]> Sat, 19 Apr 2025 12:58:43 +0200
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
On 19.04.25 12:32, Saravanan Palanichamy wrote:
> When I define a class in Groovy with 2 methods with the same name, one 
> private and one public, I get this error during static compilation
> 
>     Mixing private and public/protected methods of the same name causes
>     multimethods to be disabled and is forbidden to avoid surprising
>     behaviour. Renaming the private methods will solve the problem.
> 
> 
> I understand the need for multi methods and dispatching with runtime 
> types, but how can I disable this behaviour? I am using @CompileStatic 
> and it still hits this error

CompileStatic does not support multi methods, so I totally agree that 
this message should not appear for static compiled classes.

bye Jochen