Uploaded image for project: 'Commons Text'
  1. Commons Text
  2. TEXT-84

RandomStringGenerator claims to be immutable, but isn't

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1
    • 1.2
    • None

    Description

      RandomStringGenerator claims to be immutable in the Javadocs, however it accepts a TextRandomProvider object through the builder pattern. This object may altered by external code, thus breaking the immutability claim of our generator.

      A possible solution is to adjust the documentation for TextRandomProvider and require implementations to be immutable. Alternatively, we can relax the documentation in RandomStringGenerator to remove the immutability claim or state that the mutability is linked to the mutability of the random source (when provided).

      I think we will have to do the latter, since the former would forbid callers from supplying a UniformRandomProvider instance as suggested in the documentation. Thoughts welcome.

      Attachments

        Activity

          People

            dmjones500 Duncan Jones
            dmjones500 Duncan Jones
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: