Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5989 Inner Class Issues
  3. GROOVY-6373

'log' field introduced via @Slf4j not accessible in inner class of @CompileStatic class

    XMLWordPrintableJSON

Details

    Description

      @groovy.transform.CompileStatic
      @groovy.util.logging.Slf4j
      class Foo {
        static class Bar {
          void method() {
            log.info('some info')
          }
        }
      }
      
      new Foo.Bar().method()
      

      produces the compilation error

      [Static type checking] - The variable [log] is undeclared.
       at line: 6, column: 7
      

      But works perfectly fine without the @CompileStatic. Additionally, the inner class can be either static or non-static and the same compilation error occurs.

      Attachments

        Activity

          People

            paulk Paul King
            acourtneybrown Adam Brown
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: