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

Add support for parameters of type java.util.Set

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • structs-plugin
    • None
    • core 1.609
      structs 1.1
      dockerhub-notification 2.0

      TriggerOnSpecifiedImageNames from the Docker Hub Notification plugin has a parameter with type Set<String>, see source.

      Instantiation will fail due to argument type mismatch when passing a Groovy list literal. It would be nice if the list would be coerced to a set automatically.

      import org.jenkinsci.plugins.registry.notification.opt.impl.TriggerOnSpecifiedImageNames 
      import org.jenkinsci.plugins.structs.describable.DescribableModel
      
      def m = new DescribableModel(TriggerOnSpecifiedImageNames)
      m.instantiate([repoNames: ['foo', 'bar']])
      
      java.lang.IllegalArgumentException: argument type mismatch
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.jenkinsci.plugins.structs.describable.Setter$1.set(Setter.java:28)
      	at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:268)
      	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:194)
      	at org.jenkinsci.plugins.structs.describable.DescribableModel$instantiate.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      	at Script1.run(Script1.groovy:5)
      ...
      

            kohsuke Kohsuke Kawaguchi
            daspilker Daniel Spilker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: