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

ASF GitHub Bot commented on GROOVY-8788:
----------------------------------------

eric-milles opened a new pull request, #1768:
URL: https://github.com/apache/groovy/pull/1768

   Given choice between methods m(String,Object) and m(Object,String), prefer 
closer parameter matching. This aligns with the method selection of the dynamic 
runtime.  There is much more discussion of the various test cases in the ticket.
   
   With proper selection of `getAt(Object,String)` over `getAt(Map,Object)` and 
`putAt(Object,String,Object)` over `putAt(Map,K,V)` there are quite a few STC 
test issues.  Not sure if I should separate them out to a test script just for 
8788 or mitigate them with some minor changes or something else.  I'd be 
interested to hear how this sits now.  @blackdrag @paulk-asert 
   
   https://issues.apache.org/jira/browse/GROOVY-8788
   
   https://issues.apache.org/jira/browse/GROOVY-6504
   https://issues.apache.org/jira/browse/GROOVY-6849
   https://issues.apache.org/jira/browse/GROOVY-6970
   https://issues.apache.org/jira/browse/GROOVY-8787
   https://issues.apache.org/jira/browse/GROOVY-9069
   https://issues.apache.org/jira/browse/GROOVY-9420




> Inconsistency in extension method selection with @CompileStatic
> ---------------------------------------------------------------
>
>                 Key: GROOVY-8788
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8788
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.4.15, 2.5.2
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: breaking
>
> Given properly registered extension class:
> {code:java|title=MyExtensions.java}
> public class MyExtensions {
>     public static void foo(Object self, String s) {
>         System.out.println("Object#foo(String)");
>     }
>     public static void foo(String self, Object o) {
>         System.out.println("String#foo(Object)");
>     }
> }
> {code}
> Run
> {code:java|title=playground.groovy}
> void usageExt() {
>     "".foo("") // prints "Object#foo(String)" which is correct
> }
> @groovy.transform.CompileStatic
> void usageExtStatic() {
>     "".foo("") // prints "String#foo(Object)" which is questionable
> }
> usageExt()
> usageExtStatic()
> {code}



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

Reply via email to