This piece of code works perfectly in dynamically typed Groovy
buildDirectory.traverse(type: FILES, nameFilter: ~/dependency-updates-report.xml/) {
reports << it
}
but when adding @CompileStatic
to the class it get an error, something along the line
'traverse' in 'org.codehaus.groovy.runtime.ResourceGroovyMethods' cannot be applied to ...
Is the Map
parameter the problem here?
EDIT buildDirectory is of type java.io.File
and is injected.
In case of a static compilation like that one, you need to make an explicit cast to:
The problem here is that
File.traverse()
method expects a map of typewhile the Groovy idiomatic map creation creates a map of type
This
Serializable
is a problem here because it is not a subclass of thejava.lang.Object
.