Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33051

Groovy Star-Dot operator not supported in sandbox

      Groovy star-dot operator "*." is not supported in JenkinsFile, causes the error:

      unclassified field java.util.ArrayList property
      

          [JENKINS-33051] Groovy Star-Dot operator not supported in sandbox

          Graham Burgess added a comment - - edited

          I just hit this bug while building a shared library that really could use the spread ( * ) operator to spread method params!

          Graham Burgess added a comment - - edited I just hit this bug while building a shared library that really could use the spread ( * ) operator to spread method params!

          Daniel Browne added a comment -

          Also running into this bug. Is there any workaround that has been found?

          Daniel Browne added a comment - Also running into this bug. Is there any workaround that has been found?

          Jesse Glick added a comment -

          Just do not use that operator. You can get an equivalent effect with method calls in the GDK.

          Jesse Glick added a comment - Just do not use that operator. You can get an equivalent effect with method calls in the GDK.

          Daniel Browne added a comment -

          I have a config driven function call where the name of the function and the list of args are passed in. Also all the Groovy and most of the pipeline functionality I know has been learnt from Google today, so I am not entirely sure how to achieve the equivalent effect. I worked around it for now, but it is not pretty. I will go back and change it once this bug is resolved.

          Daniel Browne added a comment - I have a config driven function call where the name of the function and the list of args are passed in. Also all the Groovy and most of the pipeline functionality I know has been learnt from Google today, so I am not entirely sure how to achieve the equivalent effect. I worked around it for now, but it is not pretty. I will go back and change it once this bug is resolved.

          Tatu Kairi added a comment -

          Still an issue. The following does not work in script block:

          // Simplified example; In reality, there are a lot of defaultArguments to pass
          def defaultArguments = [
              "arg1": "arg1",
              "arg2": "arg2"
          ]                  
           
           if ( my_condition ) {
              doStuff(*:defaultArguments, foo: "bar")
          } else {
              doStuff(*:defaultArguments, foo: "cux")
          }
          General error during canonicalization: java.lang.UnsupportedOperationException
          
          java.lang.UnsupportedOperationException
          	at com.cloudbees.groovy.cps.CpsTransformer.visitSpreadMapExpression(CpsTransformer.java:1207)
                  // etc...

           

          Tatu Kairi added a comment - Still an issue. The following does not work in script block: // Simplified example; In reality, there are a lot of defaultArguments to pass def defaultArguments = [ "arg1" : "arg1" , "arg2" : "arg2" ] if ( my_condition ) { doStuff(*:defaultArguments, foo: "bar" ) } else { doStuff(*:defaultArguments, foo: "cux" ) } General error during canonicalization: java.lang.UnsupportedOperationException java.lang.UnsupportedOperationException at com.cloudbees.groovy.cps.CpsTransformer.visitSpreadMapExpression(CpsTransformer.java:1207) // etc...  

            jglick Jesse Glick
            valones Flávio Augusto Valones
            Votes:
            14 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: