File tree 1 file changed +5
-4
lines changed
okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import java.net.ServerSocket
24
24
import java.net.Socket
25
25
import java.net.SocketTimeoutException
26
26
import java.nio.charset.Charset
27
+ import java.util.Collections
27
28
import java.util.Locale
28
29
import java.util.TimeZone
29
30
import java.util.concurrent.ThreadFactory
@@ -233,17 +234,17 @@ internal inline fun threadName(
233
234
}
234
235
235
236
/* * Returns the Content-Length as reported by the response headers. */
236
- internal fun Response.headersContentLength (): Long = headers[" Content-Length" ]?.toLongOrDefault( - 1L ) ? : - 1L
237
+ internal fun Response.headersContentLength (): Long = headers[" Content-Length" ]?.toLongOrNull( ) ? : - 1L
237
238
238
239
/* * Returns an immutable copy of this. */
239
- internal inline fun <reified T > List<T>.toImmutableList (): List <T > = toTypedArray().asList()
240
+ internal inline fun <reified T > List<T>.toImmutableList (): List <T > = Collections .unmodifiableList( toTypedArray().asList() )
240
241
241
242
/* * Returns an immutable list containing [elements]. */
242
243
@SafeVarargs
243
- internal fun <T > immutableListOf (vararg elements : T ): List <T > = elements.asList()
244
+ internal fun <T > immutableListOf (vararg elements : T ): List <T > = Collections .unmodifiableList( elements.asList() )
244
245
245
246
/* * Returns an immutable list from copy of this. */
246
- internal fun <T > Array <out T >?.toImmutableList (): List <T > = this ?.copyOf()? .asList() ? : emptyList()
247
+ internal fun <T > Array <out T >?.toImmutableList (): List <T > = this ?.let { Collections .unmodifiableList(it. copyOf().asList()) } ? : emptyList()
247
248
248
249
/* * Closes this, ignoring any checked exceptions. */
249
250
internal fun Socket.closeQuietly () {
You can’t perform that action at this time.
0 commit comments