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

hudson.Util.isOverridden doesn't work for protected methods

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • core
    • None

      hudson.Util.isOverridden is used in Jenkins to test if a public method has been overridden in a base class.

      In some cases it can be helpful to perform an analogous test against protected methods, for example when using the API/SPI model for an extension point, the public methods are intended to be used by consumers while the protected methods are intended to be implemented by implementers.

      • When the SPI is extended, for interoperability with older implementations it can be useful to check if the new SPI methods have been overridden from the new default implementation.
      • When an SPI method might cause a performance hit when overridden, it can be useful to check if the shortcut can be taken (where the method is not overridden) or whether the long path has to be taken (because the method has been overridden)

      Note: For performance reasons, it may make sense to have this functionality in a separate method, e.g. hudson.Util.isProtectedOverridden or it may be that a consolidated single path is more performant. In either case there is a need for this.

      See https://github.com/jenkinsci/scm-api-plugin/blob/72eb83518f854863ec6abcd8b88888209e555708/src/main/java/jenkins/scm/api/MethodUtils.java for one sample implementation

            Unassigned Unassigned
            stephenconnolly Stephen Connolly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: