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

Better signature for ResourceGroovyMethods.traverse(File, Map<String, Object>, Closure) (and overloadings)

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.8
    • Fix Version/s: 3.0.0-rc-1
    • Component/s: groovy-jdk
    • Labels:
      None

      Description

      When you try to perform the following invocation in a statically checked/compile Groovy class you'll get a compilation error:

      myFolder.traverse([
      			type: FileType.FILES,
      			nameFilter: ~/.*\.(?i)pdf/
      		]) { println it }
      

      The error is:

      Groovy:[Static type checking] - Cannot call java.io.File#traverse(java.util.Map <java.lang.String, java.lang.Object>, groovy.lang.Closure) with arguments [java.util.LinkedHashMap <java.lang.String, java.io.Serializable>, groovy.lang.Closure] 
      

      I think that more flexible and static type checker-friendly signatures for the traverse methods would be:
      ResourceGroovyMethods.traverse(File, Map<String, ?>, Closure)
      ResourceGroovyMethods.traverse(File, Map<String, ?>)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emilles Eric Milles
                Reporter:
                mauromol Mauro Molinari
              • Votes:
                0 Vote for this issue
                Watchers:
                4 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