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

Ambiguous method overloading for method hudson.model.Hudson#doSafeExit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • pipeline
    • None
    • Jenkins 2.504.3 with embedded Jetty on Linux RedHat 8.

      I upgraded from 2.361.2 to 2.504.3 and I now have a problem with one of my pipelines.
      In this pipeline I was calling

      Jenkins.get().doSafeExit(null)
      

      Unfortunatelly, many methods on Jenkins now have multiple signatures, with StaplerRequest or StaplerRequest2 : https://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html

      When I ran my pipeline I got this message :

      groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method hudson.model.Hudson#doSafeExit.
      10:12:47  Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
      10:12:47  	[interface org.kohsuke.stapler.StaplerRequest]
      10:12:47  	[interface org.kohsuke.stapler.StaplerRequest2]
      10:12:47  	at groovy.lang.MetaClassImpl.doChooseMostSpecificParams(MetaClassImpl.java:3251)
      10:12:47  	at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:3228)
      

      I changed the code to :

      Jenkins.get().doSafeExit(null as org.kohsuke.stapler.StaplerRequest2)
      

      but I still have the same problem.

      I tried this code in the Groovy console and it worked ! But the pipeline is still failing ...
      It seems there is a bug in the pipeline interpreter for method overloading.

            Unassigned Unassigned
            jbreda Julien Bréda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: