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

Static checker fails on correct code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.4
    • None
    • None

    Description

      Sample project to reproduce attached

      Static checker fails compiling the following code

      import groovy.transform.CompileStatic
      
      import javax.servlet.ServletContext
      import javax.servlet.ServletRegistration
      
      /**
      
       * author: Richard Vowles - http://gplus.to/RichardVowles
       */
      @CompileStatic
      class ServletExample {
      
        public void myMethod(ServletContext ctx) {
          ctx.getServletRegistrations().each { String name, ServletRegistration sr ->
            println name
          }
      
        }
      }
      

      with the message
      Groovyc: [Static type checking] - Cannot call org.codehaus.groovy.runtime.DefaultGroovyMethods#each(java.util.Map <java.lang.String, java.lang.Object extends javax.servlet.ServletRegistration>, groovy.lang.Closure) with arguments [java.util.Map <java.lang.String, java.lang.Object extends javax.servlet.ServletRegistration>, groovy.lang.Closure]

      Attachments

        1. broken.zip
          2 kB
          Maximilian Michels

        Issue Links

          Activity

            People

              melix Cédric Champeau
              mxm-groovy Maxim Medvedev
              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 - 10m
                  10m