Summary
Add a suggestion for using java.time.DateTimeFormatter instead of java.text.DateFormat/java.text.SimpleDateFormat.
Problem
The Synchronization section in both DateFormat and SimpleDateFormat does not suggest a better alternative.
Solution
Add an API note to use DateTimeFormatter as an alternative in both class descriptions.
Specification
In the class descriptions of java.text.DateFormat and java.text.SimpleDateFormat classes,
Change the following paragraphs from:
* 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.
to:
* 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.
* @apiNote Consider using {@link java.time.format.DateTimeFormatter} as an
* immutable and thread-safe alternative.
Add the following @see tag:
* @see java.time.format.DateTimeFormatter
- csr of
-
JDK-8261728 SimpleDateFormat should link to DateTimeFormatter
-
- Resolved
-