[ 
https://issues.apache.org/jira/browse/GROOVY-11820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles reassigned GROOVY-11820:
------------------------------------

    Language: groovy
    Assignee: Eric Milles

> Overwriting a getter method in a supertype via category results in 
> inconsistent property / getter behavior
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11820
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11820
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.23, 3.0.25, 4.0.29, 5.0.3
>            Reporter: Björn Kautler
>            Assignee: Eric Milles
>            Priority: Major
>
> If you [execute 
> this|https://groovyconsole.dev/?g=groovy_4_0&codez=eNqlj8EOgjAMhu97it4Yl72BidGEqwd9gQnbAhmMbNWEGN7dboIQ9GBiL8u-5v_a1m3vPEIj71JY2RnhlbaqRFHUylaM7Y8SlXF-4AnkrLQyBCicgwcDqjP6ujNgFF6GXvF8wrEyHSOAxEF718ZUlrojG1fm07WhibP6IP0PapcyKzfFFjerlIbX9N2kEekb6PEBec56gmg7nrCIni17z10aObsFxemMeZdvlk--Mo0bF639h-sJdk-N3A]:
> {code:groovy}import java.lang.reflect.Field
> @Category(Field)
> class Foo {
>     String getType() {
>         'field type from Foo'
>     }
> }
> @Category(Object)
> class Bar {
>     String getType() {
>         'object type from Bar'
>     }
> }
> def field = String.fields.first()
> println(field.type)
> println(field.getType())
> println()
> use(Foo) {
>     println(field.type)
>     println(field.getType())
> }
> println()
> use(Bar) {
>     println(field.type)
>     println(field.getType())
> }
> {code}
> The result is
> {code:none}interface java.util.Comparator
> interface java.util.Comparator
> field type from Foo
> field type from Foo
> object type from Bar
> interface java.util.Comparator{code}
>  
> Do I need to say any more? :-)



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

Reply via email to