If I invoke the Copy Artifact plugin from a System Groovy script like this:
copyArtifact.perform(build, launcher, listener)
I get:
java.lang.UnsupportedOperationException
at
hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:95)
Because Groovy picks the deprecated method taking Build<?,?> instead of
AbstractBuild.
Using an AbstractBuild typed reference does not help because Groovy's
dynamic dispatch algorithm picks what it thinks is the most specific method
(the deprecated one) and I get the same error.
This *does *work:
def perform = copyArtifact.class.getMethod("perform", AbstractBuild,
Launcher, BuildListener)
perform.invoke(copyArtifact, build, launcher, listener)
But it feels *so wrong *to do that. I know there was a way to force Groovy
to use static dispatch to a Groovy method but not to a Java method if I
understand correctly.
Is there a better way that does not violate OOP concepts so badly?
Thanks,
Kevin
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.