Methods like with have a return type that depends on the passed Closure's return type. Because the method must be visited before the arguments to collect @ClosureParams and @DelegatesTo information, the passed closure expression is not visited in time to determine the return type.
Consider the following:
Matcher[] meth() {
}
def arr = with {
return meth()
}
arr.length
arr[0].group(0)
arr[0].matches()
In this example, the type of arr is dependent on the return type of the closure expression. length, group, and matches are currently highlighted as unknown.
Methods like
withhave a return type that depends on the passedClosure's return type. Because the method must be visited before the arguments to collect@ClosureParamsand@DelegatesToinformation, the passed closure expression is not visited in time to determine the return type.Consider the following:
In this example, the type of
arris dependent on the return type of the closure expression.length,group, andmatchesare currently highlighted as unknown.