I'm glad the intention is aligned with the desire to have these groovy language features available and understand that support for interface will require work in the groovy CPS.

In the short term though, is there a recommended workaround that could provide some interface like equivalent? Or is it just not possible to do anything like this at this stage?
Perhaps pass HashMaps of Closures between the top level "classes" as per
https://github.com/jenkinsci/workflow-plugin/blob/master/cps-global-lib/README.md#writing-shared-code

e.g.

org/foo/Zot.groovy
package org.foo
// Closures define the interface for Zot
Closure show
Closure name

def specify_interface (Hashmap hm) {
    this.show = hm["show"]
    this.name = hm["name"]
}
flow.groovy
node {
    def z = new org.foo.Zot()
    z.specify_interface(["show": { echo "Hello" }, "name": { return "Bernard" }])

    // you can then pass z around beyond the scope of flow.groovy
    z.show()
    echo z.name()
}

Or is there a more elegant way within the constraints of what is and what is not possible today?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to