RFR: 8250802: Refactor StringConverter and its subclasses

Nir Lisker nlisker at openjdk.org
Mon Aug 25 11:23:02 UTC 2025


On Sun, 24 Aug 2025 20:20:12 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> Seeing this a lot, what do you want to convey here? I'm just wondering what this would mean to a future maintainer... "don't accidentally make it protected because then it would be API"? Can add that to a lot of methods in FX then...

Yes, it's been used in other places to warn against promotion into the API by mistake. I replaced it with a javadoc.

> modules/javafx.base/src/test/java/test/javafx/util/converter/DateStringConverterTest.java line 75:
> 
>> 73:                 new TestCase(new DateStringConverter(DateFormat.getDateInstance(DateFormat.LONG)),
>> 74:                         DEFALUT_LOCALE, DateFormat.DEFAULT, null, DateFormat.getDateInstance(DateFormat.LONG))
>> 75:                 );
> 
> Wouldn't this look better:
> 
>         return List.of(
>                 new TestCase(new DateStringConverter(), DEFALUT_LOCALE, DateFormat.DEFAULT, null, null),
>                 new TestCase(new DateStringConverter(DateFormat.SHORT), DEFALUT_LOCALE, DateFormat.SHORT, null, null),
>                 new TestCase(new DateStringConverter(Locale.UK), Locale.UK, DateFormat.DEFAULT, null, null),
>                 new TestCase(new DateStringConverter(Locale.UK, DateFormat.SHORT), Locale.UK, DateFormat.SHORT, null, null),
>                 new TestCase(new DateStringConverter("dd MM yyyy"), DEFALUT_LOCALE, DateFormat.DEFAULT, "dd MM yyyy", null),
>                 new TestCase(
>                         new DateStringConverter(DateFormat.getDateInstance(DateFormat.LONG)), DEFALUT_LOCALE, 
>                         DateFormat.DEFAULT, null, DateFormat.getDateInstance(DateFormat.LONG)
>                 )
>         );

Not in my eyes, but can change if you want.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1880#discussion_r2297838480
PR Review Comment: https://git.openjdk.org/jfx/pull/1880#discussion_r2297840346


More information about the openjfx-dev mailing list