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

Static method call within trait is not transformed properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0-beta-2
    • 2.3.0-rc-1
    • None
    • None

    Description

      In the following example, the LOGGER receiver in the info method of the trait doesn't delegate to the class receiver, leading to a runtime error.

      import java.util.logging.Logger
      
                  trait Loggable {
      
                      static def LOGGER = Logger.getLogger(this.class.name)
      
                      void info(String msg) {
                          LOGGER.info(msg)
                      }
                  }
      
                  class Test implements Loggable {}
      
                  def t = new Test()
                  t.info('foo')
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: