-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Added numeric getById to RunMap and deprecate String API #26096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
8c0a09a
bab178b
2c89075
82c9403
0ed7d9c
e12ba9b
bc15cbe
dc93f89
eb5382f
c7e5c9d
ad7145b
c95f973
c02c8bd
32ef88f
ba2aafc
499b4b2
fd55f8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ | |
| * | ||
| * <p> | ||
| * This class is multi-thread safe by using copy-on-write technique, | ||
| * and it also updates the bi-directional links within {@link Run} | ||
| * and it also updates the bidirectional links within {@link Run} | ||
| * accordingly. | ||
| * | ||
| * @author Kohsuke Kawaguchi | ||
|
|
@@ -223,10 +223,31 @@ public R put(R r) { | |
| return super._put(r); | ||
| } | ||
|
|
||
| /** | ||
| * Lookup a build by its numeric ID. | ||
| * | ||
| * @since TODO | ||
| */ | ||
| @CheckForNull | ||
| @Override public R getById(String id) { | ||
| public R getById(int id) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I don't think there is anything wrong with this change I wonder why it's not implemented in the @jglick Since you mentioned this in #10456 (comment) - any suggestions from you here?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dates to #1379. |
||
| return getByNumber(id); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Lookup a build by a String ID. | ||
| * | ||
| * @deprecated Use {@link #getById(int)} instead. | ||
| * Jenkins build IDs were sometimes date-time strings. | ||
| * This method preserves backward compatibility by attempting to parse | ||
| * the ID as an integer and returning null if parsing fails. | ||
| */ | ||
| @Deprecated | ||
| @CheckForNull | ||
| @Override | ||
| public R getById(String id) { | ||
| try { | ||
| return getByNumber(Integer.parseInt(id)); | ||
| return getById(Integer.parseInt(id)); | ||
| } catch (NumberFormatException e) { // see https://issues.jenkins.io/browse/JENKINS-75476 | ||
| return null; | ||
| } | ||
|
|
@@ -307,7 +328,6 @@ protected Class<R> getBuildClass() { | |
|
|
||
| /** | ||
| * Backward compatibility method that notifies {@link RunMap} of who the owner is. | ||
| * | ||
| * Traditionally, this method blocked and loaded all the build records on the disk, | ||
| * but now all the actual loading happens lazily. | ||
| * | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
@sincetag is set to "TODO". This should be updated to the actual version number before merging. Please replace "TODO" with the appropriate Jenkins version number for this release.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment by GitHub Copilot is incorrect. In the Jenkins project, we use
@since TODOas a marker so that the release number can be updated after the first release that includes the new code.It also would be much better if the markdown generated by GitHub Copilot used
@sinceto show it is code, instead of referring to a GitHub user of that name. I corrected that mistake in the Copilot comment.