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

DescribableHelper error with @DataBoundSetter on Map<String,String>

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • structs-plugin
    • Jenkins 1.609
      workflow-plugin 1.6

      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

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

          Flávio Augusto Valones created issue -
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-26535 [ JENKINS-26535 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Jesse Glick made changes -
          Resolution Original: Duplicate [ 3 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Jesse Glick made changes -
          Summary Original: Reflection Error Defining Step Param New: DescribableHelper error with @DataBoundSetter on Map<String,String>
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-30519 [ JENKINS-30519 ]
          Jesse Glick made changes -
          Epic Link New: JENKINS-35393 [ 171186 ]
          Jesse Glick made changes -
          Component/s New: structs-plugin [ 21442 ]
          Component/s Original: workflow-plugin [ 18820 ]
          Labels Original: plugin step workflow New: workflow
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 163351 ] New: JNJira + In-Review [ 186287 ]
          Andrew Bayer made changes -
          Labels Original: workflow New: pipeline workflow
          Andrew Bayer made changes -
          Labels Original: pipeline workflow New: pipeline

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

              Created:
              Updated: