diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt index 7d07f5be4..0e8c5f247 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt @@ -102,7 +102,7 @@ class MockResponse : Cloneable { @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "status"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getStatus(): String = status @Deprecated( @@ -216,7 +216,7 @@ class MockResponse : Cloneable { @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "headers"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getHeaders(): Headers = headers @Deprecated( @@ -229,7 +229,7 @@ class MockResponse : Cloneable { @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "trailers"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getTrailers(): Headers = trailers @Deprecated( @@ -242,7 +242,7 @@ class MockResponse : Cloneable { @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "socketPolicy"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getSocketPolicy() = socketPolicy @Deprecated( @@ -257,7 +257,7 @@ class MockResponse : Cloneable { @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "http2ErrorCode"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getHttp2ErrorCode() = http2ErrorCode @Deprecated( diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt index 424106c8c..63a286b92 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt @@ -201,7 +201,7 @@ class MockWebServer : ExternalResource(), Closeable { @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "port"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getPort(): Int = port fun toProxyAddress(): Proxy { @@ -216,7 +216,7 @@ class MockWebServer : ExternalResource(), Closeable { replaceWith = ReplaceWith( expression = "run { this.serverSocketFactory = serverSocketFactory }" ), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun setServerSocketFactory(serverSocketFactory: ServerSocketFactory) = run { this.serverSocketFactory = serverSocketFactory } @@ -241,7 +241,7 @@ class MockWebServer : ExternalResource(), Closeable { replaceWith = ReplaceWith( expression = "run { this.bodyLimit = bodyLimit }" ), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun setBodyLimit(bodyLimit: Long) = run { this.bodyLimit = bodyLimit } @JvmName("-deprecated_protocolNegotiationEnabled") @@ -250,7 +250,7 @@ class MockWebServer : ExternalResource(), Closeable { replaceWith = ReplaceWith( expression = "run { this.protocolNegotiationEnabled = protocolNegotiationEnabled }" ), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun setProtocolNegotiationEnabled(protocolNegotiationEnabled: Boolean) = run { this.protocolNegotiationEnabled = protocolNegotiationEnabled } @@ -259,14 +259,14 @@ class MockWebServer : ExternalResource(), Closeable { @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "run { this.protocols = protocols }"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun setProtocols(protocols: List) = run { this.protocols = protocols } @JvmName("-deprecated_protocols") @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "protocols"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun protocols(): List = protocols /** @@ -335,7 +335,7 @@ class MockWebServer : ExternalResource(), Closeable { @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "requestCount"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getRequestCount(): Int = requestCount /** @@ -764,7 +764,7 @@ class MockWebServer : ExternalResource(), Closeable { val fancyResponse = Response.Builder() .code(Integer.parseInt(statusParts[1])) .message(statusParts[2]) - .headers(response.getHeaders()) + .headers(response.headers) .request(fancyRequest) .protocol(Protocol.HTTP_1_1) .build() @@ -795,14 +795,14 @@ class MockWebServer : ExternalResource(), Closeable { sink.writeUtf8(response.status) sink.writeUtf8("\r\n") - writeHeaders(sink, response.getHeaders()) + writeHeaders(sink, response.headers) val body = response.getBody() ?: return sleepIfDelayed(response.getBodyDelay(TimeUnit.MILLISECONDS)) throttledTransfer(response, socket, body, sink, body.size, false) - if ("chunked".equals(response.getHeaders()["Transfer-Encoding"], ignoreCase = true)) { - writeHeaders(sink, response.getTrailers()) + if ("chunked".equals(response.headers["Transfer-Encoding"], ignoreCase = true)) { + writeHeaders(sink, response.trailers) } } @@ -1032,11 +1032,11 @@ class MockWebServer : ExternalResource(), Closeable { } // TODO: constants for well-known header names. http2Headers.add(Header(Header.RESPONSE_STATUS, statusParts[1])) - val headers = response.getHeaders() + val headers = response.headers for ((name, value) in headers) { http2Headers.add(Header(name, value)) } - val trailers = response.getTrailers() + val trailers = response.trailers sleepIfDelayed(response.getHeadersDelay(TimeUnit.MILLISECONDS)) diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt index bb5741050..fe078a79c 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt @@ -29,27 +29,27 @@ class PushPromise( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "method"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun method() = method @JvmName("-deprecated_path") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "path"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun path() = path @JvmName("-deprecated_headers") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "headers"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun headers() = headers @JvmName("-deprecated_response") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "response"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun response() = response } diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt index 7838e4666..5c175d42d 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt @@ -68,7 +68,7 @@ class RecordedRequest( @Deprecated( message = "Use body.readUtf8()", replaceWith = ReplaceWith("body.readUtf8()"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) val utf8Body: String get() = body.readUtf8() diff --git a/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt b/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt index 6cd3b6582..d2ea1a2c6 100644 --- a/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt +++ b/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt @@ -138,7 +138,7 @@ class HttpLoggingInterceptor @JvmOverloads constructor( @Deprecated( message = "moved to var", replaceWith = ReplaceWith(expression = "level"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun getLevel(): Level = level @Throws(IOException::class) diff --git a/okhttp-tls/src/main/java/okhttp3/tls/HandshakeCertificates.kt b/okhttp-tls/src/main/java/okhttp3/tls/HandshakeCertificates.kt index 97a7e8d62..a9859a241 100644 --- a/okhttp-tls/src/main/java/okhttp3/tls/HandshakeCertificates.kt +++ b/okhttp-tls/src/main/java/okhttp3/tls/HandshakeCertificates.kt @@ -75,14 +75,14 @@ class HandshakeCertificates private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "keyManager"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun keyManager(): X509KeyManager = keyManager @JvmName("-deprecated_trustManager") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "trustManager"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun trustManager(): X509TrustManager = trustManager fun sslSocketFactory(): SSLSocketFactory = sslContext().socketFactory diff --git a/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt b/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt index 45aca8c78..6fae9ee61 100644 --- a/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt +++ b/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt @@ -120,14 +120,14 @@ class HeldCertificate( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "certificate"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun certificate(): X509Certificate = certificate @JvmName("-deprecated_keyPair") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "keyPair"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun keyPair(): KeyPair = keyPair /** diff --git a/okhttp/src/main/java/okhttp3/Address.kt b/okhttp/src/main/java/okhttp3/Address.kt index f769b41c0..e09d129e8 100644 --- a/okhttp/src/main/java/okhttp3/Address.kt +++ b/okhttp/src/main/java/okhttp3/Address.kt @@ -90,77 +90,77 @@ class Address( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "url"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun url() = url @JvmName("-deprecated_dns") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "dns"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun dns() = dns @JvmName("-deprecated_socketFactory") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "socketFactory"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun socketFactory() = socketFactory @JvmName("-deprecated_proxyAuthenticator") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxyAuthenticator"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxyAuthenticator() = proxyAuthenticator @JvmName("-deprecated_protocols") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "protocols"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun protocols() = protocols @JvmName("-deprecated_connectionSpecs") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "connectionSpecs"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun connectionSpecs() = connectionSpecs @JvmName("-deprecated_proxySelector") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxySelector"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxySelector() = proxySelector @JvmName("-deprecated_proxy") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxy"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxy() = proxy @JvmName("-deprecated_sslSocketFactory") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "sslSocketFactory"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun sslSocketFactory() = sslSocketFactory @JvmName("-deprecated_hostnameVerifier") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "hostnameVerifier"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun hostnameVerifier() = hostnameVerifier @JvmName("-deprecated_certificatePinner") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "certificatePinner"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun certificatePinner() = certificatePinner override fun equals(other: Any?): Boolean { diff --git a/okhttp/src/main/java/okhttp3/Cache.kt b/okhttp/src/main/java/okhttp3/Cache.kt index efa7ba675..b84bb141e 100644 --- a/okhttp/src/main/java/okhttp3/Cache.kt +++ b/okhttp/src/main/java/okhttp3/Cache.kt @@ -356,7 +356,7 @@ class Cache internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "directory"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun directory(): File = cache.directory @Synchronized internal fun trackResponse(cacheStrategy: CacheStrategy) { diff --git a/okhttp/src/main/java/okhttp3/CacheControl.kt b/okhttp/src/main/java/okhttp3/CacheControl.kt index 619f79cfd..d9e887c57 100644 --- a/okhttp/src/main/java/okhttp3/CacheControl.kt +++ b/okhttp/src/main/java/okhttp3/CacheControl.kt @@ -74,70 +74,70 @@ class CacheControl private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "noCache"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun noCache() = noCache @JvmName("-deprecated_noStore") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "noStore"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun noStore() = noStore @JvmName("-deprecated_maxAgeSeconds") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "maxAgeSeconds"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun maxAgeSeconds() = maxAgeSeconds @JvmName("-deprecated_sMaxAgeSeconds") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "sMaxAgeSeconds"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun sMaxAgeSeconds() = sMaxAgeSeconds @JvmName("-deprecated_mustRevalidate") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "mustRevalidate"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun mustRevalidate() = mustRevalidate @JvmName("-deprecated_maxStaleSeconds") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "maxStaleSeconds"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun maxStaleSeconds() = maxStaleSeconds @JvmName("-deprecated_minFreshSeconds") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "minFreshSeconds"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun minFreshSeconds() = minFreshSeconds @JvmName("-deprecated_onlyIfCached") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "onlyIfCached"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun onlyIfCached() = onlyIfCached @JvmName("-deprecated_noTransform") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "noTransform"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun noTransform() = noTransform @JvmName("-deprecated_immutable") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "immutable"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun immutable() = immutable override fun toString(): String { diff --git a/okhttp/src/main/java/okhttp3/Challenge.kt b/okhttp/src/main/java/okhttp3/Challenge.kt index b5a92463f..38e5bcc1e 100644 --- a/okhttp/src/main/java/okhttp3/Challenge.kt +++ b/okhttp/src/main/java/okhttp3/Challenge.kt @@ -77,28 +77,28 @@ class Challenge( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "scheme"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun scheme() = scheme @JvmName("-deprecated_authParams") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "authParams"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun authParams() = authParams @JvmName("-deprecated_realm") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "realm"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun realm(): String? = realm @JvmName("-deprecated_charset") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "charset"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun charset(): Charset = charset override fun equals(other: Any?): Boolean { diff --git a/okhttp/src/main/java/okhttp3/CipherSuite.kt b/okhttp/src/main/java/okhttp3/CipherSuite.kt index e17eb18d6..734047d93 100644 --- a/okhttp/src/main/java/okhttp3/CipherSuite.kt +++ b/okhttp/src/main/java/okhttp3/CipherSuite.kt @@ -48,7 +48,7 @@ class CipherSuite private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "javaName"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun javaName(): String = javaName override fun toString(): String = javaName diff --git a/okhttp/src/main/java/okhttp3/ConnectionSpec.kt b/okhttp/src/main/java/okhttp3/ConnectionSpec.kt index 887ae7a96..a9b54f00e 100644 --- a/okhttp/src/main/java/okhttp3/ConnectionSpec.kt +++ b/okhttp/src/main/java/okhttp3/ConnectionSpec.kt @@ -63,7 +63,7 @@ class ConnectionSpec internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cipherSuites"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cipherSuites(): List? = cipherSuites /** @@ -79,14 +79,14 @@ class ConnectionSpec internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "tlsVersions"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun tlsVersions(): List? = tlsVersions @JvmName("-deprecated_supportsTlsExtensions") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "supportsTlsExtensions"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun supportsTlsExtensions(): Boolean = supportsTlsExtensions /** Applies this spec to [sslSocket]. */ diff --git a/okhttp/src/main/java/okhttp3/Cookie.kt b/okhttp/src/main/java/okhttp3/Cookie.kt index 0a26109b4..6d86410cf 100644 --- a/okhttp/src/main/java/okhttp3/Cookie.kt +++ b/okhttp/src/main/java/okhttp3/Cookie.kt @@ -144,63 +144,63 @@ class Cookie private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "name"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun name(): String = name @JvmName("-deprecated_value") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "value"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun value(): String = value @JvmName("-deprecated_persistent") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "persistent"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun persistent(): Boolean = persistent @JvmName("-deprecated_expiresAt") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "expiresAt"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun expiresAt(): Long = expiresAt @JvmName("-deprecated_hostOnly") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "hostOnly"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun hostOnly(): Boolean = hostOnly @JvmName("-deprecated_domain") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "domain"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun domain(): String = domain @JvmName("-deprecated_path") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "path"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun path(): String = path @JvmName("-deprecated_httpOnly") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "httpOnly"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun httpOnly(): Boolean = httpOnly @JvmName("-deprecated_secure") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "secure"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun secure(): Boolean = secure /** diff --git a/okhttp/src/main/java/okhttp3/Dispatcher.kt b/okhttp/src/main/java/okhttp3/Dispatcher.kt index 791c943dc..d64d82693 100644 --- a/okhttp/src/main/java/okhttp3/Dispatcher.kt +++ b/okhttp/src/main/java/okhttp3/Dispatcher.kt @@ -232,6 +232,6 @@ class Dispatcher constructor() { @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "executorService"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun executorService(): ExecutorService = executorService } diff --git a/okhttp/src/main/java/okhttp3/FormBody.kt b/okhttp/src/main/java/okhttp3/FormBody.kt index 235840ad4..de55d4427 100644 --- a/okhttp/src/main/java/okhttp3/FormBody.kt +++ b/okhttp/src/main/java/okhttp3/FormBody.kt @@ -40,7 +40,7 @@ class FormBody internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "size"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun size(): Int = size fun encodedName(index: Int) = encodedNames[index] diff --git a/okhttp/src/main/java/okhttp3/Handshake.kt b/okhttp/src/main/java/okhttp3/Handshake.kt index 3bbaafc81..ffe41afd2 100644 --- a/okhttp/src/main/java/okhttp3/Handshake.kt +++ b/okhttp/src/main/java/okhttp3/Handshake.kt @@ -52,21 +52,21 @@ class Handshake private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "tlsVersion"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun tlsVersion() = tlsVersion @JvmName("-deprecated_cipherSuite") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cipherSuite"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cipherSuite() = cipherSuite @JvmName("-deprecated_peerCertificates") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "peerCertificates"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun peerCertificates() = peerCertificates /** Returns the remote peer's principle, or null if that peer is anonymous. */ @@ -78,14 +78,14 @@ class Handshake private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "peerPrincipal"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun peerPrincipal() = peerPrincipal @JvmName("-deprecated_localCertificates") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "localCertificates"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun localCertificates() = localCertificates /** Returns the local principle, or null if this peer is anonymous. */ @@ -97,7 +97,7 @@ class Handshake private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "localPrincipal"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun localPrincipal() = localPrincipal override fun equals(other: Any?): Boolean { @@ -173,7 +173,7 @@ class Handshake private constructor( @Deprecated( message = "moved to extension function", replaceWith = ReplaceWith(expression = "sslSession.handshake()"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun get(sslSession: SSLSession) = sslSession.handshake() @JvmStatic diff --git a/okhttp/src/main/java/okhttp3/Headers.kt b/okhttp/src/main/java/okhttp3/Headers.kt index 45fadd22d..6193b39ab 100644 --- a/okhttp/src/main/java/okhttp3/Headers.kt +++ b/okhttp/src/main/java/okhttp3/Headers.kt @@ -76,7 +76,7 @@ class Headers private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "size"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun size(): Int = size /** Returns the field at `position`. */ @@ -383,7 +383,7 @@ class Headers private constructor( @Deprecated( message = "function name changed", replaceWith = ReplaceWith(expression = "headersOf(*namesAndValues)"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun of(vararg namesAndValues: String): Headers { return headersOf(*namesAndValues) } @@ -412,7 +412,7 @@ class Headers private constructor( @Deprecated( message = "function moved to extension", replaceWith = ReplaceWith(expression = "headers.toHeaders()"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun of(headers: Map): Headers { return headers.toHeaders() } diff --git a/okhttp/src/main/java/okhttp3/HttpUrl.kt b/okhttp/src/main/java/okhttp3/HttpUrl.kt index 573f4765f..92ff49a76 100644 --- a/okhttp/src/main/java/okhttp3/HttpUrl.kt +++ b/okhttp/src/main/java/okhttp3/HttpUrl.kt @@ -800,133 +800,133 @@ class HttpUrl internal constructor( @Deprecated( message = "moved to toUrl()", replaceWith = ReplaceWith(expression = "toUrl()"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun url() = toUrl() @JvmName("-deprecated_uri") @Deprecated( message = "moved to toUri()", replaceWith = ReplaceWith(expression = "toUri()"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun uri() = toUri() @JvmName("-deprecated_scheme") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "scheme"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun scheme(): String = scheme @JvmName("-deprecated_encodedUsername") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "encodedUsername"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun encodedUsername(): String = encodedUsername @JvmName("-deprecated_username") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "username"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun username(): String = username @JvmName("-deprecated_encodedPassword") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "encodedPassword"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun encodedPassword(): String = encodedPassword @JvmName("-deprecated_password") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "password"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun password(): String = password @JvmName("-deprecated_host") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "host"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun host(): String = host @JvmName("-deprecated_port") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "port"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun port(): Int = port @JvmName("-deprecated_pathSize") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "pathSize"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun pathSize(): Int = pathSize @JvmName("-deprecated_encodedPath") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "encodedPath"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun encodedPath(): String = encodedPath @JvmName("-deprecated_encodedPathSegments") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "encodedPathSegments"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun encodedPathSegments(): List = encodedPathSegments @JvmName("-deprecated_pathSegments") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "pathSegments"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun pathSegments(): List = pathSegments @JvmName("-deprecated_encodedQuery") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "encodedQuery"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun encodedQuery(): String? = encodedQuery @JvmName("-deprecated_query") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "query"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun query(): String? = query @JvmName("-deprecated_querySize") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "querySize"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun querySize(): Int = querySize @JvmName("-deprecated_queryParameterNames") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "queryParameterNames"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun queryParameterNames(): Set = queryParameterNames @JvmName("-deprecated_encodedFragment") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "encodedFragment"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun encodedFragment(): String? = encodedFragment @JvmName("-deprecated_fragment") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "fragment"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun fragment(): String? = fragment class Builder { @@ -1680,7 +1680,7 @@ class HttpUrl internal constructor( replaceWith = ReplaceWith( expression = "url.toHttpUrl()", imports = ["okhttp3.HttpUrl.Companion.toHttpUrl"]), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun get(url: String): HttpUrl = url.toHttpUrl() @JvmName("-deprecated_parse") @@ -1689,7 +1689,7 @@ class HttpUrl internal constructor( replaceWith = ReplaceWith( expression = "url.toHttpUrlOrNull()", imports = ["okhttp3.HttpUrl.Companion.toHttpUrlOrNull"]), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun parse(url: String): HttpUrl? = url.toHttpUrlOrNull() @JvmName("-deprecated_get") @@ -1698,7 +1698,7 @@ class HttpUrl internal constructor( replaceWith = ReplaceWith( expression = "url.toHttpUrlOrNull()", imports = ["okhttp3.HttpUrl.Companion.toHttpUrlOrNull"]), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun get(url: URL): HttpUrl? = url.toHttpUrlOrNull() @JvmName("-deprecated_get") @@ -1707,7 +1707,7 @@ class HttpUrl internal constructor( replaceWith = ReplaceWith( expression = "uri.toHttpUrlOrNull()", imports = ["okhttp3.HttpUrl.Companion.toHttpUrlOrNull"]), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun get(uri: URI): HttpUrl? = uri.toHttpUrlOrNull() internal fun String.percentDecode( diff --git a/okhttp/src/main/java/okhttp3/MediaType.kt b/okhttp/src/main/java/okhttp3/MediaType.kt index 4cc66fcdd..d50a09c34 100644 --- a/okhttp/src/main/java/okhttp3/MediaType.kt +++ b/okhttp/src/main/java/okhttp3/MediaType.kt @@ -58,14 +58,14 @@ class MediaType private constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "type"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun type() = type @JvmName("-deprecated_subtype") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "subtype"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun subtype() = subtype /** @@ -151,7 +151,7 @@ class MediaType private constructor( replaceWith = ReplaceWith( expression = "mediaType.toMediaType()", imports = ["okhttp3.MediaType.Companion.toMediaType"]), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun get(mediaType: String): MediaType = mediaType.toMediaType() @JvmName("-deprecated_parse") @@ -160,7 +160,7 @@ class MediaType private constructor( replaceWith = ReplaceWith( expression = "mediaType.toMediaTypeOrNull()", imports = ["okhttp3.MediaType.Companion.toMediaTypeOrNull"]), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun parse(mediaType: String): MediaType? = mediaType.toMediaTypeOrNull() } } diff --git a/okhttp/src/main/java/okhttp3/MultipartBody.kt b/okhttp/src/main/java/okhttp3/MultipartBody.kt index 5c70a7934..fce2c2b51 100644 --- a/okhttp/src/main/java/okhttp3/MultipartBody.kt +++ b/okhttp/src/main/java/okhttp3/MultipartBody.kt @@ -53,28 +53,28 @@ class MultipartBody internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "type"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun type(): MediaType = type @JvmName("-deprecated_boundary") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "boundary"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun boundary(): String = boundary @JvmName("-deprecated_size") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "size"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun size(): Int = size @JvmName("-deprecated_parts") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "parts"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun parts(): List = parts @Throws(IOException::class) @@ -181,14 +181,14 @@ class MultipartBody internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "headers"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun headers(): Headers? = headers @JvmName("-deprecated_body") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "body"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun body(): RequestBody = body companion object { diff --git a/okhttp/src/main/java/okhttp3/OkHttpClient.kt b/okhttp/src/main/java/okhttp3/OkHttpClient.kt index 539c282ee..a80f756fb 100644 --- a/okhttp/src/main/java/okhttp3/OkHttpClient.kt +++ b/okhttp/src/main/java/okhttp3/OkHttpClient.kt @@ -247,182 +247,182 @@ open class OkHttpClient internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "dispatcher"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun dispatcher(): Dispatcher = dispatcher @JvmName("-deprecated_connectionPool") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "connectionPool"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun connectionPool(): ConnectionPool = connectionPool @JvmName("-deprecated_interceptors") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "interceptors"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun interceptors(): List = interceptors @JvmName("-deprecated_networkInterceptors") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "networkInterceptors"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun networkInterceptors(): List = networkInterceptors @JvmName("-deprecated_eventListenerFactory") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "eventListenerFactory"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun eventListenerFactory(): EventListener.Factory = eventListenerFactory @JvmName("-deprecated_retryOnConnectionFailure") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "retryOnConnectionFailure"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun retryOnConnectionFailure(): Boolean = retryOnConnectionFailure @JvmName("-deprecated_authenticator") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "authenticator"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun authenticator(): Authenticator = authenticator @JvmName("-deprecated_followRedirects") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "followRedirects"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun followRedirects(): Boolean = followRedirects @JvmName("-deprecated_followSslRedirects") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "followSslRedirects"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun followSslRedirects(): Boolean = followSslRedirects @JvmName("-deprecated_cookieJar") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cookieJar"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cookieJar(): CookieJar = cookieJar @JvmName("-deprecated_cache") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cache"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cache(): Cache? = cache @JvmName("-deprecated_dns") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "dns"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun dns(): Dns = dns @JvmName("-deprecated_proxy") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxy"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxy(): Proxy? = proxy @JvmName("-deprecated_proxySelector") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxySelector"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxySelector(): ProxySelector = proxySelector @JvmName("-deprecated_proxyAuthenticator") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxyAuthenticator"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxyAuthenticator(): Authenticator = proxyAuthenticator @JvmName("-deprecated_socketFactory") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "socketFactory"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun socketFactory(): SocketFactory = socketFactory @JvmName("-deprecated_sslSocketFactory") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "sslSocketFactory"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun sslSocketFactory(): SSLSocketFactory = sslSocketFactory @JvmName("-deprecated_connectionSpecs") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "connectionSpecs"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun connectionSpecs(): List = connectionSpecs @JvmName("-deprecated_protocols") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "protocols"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun protocols(): List = protocols @JvmName("-deprecated_hostnameVerifier") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "hostnameVerifier"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun hostnameVerifier(): HostnameVerifier = hostnameVerifier @JvmName("-deprecated_certificatePinner") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "certificatePinner"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun certificatePinner(): CertificatePinner = certificatePinner @JvmName("-deprecated_callTimeoutMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "callTimeoutMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun callTimeoutMillis(): Int = callTimeoutMillis @JvmName("-deprecated_connectTimeoutMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "connectTimeoutMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun connectTimeoutMillis(): Int = connectTimeoutMillis @JvmName("-deprecated_readTimeoutMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "readTimeoutMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun readTimeoutMillis(): Int = readTimeoutMillis @JvmName("-deprecated_writeTimeoutMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "writeTimeoutMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun writeTimeoutMillis(): Int = writeTimeoutMillis @JvmName("-deprecated_pingIntervalMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "pingIntervalMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun pingIntervalMillis(): Int = pingIntervalMillis class Builder constructor() { diff --git a/okhttp/src/main/java/okhttp3/Request.kt b/okhttp/src/main/java/okhttp3/Request.kt index 4aa758905..8a0f1e425 100644 --- a/okhttp/src/main/java/okhttp3/Request.kt +++ b/okhttp/src/main/java/okhttp3/Request.kt @@ -78,35 +78,35 @@ class Request internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "url"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun url(): HttpUrl = url @JvmName("-deprecated_method") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "method"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun method(): String = method @JvmName("-deprecated_headers") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "headers"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun headers(): Headers = headers @JvmName("-deprecated_body") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "body"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun body(): RequestBody? = body @JvmName("-deprecated_cacheControl") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cacheControl"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cacheControl(): CacheControl = cacheControl override fun toString() = buildString { diff --git a/okhttp/src/main/java/okhttp3/Response.kt b/okhttp/src/main/java/okhttp3/Response.kt index 4b339b100..6a6428179 100644 --- a/okhttp/src/main/java/okhttp3/Response.kt +++ b/okhttp/src/main/java/okhttp3/Response.kt @@ -122,21 +122,21 @@ class Response internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "request"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun request(): Request = request @JvmName("-deprecated_protocol") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "protocol"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun protocol(): Protocol = protocol @JvmName("-deprecated_code") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "code"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun code(): Int = code /** @@ -150,14 +150,14 @@ class Response internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "message"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun message(): String = message @JvmName("-deprecated_handshake") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "handshake"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun handshake(): Handshake? = handshake fun headers(name: String): List = headers.values(name) @@ -169,7 +169,7 @@ class Response internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "headers"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun headers(): Headers = headers /** @@ -203,7 +203,7 @@ class Response internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "body"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun body(): ResponseBody? = body fun newBuilder(): Builder = Builder(this) @@ -219,21 +219,21 @@ class Response internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "networkResponse"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun networkResponse(): Response? = networkResponse @JvmName("-deprecated_cacheResponse") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cacheResponse"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cacheResponse(): Response? = cacheResponse @JvmName("-deprecated_priorResponse") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "priorResponse"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun priorResponse(): Response? = priorResponse /** @@ -275,21 +275,21 @@ class Response internal constructor( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "cacheControl"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun cacheControl(): CacheControl = cacheControl @JvmName("-deprecated_sentRequestAtMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "sentRequestAtMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun sentRequestAtMillis(): Long = sentRequestAtMillis @JvmName("-deprecated_receivedResponseAtMillis") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "receivedResponseAtMillis"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun receivedResponseAtMillis(): Long = receivedResponseAtMillis /** diff --git a/okhttp/src/main/java/okhttp3/Route.kt b/okhttp/src/main/java/okhttp3/Route.kt index 3cdb9d99f..6913ee8c1 100644 --- a/okhttp/src/main/java/okhttp3/Route.kt +++ b/okhttp/src/main/java/okhttp3/Route.kt @@ -47,21 +47,21 @@ class Route( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "address"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun address(): Address = address @JvmName("-deprecated_proxy") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "proxy"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun proxy(): Proxy = proxy @JvmName("-deprecated_socketAddress") @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "socketAddress"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun socketAddress(): InetSocketAddress = socketAddress /** diff --git a/okhttp/src/main/java/okhttp3/TlsVersion.kt b/okhttp/src/main/java/okhttp3/TlsVersion.kt index 913bb08ee..79e8a586f 100644 --- a/okhttp/src/main/java/okhttp3/TlsVersion.kt +++ b/okhttp/src/main/java/okhttp3/TlsVersion.kt @@ -32,7 +32,7 @@ enum class TlsVersion( @Deprecated( message = "moved to val", replaceWith = ReplaceWith(expression = "javaName"), - level = DeprecationLevel.WARNING) + level = DeprecationLevel.ERROR) fun javaName() = javaName companion object { diff --git a/okhttp/src/test/java/okhttp3/KotlinSourceCompatibilityTest.kt b/okhttp/src/test/java/okhttp3/KotlinSourceCompatibilityTest.kt deleted file mode 100644 index a3d531b51..000000000 --- a/okhttp/src/test/java/okhttp3/KotlinSourceCompatibilityTest.kt +++ /dev/null @@ -1,1218 +0,0 @@ -/* - * Copyright (C) 2019 Square, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package okhttp3 - -import okhttp3.internal.http2.Settings -import okhttp3.internal.proxy.NullProxySelector -import okhttp3.logging.HttpLoggingInterceptor -import okhttp3.logging.LoggingEventListener -import okhttp3.mockwebserver.MockResponse -import okhttp3.mockwebserver.MockWebServer -import okhttp3.mockwebserver.PushPromise -import okhttp3.mockwebserver.QueueDispatcher -import okhttp3.mockwebserver.RecordedRequest -import okhttp3.mockwebserver.SocketPolicy -import okhttp3.tls.HandshakeCertificates -import okhttp3.tls.HeldCertificate -import okhttp3.tls.internal.TlsUtil.localhost -import okio.Buffer -import okio.BufferedSink -import okio.BufferedSource -import okio.ByteString -import okio.Timeout -import org.junit.Ignore -import org.junit.Test -import java.io.File -import java.io.IOException -import java.math.BigInteger -import java.net.CookieHandler -import java.net.InetAddress -import java.net.InetSocketAddress -import java.net.Proxy -import java.net.ProxySelector -import java.net.Socket -import java.net.URI -import java.net.URL -import java.nio.charset.Charset -import java.security.KeyPair -import java.security.KeyPairGenerator -import java.security.Principal -import java.security.cert.Certificate -import java.security.cert.X509Certificate -import java.time.Duration -import java.time.Instant -import java.util.Date -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors -import java.util.concurrent.TimeUnit -import javax.net.ServerSocketFactory -import javax.net.SocketFactory -import javax.net.ssl.HostnameVerifier -import javax.net.ssl.SSLContext -import javax.net.ssl.SSLSession -import javax.net.ssl.SSLSocket -import javax.net.ssl.SSLSocketFactory -import javax.net.ssl.X509KeyManager -import javax.net.ssl.X509TrustManager - -/** - * Access every type, function, and property from Kotlin to defend against unexpected regressions in - * okhttp 3.14.x source-compatibility. - * - * Unlike most tests we're only really interested in whether this test compiles: it's output is not - * interesting. Do not simplify this code by removing unused declarations or unnecessary types; - * doing so limits the utility of the test. - */ -@Suppress( - "ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", - "DEPRECATION", - "RedundantExplicitType", - "RedundantLambdaArrow", - "UNUSED_ANONYMOUS_PARAMETER", - "UNUSED_VALUE", - "UNUSED_VARIABLE", - "VARIABLE_WITH_REDUNDANT_INITIALIZER" -) -class KotlinSourceCompatibilityTest { - @Test @Ignore - fun address() { - val address: Address = newAddress() - val url: HttpUrl = address.url() - val dns: Dns = address.dns() - val socketFactory: SocketFactory = address.socketFactory() - val proxyAuthenticator: Authenticator = address.proxyAuthenticator() - val protocols: List = address.protocols() - val connectionSpecs: List = address.connectionSpecs() - val proxySelector: ProxySelector = address.proxySelector() - val proxy: Proxy? = address.proxy() - val sslSocketFactory: SSLSocketFactory? = address.sslSocketFactory() - val hostnameVerifier: HostnameVerifier? = address.hostnameVerifier() - val certificatePinner: CertificatePinner? = address.certificatePinner() - } - - @Test @Ignore - fun authenticator() { - var authenticator: Authenticator = object : Authenticator { - override fun authenticate(route: Route?, response: Response): Request? = TODO() - } - } - - @Test @Ignore - fun cache() { - val cache = Cache(File("/cache/"), Integer.MAX_VALUE.toLong()) - cache.initialize() - cache.delete() - cache.evictAll() - val urls: MutableIterator = cache.urls() - val writeAbortCount: Int = cache.writeAbortCount() - val writeSuccessCount: Int = cache.writeSuccessCount() - val size: Long = cache.size() - val maxSize: Long = cache.maxSize() - cache.flush() - cache.close() - val directory: File = cache.directory() - val networkCount: Int = cache.networkCount() - val hitCount: Int = cache.hitCount() - val requestCount: Int = cache.requestCount() - } - - @Test @Ignore - fun cacheControl() { - val cacheControl: CacheControl = CacheControl.Builder().build() - val noCache: Boolean = cacheControl.noCache() - val noStore: Boolean = cacheControl.noStore() - val maxAgeSeconds: Int = cacheControl.maxAgeSeconds() - val sMaxAgeSeconds: Int = cacheControl.sMaxAgeSeconds() - val mustRevalidate: Boolean = cacheControl.mustRevalidate() - val maxStaleSeconds: Int = cacheControl.maxStaleSeconds() - val minFreshSeconds: Int = cacheControl.minFreshSeconds() - val onlyIfCached: Boolean = cacheControl.onlyIfCached() - val noTransform: Boolean = cacheControl.noTransform() - val immutable: Boolean = cacheControl.immutable() - val forceCache: CacheControl = CacheControl.FORCE_CACHE - val forceNetwork: CacheControl = CacheControl.FORCE_NETWORK - val parse: CacheControl = CacheControl.parse(Headers.of()) - } - - @Test @Ignore - fun cacheControlBuilder() { - var builder: CacheControl.Builder = CacheControl.Builder() - builder = builder.noCache() - builder = builder.noStore() - builder = builder.maxAge(0, TimeUnit.MILLISECONDS) - builder = builder.maxStale(0, TimeUnit.MILLISECONDS) - builder = builder.minFresh(0, TimeUnit.MILLISECONDS) - builder = builder.onlyIfCached() - builder = builder.noTransform() - builder = builder.immutable() - val cacheControl: CacheControl = builder.build() - } - - @Test @Ignore - fun call() { - val call: Call = newCall() - } - - @Test @Ignore - fun callback() { - val callback = object : Callback { - override fun onFailure(call: Call, e: IOException) = TODO() - override fun onResponse(call: Call, response: Response) = TODO() - } - } - - @Test @Ignore - fun certificatePinner() { - val heldCertificate: HeldCertificate = HeldCertificate.Builder().build() - val certificate: X509Certificate = heldCertificate.certificate() - val certificatePinner: CertificatePinner = CertificatePinner.Builder().build() - val certificates: List = listOf() - certificatePinner.check("", listOf(certificate)) - certificatePinner.check("", certificate, certificate) - val pin: String = CertificatePinner.pin(certificate) - val default: CertificatePinner = CertificatePinner.DEFAULT - } - - @Test @Ignore - fun certificatePinnerBuilder() { - val builder: CertificatePinner.Builder = CertificatePinner.Builder() - builder.add("", "pin1", "pin2") - } - - @Test @Ignore - fun challenge() { - var challenge = Challenge("", mapOf("" to "")) - challenge = Challenge("", "") - val scheme: String = challenge.scheme() - val authParams: Map = challenge.authParams() - val realm: String? = challenge.realm() - val charset: Charset = challenge.charset() - val utf8: Challenge = challenge.withCharset(Charsets.UTF_8) - } - - @Test @Ignore - fun cipherSuite() { - var cipherSuite: CipherSuite = CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - cipherSuite = CipherSuite.forJavaName("") - val javaName: String = cipherSuite.javaName() - } - - @Test @Ignore - fun connection() { - val connection = object : Connection { - override fun route(): Route = TODO() - override fun socket(): Socket = TODO() - override fun handshake(): Handshake? = TODO() - override fun protocol(): Protocol = TODO() - } - } - - @Test @Ignore - fun connectionPool() { - var connectionPool = ConnectionPool() - connectionPool = ConnectionPool(0, 0L, TimeUnit.SECONDS) - val idleConnectionCount: Int = connectionPool.idleConnectionCount() - val connectionCount: Int = connectionPool.connectionCount() - connectionPool.evictAll() - } - - @Test @Ignore - fun connectionSpec() { - var connectionSpec: ConnectionSpec = ConnectionSpec.RESTRICTED_TLS - connectionSpec = ConnectionSpec.MODERN_TLS - connectionSpec = ConnectionSpec.COMPATIBLE_TLS - connectionSpec = ConnectionSpec.CLEARTEXT - val tlsVersions: List? = connectionSpec.tlsVersions() - val cipherSuites: List? = connectionSpec.cipherSuites() - val supportsTlsExtensions: Boolean = connectionSpec.supportsTlsExtensions() - val compatible: Boolean = connectionSpec.isCompatible( - localhost().sslSocketFactory().createSocket() as SSLSocket) - } - - @Test @Ignore - fun connectionSpecBuilder() { - var builder = ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) - builder = builder.allEnabledCipherSuites() - builder = builder.cipherSuites(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) - builder = builder.cipherSuites("", "") - builder = builder.allEnabledTlsVersions() - builder = builder.tlsVersions(TlsVersion.TLS_1_3) - builder = builder.tlsVersions("", "") - builder = builder.supportsTlsExtensions(false) - val connectionSpec: ConnectionSpec = builder.build() - } - - @Test @Ignore - fun cookie() { - val cookie: Cookie = Cookie.Builder().build() - val name: String = cookie.name() - val value: String = cookie.value() - val persistent: Boolean = cookie.persistent() - val expiresAt: Long = cookie.expiresAt() - val hostOnly: Boolean = cookie.hostOnly() - val domain: String = cookie.domain() - val path: String = cookie.path() - val httpOnly: Boolean = cookie.httpOnly() - val secure: Boolean = cookie.secure() - val matches: Boolean = cookie.matches(HttpUrl.get("")) - val parsedCookie: Cookie? = Cookie.parse(HttpUrl.get(""), "") - val cookies: List = Cookie.parseAll(HttpUrl.get(""), Headers.of()) - } - - @Test @Ignore - fun cookieBuilder() { - var builder: Cookie.Builder = Cookie.Builder() - builder = builder.name("") - builder = builder.value("") - builder = builder.expiresAt(0L) - builder = builder.domain("") - builder = builder.hostOnlyDomain("") - builder = builder.path("") - builder = builder.secure() - builder = builder.httpOnly() - val cookie: Cookie = builder.build() - } - - @Test @Ignore - fun cookieJar() { - val cookieJar = object : CookieJar { - override fun saveFromResponse(url: HttpUrl, cookies: List) = TODO() - override fun loadForRequest(url: HttpUrl): List = TODO() - } - } - - @Test @Ignore - fun credentials() { - val basic: String = Credentials.basic("", "") - } - - @Test @Ignore - fun dispatcher() { - var dispatcher = Dispatcher() - dispatcher = Dispatcher(Executors.newCachedThreadPool()) - val maxRequests: Int = dispatcher.maxRequests - dispatcher.maxRequests = 0 - val maxRequestsPerHost: Int = dispatcher.maxRequestsPerHost - dispatcher.maxRequestsPerHost = 0 - val executorService: ExecutorService = dispatcher.executorService() - dispatcher.idleCallback = object : Runnable { - override fun run() { - TODO() - } - } - val queuedCalls: List = dispatcher.queuedCalls() - val runningCalls: List = dispatcher.runningCalls() - val queuedCallsCount: Int = dispatcher.queuedCallsCount() - val runningCallsCount: Int = dispatcher.runningCallsCount() - dispatcher.cancelAll() - } - - @Test @Ignore - fun dispatcherFromMockWebServer() { - val dispatcher = object : okhttp3.mockwebserver.Dispatcher() { - override fun dispatch(request: RecordedRequest): MockResponse = TODO() - override fun peek(): MockResponse = TODO() - override fun shutdown() = TODO() - } - } - - @Test @Ignore - fun dns() { - var dns: Dns = object : Dns { - override fun lookup(hostname: String): List = TODO() - } - - val system: Dns = Dns.SYSTEM - } - - @Test @Ignore - fun eventListener() { - val eventListener = object : EventListener() { - override fun callStart(call: Call) = TODO() - override fun dnsStart(call: Call, domainName: String) = TODO() - override fun dnsEnd( - call: Call, - domainName: String, - inetAddressList: List - ) = TODO() - - override fun connectStart( - call: Call, - inetSocketAddress: InetSocketAddress, - proxy: Proxy - ) = TODO() - - override fun secureConnectStart(call: Call) = TODO() - override fun secureConnectEnd(call: Call, handshake: Handshake?) = TODO() - override fun connectEnd( - call: Call, - inetSocketAddress: InetSocketAddress, - proxy: Proxy, - protocol: Protocol? - ) = TODO() - - override fun connectFailed( - call: Call, - inetSocketAddress: InetSocketAddress, - proxy: Proxy, - protocol: Protocol?, - ioe: IOException - ) = TODO() - - override fun connectionAcquired(call: Call, connection: Connection) = TODO() - override fun connectionReleased(call: Call, connection: Connection) = TODO() - override fun requestHeadersStart(call: Call) = TODO() - override fun requestHeadersEnd(call: Call, request: Request) = TODO() - override fun requestBodyStart(call: Call) = TODO() - override fun requestBodyEnd(call: Call, byteCount: Long) = TODO() - override fun requestFailed(call: Call, ioe: IOException) = TODO() - override fun responseHeadersStart(call: Call) = TODO() - override fun responseHeadersEnd(call: Call, response: Response) = TODO() - override fun responseBodyStart(call: Call) = TODO() - override fun responseBodyEnd(call: Call, byteCount: Long) = TODO() - override fun responseFailed(call: Call, ioe: IOException) = TODO() - override fun callEnd(call: Call) = TODO() - override fun callFailed(call: Call, ioe: IOException) = TODO() - } - val none: EventListener = EventListener.NONE - } - - @Test @Ignore - fun eventListenerBuilder() { - var builder: EventListener.Factory = object : EventListener.Factory { - override fun create(call: Call): EventListener = TODO() - } - } - - @Test @Ignore - fun formBody() { - val formBody: FormBody = FormBody.Builder().build() - val size: Int = formBody.size() - val encodedName: String = formBody.encodedName(0) - val name: String = formBody.name(0) - val encodedValue: String = formBody.encodedValue(0) - val value: String = formBody.value(0) - val contentType: MediaType? = formBody.contentType() - val contentLength: Long = formBody.contentLength() - formBody.writeTo(Buffer()) - val requestBody: RequestBody = formBody - } - - @Test @Ignore - fun formBodyBuilder() { - var builder: FormBody.Builder = FormBody.Builder() - builder = FormBody.Builder(Charsets.UTF_8) - builder = builder.add("", "") - builder = builder.addEncoded("", "") - val formBody: FormBody = builder.build() - } - - @Test @Ignore - fun handshake() { - var handshake: Handshake = - Handshake.get((localhost().sslSocketFactory().createSocket() as SSLSocket).session) - val listOfCertificates: List = listOf() - handshake = Handshake.get( - TlsVersion.TLS_1_3, - CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - listOfCertificates, - listOfCertificates - ) - val tlsVersion: TlsVersion = handshake.tlsVersion() - val cipherSuite: CipherSuite = handshake.cipherSuite() - val peerCertificates: List = handshake.peerCertificates() - val peerPrincipal: Principal? = handshake.peerPrincipal() - val localCertificates: List = handshake.localCertificates() - val localPrincipal: Principal? = handshake.localPrincipal() - } - - @Test @Ignore - fun headers() { - var headers: Headers = Headers.of("", "") - headers = Headers.of(mapOf("" to "")) - val get: String? = headers.get("") - val date: Date? = headers.getDate("") - val instant: Instant? = headers.getInstant("") - val size: Int = headers.size() - val name: String = headers.name(0) - val value: String = headers.value(0) - val names: Set = headers.names() - val values: List = headers.values("") - val byteCount: Long = headers.byteCount() - val builder: Headers.Builder = headers.newBuilder() - val multimap: Map> = headers.toMultimap() - } - - @Test @Ignore - fun headersBuilder() { - var builder: Headers.Builder = Headers.Builder() - builder = builder.add("") - builder = builder.add("", "") - builder = builder.addUnsafeNonAscii("", "") - builder = builder.addAll(Headers.of()) - builder = builder.add("", Date(0L)) - builder = builder.add("", Instant.EPOCH) - builder = builder.set("", "") - builder = builder.set("", Date(0L)) - builder = builder.set("", Instant.EPOCH) - builder = builder.removeAll("") - val get: String? = builder.get("") - val headers: Headers = builder.build() - } - - @Test @Ignore - fun httpLoggingInterceptor() { - var interceptor: HttpLoggingInterceptor = HttpLoggingInterceptor() - interceptor = HttpLoggingInterceptor(HttpLoggingInterceptor.Logger.DEFAULT) - interceptor.redactHeader("") - interceptor.level = HttpLoggingInterceptor.Level.BASIC - interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC) - var level: HttpLoggingInterceptor.Level = interceptor.level - level = interceptor.getLevel() - interceptor.intercept(newInterceptorChain()) - } - - @Test @Ignore - fun httpLoggingInterceptorLevel() { - val none: HttpLoggingInterceptor.Level = HttpLoggingInterceptor.Level.NONE - val basic: HttpLoggingInterceptor.Level = HttpLoggingInterceptor.Level.BASIC - val headers: HttpLoggingInterceptor.Level = HttpLoggingInterceptor.Level.HEADERS - val body: HttpLoggingInterceptor.Level = HttpLoggingInterceptor.Level.BODY - } - - @Test @Ignore - fun httpLoggingInterceptorLogger() { - var logger: HttpLoggingInterceptor.Logger = object : HttpLoggingInterceptor.Logger { - override fun log(message: String) = TODO() - } - val default: HttpLoggingInterceptor.Logger = HttpLoggingInterceptor.Logger.DEFAULT - } - - @Test @Ignore - fun httpUrl() { - val httpUrl: HttpUrl = HttpUrl.get("") - val isHttps: Boolean = httpUrl.isHttps - val url: URL = httpUrl.url() - val uri: URI = httpUrl.uri() - val scheme: String = httpUrl.scheme() - val encodedUsername: String = httpUrl.encodedUsername() - val username: String = httpUrl.username() - val encodedPassword: String = httpUrl.encodedPassword() - val password: String = httpUrl.password() - val host: String = httpUrl.host() - val port: Int = httpUrl.port() - val pathSize: Int = httpUrl.pathSize() - val encodedPath: String = httpUrl.encodedPath() - val encodedPathSegments: List = httpUrl.encodedPathSegments() - val pathSegments: List = httpUrl.pathSegments() - val encodedQuery: String? = httpUrl.encodedQuery() - val query: String? = httpUrl.query() - val querySize: Int = httpUrl.querySize() - val queryParameter: String? = httpUrl.queryParameter("") - val queryParameterNames: Set = httpUrl.queryParameterNames() - val queryParameterValues: List = httpUrl.queryParameterValues("") - val queryParameterName: String = httpUrl.queryParameterName(0) - val queryParameterValue: String? = httpUrl.queryParameterValue(0) - val encodedFragment: String? = httpUrl.encodedFragment() - val fragment: String? = httpUrl.fragment() - val redact: String = httpUrl.redact() - var builder: HttpUrl.Builder = httpUrl.newBuilder() - var resolveBuilder: HttpUrl.Builder? = httpUrl.newBuilder("") - val topPrivateDomain: String? = httpUrl.topPrivateDomain() - val resolve: HttpUrl? = httpUrl.resolve("") - val getFromUrl: HttpUrl? = HttpUrl.get(URL("")) - val getFromUri: HttpUrl? = HttpUrl.get(URI("")) - val parse: HttpUrl? = HttpUrl.parse("") - val defaultPort: Int = HttpUrl.defaultPort("") - } - - @Test @Ignore - fun httpUrlBuilder() { - var builder: HttpUrl.Builder = HttpUrl.Builder() - builder = builder.scheme("") - builder = builder.username("") - builder = builder.encodedUsername("") - builder = builder.password("") - builder = builder.encodedPassword("") - builder = builder.host("") - builder = builder.port(0) - builder = builder.addPathSegment("") - builder = builder.addPathSegments("") - builder = builder.addEncodedPathSegment("") - builder = builder.addEncodedPathSegments("") - builder = builder.setPathSegment(0, "") - builder = builder.setEncodedPathSegment(0, "") - builder = builder.removePathSegment(0) - builder = builder.encodedPath("") - builder = builder.query("") - builder = builder.encodedQuery("") - builder = builder.addQueryParameter("", "") - builder = builder.addEncodedQueryParameter("", "") - builder = builder.setQueryParameter("", "") - builder = builder.setEncodedQueryParameter("", "") - builder = builder.removeAllQueryParameters("") - builder = builder.removeAllEncodedQueryParameters("") - builder = builder.fragment("") - builder = builder.encodedFragment("") - val httpUrl: HttpUrl = builder.build() - } - - @Test @Ignore - fun interceptor() { - var interceptor: Interceptor = object : Interceptor { - override fun intercept(chain: Interceptor.Chain): Response = TODO() - } - interceptor = Interceptor { chain: Interceptor.Chain -> chain.proceed(chain.request()) } - } - - @Test @Ignore - fun interceptorChain() { - val chain: Interceptor.Chain = newInterceptorChain() - } - - @Test @Ignore - fun handshakeCertificates() { - val handshakeCertificates = HandshakeCertificates.Builder().build() - val keyManager: X509KeyManager = handshakeCertificates.keyManager() - val trustManager: X509TrustManager = handshakeCertificates.trustManager() - val sslSocketFactory: SSLSocketFactory = handshakeCertificates.sslSocketFactory() - val sslContext: SSLContext = handshakeCertificates.sslContext() - } - - @Test @Ignore - fun handshakeCertificatesBuilder() { - var builder: HandshakeCertificates.Builder = HandshakeCertificates.Builder() - val heldCertificate = HeldCertificate.Builder().build() - builder = builder.heldCertificate(heldCertificate, heldCertificate.certificate()) - builder = builder.addTrustedCertificate(heldCertificate.certificate()) - builder = builder.addPlatformTrustedCertificates() - val handshakeCertificates: HandshakeCertificates = builder.build() - } - - @Test @Ignore - fun heldCertificate() { - val heldCertificate: HeldCertificate = HeldCertificate.Builder().build() - val certificate: X509Certificate = heldCertificate.certificate() - val keyPair: KeyPair = heldCertificate.keyPair() - val certificatePem: String = heldCertificate.certificatePem() - val privateKeyPkcs8Pem: String = heldCertificate.privateKeyPkcs8Pem() - val privateKeyPkcs1Pem: String = heldCertificate.privateKeyPkcs1Pem() - } - - @Test @Ignore - fun heldCertificateBuilder() { - val keyPair: KeyPair = KeyPairGenerator.getInstance("").genKeyPair() - var builder: HeldCertificate.Builder = HeldCertificate.Builder() - builder = builder.validityInterval(0L, 0L) - builder = builder.duration(0L, TimeUnit.SECONDS) - builder = builder.addSubjectAlternativeName("") - builder = builder.commonName("") - builder = builder.organizationalUnit("") - builder = builder.serialNumber(BigInteger.ZERO) - builder = builder.serialNumber(0L) - builder = builder.keyPair(keyPair) - builder = builder.keyPair(keyPair.public, keyPair.private) - builder = builder.signedBy(HeldCertificate.Builder().build()) - builder = builder.certificateAuthority(0) - builder = builder.ecdsa256() - builder = builder.rsa2048() - val heldCertificate: HeldCertificate = builder.build() - } - - @Test @Ignore - fun javaNetAuthenticator() { - val authenticator = JavaNetAuthenticator() - val response = Response.Builder().build() - var request: Request? = authenticator.authenticate(newRoute(), response) - request = authenticator.authenticate(null, response) - } - - @Test @Ignore - fun javaNetCookieJar() { - val cookieJar: JavaNetCookieJar = JavaNetCookieJar(newCookieHandler()) - val httpUrl = HttpUrl.get("") - val loadForRequest: List = cookieJar.loadForRequest(httpUrl) - cookieJar.saveFromResponse(httpUrl, listOf(Cookie.Builder().build())) - } - - @Test @Ignore - fun loggingEventListener() { - var loggingEventListener: EventListener = LoggingEventListener.Factory().create(newCall()) - } - - @Test @Ignore - fun loggingEventListenerFactory() { - var factory: LoggingEventListener.Factory = LoggingEventListener.Factory() - factory = LoggingEventListener.Factory(HttpLoggingInterceptor.Logger.DEFAULT) - factory = object : LoggingEventListener.Factory() { - override fun create(call: Call): EventListener = TODO() - } - val eventListener: EventListener = factory.create(newCall()) - } - - @Test @Ignore - fun mediaType() { - val mediaType: MediaType = MediaType.get("") - val defaultCharset: Charset? = mediaType.charset() - val charset: Charset? = mediaType.charset(Charsets.UTF_8) - val type: String = mediaType.type() - val subtype: String = mediaType.subtype() - val parse: MediaType? = MediaType.parse("") - } - - @Test @Ignore - fun mockResponse() { - var mockResponse: MockResponse = MockResponse() - var status: String = mockResponse.getStatus() - status = mockResponse.status - mockResponse = mockResponse.setStatus("") - mockResponse.status = "" - mockResponse = mockResponse.setResponseCode(0) - var headers: Headers = mockResponse.getHeaders() - headers = mockResponse.headers - var trailers: Headers = mockResponse.getTrailers() - trailers = mockResponse.trailers - mockResponse = mockResponse.clearHeaders() - mockResponse = mockResponse.addHeader("") - mockResponse = mockResponse.addHeader("", "") - mockResponse = mockResponse.addHeaderLenient("", Any()) - mockResponse = mockResponse.setHeader("", Any()) - mockResponse = mockResponse.setHeaders(Headers.of()) - mockResponse.headers = Headers.of() - mockResponse = mockResponse.setTrailers(Headers.of()) - mockResponse.trailers = Headers.of() - mockResponse = mockResponse.removeHeader("") - var body: Buffer? = mockResponse.getBody() - mockResponse = mockResponse.setBody(Buffer()) - mockResponse = mockResponse.setChunkedBody(Buffer(), 0) - mockResponse = mockResponse.setChunkedBody("", 0) - var socketPolicy: SocketPolicy = mockResponse.getSocketPolicy() - socketPolicy = mockResponse.socketPolicy - mockResponse = mockResponse.setSocketPolicy(SocketPolicy.KEEP_OPEN) - var http2ErrorCode: Int = mockResponse.getHttp2ErrorCode() - http2ErrorCode = mockResponse.http2ErrorCode - mockResponse = mockResponse.setHttp2ErrorCode(0) - mockResponse.http2ErrorCode = 0 - mockResponse = mockResponse.throttleBody(0L, 0L, TimeUnit.SECONDS) - var throttleBytesPerPeriod: Long = mockResponse.throttleBytesPerPeriod - throttleBytesPerPeriod = mockResponse.throttleBytesPerPeriod - var throttlePeriod: Long = mockResponse.getThrottlePeriod(TimeUnit.SECONDS) - mockResponse = mockResponse.setBodyDelay(0L, TimeUnit.SECONDS) - val bodyDelay: Long = mockResponse.getBodyDelay(TimeUnit.SECONDS) - mockResponse = mockResponse.setHeadersDelay(0L, TimeUnit.SECONDS) - val headersDelay: Long = mockResponse.getHeadersDelay(TimeUnit.SECONDS) - mockResponse = mockResponse.withPush(PushPromise("", "", Headers.of(), MockResponse())) - var pushPromises: List = mockResponse.pushPromises - pushPromises = mockResponse.pushPromises - mockResponse = mockResponse.withSettings(Settings()) - var settings: Settings = mockResponse.settings - settings = mockResponse.settings - mockResponse = mockResponse.withWebSocketUpgrade(object : WebSocketListener() { - }) - var webSocketListener: WebSocketListener? = mockResponse.webSocketListener - webSocketListener = mockResponse.webSocketListener - } - - @Test @Ignore - fun mockWebServer() { - val mockWebServer: MockWebServer = MockWebServer() - var port: Int = mockWebServer.getPort() - port = mockWebServer.port - var hostName: String = mockWebServer.hostName - val toProxyAddress: Proxy = mockWebServer.toProxyAddress() - mockWebServer.setServerSocketFactory(ServerSocketFactory.getDefault()) - val url: HttpUrl = mockWebServer.url("") - mockWebServer.setBodyLimit(0L) - mockWebServer.setProtocolNegotiationEnabled(false) - mockWebServer.setProtocols(listOf(Protocol.HTTP_1_1)) - val protocols: List = mockWebServer.protocols() - mockWebServer.useHttps(SSLSocketFactory.getDefault() as SSLSocketFactory, false) - mockWebServer.noClientAuth() - mockWebServer.requestClientAuth() - mockWebServer.requireClientAuth() - var request: RecordedRequest = mockWebServer.takeRequest() - request = mockWebServer.takeRequest(0L, TimeUnit.SECONDS) - var requestCount: Int = mockWebServer.getRequestCount() - requestCount = mockWebServer.requestCount - mockWebServer.enqueue(MockResponse()) - mockWebServer.start() - mockWebServer.start(0) - mockWebServer.start(InetAddress.getLocalHost(), 0) - mockWebServer.shutdown() - var dispatcher: okhttp3.mockwebserver.Dispatcher = mockWebServer.dispatcher - dispatcher = mockWebServer.dispatcher - mockWebServer.dispatcher = QueueDispatcher() - mockWebServer.close() - } - - @Test @Ignore - fun multipartBody() { - val multipartBody: MultipartBody = MultipartBody.Builder().build() - val type: MediaType = multipartBody.type() - val boundary: String = multipartBody.boundary() - val size: Int = multipartBody.size() - val parts: List = multipartBody.parts() - val part: MultipartBody.Part = multipartBody.part(0) - val contentType: MediaType? = multipartBody.contentType() - val contentLength: Long = multipartBody.contentLength() - multipartBody.writeTo(Buffer()) - val mixed: MediaType = MultipartBody.MIXED - val alternative: MediaType = MultipartBody.ALTERNATIVE - val digest: MediaType = MultipartBody.DIGEST - val parallel: MediaType = MultipartBody.PARALLEL - val form: MediaType = MultipartBody.FORM - } - - @Test @Ignore - fun multipartBodyPart() { - val requestBody: RequestBody = RequestBody.create(null, "") - var part: MultipartBody.Part = MultipartBody.Part.create(null, requestBody) - part = MultipartBody.Part.create(Headers.of(), requestBody) - part = MultipartBody.Part.create(requestBody) - part = MultipartBody.Part.createFormData("", "") - part = MultipartBody.Part.createFormData("", "", requestBody) - part = MultipartBody.Part.createFormData("", null, requestBody) - val headers: Headers? = part.headers() - val body: RequestBody = part.body() - } - - @Test @Ignore - fun multipartBodyBuilder() { - val requestBody = RequestBody.create(null, "") - var builder: MultipartBody.Builder = MultipartBody.Builder() - builder = MultipartBody.Builder("") - builder = builder.setType(MediaType.get("")) - builder = builder.addPart(requestBody) - builder = builder.addPart(Headers.of(), requestBody) - builder = builder.addPart(null, requestBody) - builder = builder.addFormDataPart("", "") - builder = builder.addFormDataPart("", "", requestBody) - builder = builder.addFormDataPart("", null, requestBody) - builder = builder.addPart(MultipartBody.Part.create(requestBody)) - val multipartBody: MultipartBody = builder.build() - } - - @Test @Ignore - fun okHttpClient() { - val client: OkHttpClient = OkHttpClient() - val dispatcher: Dispatcher = client.dispatcher() - val proxy: Proxy? = client.proxy() - val protocols: List = client.protocols() - val connectionSpecs: List = client.connectionSpecs() - val interceptors: List = client.interceptors() - val networkInterceptors: List = client.networkInterceptors() - val eventListenerFactory: EventListener.Factory = client.eventListenerFactory() - val proxySelector: ProxySelector = client.proxySelector() - val cookieJar: CookieJar = client.cookieJar() - val cache: Cache? = client.cache() - val socketFactory: SocketFactory = client.socketFactory() - val sslSocketFactory: SSLSocketFactory = client.sslSocketFactory() - val hostnameVerifier: HostnameVerifier = client.hostnameVerifier() - val certificatePinner: CertificatePinner = client.certificatePinner() - val proxyAuthenticator: Authenticator = client.proxyAuthenticator() - val authenticator: Authenticator = client.authenticator() - val connectionPool: ConnectionPool = client.connectionPool() - val dns: Dns = client.dns() - val followSslRedirects: Boolean = client.followSslRedirects() - val followRedirects: Boolean = client.followRedirects() - val retryOnConnectionFailure: Boolean = client.retryOnConnectionFailure() - val callTimeoutMillis: Int = client.callTimeoutMillis() - val connectTimeoutMillis: Int = client.connectTimeoutMillis() - val readTimeoutMillis: Int = client.readTimeoutMillis() - val writeTimeoutMillis: Int = client.writeTimeoutMillis() - val pingIntervalMillis: Int = client.pingIntervalMillis() - val call: Call = client.newCall(Request.Builder().build()) - val webSocket: WebSocket = client.newWebSocket( - Request.Builder().build(), - object : WebSocketListener() { - }) - val newBuilder: OkHttpClient.Builder = client.newBuilder() - } - - @Test @Ignore - fun okHttpClientBuilder() { - var builder: OkHttpClient.Builder = OkHttpClient.Builder() - builder = builder.callTimeout(0L, TimeUnit.SECONDS) - builder = builder.callTimeout(Duration.ofSeconds(0L)) - builder = builder.connectTimeout(0L, TimeUnit.SECONDS) - builder = builder.connectTimeout(Duration.ofSeconds(0L)) - builder = builder.readTimeout(0L, TimeUnit.SECONDS) - builder = builder.readTimeout(Duration.ofSeconds(0L)) - builder = builder.writeTimeout(0L, TimeUnit.SECONDS) - builder = builder.writeTimeout(Duration.ofSeconds(0L)) - builder = builder.pingInterval(0L, TimeUnit.SECONDS) - builder = builder.pingInterval(Duration.ofSeconds(0L)) - builder = builder.proxy(Proxy.NO_PROXY) - builder = builder.proxySelector(NullProxySelector()) - builder = builder.cookieJar(CookieJar.NO_COOKIES) - builder = builder.cache(Cache(File("/cache/"), Integer.MAX_VALUE.toLong())) - builder = builder.dns(Dns.SYSTEM) - builder = builder.socketFactory(SocketFactory.getDefault()) - builder = builder.sslSocketFactory(localhost().sslSocketFactory(), localhost().trustManager()) - builder = builder.hostnameVerifier(newHostnameVerifier()) - builder = builder.hostnameVerifier(HostnameVerifier { hostname, session -> false }) - builder = builder.certificatePinner(CertificatePinner.DEFAULT) - builder = builder.authenticator(Authenticator.NONE) - builder = builder.proxyAuthenticator(Authenticator.NONE) - builder = builder.connectionPool(ConnectionPool(0, 0, TimeUnit.SECONDS)) - builder = builder.followSslRedirects(false) - builder = builder.followRedirects(false) - builder = builder.retryOnConnectionFailure(false) - builder = builder.dispatcher(Dispatcher()) - builder = builder.protocols(listOf(Protocol.HTTP_1_1)) - builder = builder.connectionSpecs(listOf(ConnectionSpec.MODERN_TLS)) - val interceptors: List = builder.interceptors() - builder = builder.addInterceptor(object : Interceptor { - override fun intercept(chain: Interceptor.Chain): Response = TODO() - }) - builder = builder.addInterceptor { it: Interceptor.Chain -> TODO() } - val networkInterceptors: List = builder.networkInterceptors() - builder = builder.addNetworkInterceptor(object : Interceptor { - override fun intercept(chain: Interceptor.Chain): Response = TODO() - }) - builder = builder.addNetworkInterceptor { it: Interceptor.Chain -> TODO() } - builder = builder.eventListener(EventListener.NONE) - builder = builder.eventListenerFactory(object : EventListener.Factory { - override fun create(call: Call): EventListener = TODO() - }) - val client: OkHttpClient = builder.build() - } - - @Test @Ignore - fun testAddInterceptor() { - val builder = OkHttpClient.Builder() - - val i = HttpLoggingInterceptor() - - builder.interceptors().add(i) - builder.networkInterceptors().add(i) - } - - @Test @Ignore - fun protocol() { - var protocol: Protocol = Protocol.HTTP_2 - protocol = Protocol.get("") - } - - @Test @Ignore - fun pushPromise() { - val pushPromise: PushPromise = PushPromise("", "", Headers.of(), MockResponse()) - val method: String = pushPromise.method() - val path: String = pushPromise.path() - val headers: Headers = pushPromise.headers() - val response: MockResponse = pushPromise.response() - } - - @Test @Ignore - fun queueDispatcher() { - var queueDispatcher: QueueDispatcher = object : QueueDispatcher() { - override fun dispatch(request: RecordedRequest): MockResponse = TODO() - override fun peek(): MockResponse = TODO() - override fun enqueueResponse(response: MockResponse) = TODO() - override fun shutdown() = TODO() - override fun setFailFast(failFast: Boolean) = TODO() - override fun setFailFast(failFastResponse: MockResponse?) = TODO() - } - queueDispatcher = QueueDispatcher() - var mockResponse: MockResponse = queueDispatcher.dispatch( - RecordedRequest("", Headers.of(), listOf(), 0L, Buffer(), 0, Socket())) - mockResponse = queueDispatcher.peek() - queueDispatcher.enqueueResponse(MockResponse()) - queueDispatcher.shutdown() - queueDispatcher.setFailFast(false) - queueDispatcher.setFailFast(MockResponse()) - } - - @Test @Ignore - fun recordedRequest() { - var recordedRequest: RecordedRequest = RecordedRequest( - "", Headers.of(), listOf(), 0L, Buffer(), 0, Socket()) - recordedRequest = RecordedRequest("", Headers.of(), listOf(), 0L, Buffer(), 0, Socket()) - var requestUrl: HttpUrl? = recordedRequest.requestUrl - var requestLine: String = recordedRequest.requestLine - var method: String? = recordedRequest.method - var path: String? = recordedRequest.path - var headers: Headers = recordedRequest.headers - val header: String? = recordedRequest.getHeader("") - var chunkSizes: List = recordedRequest.chunkSizes - var bodySize: Long = recordedRequest.bodySize - var body: Buffer = recordedRequest.body - var utf8Body: String = recordedRequest.utf8Body - var sequenceNumber: Int = recordedRequest.sequenceNumber - var tlsVersion: TlsVersion? = recordedRequest.tlsVersion - var handshake: Handshake? = recordedRequest.handshake - } - - @Test @Ignore - fun request() { - val request: Request = Request.Builder().build() - val isHttps: Boolean = request.isHttps - val url: HttpUrl = request.url() - val method: String = request.method() - val headers: Headers = request.headers() - val header: String? = request.header("") - val headersForName: List = request.headers("") - val body: RequestBody? = request.body() - var tag: Any? = request.tag() - tag = request.tag(Any::class.java) - val builder: Request.Builder = request.newBuilder() - val cacheControl: CacheControl = request.cacheControl() - } - - @Test @Ignore - fun requestBuilder() { - val requestBody = RequestBody.create(null, "") - var builder = Request.Builder() - builder = builder.url(HttpUrl.get("")) - builder = builder.url("") - builder = builder.url(URL("")) - builder = builder.header("", "") - builder = builder.addHeader("", "") - builder = builder.removeHeader("") - builder = builder.headers(Headers.of()) - builder = builder.cacheControl(CacheControl.FORCE_CACHE) - builder = builder.get() - builder = builder.head() - builder = builder.post(requestBody) - builder = builder.delete(requestBody) - builder = builder.delete(null) - builder = builder.put(requestBody) - builder = builder.patch(requestBody) - builder = builder.method("", requestBody) - builder = builder.method("", null) - builder = builder.tag("") - builder = builder.tag(null) - builder = builder.tag(String::class.java, "") - builder = builder.tag(String::class.java, null) - val request: Request = builder.build() - } - - @Test @Ignore - fun requestBody() { - var requestBody: RequestBody = object : RequestBody() { - override fun contentType(): MediaType? = TODO() - override fun contentLength(): Long = TODO() - override fun isDuplex(): Boolean = TODO() - override fun isOneShot(): Boolean = TODO() - override fun writeTo(sink: BufferedSink) = TODO() - } - requestBody = RequestBody.create(null, "") - requestBody = RequestBody.create(MediaType.parse(""), "") - requestBody = RequestBody.create(null, ByteString.EMPTY) - requestBody = RequestBody.create(MediaType.parse(""), ByteString.EMPTY) - requestBody = RequestBody.create(null, byteArrayOf(0, 1)) - requestBody = RequestBody.create(MediaType.parse(""), byteArrayOf(0, 1)) - requestBody = RequestBody.create(null, byteArrayOf(0, 1), 0, 2) - requestBody = RequestBody.create(MediaType.parse(""), byteArrayOf(0, 1), 0, 2) - requestBody = RequestBody.create(null, File("")) - requestBody = RequestBody.create(MediaType.parse(""), File("")) - } - - @Test @Ignore - fun response() { - val response: Response = Response.Builder().build() - val request: Request = response.request() - val protocol: Protocol = response.protocol() - val code: Int = response.code() - val successful: Boolean = response.isSuccessful - val message: String = response.message() - val handshake: Handshake? = response.handshake() - val headersForName: List = response.headers("") - val header: String? = response.header("") - val headers: Headers = response.headers() - val trailers: Headers = response.trailers() - val peekBody: ResponseBody = response.peekBody(0L) - val body: ResponseBody? = response.body() - val builder: Response.Builder = response.newBuilder() - val redirect: Boolean = response.isRedirect - val networkResponse: Response? = response.networkResponse() - val cacheResponse: Response? = response.cacheResponse() - val priorResponse: Response? = response.priorResponse() - val challenges: List = response.challenges() - val cacheControl: CacheControl = response.cacheControl() - val sentRequestAtMillis: Long = response.sentRequestAtMillis() - val receivedResponseAtMillis: Long = response.receivedResponseAtMillis() - } - - @Test @Ignore - fun responseBuilder() { - var builder: Response.Builder = Response.Builder() - builder = builder.request(Request.Builder().build()) - builder = builder.protocol(Protocol.HTTP_2) - builder = builder.code(0) - builder = builder.message("") - builder = builder.handshake(Handshake.get( - TlsVersion.TLS_1_3, - CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - listOf(), - listOf()) - ) - builder = builder.handshake(null) - builder = builder.header("", "") - builder = builder.addHeader("", "") - builder = builder.removeHeader("") - builder = builder.headers(Headers.of()) - builder = builder.body(ResponseBody.create(null, "")) - builder = builder.body(null) - builder = builder.networkResponse(Response.Builder().build()) - builder = builder.networkResponse(null) - builder = builder.cacheResponse(Response.Builder().build()) - builder = builder.cacheResponse(null) - builder = builder.priorResponse(Response.Builder().build()) - builder = builder.priorResponse(null) - builder = builder.sentRequestAtMillis(0L) - builder = builder.receivedResponseAtMillis(0L) - val response: Response = builder.build() - } - - @Test @Ignore - fun responseBody() { - var responseBody: ResponseBody = object : ResponseBody() { - override fun contentType(): MediaType? = TODO() - override fun contentLength(): Long = TODO() - override fun source(): BufferedSource = TODO() - override fun close() = TODO() - } - val byteStream = responseBody.byteStream() - val source = responseBody.source() - val bytes = responseBody.bytes() - val charStream = responseBody.charStream() - val string = responseBody.string() - responseBody.close() - responseBody = ResponseBody.create(MediaType.get(""), "") - responseBody = ResponseBody.create(null, "") - responseBody = ResponseBody.create(MediaType.get(""), ByteString.EMPTY) - responseBody = ResponseBody.create(null, ByteString.EMPTY) - responseBody = ResponseBody.create(MediaType.get(""), byteArrayOf(0, 1)) - responseBody = ResponseBody.create(null, byteArrayOf(0, 1)) - responseBody = ResponseBody.create(MediaType.get(""), 0L, Buffer()) - responseBody = ResponseBody.create(null, 0L, Buffer()) - } - - @Test @Ignore - fun route() { - val route: Route = newRoute() - val address: Address = route.address() - val proxy: Proxy = route.proxy() - val inetSocketAddress: InetSocketAddress = route.socketAddress() - val requiresTunnel: Boolean = route.requiresTunnel() - } - - @Test @Ignore - fun socketPolicy() { - val socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN - } - - @Test @Ignore - fun tlsVersion() { - var tlsVersion: TlsVersion = TlsVersion.TLS_1_3 - val javaName: String = tlsVersion.javaName() - tlsVersion = TlsVersion.forJavaName("") - } - - @Test @Ignore - fun webSocket() { - val webSocket = object : WebSocket { - override fun request(): Request = TODO() - override fun queueSize(): Long = TODO() - override fun send(text: String): Boolean = TODO() - override fun send(bytes: ByteString): Boolean = TODO() - override fun close(code: Int, reason: String?): Boolean = TODO() - override fun cancel() = TODO() - } - } - - @Test @Ignore - fun webSocketListener() { - val webSocketListener = object : WebSocketListener() { - override fun onOpen(webSocket: WebSocket, response: Response) = TODO() - override fun onMessage(webSocket: WebSocket, text: String) = TODO() - override fun onMessage(webSocket: WebSocket, bytes: ByteString) = TODO() - override fun onClosing(webSocket: WebSocket, code: Int, reason: String) = TODO() - override fun onClosed(webSocket: WebSocket, code: Int, reason: String) = TODO() - override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) = TODO() - } - } - - private fun newAddress(): Address { - return Address( - "", - 0, - Dns.SYSTEM, - SocketFactory.getDefault(), - localhost().sslSocketFactory(), - newHostnameVerifier(), - CertificatePinner.DEFAULT, - Authenticator.NONE, - Proxy.NO_PROXY, - listOf(Protocol.HTTP_1_1), - listOf(ConnectionSpec.MODERN_TLS), - NullProxySelector() - ) - } - - private fun newHostnameVerifier(): HostnameVerifier { - return object : HostnameVerifier { - override fun verify(hostname: String, sslSession: SSLSession) = false - } - } - - private fun newCall(): Call { - return object : Call { - override fun request(): Request = TODO() - override fun execute(): Response = TODO() - override fun enqueue(responseCallback: Callback) = TODO() - override fun cancel() = TODO() - override fun isExecuted(): Boolean = TODO() - override fun isCanceled(): Boolean = TODO() - override fun timeout(): Timeout = TODO() - override fun clone(): Call = TODO() - } - } - - private fun newCookieHandler(): CookieHandler { - return object : CookieHandler() { - override fun put( - uri: URI?, - responseHeaders: MutableMap>? - ) = TODO() - - override fun get( - uri: URI?, - requestHeaders: MutableMap>? - ): MutableMap> = TODO() - } - } - - private fun newInterceptorChain(): Interceptor.Chain { - return object : Interceptor.Chain { - override fun request(): Request = TODO() - override fun proceed(request: Request): Response = TODO() - override fun connection(): Connection? = TODO() - override fun call(): Call = TODO() - override fun connectTimeoutMillis(): Int = TODO() - override fun withConnectTimeout(timeout: Int, unit: TimeUnit): Interceptor.Chain = TODO() - override fun readTimeoutMillis(): Int = TODO() - override fun withReadTimeout(timeout: Int, unit: TimeUnit): Interceptor.Chain = TODO() - override fun writeTimeoutMillis(): Int = TODO() - override fun withWriteTimeout(timeout: Int, unit: TimeUnit): Interceptor.Chain = TODO() - } - } - - private fun newRoute(): Route { - return Route(newAddress(), Proxy.NO_PROXY, InetSocketAddress.createUnresolved("", 0)) - } -} \ No newline at end of file diff --git a/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt b/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt index 336cba12a..91887717c 100644 --- a/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt +++ b/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt @@ -80,9 +80,6 @@ import javax.net.ssl.X509TrustManager /** * Access every type, function, and property from Kotlin to defend against unexpected regressions in * modern 4.0.x kotlin source-compatibility. - * - * To regenerate, copy the body of [KotlinSourceCompatibilityTest] and then run Intellij - * SilentCode Cleanup on this file only. */ @Suppress( "ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", @@ -483,7 +480,6 @@ class KotlinSourceModernTest { interceptor.level = HttpLoggingInterceptor.Level.BASIC interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC) var level: HttpLoggingInterceptor.Level = interceptor.level - level = interceptor.getLevel() interceptor.intercept(newInterceptorChain()) } @@ -689,8 +685,8 @@ class KotlinSourceModernTest { mockResponse = mockResponse.addHeader("", "") mockResponse = mockResponse.addHeaderLenient("", Any()) mockResponse = mockResponse.setHeader("", Any()) - mockResponse.headers = Headers.of() - mockResponse.trailers = Headers.of() + mockResponse.headers = headersOf() + mockResponse.trailers = headersOf() mockResponse = mockResponse.removeHeader("") var body: Buffer? = mockResponse.getBody() mockResponse = mockResponse.setBody(Buffer()) @@ -943,22 +939,10 @@ class KotlinSourceModernTest { var chunkSizes: List = recordedRequest.chunkSizes var bodySize: Long = recordedRequest.bodySize var body: Buffer = recordedRequest.body - var utf8Body: String = recordedRequest.utf8Body + var utf8Body: String = recordedRequest.body.readUtf8() var sequenceNumber: Int = recordedRequest.sequenceNumber var tlsVersion: TlsVersion? = recordedRequest.tlsVersion var handshake: Handshake? = recordedRequest.handshake - requestUrl = recordedRequest.requestUrl - requestLine = recordedRequest.requestLine - method = recordedRequest.method - path = recordedRequest.path - headers = recordedRequest.headers - chunkSizes = recordedRequest.chunkSizes - bodySize = recordedRequest.bodySize - body = recordedRequest.body - utf8Body = recordedRequest.utf8Body - sequenceNumber = recordedRequest.sequenceNumber - tlsVersion = recordedRequest.tlsVersion - handshake = recordedRequest.handshake } @Test @Ignore