<Swing Dev> RFR: 8264218: Public method javax.swing.JMenu.setComponentOrientation() has no spec [v2]

Alexey Ivanov aivanov at openjdk.java.net
Thu Apr 1 13:03:32 UTC 2021


On Thu, 1 Apr 2021 12:49:06 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/JMenu.java line 1269:
>> 
>>> 1267:      * </ul>
>>> 1268:      * @see java.awt.ComponentOrientation
>>> 1269:      */
>> 
>> Shall it just use `{@inheritDoc}`?
>> The javadoc generated in 7 and 8 does exactly this.
>> 
>> However, the new text explicitly mentions that this method changes not only orientation of this component but also of the associated popup menu.
>> 
>> I do not think the description of the parameter has to list all the values of `ComponentOrientation`, these are the only publicly available values any way. If a value is added in the future, the javadoc will become incorrect.
>
> It is done similarly in JScrollPane which I used here...maybe there also it's an oversight then..
> I will update to use @inheritdoc in this spec ...

Yes, I see… Yet I think listing values of `ComponentOrientation` is redundant.

However, looking at JScrollPane, its javadoc specifies why it's overridden: _Sets the orientation for the vertical and horizontal scrollbars_. In the case of `JMenu`, it also changes the orientation of *popup menu* inside JMenu. Taking into account this additional detail, your initial text could have been better.

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

PR: https://git.openjdk.java.net/jdk/pull/3213


More information about the swing-dev mailing list