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

Type checker doesn't find the inject method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.5
    • 2.2.2
    • Static Type Checker
    • None

    Description

      For some reason, in the following code, the inject method is not recognized by the type checker:

      @groovy.transform.TypeChecked
      def foo() {
          [milk: [1,1.0], croissant:[4,0.85]].inject(0) { int sum, Map.Entry<String,List> entry -> 
              List<? extends Number> v = entry.value
              sum += v[0]*v[1]
              sum 
          }
      }
      
      foo()
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: