I was not able to find a prior version in which this bug disappears, but I'm thinking that this might be caused by the Pipeline: Groovy plugin since that was recently upgraded several versions.Īt .CpsTransformer.visitMapEntryExpression(CpsTransformer.java:944)Īt .(MapEntryExpression.java:39)Īt .CpsTransformer.visit(CpsTransformer.java:346)Īt .CpsTransformer$24.run(CpsTransformer.java:834)Īt .CpsTransformer.makeChildren(CpsTransformer.java:435)Īt .CpsTransformer.makeNode(CpsTransformer.java:398)Īt .CpsTransformer.visitBinaryExpression(CpsTransformer.java:829)Īt .(BinaryExpression.java:51)Īt .CpsTransformer.visitExpressionStatement(CpsTransformer.java:577)Īt .(ExpressionStatement.java:42)Īt .CpsTransformer.visit(CpsTransformer.java:352)Īt .CpsTransformer$5.run(CpsTransformer.java:503)Īt .CpsTransformer.visitBlockStatement(CpsTransformer.java:500)Īt .(BlockStatement.java:71)Īt .CpsTransformer$2.run(CpsTransformer.java:377)Īt .CpsTransformer.visitWithSafepoint(CpsTransformer.java:363)Īt .CpsTransformer.visitMethod(CpsTransformer.java:222)Īt .CpsTransformer.call(CpsTransformer.java:132)Īt .CompilationUnit.applyToPrimar圜lassNodes(CompilationUnit.java:1065)Īt .CompilationUnit.doPhaseOperation(CompilationUnit.java:603)Īt .CompilationUnit.processPhaseOperations(CompilationUnit.java:581)Īt .pile(CompilationUnit.java:558)Īt 圜lassLoader.doParseClass(Groov圜lassLoader.java:298)Īt 圜lassLoader.parseClass(Groov圜lassLoader.java:268)Īt 圜lassLoader.parseClass(Groov圜lassLoader.java:254)Īt 圜lassLoader.recompile(Groov圜lassLoader.java:761)Īt 圜lassLoader.loadClass(Groov圜lassLoader.java:718)Īt 圜lassLoader.loadClass(Groov圜lassLoader.java:787)Īt (Unknown Source)Īt .cps.CpsGroovyShell$TimingLoader.loadClass(CpsGroovyShell.java:158)Īt 圜lassLoader.loadClass(Groov圜lassLoader.java:677)Īt 圜lassLoader.loadClass(Groov圜lassLoader.java:545)Īt .yAsLoaderClassOrScript(ClassNodeResolver.java:185)Īt .ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)Īt .ClassNodeResolver.resolveName(ClassNodeResolver.java:126)Īt .ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)Īt .ResolveVisitor.resolve(ResolveVisitor.java:313)Īt .ResolveVisitor.visitClass(ResolveVisitor.java:1236)Īt .ResolveVisitor.startResolving(ResolveVisitor.java:176)Īt .CompilationUnit$12.call(CompilationUnit.java:663)Īt .CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)Īt .CompilationUnit.doPhaseOperation(CompilationUnit.java:605)Īt .pile(CompilationUnit.java:554)Īt (GroovyShell.java:688)Īt (GroovyShell.java:700)Īt .(CpsGroovyShell.java:131)Īt .(CpsGroovyShell.java:125)Īt .(CpsFlowExecution.java:560)Īt .(CpsFlowExecution.java:521)Īt .(WorkflowRun. IntelliJ IDEA has a Groovy intention to turn method parameters into a Map parameter for named arguments with a few mouse clicks. I've tried reverting the versions of both Jenkins and the plugin and this bug exists in the following versions: This leads to better readable code and that is very useful. This version of sayHello will work and will print "Hello from Foo!" to theĭef mapVariable = įinally, I want to mention that we are pretty sure that the original code, which was directly passing literal map values to another method, was working in prior versions of Jenkins and the Pipeline: Groovy plugin. I've reproduced this error for the following toy case: There should not have been any compilation from this call. Passing a map literal value to a custom step function inside of a shared library appears to cause an "UnsupportedOperationException" and gives the following error messageīUG! exception in phase 'semantic analysis' in source unit 'WorkflowScript' The lookup for foo.Foo caused a failed compilaton. Pipeline-model-declarative-agent 1.1.1 true Global-variable-string-parameter 1.2 true Lets imagine we have the following map: def map FF0000 : Red, 00FF00 : Lime, 0000FF : Blue, FFFF00 : Yellow We can iterate over. class BaseObject else if (object."$item.name".Passing map literal values to method in shared library causes UnsupportedOperationExceptionĪpache-httpcomponents-client-4-api 4.5.5-3.0 trueĬloudbees-bitbucket-branch-source 2.2.12 true In this short tutorial, well look at ways to iterate over a map in Groovy using standard language features like each, eachWithIndex, and a for-in loop. I added mine to a baseObject which in your case object would extend. If you don't mind using a few libraries, here's an option where you convert the object to JSON and then parse it back out as a map.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |