-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins ver. 2.60.2
Pipeline 2.5
Pipeline: Groovy 2.39
-
-
workflow-cps 3536.vb_8a_6628079d5
It seems the groovy spread '*' operator causes compilation errors when it is used in Pipeline. This example code does not seem to compile:
def fn (String... strs) { println "${strs.size()}" } def s = ["This should only be one string", "this is another"] def n = fn(*s) print(n)
The exception we get is:
java.lang.UnsupportedOperationException at com.cloudbees.groovy.cps.CpsTransformer.visitSpreadExpression(CpsTransformer.java:1130) at org.codehaus.groovy.ast.expr.SpreadExpression.visit(SpreadExpression.java:41) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:335) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:341) at com.cloudbees.groovy.cps.CpsTransformer$4.run(CpsTransformer.java:482) at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:424) at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:387) at com.cloudbees.groovy.cps.CpsTransformer.visitMethodCallExpression(CpsTransformer.java:465) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:335) at com.cloudbees.groovy.cps.CpsTransformer$40.run(CpsTransformer.java:1083) at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:424) at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:387) at com.cloudbees.groovy.cps.CpsTransformer.visitDeclarationExpression(CpsTransformer.java:1076) at org.codehaus.groovy.ast.expr.DeclarationExpression.visit(DeclarationExpression.java:89) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:335) at com.cloudbees.groovy.cps.CpsTransformer.visitExpressionStatement(CpsTransformer.java:566) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:335) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:341) at com.cloudbees.groovy.cps.CpsTransformer$5.run(CpsTransformer.java:492) at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:424) at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:387) at com.cloudbees.groovy.cps.CpsTransformer.visitBlockStatement(CpsTransformer.java:489) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71) at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:335) at com.cloudbees.groovy.cps.CpsTransformer$2.run(CpsTransformer.java:366) at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:424) at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:387) at com.cloudbees.groovy.cps.CpsTransformer.visitWithSafepoint(CpsTransformer.java:352) at com.cloudbees.groovy.cps.CpsTransformer.visitMethod(CpsTransformer.java:212) at com.cloudbees.groovy.cps.CpsTransformer.call(CpsTransformer.java:126) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:516) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:479) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:269) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:405) 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) at groovy.lang.GroovyShell.parse(GroovyShell.java:700) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:129) at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:123) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:516) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:479) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:269) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:405) Finished: FAILURE
- duplicates
-
JENKINS-33051 Groovy Star-Dot operator not supported in sandbox
- Open
- is duplicated by
-
JENKINS-43520 groovy parameter expansion splat operator (*) causes exception
- Resolved
- links to