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

Type checker doesn't find the inject method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.5
    • Fix Version/s: 2.2.2
    • Component/s: Static Type Checker
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: