Jenkins 管道 groovy 奇怪的行为

Jenkins pipeline groovy odd behavior

我有一个 groovy 管道脚本:

stage("Test") {
    str="[\"asd1\", \"asd2\"]"
    def tagNames = str.tokenize(',[]').collect { it as String }
    echo "${tagNames.getClass()}"
    echo "${tagNames.size}"
}

但在输出中我看到错误 "No such field found: field java.lang.String size":

[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
class java.util.ArrayList
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
No such field found: field java.lang.String size. Administrators can decide whether to approve or reject this signature.
[Pipeline] End of Pipeline

我做错了什么?

编辑:我有 "No pending signature approvals."

正在使用

size()

而不是

size

成功了。