RFR: 8332103: Add missing `@since` tags to `java.desktop`

Nizar Benalla duke at openjdk.org
Tue May 14 23:43:02 UTC 2024


On Tue, 14 May 2024 21:53:24 GMT, Phil Race <prr at openjdk.org> wrote:

>> If you're currently reviewing this PR, thank you!
>> Most fixes here are according to the reports by the since checker tool in #18934 and are pretty simple.
>> 
>> To make reviewing easier
>> - `BasicSliderUI` has the constructor `public BasicSliderUI(JSlider b)` for a long time so the default constructor (without parameters) didn't exist until JDK 16
>> 
>> For the `package-info` files, it is pretty hard to find source code of JDK 1-5 so I used the `grep` command to find the oldest instance of an `@since` in those packages.
>> 
>> I found instances of `@since 1.1` in the other packages but `javax/swing/plaf/synth/package-info.java` might be worth checking as most classes there had no `@since`.
>
> src/java.desktop/share/classes/javax/swing/package-info.java line 153:
> 
>> 151:  * @serial exclude
>> 152:  *
>> 153:  * @since 1.1
> 
> This isn't right. Where did you get this from ?
> Swing only became part of the JDK in JDK 1.2
> It was an unbundled library before then.
> If you find any @since 1.1 tags in the Swing API they are a mistake.

My bad then, this is a mistake.

> 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.

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

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


More information about the client-libs-dev mailing list