1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-27 18:21:14 +03:00

Remove most of the SAM bridges

The ReplaceWith() on these doesn't work well.

For interceptors I expect the need to be common enough that I'm making these
new APIs that we'll keep going forward. This is for both creating interceptors
directly and as arguments to addInterceptor() and addNetworkInterceptor().
This commit is contained in:
Jesse Wilson
2019-06-02 11:07:13 -04:00
parent 59e5d76954
commit 6b537e2585
13 changed files with 76 additions and 103 deletions

View File

@@ -109,14 +109,6 @@ class HttpLoggingInterceptor @JvmOverloads constructor(
fun log(message: String)
companion object {
@JvmName("-deprecated_Logger")
@Deprecated(
message = "No SAM (single-abstract-method) conversions for Kotlin declarations",
level = DeprecationLevel.WARNING)
operator fun invoke(block: (message: String) -> Unit): Logger = object : Logger {
override fun log(message: String) = block(message)
}
/** A [Logger] defaults output appropriate for the current platform. */
@JvmField
val DEFAULT: Logger = object : Logger {

View File

@@ -150,8 +150,6 @@ class LoggingEventListener private constructor(
open class Factory @JvmOverloads constructor(
private val logger: HttpLoggingInterceptor.Logger = HttpLoggingInterceptor.Logger.DEFAULT
) : EventListener.Factory {
constructor(block: (string: String) -> Unit) : this(HttpLoggingInterceptor.Logger(block))
override fun create(call: Call): EventListener = LoggingEventListener(logger)
}
}