[
https://issues.apache.org/jira/browse/TEXT-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16026279#comment-16026279
]
Bruno P. Kinoshita commented on TEXT-84:
----------------------------------------
+1 for adjusting the documentation. There are other classes that state that
instances are thread safe if a certain property is thread safe. Perhaps a
similar comment here would be enough? Here's an [example from
lang|https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/tuple/ImmutablePair.html]
which reads:
{quote}
An immutable pair consisting of two Object elements.
Although the implementation is immutable, there is no restriction on the
objects that may be stored. If mutable objects are stored in the pair, then the
pair itself effectively becomes mutable. The class is also final, so a subclass
can not add undesirable behaviour.
#ThreadSafe# if both paired objects are thread-safe
{quote}
> RandomStringGenerator claims to be immutable, but isn't
> -------------------------------------------------------
>
> Key: TEXT-84
> URL: https://issues.apache.org/jira/browse/TEXT-84
> Project: Commons Text
> Issue Type: Bug
> Affects Versions: 1.1
> Reporter: Duncan Jones
>
> {{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.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)