Skip to content

Commit

Permalink
Merge pull request #10868 from xuwei-k/explicit-implicit-types
Browse files Browse the repository at this point in the history
add explicit type annotations for public implicit val and def
  • Loading branch information
mergify[bot] committed Jun 16, 2021
2 parents 9937609 + 99331b0 commit 8eaae2c
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/play/src/main/scala/controllers/Execution.scala
Expand Up @@ -4,7 +4,7 @@

package play.api.controllers {
sealed trait TrampolineContextProvider {
implicit def trampoline = play.core.Execution.Implicits.trampoline
implicit def trampoline: play.api.libs.streams.Execution.trampoline.type = play.core.Execution.Implicits.trampoline
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/play/src/main/scala/play/api/Logger.scala
Expand Up @@ -367,7 +367,7 @@ trait LowPriorityMarkerContextImplicits {
* no implicit MarkerContext is found in local scope (meaning there is nothing defined
* through import or "implicit val").
*/
implicit val NoMarker = MarkerContext(null)
implicit val NoMarker: MarkerContext = MarkerContext(null)

/**
* Enables conversion from a marker to a MarkerContext:
Expand Down
2 changes: 1 addition & 1 deletion core/play/src/main/scala/play/api/http/MediaRange.scala
Expand Up @@ -145,7 +145,7 @@ object MediaRange {
* Then compare the sub media type. If they are the same, the one with the more parameters has a higher priority.
* Otherwise the least specific has the lower priority, otherwise they have the same priority.
*/
implicit val ordering = new Ordering[play.api.http.MediaRange] {
implicit val ordering: Ordering[play.api.http.MediaRange] = new Ordering[play.api.http.MediaRange] {
def compareQValues(x: Option[BigDecimal], y: Option[BigDecimal]) = {
if (x.isEmpty && y.isEmpty) 0
else if (x.isEmpty) 1
Expand Down
2 changes: 1 addition & 1 deletion core/play/src/main/scala/play/api/mvc/Binders.scala
Expand Up @@ -333,7 +333,7 @@ object QueryStringBindable {
/**
* QueryString binder for String.
*/
implicit def bindableString = new QueryStringBindable[String] {
implicit def bindableString: QueryStringBindable[String] = new QueryStringBindable[String] {
def bind(key: String, params: Map[String, Seq[String]]) =
params.get(key).flatMap(_.headOption).map(Right(_))
// No need to URL decode from query string since netty already does that
Expand Down
2 changes: 1 addition & 1 deletion core/play/src/main/scala/play/api/mvc/Results.scala
Expand Up @@ -463,7 +463,7 @@ object Codec {
/**
* Codec for UTF-8
*/
implicit val utf_8 = javaSupported("utf-8")
implicit val utf_8: Codec = javaSupported("utf-8")

/**
* Codec for ISO-8859-1
Expand Down
2 changes: 1 addition & 1 deletion core/play/src/main/scala/play/core/Execution.scala
Expand Up @@ -8,6 +8,6 @@ private[play] object Execution {
def trampoline = play.api.libs.streams.Execution.trampoline

object Implicits {
implicit def trampoline = Execution.trampoline
implicit def trampoline: play.api.libs.streams.Execution.trampoline.type = Execution.trampoline
}
}
Expand Up @@ -17,5 +17,5 @@ package play.core.routing
case class ReverseRouteContext(fixedParams: Map[String, Any])

object ReverseRouteContext {
implicit val empty = ReverseRouteContext(Map())
implicit val empty: ReverseRouteContext = ReverseRouteContext(Map())
}
11 changes: 6 additions & 5 deletions testkit/play-specs2/src/main/scala/play/api/test/Specs.scala
Expand Up @@ -5,6 +5,7 @@
package play.api.test

import akka.annotation.ApiMayChange
import akka.stream.Materializer
import org.openqa.selenium.WebDriver
import org.specs2.execute.AsResult
import org.specs2.execute.Result
Expand Down Expand Up @@ -52,8 +53,8 @@ abstract class WithApplication(val app: Application = GuiceApplicationBuilder().
this(builder(GuiceApplicationBuilder()).build())
}

implicit def implicitApp = app
implicit def implicitMaterializer = app.materializer
implicit def implicitApp: Application = app
implicit def implicitMaterializer: Materializer = app.materializer
override def around[T: AsResult](t: => T): Result = {
Helpers.running(app)(AsResult.effectively(t))
}
Expand All @@ -73,9 +74,9 @@ abstract class WithServer(
val serverProvider: Option[ServerProvider] = None
) extends Around
with Scope {
implicit def implicitMaterializer = app.materializer
implicit def implicitApp = app
implicit def implicitPort: Port = port
implicit def implicitMaterializer: Materializer = app.materializer
implicit def implicitApp: Application = app
implicit def implicitPort: Port = port

override def around[T: AsResult](t: => T): Result =
Helpers.running(TestServer(port = port, application = app, serverProvider = serverProvider))(
Expand Down
Expand Up @@ -220,7 +220,7 @@ trait DefaultAwaitTimeout {
* check for the event immediately rather than using using NegativeTimeout.
*/
case class NegativeTimeout(t: Timeout)
implicit val defaultNegativeTimeout = NegativeTimeout(200.millis)
implicit val defaultNegativeTimeout: NegativeTimeout = NegativeTimeout(200.millis)
}

trait FutureAwaits {
Expand Down
Expand Up @@ -397,7 +397,7 @@ class NettyServerProvider extends ServerProvider {
object NettyServer extends ServerFromRouter {
private val logger = Logger(this.getClass)

implicit val provider = new NettyServerProvider
implicit val provider: NettyServerProvider = new NettyServerProvider

def main(args: Array[String]): Unit = {
System.err.println(
Expand Down

0 comments on commit 8eaae2c

Please sign in to comment.