RFR: 8354646: java.awt.TextField allows to identify the spaces in a password when double clicked at the starting and end of the text [v12]

Tejesh R tr at openjdk.org
Mon Jun 9 05:45:55 UTC 2025


On Fri, 6 Jun 2025 07:51:11 GMT, Jeremy Wood <duke at openjdk.org> wrote:

>> Make sure AquaTextPasswordFieldUI can't use selectWordAction.
>> 
>> The core problem here was we could call selectWordAction in the Aqua LAF on a JPasswordField. This problem was already solved in the BasicPasswordFieldUI . The same solution was copied and pasted into the SynthPasswordFieldUI . But the AquaTextPasswordFieldUI does NOT extend either class with the solution.
>> 
>> So the problem is partially about multiple inheritance.
>> 
>> My first response at solving the problem is just to move the existing solution to the parent BasicTextUI class and use an `instanceof` to make sure it is only applied to JPasswordFields. This should benefit all the PasswordFieldUI's (that I know about).
>> 
>> There may be many different philosophies/recommendations on how to resolve this; I'm open to suggestions.
>
> Jeremy Wood has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - 8354646: change Error to RuntimeException
>    
>    This is in response to:
>    https://github.com/openjdk/jdk/pull/25443#discussion_r2131681790
>  - 8354646: removing catching RuntimeException
>    
>    This is in response to:
>    https://github.com/openjdk/jdk/pull/25443#discussion_r2131680454

test/jdk/javax/swing/plaf/basic/BasicPasswordFieldUI/PasswordSelectionWordTest.java line 45:

> 43: public class PasswordSelectionWordTest {
> 44:     public static void main(String[] args) throws Exception {
> 45:         for (UIManager.LookAndFeelInfo laf :

Now since the test is for all the look and feel, should it be inside `test/jdk/javax/swing/JPasswordField` folder?
Other than this it looks good to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25443#discussion_r2131872951


More information about the client-libs-dev mailing list