-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any and Nothing fail with play-json in Scala 2.13 #454
Comments
Minimized example. The code below compiles fine even on Scala 2.13: import play.api.libs.json.{ JsPath, Reads }
import play.api.libs.functional.FunctionalCanBuild
import play.api.libs.functional.syntax
val x = syntax.toFunctionalBuilderOps((JsPath \ "id").read[Long])(FunctionalCanBuild.functionalCanBuildApplicative[Reads]) From
The following code is generated by macros and causes import play.api.libs.json.{ JsPath, Reads }
import play.api.libs.functional.FunctionalCanBuild
import play.api.libs.functional.syntax
val x = syntax.toFunctionalBuilderOps((JsPath \ "id").read[Long]) From
So this |
Does anyone have an idea how to fix this? What comes to my mind is to ignore |
I have the same issue. Bumped a project to Scala 2.13.2 and using Given this model: sealed trait A extends Product with Serializable
object A{
case object B extends A
case object C extends A
implicit val format: OFormat[A] = derived.oformat()
} Wartremover complains : [wartremover: Any] Inferred type containing Any: julienrf.json.derived.DerivedReads[A] Even trying: implicit val format: OFormat[A] = derived.oformat[A]() doesn't work |
Same occurs even for this: final case class AuthenticatedRequest[A](request: MessagesRequest[A]) extends WrappedRequest[A](request) [wartremover:Any] Inferred type containing Any: [A] AuthenticatedRequest[A] |
Same problem for a pretty simple case class Response(name: String, data: Map[String, String])
object Response {
implicit val format: Format[Response] = Json.format
} Results in:
Strangely, it does not complain about: case class Request(data: Map[String, String])
object Request {
implicit val format: Format[Request] = Json.format
} Time to slap |
I have also seen:
Which has to be suppressed with: @SuppressWarnings(Array("org.wartremover.warts.Product", "org.wartremover.warts.Serializable")) |
Any
andNothing
fail onJson.reads
macro for case classes with more than one param. On Scala 2.12 same code compiles fine.Build settings:
Example code:
Error:
Output of
-Xprint:typer
for the part which is presumably responsible for this:The text was updated successfully, but these errors were encountered: