Eyal Ben Moshe Hmm, looks like your code is rather unique, you directly call CpsScript.invokeMethod inside of ArtifactoryServer.upload. This kind of metaprogramming is opaque to the CPS method mismatch detector because ArtifactoryServer.upload is in a Plugin rather than directly in a shared library or the Pipeline itself, so what we did for Steven Terrana's case doesn't apply here. CC Jesse Glick, any ideas on a fix or workaround? The only thing I can think of would be to ignore mismatch warnings in workflow-cps whenever the receiver is a plugin using something like this:
diff --git a/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsVmExecutorService.java b/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsVmExecutorService.java
index 7034810e..e96757cb 100644
--- a/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsVmExecutorService.java
+++ b/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsVmExecutorService.java
@@ -12,4 +12,5 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
+import jenkins.model.Jenkins;
import jenkins.util.InterceptingExecutorService;
@@ -113,4 +114,9 @@ class CpsVmExecutorService extends InterceptingExecutorService {
private void handleMismatch(Object expectedReceiver, String expectedMethodName, Object actualReceiver, String actualMethodName) {
+ Class receiverClass = expectedReceiver.getClass();
+ if (Jenkins.get().getPluginManager().whichPlugin(receiverClass) != null) {
+ // Plugin code is opaque to the mismatch detector.
+ return;
+ }
String mismatchMessage = mismatchMessage(className(expectedReceiver), expectedMethodName, className(actualReceiver), actualMethodName);
if (FAIL_ON_MISMATCH) {
I haven't tested that to see if it even works, and I think that might also mask real problems in DSLs like pipeline-model-definition and docker-workflow, so it doesn't seem like a great solution. |