java.lang.Object in new pipeline command causing snippetizer to fall over, is there an annotation?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.Object in new pipeline command causing snippetizer to fall over, is there an annotation?

Michael Carter
Caused by: java.lang.IllegalArgumentException: Unable to convert to class java.lang.Object
    at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON (RequestImpl.java:738)

Caused by: java.lang.Error: Failed to instantiate class io.jenkins.plugins.****
    at hudson.model.Descriptor.newInstance (Descriptor.java:606)
    at org.jenkinsci.plugins.workflow.cps.Snippetizer.doGenerateSnippet (Snippetizer.java:502)
    at java.lang.invoke.MethodHandle.invokeWithArguments (MethodHandle.java:627)


So basically I have an java.lang.Object field and snippetizer falls over on the "generate command"

Is there an annotation or something to say tell snippetizer to use this Object as a string?   As the generator command will be a String but in script it could be a Json object or other things.

Bottom line is I wanted to have a single input field that could be mutiple types.

... and if anyone asks no I can't share the source.  It's part of an inhouse plugin and it's not something I'm allowed to share. 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/700c59d8-b081-4e38-95e3-7e2a27eea789o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.Object in new pipeline command causing snippetizer to fall over, is there an annotation?

Jesse Glick-4
On Mon, Jul 13, 2020 at 12:44 PM Michael Carter
<[hidden email]> wrote:
> Is there an annotation or something to say tell snippetizer to use this Object as a string?

No. `Object` is not supported for databinding purposes.

> Bottom line is I wanted to have a single input field that could be mutiple types.

Define a subtype of `Describable`.

https://www.jenkins.io/doc/developer/plugin-development/pipeline-integration/

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0s7_2tnEX_E5QzCJOvouM2q%3DVexR48dS%3D9CTEdSuTqrw%40mail.gmail.com.