There are a few places in the Scala library where where
@deprecated is used to warn about doing something unintended, rather than to indicate actual deprecation. For example,
RichLong.round:Long are all deprecated with the message
"This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value?". In personal projects, I have used the
@deprecated annotation similarly for a no-arg variant of a varargs method, to warn that calling it is pointless.
I opine that it would be valuable to have one or more annotations more suited to warning about unintended actions. In theory,
@deprecated annotations should eventually be removed with their methods, when users have had time to stop using the methods in question. However, the annotations for the various rounding methods should exist forever, as the methods are there to help prevent accidental conversion to
Float when calling the method on with
Long. Additionally, while it makes sense to state when a method was deprecated, it makes less sense for methods created and annotated to prevent mistakes - they were always mistakes ever since they were added.
An annotation such as
@mistake (or something else?) would be useful to mark such methods as something you probably don’t mean to do. If there are use cases with sufficiently different rationales, more than one new annotation may perhaps be useful.