詹金斯管道 groovy 奇怪的行为

Mic*_*ael 3 jenkins-groovy jenkins-pipeline

我有一个 groovy 管道脚本:

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

但在输出中我看到错误“找不到这样的字段:字段 java.lang.String 大小”:

[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
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

编辑:我有“没有待处理的签名批准”。