RFR: 6852577: Only for Nimbus LAF UIManager.get("PasswordField.echoChar") is null [v3]

Alexey Ivanov aivanov at openjdk.org
Tue Sep 27 18:06:24 UTC 2022


On Wed, 7 Sep 2022 16:23:43 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Default echo character obtained through `PasswordField.echoChar` UIProperty returns null for Nimbus L&F,
>> which is fixed by adding the default character * in the UIDefault table.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Honour PasswordField.echoChar property

Changes requested by aivanov (Reviewer).

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java line 77:

> 75:             LookAndFeel.installProperty(getComponent(), "echoChar", echoChar);
> 76:         }
> 77:     }

This is a public API class, it should provide a Javadoc, the text copied from `BasicPasswordFieldUI.installDefaults` which does the same thing should be enough.

I agree with @turbanoff, let's add a space after `if`.

Let's also add `@Override` annotation which are used on the methods above and below at the very least.

test/jdk/javax/swing/plaf/nimbus/PasswordFieldTest.java line 50:

> 48:                             UIManager.getInstalledLookAndFeels()) {
> 49:             System.out.println("Testing L&F: " + laf.getClassName());
> 50:             SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));

You should probably call `setLookAndFeel` on the main thread, or you should call `UIManager.get` below on the EDT as well.

test/jdk/javax/swing/plaf/nimbus/PasswordFieldTest.java line 56:

> 54:             if (UIManager.get("PasswordField.echoChar") == null) {
> 55:                 throw new RuntimeException(
> 56:                     "PasswordField.echoChar returns null");

I agree with @TejeshR13, including the L&F name in the exception message would make the message more specific without opening the log for the test.

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

PR: https://git.openjdk.org/jdk/pull/10035



More information about the client-libs-dev mailing list