A DESCRIPTION OF THE PROBLEM :
Javadoc of ThreadLocal#initialValue() states:
if the programmer desires thread-local variables to have an initial value other than null, ThreadLocal must be subclassed
This has been there before Java 8 and now seems to suggest a non-recommended way as there is ThreadLocal#withInitial() now which serves the same purpose but is simpler and does not require subclassing.
Thus the Javadoc should be changed to recommend the latter approach.
Javadoc of ThreadLocal#initialValue() states:
if the programmer desires thread-local variables to have an initial value other than null, ThreadLocal must be subclassed
This has been there before Java 8 and now seems to suggest a non-recommended way as there is ThreadLocal#withInitial() now which serves the same purpose but is simpler and does not require subclassing.
Thus the Javadoc should be changed to recommend the latter approach.
- csr for
-
JDK-8299714 ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial()
-
- Closed
-
- links to
-
Commit openjdk/jdk/e209693a
-
Review(master) openjdk/jdk/11846