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

possible bug when applying static typing to AIC referencing an outer local variable

    Details

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

      Description

      compiling this code:

      @groovy.transform.TypeChecked
      def foo() {
          List things = []
          Serializable s = new Serializable() {
            def size() {
              things.size()
            }
          }
          s.size()
      }
      
      println foo()
      

      yields this error:

      [Static type checking] - Cannot find matching method ConsoleScript51$1#<init>(ConsoleScript51, java.util.List)
       at line: 4, column: 22
      

      If you make the things list be something more specific, e.g. ['a', 'b'], then the error message becomes more specific:

      [Static type checking] - Cannot find matching method ConsoleScript54$1#<init>(ConsoleScript54, java.util.List <java.lang.String>)
       at line: 4, column: 22
      

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              paulk Paul King
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: