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

STC: unresolved generics for return type of extension method call with full type arguments

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5.14, 3.0.7, 4.0.0-alpha-3
    • 4.0.0-beta-1, 3.0.9
    • Static Type Checker
    • None

    Description

      Consider the following:

      @groovy.transform.TypeChecked
      void test() {
        def list = ['x','y']
        def map = list.<String,Object,String>collectEntries { [it, it.length()] }
      }
      

      The type checker infers Map<K,V> for the type of "map" even though all type arguments are provided to "collectEntries".

          public static <K,V,E> Map<K, V> collectEntries(Iterable<E> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure<?> transform)
      

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            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 - 0.5h
                0.5h