RFR: 8357305: Compilation failure in javax/swing/JMenuItem/bug6197830.java
Alexey Ivanov
aivanov at openjdk.org
Tue May 20 12:05:53 UTC 2025
On Tue, 20 May 2025 11:52:58 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> > > I see that `MenuItemTest` class exists in `bug4729669.java`:
> > > https://github.com/openjdk/jdk/blob/e961b13cd68bc352b86af17c7e53df8537519beb/test/jdk/javax/swing/JMenuItem/bug4729669.java#L80
> > >
> > > Is it similar to the one that you copied?
> > > If that `MenuItemTest` class is identical, I suggest moving both tests into a subdirectory and promoting `MenuItemTest` into a public class in that subdirectory which is located in its own `.java` file.
> >
> >
> > No, these are no exactly the same, the doMenuItemTest(boolean isLeft) method in bug4729669.java has only one parameter, but the doMenuItemTest(boolean isLeft, String lafName, int frameY) method has three parameters in bug6197830.java.
>
> Can they be merged together?
>
> If possible, I'd like to eliminate code duplication and extract common code.
The only difference is the Look-and-Feel parameter, which can be abstracted by pulling out common code.
Then `frameY` is used to position the test frame. It's not needed if [`PassFailJFrame.Builder.positionTestUIBottomRowCentered`](https://cr.openjdk.org/~aivanov/PassFailJFrame/api/PassFailJFrame.Builder.html#positionTestUIBottomRowCentered()) or [`positionTestUIRightColumnCentered`](https://cr.openjdk.org/~aivanov/PassFailJFrame/api/PassFailJFrame.Builder.html#positionTestUIRightColumnCentered()) are used.
For the case where multiple L&Fs are tested, a custom layout could be implemented to position test windows in two columns and two rows, which is easy with [`WindowLayouts`](https://cr.openjdk.org/~aivanov/PassFailJFrame/api/WindowLayouts.html).
Is Motif L&F still supported? I guess it is but it's deprecated.
https://github.com/openjdk/jdk/blob/ab985a7c5d313304e6d601571885dcb871967259/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java#L51-L57
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25319#issuecomment-2894154602
More information about the client-libs-dev
mailing list