Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.3.8
-
None
-
CentOS 7
Description
Repro
A.groovy
def files = new File(".").list( [ accept: { d, f -> (f ==~ ".*") && !f.endsWith(".tmp") }] as FilenameFilter ).toList()
Result: works fine
B.groovy
def files = new File(".").list( [ accept: { d, f -> (f ==~ ".*") && !f.endsWith(".tmp") }] as FilenameFilter ).toList()
Result:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/csbubbles/B.groovy: 5: unexpected token: && @ line 5, column 3.
&& !f.endsWith(".tmp")
^
1 error
Expected results
B.groovy should get executed successfully the same way as A.groovy, as its two lines in a closure is the only expression.
PS "return" statement doesn't help if you put it before "(f ==~ ".*")" either.