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

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

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            stephenconnolly Stephen Connolly created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue duplicates JENKINS-30002 [ JENKINS-30002 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Duplicate [ 3 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: