jenkinsci / jenkinsci/structs-plugin

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

Open
#272 1 comment 0 reactions 0 assignees View on GitHub
component:structs-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
11
Forks
33
PR merge metrics
No merged PRs in 30d

Description

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

structs 1.1

dockerhub-notification 2.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.