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

Improve ClosureParam type hints for various splitEachLine GroovyMethod methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5.0-alpha-1
    • None
    • None

    Description

      Currently, the splitEachLine extension methods in different files have slightly different type hints:

      NioGroovyMethods:        @ClosureParams(value = FromString.class, options = "List<String>")
      StringGroovyMethods:     @ClosureParams(value = FromString.class, options = "List<String>")
      IOGroovyMethods:         @ClosureParams(value = FromString.class, options = "List<String>")
      ResourceGroovyMethods:   @ClosureParams(value=SimpleType.class, options="java.lang.String[]")
      

      The List<String> variant is the best match but the type checker is smart enough to handle some vararg cases too, so the following is actually better:

      @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class)
      

      Attachments

        Activity

          People

            paulk Paul King
            paulk Paul King
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: