RFR: 8250802: Refactor StringConverter and its subclasses [v2]

Nir Lisker nlisker at openjdk.org
Wed Nov 19 21:04:11 UTC 2025


On Wed, 19 Nov 2025 15:48:19 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Some do, but that state is immutable. Converters build a formatter/parser on construction (if at all needed) and use it for the duration of their existence. There are some deprecations that we need to do regarding inspecting the internal state.
>
> This is what `DateFormat` javadoc says:
> 
> 
> Synchronization
> Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.
> 
> 
> As long as the `DateTimeStringConverter` is used only in the context of the FX application thread, we should be fine.  But can we guarantee that the application code does not try to call it from other threads?

Huh, looks like even non-modifying methods like `DateFormat#parse` are not thread safe. The wording is still correct in that the classes are immutable, but in the specific case of the Java 8 Date/Time ones, they indeed need to reused on the same thread. I'll add a caveat.

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

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


More information about the openjfx-dev mailing list