RFR: 8332103: Add missing `@since` tags to `java.desktop` [v2]
Alexey Ivanov
aivanov at openjdk.org
Wed May 29 11:54:02 UTC 2024
On Tue, 14 May 2024 23:36:13 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java line 154:
>>
>>> 152: * Constructs a {@code BasicSliderUI}.
>>> 153: *
>>> 154: * @since 16
>>
>> 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.
>
> When mapping methods and when they first appeared (by using the historical record built into javac) I use an id in the form of
> `method: <erased-return-descriptor> <binary-name-of-enclosing-class>.<method-name>(<ParameterDescriptor>)` so for covariant overrides in general, when the return type changes I consider it to be a new method.
>
> Looking at the contents of the dictionnary:
> This explicit constructor existed for a long time but then this new was added a new one was added in JDK 16
> | Key | Value |
> | ------------- | ------------- |
> | `method: void javax.swing.plaf.basic.BasicSliderUI.<init>(javax.swing.JSlider):` | 9 |
> | `method: void javax.swing.plaf.basic.BasicSliderUI.<init>():` | 16 |
>
> Note: JDK 9 is used as the "base" as that's how far I can reliably use the `--release` info, so if something was added in JDK 2,5.7,9. It has a value of "9" in the dictionnary. I mainly check for errors in newer code.
> 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?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19192#discussion_r1618748176
More information about the client-libs-dev
mailing list