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

Eric Milles commented on GROOVY-10587:
--------------------------------------

GROOVY-8063 is one part of this issue.  Type annotations are using the scope of 
the type they are attached to.  This is different from Java scope rules.  With 
that in mind, the first thing checked for is if the annotated type or one of 
its superclasses or superinterfaces declares an inner class that matches the 
annotation type name.

In this case, {{TestClient}} implements {{Api.Client}} and {{Api}}.  {{Api}} 
declares an inner class with the name {{Client}} and so the resolution of an 
inner type is satisfied.

> Groovy resolves wrong annotation type
> -------------------------------------
>
>                 Key: GROOVY-10587
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10587
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.10, 4.0.1
>            Reporter: Cédric Champeau
>            Assignee: Eric Milles
>            Priority: Major
>
> The issue was initially reported in Micronaut, but it turns out to be a bug 
> in Groovy: [https://github.com/micronaut-projects/micronaut-core/issues/7189]
> The problem is Groovy incorrectly resolving the @Client annotation on the 
> TestClient interface to the inner interface instead of the imported 
> annotation.
> The code below illustrates the bug. It fails to compile.
> {code:java}
> @Grab("io.micronaut:micronaut-http-client-core")
> import io.micronaut.http.client.annotation.Client
> class Application {
>     static interface Api {
>          static interface Client extends Api {}
>     }
>     
>     @Client("/")
>     static interface TestClient extends Api.Client {}
> }
> println Application.TestClient.annotations
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to