Skip to content

[JENKINS-34105] Add support for parameters of type java.util.Set #272

Description

@jenkins-infra-bot

TriggerOnSpecifiedImageNames from the Docker Hub Notification plugin has a parameter with type Set, 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)
...

Originally reported by daspilker, imported from: Add support for parameters of type java.util.Set
  • assignee: kohsuke
  • status: Open
  • priority: Major
  • component(s): structs-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20260604-211335
Raw content of original issue

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)
...
environment
core 1.609<br/>
structs 1.1<br/>
dockerhub-notification 2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions