-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Add default implementations of deprecated methods of BuilableItem and Item. #3142
Changes from 2 commits
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 |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
import jenkins.util.SystemProperties; | ||
import hudson.security.PermissionScope; | ||
import jenkins.util.io.OnMaster; | ||
import jline.internal.Nullable; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
|
||
import java.io.IOException; | ||
|
@@ -41,6 +42,9 @@ | |
import hudson.security.AccessControlled; | ||
import hudson.util.Secret; | ||
|
||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
|
||
/** | ||
* Basic configuration unit in Hudson. | ||
* | ||
|
@@ -134,24 +138,28 @@ public interface Item extends PersistenceRoot, SearchableModelObject, AccessCont | |
* Gets the relative name to this item from the specified group. | ||
* | ||
* @param g | ||
* The ItemGroup instance used as context to evaluate the relative name of this AbstractItem | ||
* The {@link ItemGroup} instance used as context to evaluate the relative name of this item | ||
* @return | ||
* The name of the current item, relative to p. Nested ItemGroups are separated by {@code /} character. | ||
* The name of the current item, relative to p. Nested {@link ItemGroup}s are separated by {@code /} character. | ||
* @since 1.419 | ||
* @return | ||
* String like "../foo/bar". | ||
* {@code null} if item parents is not an {@link ItemGroup}. | ||
* {@code null} if one of item parents is not an {@link Item}. | ||
*/ | ||
default String getRelativeNameFrom(ItemGroup g) { | ||
@Nullable | ||
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. Not actually sure why these are all 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. Yes, generally "in all sane cases" assuming you do not resolve names for things like Promoted Builds plugin PromotionProcess instances or pass nulls. I can add |
||
default String getRelativeNameFrom(@CheckForNull ItemGroup g) { | ||
return Functions.getRelativeNameFrom(this, g); | ||
} | ||
|
||
/** | ||
* Short for {@code getRelativeNameFrom(item.getParent())} | ||
* | ||
* @return String like "../foo/bar". | ||
* {@code null} if one of item parents is not an {@link Item}. | ||
* @since 1.419 | ||
*/ | ||
default String getRelativeNameFrom(Item item) { | ||
@Nullable | ||
default String getRelativeNameFrom(@Nonnull Item item) { | ||
return getRelativeNameFrom(item.getParent()); | ||
|
||
} | ||
|
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.
mark it
@CheckForNull
please