On Fri, 4 Jul 2025 09:54:54 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 92: >> >>> 90: JMenuBar menuBar = new JMenuBar(); >>> 91: >>> 92: >>> menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel", >> >> I tried to extend the test (with this PR changes included) for all installed >> L&Fs and then create the menu for each L&F. >> >> UIManager.LookAndFeelInfo[] lafs = >> UIManager.getInstalledLookAndFeels(); >> for (final UIManager.LookAndFeelInfo lafInfo : lafs) { >> System.out.println("installed laf className : " + >> lafInfo.getClassName()); >> System.out.println("installed laf Name : " + lafInfo.getName()); >> menuBar.add(createMenu(lafInfo.getClassName(), >> lafInfo.getName())); >> } >> >> Then the test failed with this exception >> >> java.lang.NullPointerException: Cannot invoke >> "java.awt.Font.hashCode()" because "font" is null >> at >> java.desktop/sun.font.FontDesignMetrics$MetricsKey.init(FontDesignMetrics.java:213) >> at >> java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:282) >> at >> java.desktop/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1235) >> >> Otherwise the RBMI and CBMI does contain the icon after the fix. > > This is similar to the exception that I got > [above](https://github.com/openjdk/jdk/pull/25907#issuecomment-3001288429). > It's just a result of mixing several L&Fs at the same time. Yes but it was not supposed to come when `SwingUtilities.updateComponentTreeUI(frame)` is used to update all UI components. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2184932515