Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10587

Groovy resolves wrong annotation type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.10, 4.0.1
    • 4.0.3
    • None
    • None

    Description

      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.

      @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
      

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              melix Cédric Champeau
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m