In the following code:
case class Token(name: String, number: Int)
tokensDAO.getTokenSeq().map(
tokenSeq => tokenSeq.map(_.number).fold(0)(_ max _)
)
What might possibly be the cause of this compile error?
value max is not a member of Int
The error can be reproduced when the tokenSeq is retrieved from the JDBC database. It is the HikariCP connection pool on the Play Framework.
Since the problem got solved by import Predef.intWrapper, which shouldn't normally be needed, the full imports are included for further scrutiny:
import java.io.{ File, PrintWriter }
import models.{ DownloadToken, User }
import models.daos.{ DownloadDAO, UserDAO }
import Predef.intWrapper
import java.util.UUID
import scala.util.Random
import java.security.SecureRandom
import javax.inject.Inject
import scala.concurrent.{ ExecutionContext, Future }
import java.util.Base64
This is the signature of the class:
class DownloadServiceImpl @Inject() (downloadDAO: DownloadDAO, userDAO: UserDAO, configuration: play.api.Configuration)(implicit ex: ExecutionContext) extends DownloadService
This is the full scalacOptions on build.sbt as requested in the comments:
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
//"-Xlint", // Enable recommended additional warnings.
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
// Play has a lot of issues with unused imports and unsued params
// https://github.com/playframework/playframework/issues/6690
// https://github.com/playframework/twirl/issues/105
"-Xlint:-unused,_"
)