Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.0-rc-2
-
None
-
None
Description
The following code causes a VerifyError:
import groovy.transform.CompileStatic @CompileStatic def extractSquares(String s) { s.findAll(~/\d+/) { String num -> num.toInteger() }.collect{ it ** 2 } } assert extractSquares(" ab 12 cdef 34 jhg ") == [144, 1156]
This occurs when the DGM method has the closure param not annotated with @CP or annotated with the following value:
@ClosureParams(value=FromString.class, options={"java.lang.String","java.lang.String[]"}
Adding a type to the last closure makes the error vanish:
collect{ Integer num -> num ** 2 }