1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-29 06:23:09 +03:00

Deprecate SAM conversion methods

This commit is contained in:
Jesse Wilson
2019-06-01 18:15:36 -04:00
parent f050a7c7e9
commit 6b30649e6e
8 changed files with 67 additions and 54 deletions

View File

@@ -109,11 +109,11 @@ class HttpLoggingInterceptor @JvmOverloads constructor(
fun log(message: String)
companion object {
// This lambda conversion is for Kotlin callers expecting a Java SAM (single-abstract-method).
@JvmName("-deprecated_Logger")
inline operator fun invoke(
crossinline block: (message: String) -> Unit
): Logger = object : 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)
}