[ 
https://issues.apache.org/jira/browse/GROOVY-11627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17951454#comment-17951454
 ] 

Eric Milles commented on GROOVY-11627:
--------------------------------------

[~blackdrag]  When I run the sample, with a couple small typo fixes, it does 
demonstrate the use of new overload from {{B}}, namely {{B#m(String)}}.  When I 
change this method to private, {{b.m("string")}} still works the same, however 
{{b.dispatch("string")}} changes behavior.  I'm not 100% if that tracks with 
your explanation.  It is a case of implementation detail not being active for 
calls located in super class.

However, I get no warning when doing this, so I don't know if it fits with 
GROOVY-5193 scenarios.  If I lift the check in MetaClassImpl, are we expecting 
that the behavior will change and thus it is a situation that should be flagged?

> Compile Error when private and public functions use same name in compile 
> static mode
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11627
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11627
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation
>    Affects Versions: 5.0.0-alpha-12
>            Reporter: Saravanan
>            Assignee: Eric Milles
>            Priority: Minor
>
> 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
> {quote}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.
> {quote}
> 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
> Per Jochen
> {quote}CompileStatic does not support multi methods, so I totally agree that
> this message should not appear for static compiled classes.
> {quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to