You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/06/03 17:02:00 UTC

[jira] [Commented] (GROOVY-5453) Incorrect resolve of category property for String

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

Eric Milles commented on GROOVY-5453:
-------------------------------------

{{groovy.lang.MetaClassImpl#getCategoryMethodGetter}} and {{groovy.lang.MetaClassImpl#getCategoryMethodSetter}} are where the selection is made.

> Incorrect resolve of category property for String
> -------------------------------------------------
>
>                 Key: GROOVY-5453
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5453
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.0-rc-1
>            Reporter: Maxim Medvedev
>            Priority: Major
>
> Assume you have two category methods with String and CharSequence as first parameters respectively. The bug is that Groovy prefers the 'CharSequence' method for String qualifier. 
> The bug is reproduced only for String and CharSequence types.
> Direct accessor invoking returns correct result.
> {code}
> class Cat {
>   static getFoo(String s) {'String'}
>   static getFoo(CharSequence s) {'CharSequence'}
> }
> use (Cat) {
>   assert 'abc'.getFoo() == 'String'   //works
>   assert 'abc'.foo      == 'String'   //fails
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)