Skip to content

Commit 53d8150

Browse files
authored
Merge pull request scala/scala#6850 from NthPortal/bug#10747/PR
bug#10747 Document thread-safety of Enumeration
2 parents 07e5274 + d761950 commit 53d8150

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/src/scala/Enumeration.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ import scala.util.matching.Regex
2525
* `Value` type member of the enumeration (`Value` selected on the stable
2626
* identifier path of the enumeration instance).
2727
*
28+
* Values SHOULD NOT be added to an enumeration after its construction;
29+
* doing so makes the enumeration thread-unsafe. If values are added to an
30+
* enumeration from multiple threads (in a non-synchronized fashion) after
31+
* construction, the behavior of the enumeration is undefined.
32+
*
2833
* @example {{{
2934
* // Define a new enumeration with a type alias and work with the full set of enumerated values
3035
* object WeekDay extends Enumeration {

0 commit comments

Comments
 (0)