RFR: 8334580: Deprecate no-arg constructor BasicSliderUI() for removal [v2]

Kevin Rushforth kcr at openjdk.org
Fri Jun 21 18:52:11 UTC 2024


On Fri, 21 Jun 2024 18:44:58 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java line 153:
>> 
>>> 151:     /**
>>> 152:      * Constructs a {@code BasicSliderUI}.
>>> 153:      * @deprecated This constructor will be removed in future release
>> 
>> Sounds reasonable enough. It's what happened, isn't it? It's the reason why we're deprecating it and planning to remove it.
>> 
>> Suggestion:
>> 
>>      * @deprecated This constructor was added by accident. Do not use it.
>>      *             This constructor will be removed in a future release.
>> 
>> 
>> There are comments that say this method shouldn't have been public.
>> 
>> On the other hand, there are quite a few methods and classes in the list of terminally terminated elements which don't say anything at all.
>
> Or:
> 
> 
>      * @deprecated This constructor will be removed in a future release.
>      *             Use {@link #BasicSliderUI(JSlider b)} instead.
> 
> This is in the gist of the deprecation message for [`SecurityManager`](https://download.java.net/java/early_access/jdk24/docs/api/java.base/java/lang/SecurityManager.html).

FWIW, we did something similar to this in JavaFX when we deprecated for removal an accidentally added constructor (an implicit no-arg constructor in our case).

https://github.com/openjdk/jfx/commit/a5ecfb68


     * @deprecated This constructor was exposed erroneously and will be removed in the next version.
     * Use {@link #createSelector(String)} instead.


If you decide it's worth doing, you might also include a pointer to the other constructor, although since there only is one more, it is pretty obvious for this class.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19819#discussion_r1649322438


More information about the client-libs-dev mailing list