On Mon, 3 Jun 2024 20:02:12 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

>>> Hmm, the _explicit_ default constructor was added in JDK 16, but it was 
>>> implicit before then. So I am not 100% sure what the right answer is - the 
>>> same as the class, or when it was explicitly added.
>> 
>> I believe there was no default constructor in `BasicSliderUI()` because 
>> there was a constructor with a parameter `BasicSliderUI(JSlider b)`.
>> 
>> Thus, this case seem to be correct `BasicSliderUI()` is available since 16.
>> 
>> At the same time, `BasicSliderUI(JSlider b)` has existed since at least 7, 
>> the constructor is present in the history of the file. The history in GitHub 
>> goes up to 1st December 2007 which corresponds to Java 7 timeline. I'm 
>> pretty sure this constructor existed in previous releases, and you have to 
>> dig further to find when it was added.
>> 
>> Very much likely, the constructor `BasicSliderUI(JSlider b)` was added when 
>> the `BasicSliderUI` class was added. The class does not have `@since` tag, 
>> so it's inherited from the package, isn't it? The same rule applies to the 
>> constructor, doesn't it?
>
> It seems that BasicSliderUI() was added by the mistake? it was not mentioned 
> in the bug report...Seems it is too late to delete it?

I'm sorry but `method: void javax.swing.plaf.basic.BasicSliderUI.<init>()` 
refers to the constructor, 
 as I use [this 
method](https://docs.oracle.com/en/java/javase/22/docs/api/java.compiler/javax/lang/model/element/ExecutableElement.html#getSimpleName())
 to get a method's name.

I am saying that there was no default constructor before JDK 16 as it doesn't 
appear in the compiler's historical data until then and therefore warrants an 
`@since`

I am stealing my colleagues words but here is the general rule for when we want 
to add an `@since` until we publish a doc with rules for `@since`

> As a practical rule for deciding whether any declaration is new or not, 
> imagine writing a test program that refers to the most specific form of the 
> declaration. If that test program does not compile on JDK version N-1 and 
> does compile on version N, then it warrants having `@since N`. Put another 
> way, `@since N` should identify the first release in which the declaration 
> can be used in the given form

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19192#discussion_r1625176050

Reply via email to