I've implemented my first Play 2.1 Controller based on an example from the Play Framework doc site at http://www.playframework.com/documentation/2.1.1/ScalaJsonRequests . The operative part of my code looks like:
object Sessions extends Controller {
val log = LoggerFactory.getLogger(getClass())
implicit val rds = (
(__ \ 'userName).read[String] and
(__ \ 'credentials).read[String]) tupled
def session = Action(parse.json) { request =>
log.trace("session request: {}", request)
request.body.validate[(String, String)].map {
case (userName, credentials) =>
if (isAuthenticated(userName, credentials)) {
Created(createSession(userName))
} else {
log.warn("userName: {} failed isAuthenticated", userName)
BadRequest
}
}.recoverTotal {
e =>
val message = "Parse error: " + JsError.toFlatJson(e)
log.warn(message)
BadRequest
}
}
The problem is that the Scala compiler warns on the "tupled" thing (is that a keyword, operator, I don't know...I'm new to this). I don't know whether the warning is real and I should take the recommended action or not. The text of the warn is
[warn] /Users/bobk/work/dm2-server/app/controllers/admin/Sessions.scala:20: postfix operator tupled should be enabled
[warn] by making the implicit value language.postfixOps visible.
[warn] This can be achieved by adding the import clause 'import scala.language.postfixOps'
[warn] or by setting the compiler option -language:postfixOps.
[warn] See the Scala docs for value scala.language.postfixOps for a discussion
[warn] why the feature should be explicitly enabled.
[warn] (__ \ 'credentials).read[String]) tupled
[warn] ^
[warn] one warning found
Searching ScalaDocs for the discussion on "scala.language.postfixOps" turns up nothing; I couldn't find the discussion. What does this warning mean? Should I take the recommended action to make it go away?
I have much to learn about Scala and Play.