Skip to content

Commit 6d2feae

Browse files
authored
Merge pull request #1071 from xuwei-k/JsResult-instance-size
reduce `JsSuccess` and `JsError` instance size
2 parents 02e70c4 + 13199c3 commit 6d2feae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

play-json/shared/src/main/scala/play/api/libs/json/JsResult.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import scala.collection.Seq
1212
case class JsSuccess[T](value: T, path: JsPath = JsPath()) extends JsResult[T] {
1313
def get: T = value
1414

15-
val isSuccess = true
16-
val isError = false
15+
def isSuccess = true
16+
def isError = false
1717

1818
def fold[U](invalid: Seq[(JsPath, Seq[JsonValidationError])] => U, valid: T => U): U = valid(value)
1919

@@ -60,8 +60,8 @@ case class JsError(errors: Seq[(JsPath, Seq[JsonValidationError])]) extends JsRe
6060
def +:(error: (JsPath, JsonValidationError)): JsError = JsError.merge(JsError(error), this)
6161
def prepend(error: (JsPath, JsonValidationError)): JsError = this.+:(error)
6262

63-
val isSuccess = false
64-
val isError = true
63+
def isSuccess = false
64+
def isError = true
6565

6666
def fold[U](invalid: Seq[(JsPath, Seq[JsonValidationError])] => U, valid: Nothing => U): U = invalid(errors)
6767

@@ -84,7 +84,7 @@ case class JsError(errors: Seq[(JsPath, Seq[JsonValidationError])]) extends JsRe
8484

8585
def orElse[U >: Nothing](t: => JsResult[U]): JsResult[U] = t
8686

87-
val asOpt = None
87+
def asOpt = None
8888

8989
def asEither: Either[Seq[(JsPath, Seq[JsonValidationError])], Nothing] = Left(errors)
9090

0 commit comments

Comments
 (0)