Annotation Interface MutableParam
While we consider mutating arguments in any way to be generally poor practice that can lead to unexpected and/or confusing behavior, sometimes it would be impossible or much more difficult to avoid doing than to just make the behavior explicit. Consider, for example, the Java Collections shuffle method which shuffles a collection in-place. It might be better to create a new shuffled Collection rather than change in-place, but in some situations like unit tests, it may be acceptable.
At the very least, adding this annotation makes it clear that a parameter might be changed in some way. And, it can also illustrate poor design if this annotation is "all over the place" in a code base. Mutating constructor and method parameters should be the exception, not the rule.
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueOptional description about the possible parameter mutation.- Default:
- ""
-