jenkinsci / jenkinsci/structs-plugin

[JENKINS-28510] DescribableHelper error with @DataBoundSetter on Map<String,String>

Open
#267 7 comments 0 reactions 0 assignees View on GitHub
component:structs-plugin imported-jira-issue pipeline priority:minor resolution:unresolved
Dominant language
Java
Stars
11
Forks
33
PR merge metrics
No merged PRs in 30d

Description

I'm working on implementing a new step in a plugin, and came across the following error:

If one argument step is a Map, and it is a field annotated with @​DataBoundSetter, Ok, no problems. But if it is a Setter annotated with @​DataBoundSetter the following error occurs during instantiation:

java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:214)
at org.jenkinsci.plugins.workflow.structs.DescribableHelper.buildArguments(DescribableHelper.java:186)
at org.jenkinsci.plugins.workflow.structs.DescribableHelper.injectSetters(DescribableHelper.java:308)
at org.jenkinsci.plugins.workflow.structs.DescribableHelper.instantiate(DescribableHelper.java:93)
at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:95)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:133)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:100)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
at WorkflowScript.run(WorkflowScript:5)
...

Apparently the error is in injectSetters() method of the class DescribableHelper

---
Originally reported by valones, imported from: DescribableHelper error with @DataBoundSetter on Map


  • assignee: jglick
  • status: Reopened
  • priority: Minor
  • component(s): structs-plugin
  • label(s): pipeline
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 20260604-211335

Raw content of original issue

I'm working on implementing a new step in a plugin, and came across the following error:
If one argument step is a Map, and it is a field annotated with @DataBoundSetter, Ok, no problems. But if it is a Setter annotated with @DataBoundSetter the following error occurs during instantiation:


java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:214)
at org.jenkinsci.plugins.workflow.structs.DescribableHelper.buildArguments(DescribableHelper.java:186)
at org.jenkinsci.plugins.workflow.structs.DescribableHelper.injectSetters(DescribableHelper.java:308)
at org.jenkinsci.plugins.workflow.structs.DescribableHelper.instantiate(DescribableHelper.java:93)
at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:95)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:133)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:100)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
at WorkflowScript.run(WorkflowScript:5)
...

Apparently the error is in injectSetters() method of the class DescribableHelper

environment

```
Jenkins 1.609

workflow-plugin 1.6
```

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.