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

Types not inferred correctly for static fields

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: Static compilation
    • Labels:
      None

      Description

      Example:

      import org.apache.commons.logging.LogFactory
      
      class Foo {
          private static final LOG = LogFactory.getLog(this)
          
          @groovy.transform.CompileStatic
          static foo() {
              def bar = 1
              LOG.debug "number is $bar"
          }
      }
      

      Produces

      [Static type checking] - Cannot find matching method java.lang.Object#debug(groovy.lang.GString)
       at line: 9, column: 9
      

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              graemerocher Graeme Rocher
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: