Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8258776

ThreadLocal#initialValue() Javadoc is unaware of ThreadLocal#withInitial()

XMLWordPrintable

    • b05
    • generic
    • generic

      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.


            jpai Jaikiran Pai
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: