Skip to content

Commit 34b4424

Browse files
author
Martijn Hoekstra
committed
include migration instructions in deprecation message
1 parent c8fe7c8 commit 34b4424

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/library/scala/util/Either.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
168168
*
169169
* Because `Either` is right-biased, this method is not normally needed.
170170
*/
171-
@deprecated("Either is now right-biased", "2.13.0")
171+
@deprecated("Either is now right-biased, use methods directly on Either", "2.13.0")
172172
def right = Either.RightProjection(this)
173173

174174
/** Applies `fa` if this is a `Left` or `fb` if this is a `Right`.
@@ -512,7 +512,7 @@ object Either {
512512
* @author <a href="mailto:[email protected]">Tony Morris</a>, Workingmouse
513513
* @see [[scala.util.Either#left]]
514514
*/
515-
@deprecated("use swap instead", "2.13.0")
515+
@deprecated("use `swap` instead", "2.13.0")
516516
final case class LeftProjection[+A, +B](e: Either[A, B]) {
517517
/** Returns the value from this `Left` or throws `java.util.NoSuchElementException`
518518
* if this is a `Right`.
@@ -524,6 +524,7 @@ object Either {
524524
*
525525
* @throws java.util.NoSuchElementException if the projection is [[scala.util.Right]]
526526
*/
527+
@deprecated("use `Either.swap.getOrElse` instead", "2.13.0")
527528
def get: A = e match {
528529
case Left(a) => a
529530
case _ => throw new NoSuchElementException("Either.left.get on Right")
@@ -656,7 +657,7 @@ object Either {
656657
*
657658
* @author <a href="mailto:[email protected]">Tony Morris</a>, Workingmouse
658659
*/
659-
@deprecated("Either is now right-biased", "2.13.0")
660+
@deprecated("Either is now right-biased, calls to `right` should be removed", "2.13.0")
660661
final case class RightProjection[+A, +B](e: Either[A, B]) {
661662

662663
/** Returns the value from this `Right` or throws
@@ -669,6 +670,7 @@ object Either {
669670
*
670671
* @throws java.util.NoSuchElementException if the projection is `Left`.
671672
*/
673+
@deprecated("Use `Either.getOrElse` instead", "2.13.0")
672674
def get: B = e match {
673675
case Right(b) => b
674676
case _ => throw new NoSuchElementException("Either.right.get on Left")

0 commit comments

Comments
 (0)