-
Bug
-
Resolution: Unresolved
-
Major
Jenkins code contradicts itself - leaving a developer to go "WUT"?
hudson.model.Descriptor.getDisplayName()
/** * Human readable name of this kind of configurable object. * Should be overridden for most descriptors, if the display name is visible somehow. * As a fallback it uses {@link Class#getSimpleName} on {@link #clazz}, so for example {@code MyThing} from {@code some.pkg.MyThing.DescriptorImpl}. * Historically some implementations returned null as a way of hiding the descriptor from the UI, * but this is generally managed by an explicit method such as {@code isEnabled} or {@code isApplicable}. */ @Nonnull public String getDisplayName() { return clazz.getSimpleName(); }
hudson.model.ReconfigurableDescribable
* <h1>Use Cases</h1> * <h2>Invisible Property</h2> * <p> * This mechanism can be used to create an entirely invisible {@link Describable}, which is handy * for {@link NodeProperty}, {@link JobProperty}, etc. To do so, define a descriptor with null * {@linkplain Descriptor#getDisplayName() display name} and empty config.jelly to prevent it from * showing up in the config UI, then implement {@link #reconfigure(StaplerRequest, JSONObject)} * and simply return {@code this}.
So some code says to hide things use null in getDisplayName() - yet getDisplayName() is non-null.