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

IncompatibleClassChangeError when using @Slf4j (on inner class) with @CompileStatic

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.7
    • 2.4.0-beta-3
    • Compiler
    • None

    Description

      Getting this error:

      java.lang.IncompatibleClassChangeError: Class co.e.Outer does not implement the requested interface org.slf4j.Logger
      	at co.e.Outer$Inner.myMethod(Outer.groovy:19)
      	at co.e.Outer.doSomething(Outer.groovy:13)
      	at co.e.Outer$doSomething.call(Unknown Source)
      

      when running the following code:

      package co.e
      
      @CompileStatic
      @Slf4j
      class Outer {
      
        void run() {
          def m = [:]
          log.info(m.toString())
          new Inner().myMethod(m)
        }
      
        @Slf4j
        private class Inner {
          void myMethod(Map m) {
            log.info(m.toString()) // fails here
          }
        }
      }
      

      It runs fine if I remove the @CompileStatic

      Attachments

        Activity

          People

            pschumacher Pascal Schumacher
            eman Emanuel Alasu
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: