RFR: 8358813: JPasswordField identifies spaces in password via delete shortcuts [v2]
Damon Nguyen
dnguyen at openjdk.org
Fri Aug 1 00:10:58 UTC 2025
On Sat, 12 Jul 2025 03:34:08 GMT, Jeremy Wood <duke at openjdk.org> wrote:
>> There were a few action bindings available in JPasswordFields in Aqua that let you identify the boundaries of words.
>>
>> This came to my attention while looking at the related work https://github.com/openjdk/jdk/pull/25443 . In that PR we said we should iterate across all available L&Fs, so this PR copies that same approach. (The original complaint only focused on Aqua, though.)
>
> Jeremy Wood has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>
> - 8358813: putting the actions in a TreeSet
>
> This is in response to:
> https://github.com/openjdk/jdk/pull/25688#discussion_r2200230806
> - 8358813: make input map types a static constant
>
> This is in response to:
> https://github.com/openjdk/jdk/pull/25688#discussion_r2200225191
> - Merge branch 'master' into JDK-8358813
> - Update test/jdk/javax/swing/JPasswordField/PasswordFieldInputMapWordTest.java
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
> - 8358813: remove more bindings for JPasswordFields in Aqua
Tested with and without the change to AquaKeyBindings. Passes after adding null to the 3 key bindings. Ran on clientlibs tests and all tests still pass. I left a question on the bindings segment for clarification.
src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java line 162:
> 160: "alt BACK_SPACE", null,
> 161: "ctrl W", null,
> 162: "alt DELETE", null
The change "works" for the test, but I'm not exactly sure what's changed here. When I make my own local test with a JPasswordField, the key binds don't do anything on Aqua. The `CTRL+W` seems to just input `W`. `ALT+BACK_SPACE` seems to just backspace the character before the carat. Can you help me understand this?
Also, I guess you can end in a trailing comma to match the previous format if you want. Either is OK.
test/jdk/javax/swing/JPasswordField/PasswordFieldInputMapWordTest.java line 43:
> 41: import java.util.Arrays;
> 42: import java.util.Collection;
> 43: import java.util.TreeSet;
Suggestion:
import java.util.Arrays;
import java.util.Collection;
import java.util.TreeSet;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPasswordField;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.text.DefaultEditorKit;
Reorganize imports.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25688#pullrequestreview-3076765762
PR Review Comment: https://git.openjdk.org/jdk/pull/25688#discussion_r2246362320
PR Review Comment: https://git.openjdk.org/jdk/pull/25688#discussion_r2246293491
More information about the client-libs-dev
mailing list