From a042c33c75436c42080311335ee22bb64847f46d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:07:27 +0000 Subject: [PATCH 01/11] Update dependency org.jmailen.gradle:kotlinter-gradle to v4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 062d96b6f3b..8075c1b3d8f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ serialization = "1.7.3" binaryCompatibilityValidator = "0.16.3" dokka = "1.9.20" kover = "0.8.3" -ktlint = "3.15.0" +ktlint = "4.5.0" kotlinx-browser = "0.2" # Used for test server in buildSrc From 23c6f1707d7288976437ffb416872818083a1f3c Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 10:12:54 +0100 Subject: [PATCH 02/11] Use Suppress annotation for ktlint rules --- buildSrc/src/main/kotlin/test/server/tests/Events.kt | 3 ++- .../src/io/ktor/client/engine/cio/CIOCommon.kt | 5 ++--- .../io/ktor/client/engine/cio/ConnectionPipelineCommon.kt | 5 ++--- .../io/ktor/client/engine/cio/ConnectionPipelineNative.kt | 5 ++--- .../src/io/ktor/client/plugins/api/KtorCallContexts.kt | 3 ++- .../src/io/ktor/client/plugins/websocket/WebSockets.kt | 3 ++- .../common/src/io/ktor/client/request/HttpRequest.kt | 6 +++--- .../common/src/io/ktor/client/request/buildersWithUrl.kt | 6 +++--- .../common/src/io/ktor/client/request/utils.kt | 6 +++--- .../ktor-client-core/common/test/CacheExpiresTest.kt | 5 +++-- .../src/io/ktor/client/engine/okhttp/OkHttpSSESession.kt | 5 +++-- .../tests/AbstractClientContentNegotiationTest.kt | 3 ++- .../src/io/ktor/client/plugins/json/JsonSerializer.kt | 3 ++- .../jvm/src/io/ktor/client/plugins/gson/GsonSerializer.kt | 3 ++- .../io/ktor/client/plugins/jackson/JacksonSerializer.kt | 3 ++- .../plugins/kotlinx/serializer/KotlinxSerializer.kt | 3 ++- .../io/ktor/client/tests/plugins/WebSocketRemoteTest.kt | 5 +++-- ktor-client/ktor-client-tests/build.gradle.kts | 4 ---- .../io/ktor/client/tests/utils/CommonClientTestUtils.kt | 4 ++-- .../common/test/io/ktor/client/tests/MockedTests.kt | 8 +++++--- .../common/test/io/ktor/client/tests/plugins/CacheTest.kt | 5 +++-- .../test/io/ktor/client/tests/plugins/UserAgentTest.kt | 3 ++- .../js/src/io/ktor/client/tests/utils/ClientLoaderJs.kt | 3 +-- .../io/ktor/client/tests/utils/NodeFetchOptionsTest.kt | 6 +----- .../jvm/test/io/ktor/client/tests/FileCacheTest.kt | 5 +++-- .../src/io/ktor/client/tests/utils/ClientLoaderWasm.kt | 3 +-- ktor-http/common/src/io/ktor/http/Codecs.kt | 5 +++-- ktor-http/jvm/test/io/ktor/tests/http/URLBuilderTest.kt | 3 +-- ktor-io/androidNative/src/Charset.androidNative.kt | 1 + ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt | 1 - ktor-io/linux/src/CharsetLinux.kt | 3 ++- ktor-io/mingwX64/src/CharsetMingw.kt | 3 ++- .../posix/src/io/ktor/utils/io/core/ByteOrderNative.kt | 1 - ktor-io/posix/src/io/ktor/utils/io/locks/Synchronized.kt | 3 ++- .../darwin/src/io/ktor/network/util/SocketUtils.darwin.kt | 1 + .../ios/src/io/ktor/network/util/SocketUtilsIos.kt | 3 ++- .../jvm/src/io/ktor/network/selector/JvmSelector.kt | 5 ++++- .../jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt | 3 ++- .../jvm/src/io/ktor/network/selector/SelectableJvm.kt | 5 ++++- .../jvmAndPosix/src/io/ktor/network/sockets/Builders.kt | 1 + .../jvm/test/io/ktor/network/tls/ConnectionTest.kt | 5 +---- .../posix/src/io/ktor/network/tls/TLSConfigNative.kt | 3 +-- .../macos/src/io/ktor/network/util/SocketUtilsMacos.kt | 3 ++- .../nix/src/io/ktor/network/selector/SelectUtilsNix.kt | 3 ++- .../posix/src/io/ktor/network/selector/SelectUtils.kt | 3 ++- .../src/io/ktor/network/selector/WorkerSelectorManager.kt | 5 +++-- .../tvos/src/io/ktor/network/util/SocketUtilsTvos.kt | 3 ++- .../src/io/ktor/network/util/SocketUtilsWatchos.kt | 3 ++- ktor-server/common/src/Stub.kt | 3 ++- .../test/io/ktor/tests/server/cio/CIOEngineTest.kt | 3 +-- .../src/io/ktor/server/config/yaml/YamlConfig.kt | 3 ++- .../server/application/CommonApplicationEnvironment.kt | 5 ++--- .../src/io/ktor/server/application/KtorCallContexts.kt | 3 ++- .../src/io/ktor/server/engine/BaseApplicationResponse.kt | 4 +--- .../common/src/io/ktor/server/engine/EmbeddedServer.kt | 8 +++++--- .../application/ApplicationEnvironment.jsAndWasmShared.kt | 3 +-- .../ApplicationEngineEnvironment.jsAndWasmShared.kt | 3 +-- .../io/ktor/server/engine/ApplicationEnvironmentJvm.kt | 4 +--- .../ktor/server/application/NixApplicationEnvironment.kt | 3 +-- .../ktor/server/engine/ApplicationEngineEnvironmentNix.kt | 4 +--- ktor-server/ktor-server-host-common/common/src/Stub.kt | 3 ++- .../jvm/src/io/ktor/server/jetty/jakarta/Embedded.kt | 3 +-- .../jvm/src/io/ktor/server/jetty/Embedded.kt | 3 +-- .../jvm/src/io/ktor/server/netty/Embedded.kt | 3 +-- .../common/test/io/ktor/tests/auth/OAuth2Test.kt | 4 ++-- .../ktor/server/plugins/bodylimit/RequestBodyLimitTest.kt | 1 + .../io/ktor/server/plugins/calllogging/CallLoggingTest.kt | 3 ++- .../common/test/RequestConverterTest.kt | 5 +++-- .../jvm/test/ContentNegotiationJvmTest.kt | 3 ++- .../ktor/server/plugins/doublereceive/ByteArrayCache.kt | 3 +-- .../plugins/doublereceive/FileCache.jsAndWasmShared.kt | 3 +-- .../io/ktor/server/plugins/doublereceive/FileCacheJvm.kt | 3 +-- .../io/ktor/server/plugins/doublereceive/FileCacheNix.kt | 3 +-- .../src/io/ktor/server/sessions/SessionTransportCookie.kt | 3 ++- .../ktor/server/sessions/SessionSerializerReflection.kt | 3 +-- .../jvm/src/io/ktor/server/test/base/BaseTestJvm.kt | 1 - .../jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt | 1 - .../client/TestHttpClientEngineBridge.jsAndWasmShared.kt | 3 +-- .../testing/client/TestHttpClientEngineBridgeJvm.kt | 1 - .../testing/client/TestHttpClientEngineBridgeNix.kt | 3 +-- ktor-server/ktor-server-tests/common/src/Stub.kt | 3 ++- .../ktor/tests/server/plugins/ConditionalHeadersTests.kt | 3 +-- .../ktor/server/http/ApplicationRequestContentTestJvm.kt | 1 - .../jvm/src/io/ktor/server/tomcat/jakarta/Embedded.kt | 3 +-- .../jvm/src/io/ktor/server/tomcat/Embedded.kt | 3 +-- .../common/test/CborContextualSerializationTest.kt | 3 ++- .../common/test/CborSerializationTest.kt | 3 ++- .../jvm/test/CborClientKotlinxSerializationTest.kt | 3 ++- .../jvm/test/CborServerKotlinxSerializationTest.kt | 5 +++-- .../common/test/JsonContextualSerializationTest.kt | 3 ++- .../common/test/JsonSerializationTest.kt | 3 ++- .../jvm/test/JsonClientKotlinxSerializationJsonJvmTest.kt | 3 ++- .../jvm/test/JsonClientKotlinxSerializationTest.kt | 3 ++- .../jvm/test/JsonServerKotlinxSerializationTest.kt | 5 +++-- .../common/src/AbstractContextualSerializationTest.kt | 3 ++- .../common/src/AbstractSerializationTest.kt | 3 ++- .../jvm/src/AbstractServerSerializationKotlinxTest.kt | 3 ++- .../jvm/src/AbstractServerSerializationTest.kt | 1 + .../jsAndWasmShared/src/io/ktor/websocket/FrameJs.kt | 3 +-- .../posix/src/io/ktor/websocket/FrameNative.kt | 3 +-- ktor-utils/common/src/io/ktor/util/CaseInsensitiveSet.kt | 5 +++-- ktor-utils/js/src/io/ktor/util/PlatformUtils.js.kt | 5 ++--- .../jsAndWasmShared/src/io/ktor/util/PlatformUtilsJs.kt | 5 ++--- .../src/io/ktor/util/collections/ConcurrentMapJs.kt | 3 +-- .../src/io/ktor/util/debug/IntellijIdeaDebugDetectorJs.kt | 3 +-- .../jsAndWasmShared/src/io/ktor/util/logging/LoggerJs.kt | 3 +-- .../jvm/src/io/ktor/util/collections/ConcurrentMapJvm.kt | 3 +-- .../io/ktor/util/debug/IntellijIdeaDebugDetectorJvm.kt | 3 +-- ktor-utils/jvm/src/io/ktor/util/logging/LoggerJvm.kt | 3 +-- ktor-utils/posix/src/io/ktor/util/PlatformUtilsNative.kt | 5 ++--- .../src/io/ktor/util/collections/ConcurrentMapNative.kt | 3 +-- .../io/ktor/util/collections/LockFreeMPSCQueueNative.kt | 3 ++- .../io/ktor/util/debug/IntellijIdeaDebugDetectorNative.kt | 3 +-- .../posix/src/io/ktor/util/logging/LogLevelNative.kt | 3 +-- ktor-utils/posix/src/io/ktor/util/logging/LoggerNative.kt | 3 +-- .../wasmJs/src/io/ktor/util/PlatformUtils.wasmJs.kt | 5 ++--- 116 files changed, 199 insertions(+), 199 deletions(-) diff --git a/buildSrc/src/main/kotlin/test/server/tests/Events.kt b/buildSrc/src/main/kotlin/test/server/tests/Events.kt index 0447e187902..e7b89937261 100644 --- a/buildSrc/src/main/kotlin/test/server/tests/Events.kt +++ b/buildSrc/src/main/kotlin/test/server/tests/Events.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package test.server.tests import io.ktor.http.* diff --git a/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/CIOCommon.kt b/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/CIOCommon.kt index ee1023e3bd6..4120918adfe 100644 --- a/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/CIOCommon.kt +++ b/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/CIOCommon.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.engine.cio diff --git a/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/ConnectionPipelineCommon.kt b/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/ConnectionPipelineCommon.kt index b7bb982c485..f9eaa6e0413 100644 --- a/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/ConnectionPipelineCommon.kt +++ b/ktor-client/ktor-client-cio/jvmAndPosix/src/io/ktor/client/engine/cio/ConnectionPipelineCommon.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.engine.cio diff --git a/ktor-client/ktor-client-cio/posix/src/io/ktor/client/engine/cio/ConnectionPipelineNative.kt b/ktor-client/ktor-client-cio/posix/src/io/ktor/client/engine/cio/ConnectionPipelineNative.kt index 1c9c9baf521..cccabfcd47c 100644 --- a/ktor-client/ktor-client-cio/posix/src/io/ktor/client/engine/cio/ConnectionPipelineNative.kt +++ b/ktor-client/ktor-client-cio/posix/src/io/ktor/client/engine/cio/ConnectionPipelineNative.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.engine.cio diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/api/KtorCallContexts.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/api/KtorCallContexts.kt index 4e0b58717db..46bf10e8307 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/api/KtorCallContexts.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/api/KtorCallContexts.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.client.plugins.api import io.ktor.client.* diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/WebSockets.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/WebSockets.kt index 30cd810efa1..e413f4cd8aa 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/WebSockets.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/WebSockets.kt @@ -174,8 +174,9 @@ public class WebSockets internal constructor( return@intercept } if (status != HttpStatusCode.SwitchingProtocols) { + @Suppress("ktlint:standard:max-line-length") throw WebSocketException( - "Handshake exception, expected status code ${HttpStatusCode.SwitchingProtocols.value} but was ${status.value}" // ktlint-disable max-line-length + "Handshake exception, expected status code ${HttpStatusCode.SwitchingProtocols.value} but was ${status.value}" ) } if (session !is WebSocketSession) { diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/request/HttpRequest.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/request/HttpRequest.kt index a55c6b4395d..a735421314e 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/request/HttpRequest.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/request/HttpRequest.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.request @@ -294,7 +294,7 @@ public operator fun HttpRequestBuilder.Companion.invoke( /** * Sets the [HttpRequestBuilder.url] from [urlString]. */ -public fun HttpRequestBuilder.url(urlString: String) { // ktlint-disable filename +public fun HttpRequestBuilder.url(urlString: String) { url.takeFrom(urlString) } diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/request/buildersWithUrl.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/request/buildersWithUrl.kt index 2411af424bf..192619f308d 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/request/buildersWithUrl.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/request/buildersWithUrl.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.request @@ -193,6 +193,6 @@ public suspend inline fun HttpClient.prepareDelete( /** * Sets the [HttpRequestBuilder.url] from [url]. */ -public fun HttpRequestBuilder.url(url: Url): Unit { // ktlint-disable no-unit-return +public fun HttpRequestBuilder.url(url: Url) { this.url.takeFrom(url) } diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/request/utils.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/request/utils.kt index 501eb50911a..83a711a003a 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/request/utils.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/request/utils.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.request @@ -45,7 +45,7 @@ public fun HttpMessageBuilder.cookie( secure: Boolean = false, httpOnly: Boolean = false, extensions: Map = emptyMap() -): Unit { // ktlint-disable no-unit-return +) { val renderedCookie = Cookie( name = name, value = value, diff --git a/ktor-client/ktor-client-core/common/test/CacheExpiresTest.kt b/ktor-client/ktor-client-core/common/test/CacheExpiresTest.kt index f03be3daa73..e1210e2a295 100644 --- a/ktor-client/ktor-client-core/common/test/CacheExpiresTest.kt +++ b/ktor-client/ktor-client-core/common/test/CacheExpiresTest.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.plugins.cache.tests import io.ktor.client.call.* diff --git a/ktor-client/ktor-client-okhttp/jvm/src/io/ktor/client/engine/okhttp/OkHttpSSESession.kt b/ktor-client/ktor-client-okhttp/jvm/src/io/ktor/client/engine/okhttp/OkHttpSSESession.kt index f62eab234ee..eddd4858589 100644 --- a/ktor-client/ktor-client-okhttp/jvm/src/io/ktor/client/engine/okhttp/OkHttpSSESession.kt +++ b/ktor-client/ktor-client-okhttp/jvm/src/io/ktor/client/engine/okhttp/OkHttpSSESession.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.okhttp @@ -70,8 +70,9 @@ internal class OkHttpSSESession( response != null && response.headers[HttpHeaders.ContentType] ?.let { ContentType.parse(it) }?.withoutParameters() != ContentType.Text.EventStream -> + @Suppress("ktlint:standard:max-line-length") SSEClientException( - message = "Content type must be ${ContentType.Text.EventStream} but was ${response.headers[HttpHeaders.ContentType]}" // ktlint-disable max-line-length + message = "Content type must be ${ContentType.Text.EventStream} but was ${response.headers[HttpHeaders.ContentType]}" ) else -> SSEClientException(message = "Unexpected error occurred in OkHttpSSESession") diff --git a/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt b/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt index 2d5e39426b7..f63682855c7 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.client.plugins.contentnegotiation.tests import com.fasterxml.jackson.annotation.* diff --git a/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonSerializer.kt b/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonSerializer.kt index 223cf7861f2..4ed1badd3f8 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonSerializer.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonSerializer.kt @@ -12,8 +12,9 @@ import io.ktor.utils.io.core.* /** * Client json serializer. */ +@Suppress("ktlint:standard:max-line-length") @Deprecated( - "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", // ktlint-disable max-line-length + "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", level = DeprecationLevel.ERROR ) public interface JsonSerializer { diff --git a/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-gson/jvm/src/io/ktor/client/plugins/gson/GsonSerializer.kt b/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-gson/jvm/src/io/ktor/client/plugins/gson/GsonSerializer.kt index 516ab931b70..a507a765a92 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-gson/jvm/src/io/ktor/client/plugins/gson/GsonSerializer.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-gson/jvm/src/io/ktor/client/plugins/gson/GsonSerializer.kt @@ -15,8 +15,9 @@ import io.ktor.utils.io.core.* /** * [JsonSerializer] using [Gson] as backend. */ +@Suppress("ktlint:standard:max-line-length") @Deprecated( - "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", // ktlint-disable max-line-length + "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", level = DeprecationLevel.ERROR ) public class GsonSerializer(block: GsonBuilder.() -> Unit = {}) : JsonSerializer { diff --git a/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-jackson/jvm/src/io/ktor/client/plugins/jackson/JacksonSerializer.kt b/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-jackson/jvm/src/io/ktor/client/plugins/jackson/JacksonSerializer.kt index c8007793877..33942958e80 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-jackson/jvm/src/io/ktor/client/plugins/jackson/JacksonSerializer.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-jackson/jvm/src/io/ktor/client/plugins/jackson/JacksonSerializer.kt @@ -14,8 +14,9 @@ import io.ktor.http.content.* import io.ktor.util.reflect.* import io.ktor.utils.io.core.* +@Suppress("ktlint:standard:max-line-length") @Deprecated( - "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", // ktlint-disable max-line-length + "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", level = DeprecationLevel.ERROR ) public class JacksonSerializer( diff --git a/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-serialization/common/src/io/ktor/client/plugins/kotlinx/serializer/KotlinxSerializer.kt b/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-serialization/common/src/io/ktor/client/plugins/kotlinx/serializer/KotlinxSerializer.kt index 28fbbf856c0..0822a6fbcd9 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-serialization/common/src/io/ktor/client/plugins/kotlinx/serializer/KotlinxSerializer.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-json/ktor-client-serialization/common/src/io/ktor/client/plugins/kotlinx/serializer/KotlinxSerializer.kt @@ -19,8 +19,9 @@ import kotlinx.serialization.modules.* /** * A [JsonSerializer] implemented for kotlinx [Serializable] classes. */ +@Suppress("ktlint:standard:max-line-length") @Deprecated( - "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", // ktlint-disable max-line-length + "Please use ContentNegotiation plugin and its converters: https://ktor.io/docs/migration-to-20x.html#serialization-client", level = DeprecationLevel.ERROR ) public class KotlinxSerializer( diff --git a/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketRemoteTest.kt b/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketRemoteTest.kt index f9f694f60e9..9e7a527cc98 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketRemoteTest.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketRemoteTest.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.tests.plugins import io.ktor.client.plugins.* diff --git a/ktor-client/ktor-client-tests/build.gradle.kts b/ktor-client/ktor-client-tests/build.gradle.kts index bb37cd747f9..f958b354c65 100644 --- a/ktor-client/ktor-client-tests/build.gradle.kts +++ b/ktor-client/ktor-client-tests/build.gradle.kts @@ -4,10 +4,6 @@ import test.server.* -/* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ - description = "Common tests for client" plugins { diff --git a/ktor-client/ktor-client-tests/common/src/io/ktor/client/tests/utils/CommonClientTestUtils.kt b/ktor-client/ktor-client-tests/common/src/io/ktor/client/tests/utils/CommonClientTestUtils.kt index 59ac996b784..1dd64ca5266 100644 --- a/ktor-client/ktor-client-tests/common/src/io/ktor/client/tests/utils/CommonClientTestUtils.kt +++ b/ktor-client/ktor-client-tests/common/src/io/ktor/client/tests/utils/CommonClientTestUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ @file:Suppress("NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING", "KDocMissingDocumentation") @@ -148,6 +148,6 @@ fun TestClientBuilder<*>.test(block: suspend TestInfo.(client: HttpClient) -> Un test = block } -fun TestClientBuilder<*>.after(block: suspend (client: HttpClient) -> Unit) { // ktlint-disable no-unit-return +fun TestClientBuilder<*>.after(block: suspend (client: HttpClient) -> Unit) { after = block } diff --git a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/MockedTests.kt b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/MockedTests.kt index ae0d6578031..68a57e11fa0 100644 --- a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/MockedTests.kt +++ b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/MockedTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests @@ -48,11 +48,13 @@ class MockedTests { engine { // these differ by one char at the end + @Suppress("ktlint:standard:max-line-length") val longJSONString = - """{"author": "H. P. Lovecraft", "name": "The Nameless City", "text": "When I drew nigh the nameless city I knew it was accursed. I was traveling in a parched and terrible valley under the moon, and afar I saw it protruding uncannily above the sands as parts of a corpse may protrude from an ill-made grave. Fear spoke from the age-worn stones of this hoary survivor of the deluge, this great-grandfather of the eldest pyramid; and a viewless aura repelled me and bade me retreat from antique and sinister secrets that no man should see, and no man else had dared to see..\nRemote in the desert of Araby lies the nameless city, crumbling and inarticulate, its low walls nearly hidden by the sands of uncounted ages. It must have been thus before the first stones of Memphis were laid, and while the bricks of Babylon were yet unbaked. There is no legend so old as to give it a name, or to recall that it was ever alive; but it is told of in whispers around campfires and muttered about by grandams in the tents of sheiks so that all the tribes shun it without wholly knowing why. It was of this place that Abdul Alhazred the mad poet dreamed of the night before he sang his unexplained couplet:\nThat is not dead which can eternal lie, / And with strange aeons even death may die.\nI should have known that the Arabs had good reason for shunning the nameless city, the city told of in strange tales but seen by no living man, yet I defied them and went into the untrodden waste with my camel. I alone have seen it, and that is why no other face bears such hideous lines of fear as mine; why no other man shivers so horribly when the night wind rattles the windows. When I came upon it in the ghastly stillness of unending sleep it looked at me, chilly from the rays of a cold moon amidst the desert's heat. And as I returned its look I forgot my triumph at finding it, and stopped still with my camel to wait for the dawn.\nFor hours I waited, till the east grew grey and the stars faded, and the grey turned to roseate light edged with gold. I heard a moaning and saw a storm of sand stirring among the antique stones though the sky was clear and the vast reaches of desert still. Then suddenly above the desert's far rim came the blazing edge of the sun, seen through the tiny sandstorm which was passing away, and in my fevered state I fancied that from some remote depth there came a crash of musical metal to hail the fiery disc as Memnon hails it from the banks of the Nile. My ears rang and my imagination seethed as I led my camel slowly across the sand to that unvocal place; that place which I alone of living men had seen.\nIn and out amongst the shapeless foundations of houses and places I wandered, finding never a carving or inscription to tell of these men, if men they were, who built this city and dwelt therein so long ago. The antiquity of the spot was unwholesome, and I longed to encounter some sign or device to prove that the city was indeed fashioned by mankind. There were certain proportions and dimensions in the ruins which I did not like. I had with me many tools, and dug much within the walls of the obliterated edifices; but progress was slow, and nothing significant was revealed. When night and the moon returned I felt a chill wind which brought new fear, so that I did not dare to remain in the city. And as I went outside the antique walls to sleep, a small sighing sandstorm gathered behind me, blowing over the grey stones though the moon was bright and most of the desert still.\nI awakened just at dawn from a pageant of horrible dreams, my ears ringing as from some metallic peal. I saw the sun peering redly through the last gusts of a little sandstorm that hovered over the nameless city, and marked the quietness of the rest of the landscape. Once more I ventured within those brooding ruins that swelled beneath the sand like an ogre under a coverlet, and again dug vainly for relics of the forgotten race. At noon I rested, and in the afternoon I spent much time tracing the walls and bygone streets, and the outlines of the nearly vanish..."}""" // ktlint-disable max-line-length + """{"author": "H. P. Lovecraft", "name": "The Nameless City", "text": "When I drew nigh the nameless city I knew it was accursed. I was traveling in a parched and terrible valley under the moon, and afar I saw it protruding uncannily above the sands as parts of a corpse may protrude from an ill-made grave. Fear spoke from the age-worn stones of this hoary survivor of the deluge, this great-grandfather of the eldest pyramid; and a viewless aura repelled me and bade me retreat from antique and sinister secrets that no man should see, and no man else had dared to see..\nRemote in the desert of Araby lies the nameless city, crumbling and inarticulate, its low walls nearly hidden by the sands of uncounted ages. It must have been thus before the first stones of Memphis were laid, and while the bricks of Babylon were yet unbaked. There is no legend so old as to give it a name, or to recall that it was ever alive; but it is told of in whispers around campfires and muttered about by grandams in the tents of sheiks so that all the tribes shun it without wholly knowing why. It was of this place that Abdul Alhazred the mad poet dreamed of the night before he sang his unexplained couplet:\nThat is not dead which can eternal lie, / And with strange aeons even death may die.\nI should have known that the Arabs had good reason for shunning the nameless city, the city told of in strange tales but seen by no living man, yet I defied them and went into the untrodden waste with my camel. I alone have seen it, and that is why no other face bears such hideous lines of fear as mine; why no other man shivers so horribly when the night wind rattles the windows. When I came upon it in the ghastly stillness of unending sleep it looked at me, chilly from the rays of a cold moon amidst the desert's heat. And as I returned its look I forgot my triumph at finding it, and stopped still with my camel to wait for the dawn.\nFor hours I waited, till the east grew grey and the stars faded, and the grey turned to roseate light edged with gold. I heard a moaning and saw a storm of sand stirring among the antique stones though the sky was clear and the vast reaches of desert still. Then suddenly above the desert's far rim came the blazing edge of the sun, seen through the tiny sandstorm which was passing away, and in my fevered state I fancied that from some remote depth there came a crash of musical metal to hail the fiery disc as Memnon hails it from the banks of the Nile. My ears rang and my imagination seethed as I led my camel slowly across the sand to that unvocal place; that place which I alone of living men had seen.\nIn and out amongst the shapeless foundations of houses and places I wandered, finding never a carving or inscription to tell of these men, if men they were, who built this city and dwelt therein so long ago. The antiquity of the spot was unwholesome, and I longed to encounter some sign or device to prove that the city was indeed fashioned by mankind. There were certain proportions and dimensions in the ruins which I did not like. I had with me many tools, and dug much within the walls of the obliterated edifices; but progress was slow, and nothing significant was revealed. When night and the moon returned I felt a chill wind which brought new fear, so that I did not dare to remain in the city. And as I went outside the antique walls to sleep, a small sighing sandstorm gathered behind me, blowing over the grey stones though the moon was bright and most of the desert still.\nI awakened just at dawn from a pageant of horrible dreams, my ears ringing as from some metallic peal. I saw the sun peering redly through the last gusts of a little sandstorm that hovered over the nameless city, and marked the quietness of the rest of the landscape. Once more I ventured within those brooding ruins that swelled beneath the sand like an ogre under a coverlet, and again dug vainly for relics of the forgotten race. At noon I rested, and in the afternoon I spent much time tracing the walls and bygone streets, and the outlines of the nearly vanish..."}""" + @Suppress("ktlint:standard:max-line-length") val longerJSONString = - """{"author": "H. P. Lovecraft", "name": "The Nameless City", "text": "When I drew nigh the nameless city I knew it was accursed. I was traveling in a parched and terrible valley under the moon, and afar I saw it protruding uncannily above the sands as parts of a corpse may protrude from an ill-made grave. Fear spoke from the age-worn stones of this hoary survivor of the deluge, this great-grandfather of the eldest pyramid; and a viewless aura repelled me and bade me retreat from antique and sinister secrets that no man should see, and no man else had dared to see..\nRemote in the desert of Araby lies the nameless city, crumbling and inarticulate, its low walls nearly hidden by the sands of uncounted ages. It must have been thus before the first stones of Memphis were laid, and while the bricks of Babylon were yet unbaked. There is no legend so old as to give it a name, or to recall that it was ever alive; but it is told of in whispers around campfires and muttered about by grandams in the tents of sheiks so that all the tribes shun it without wholly knowing why. It was of this place that Abdul Alhazred the mad poet dreamed of the night before he sang his unexplained couplet:\nThat is not dead which can eternal lie, / And with strange aeons even death may die.\nI should have known that the Arabs had good reason for shunning the nameless city, the city told of in strange tales but seen by no living man, yet I defied them and went into the untrodden waste with my camel. I alone have seen it, and that is why no other face bears such hideous lines of fear as mine; why no other man shivers so horribly when the night wind rattles the windows. When I came upon it in the ghastly stillness of unending sleep it looked at me, chilly from the rays of a cold moon amidst the desert's heat. And as I returned its look I forgot my triumph at finding it, and stopped still with my camel to wait for the dawn.\nFor hours I waited, till the east grew grey and the stars faded, and the grey turned to roseate light edged with gold. I heard a moaning and saw a storm of sand stirring among the antique stones though the sky was clear and the vast reaches of desert still. Then suddenly above the desert's far rim came the blazing edge of the sun, seen through the tiny sandstorm which was passing away, and in my fevered state I fancied that from some remote depth there came a crash of musical metal to hail the fiery disc as Memnon hails it from the banks of the Nile. My ears rang and my imagination seethed as I led my camel slowly across the sand to that unvocal place; that place which I alone of living men had seen.\nIn and out amongst the shapeless foundations of houses and places I wandered, finding never a carving or inscription to tell of these men, if men they were, who built this city and dwelt therein so long ago. The antiquity of the spot was unwholesome, and I longed to encounter some sign or device to prove that the city was indeed fashioned by mankind. There were certain proportions and dimensions in the ruins which I did not like. I had with me many tools, and dug much within the walls of the obliterated edifices; but progress was slow, and nothing significant was revealed. When night and the moon returned I felt a chill wind which brought new fear, so that I did not dare to remain in the city. And as I went outside the antique walls to sleep, a small sighing sandstorm gathered behind me, blowing over the grey stones though the moon was bright and most of the desert still.\nI awakened just at dawn from a pageant of horrible dreams, my ears ringing as from some metallic peal. I saw the sun peering redly through the last gusts of a little sandstorm that hovered over the nameless city, and marked the quietness of the rest of the landscape. Once more I ventured within those brooding ruins that swelled beneath the sand like an ogre under a coverlet, and again dug vainly for relics of the forgotten race. At noon I rested, and in the afternoon I spent much time tracing the walls and bygone streets, and the outlines of the nearly vanishe..."}""" // ktlint-disable max-line-length + """{"author": "H. P. Lovecraft", "name": "The Nameless City", "text": "When I drew nigh the nameless city I knew it was accursed. I was traveling in a parched and terrible valley under the moon, and afar I saw it protruding uncannily above the sands as parts of a corpse may protrude from an ill-made grave. Fear spoke from the age-worn stones of this hoary survivor of the deluge, this great-grandfather of the eldest pyramid; and a viewless aura repelled me and bade me retreat from antique and sinister secrets that no man should see, and no man else had dared to see..\nRemote in the desert of Araby lies the nameless city, crumbling and inarticulate, its low walls nearly hidden by the sands of uncounted ages. It must have been thus before the first stones of Memphis were laid, and while the bricks of Babylon were yet unbaked. There is no legend so old as to give it a name, or to recall that it was ever alive; but it is told of in whispers around campfires and muttered about by grandams in the tents of sheiks so that all the tribes shun it without wholly knowing why. It was of this place that Abdul Alhazred the mad poet dreamed of the night before he sang his unexplained couplet:\nThat is not dead which can eternal lie, / And with strange aeons even death may die.\nI should have known that the Arabs had good reason for shunning the nameless city, the city told of in strange tales but seen by no living man, yet I defied them and went into the untrodden waste with my camel. I alone have seen it, and that is why no other face bears such hideous lines of fear as mine; why no other man shivers so horribly when the night wind rattles the windows. When I came upon it in the ghastly stillness of unending sleep it looked at me, chilly from the rays of a cold moon amidst the desert's heat. And as I returned its look I forgot my triumph at finding it, and stopped still with my camel to wait for the dawn.\nFor hours I waited, till the east grew grey and the stars faded, and the grey turned to roseate light edged with gold. I heard a moaning and saw a storm of sand stirring among the antique stones though the sky was clear and the vast reaches of desert still. Then suddenly above the desert's far rim came the blazing edge of the sun, seen through the tiny sandstorm which was passing away, and in my fevered state I fancied that from some remote depth there came a crash of musical metal to hail the fiery disc as Memnon hails it from the banks of the Nile. My ears rang and my imagination seethed as I led my camel slowly across the sand to that unvocal place; that place which I alone of living men had seen.\nIn and out amongst the shapeless foundations of houses and places I wandered, finding never a carving or inscription to tell of these men, if men they were, who built this city and dwelt therein so long ago. The antiquity of the spot was unwholesome, and I longed to encounter some sign or device to prove that the city was indeed fashioned by mankind. There were certain proportions and dimensions in the ruins which I did not like. I had with me many tools, and dug much within the walls of the obliterated edifices; but progress was slow, and nothing significant was revealed. When night and the moon returned I felt a chill wind which brought new fear, so that I did not dare to remain in the city. And as I went outside the antique walls to sleep, a small sighing sandstorm gathered behind me, blowing over the grey stones though the moon was bright and most of the desert still.\nI awakened just at dawn from a pageant of horrible dreams, my ears ringing as from some metallic peal. I saw the sun peering redly through the last gusts of a little sandstorm that hovered over the nameless city, and marked the quietness of the rest of the landscape. Once more I ventured within those brooding ruins that swelled beneath the sand like an ogre under a coverlet, and again dug vainly for relics of the forgotten race. At noon I rested, and in the afternoon I spent much time tracing the walls and bygone streets, and the outlines of the nearly vanishe..."}""" val responseHeaders = headersOf("Content-Type" to listOf(ContentType.Application.Json.toString())) addHandler { request -> diff --git a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/CacheTest.kt b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/CacheTest.kt index 8e2bd721ac2..6fe9a02296b 100644 --- a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/CacheTest.kt +++ b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/CacheTest.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.tests.plugins import io.ktor.client.call.* diff --git a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/UserAgentTest.kt b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/UserAgentTest.kt index 104c069cd2c..b52832098c7 100644 --- a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/UserAgentTest.kt +++ b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/plugins/UserAgentTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.client.tests.plugins import io.ktor.client.call.* diff --git a/ktor-client/ktor-client-tests/js/src/io/ktor/client/tests/utils/ClientLoaderJs.kt b/ktor-client/ktor-client-tests/js/src/io/ktor/client/tests/utils/ClientLoaderJs.kt index cc158c7b8c6..d5641a97b8b 100644 --- a/ktor-client/ktor-client-tests/js/src/io/ktor/client/tests/utils/ClientLoaderJs.kt +++ b/ktor-client/ktor-client-tests/js/src/io/ktor/client/tests/utils/ClientLoaderJs.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests.utils diff --git a/ktor-client/ktor-client-tests/js/test/io/ktor/client/tests/utils/NodeFetchOptionsTest.kt b/ktor-client/ktor-client-tests/js/test/io/ktor/client/tests/utils/NodeFetchOptionsTest.kt index b451b8094f5..560c0467050 100644 --- a/ktor-client/ktor-client-tests/js/test/io/ktor/client/tests/utils/NodeFetchOptionsTest.kt +++ b/ktor-client/ktor-client-tests/js/test/io/ktor/client/tests/utils/NodeFetchOptionsTest.kt @@ -1,19 +1,15 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests.utils import io.ktor.client.* import io.ktor.client.call.* -import io.ktor.client.engine.* import io.ktor.client.engine.js.* import io.ktor.client.request.* -import io.ktor.client.statement.* import io.ktor.test.dispatcher.* import io.ktor.util.* -import kotlinx.coroutines.* import kotlin.test.* class NodeFetchOptionsTest { diff --git a/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/FileCacheTest.kt b/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/FileCacheTest.kt index 6dc60c1ddb5..f6a402abc48 100644 --- a/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/FileCacheTest.kt +++ b/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/FileCacheTest.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.tests import io.ktor.client.call.* diff --git a/ktor-client/ktor-client-tests/wasmJs/src/io/ktor/client/tests/utils/ClientLoaderWasm.kt b/ktor-client/ktor-client-tests/wasmJs/src/io/ktor/client/tests/utils/ClientLoaderWasm.kt index bac76c033d8..b84312a5920 100644 --- a/ktor-client/ktor-client-tests/wasmJs/src/io/ktor/client/tests/utils/ClientLoaderWasm.kt +++ b/ktor-client/ktor-client-tests/wasmJs/src/io/ktor/client/tests/utils/ClientLoaderWasm.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests.utils diff --git a/ktor-http/common/src/io/ktor/http/Codecs.kt b/ktor-http/common/src/io/ktor/http/Codecs.kt index d06095e3636..df732780731 100644 --- a/ktor-http/common/src/io/ktor/http/Codecs.kt +++ b/ktor-http/common/src/io/ktor/http/Codecs.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.http import io.ktor.utils.io.charsets.* diff --git a/ktor-http/jvm/test/io/ktor/tests/http/URLBuilderTest.kt b/ktor-http/jvm/test/io/ktor/tests/http/URLBuilderTest.kt index 84744d3d8ba..41baf99221c 100644 --- a/ktor-http/jvm/test/io/ktor/tests/http/URLBuilderTest.kt +++ b/ktor-http/jvm/test/io/ktor/tests/http/URLBuilderTest.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.http diff --git a/ktor-io/androidNative/src/Charset.androidNative.kt b/ktor-io/androidNative/src/Charset.androidNative.kt index 6dea7dfa468..c345e25aa00 100644 --- a/ktor-io/androidNative/src/Charset.androidNative.kt +++ b/ktor-io/androidNative/src/Charset.androidNative.kt @@ -1,6 +1,7 @@ /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.utils.io.charsets import io.ktor.utils.io.core.* diff --git a/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt b/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt index 8e201eedd13..091922de291 100644 --- a/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt +++ b/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt @@ -2,7 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable filename package io.ktor.utils.io.core import org.khronos.webgl.* diff --git a/ktor-io/linux/src/CharsetLinux.kt b/ktor-io/linux/src/CharsetLinux.kt index 083389a066c..5bd00bf6f2f 100644 --- a/ktor-io/linux/src/CharsetLinux.kt +++ b/ktor-io/linux/src/CharsetLinux.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.utils.io.charsets import io.ktor.utils.io.core.* diff --git a/ktor-io/mingwX64/src/CharsetMingw.kt b/ktor-io/mingwX64/src/CharsetMingw.kt index 000554af04e..8c3a5892311 100644 --- a/ktor-io/mingwX64/src/CharsetMingw.kt +++ b/ktor-io/mingwX64/src/CharsetMingw.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.utils.io.charsets import io.ktor.utils.io.core.* diff --git a/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt b/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt index 15d5bf70511..8b7447dcc15 100644 --- a/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt +++ b/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt @@ -2,7 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable filename package io.ktor.utils.io.core import kotlin.experimental.* diff --git a/ktor-io/posix/src/io/ktor/utils/io/locks/Synchronized.kt b/ktor-io/posix/src/io/ktor/utils/io/locks/Synchronized.kt index 023197000fe..a0c7850fe07 100644 --- a/ktor-io/posix/src/io/ktor/utils/io/locks/Synchronized.kt +++ b/ktor-io/posix/src/io/ktor/utils/io/locks/Synchronized.kt @@ -148,8 +148,9 @@ public actual open class SynchronizedObject { val currentThreadId = pthread_self() while (true) { val state = lock.value + @Suppress("ktlint:standard:max-line-length") require(currentThreadId == state.ownerThreadId) { - "Thin lock may be only released by the owner thread, expected: ${state.ownerThreadId}, real: $currentThreadId" // ktlint-disable max-line-length + "Thin lock may be only released by the owner thread, expected: ${state.ownerThreadId}, real: $currentThreadId" } when (state.status) { Status.THIN -> { diff --git a/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt b/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt index 84fafce9473..245881ee1f3 100644 --- a/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt +++ b/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt @@ -1,6 +1,7 @@ /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt b/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt index 56192cd3cb5..2fe51947562 100644 --- a/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt +++ b/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/jvm/src/io/ktor/network/selector/JvmSelector.kt b/ktor-network/jvm/src/io/ktor/network/selector/JvmSelector.kt index 17f88b51970..9b9723de242 100644 --- a/ktor-network/jvm/src/io/ktor/network/selector/JvmSelector.kt +++ b/ktor-network/jvm/src/io/ktor/network/selector/JvmSelector.kt @@ -1,4 +1,7 @@ -// ktlint-disable filename +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.selector import kotlinx.coroutines.* diff --git a/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt b/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt index 56c6638738d..77611629423 100644 --- a/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt +++ b/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.selector import kotlinx.atomicfu.* diff --git a/ktor-network/jvm/src/io/ktor/network/selector/SelectableJvm.kt b/ktor-network/jvm/src/io/ktor/network/selector/SelectableJvm.kt index 6a43975defc..b76375228a9 100644 --- a/ktor-network/jvm/src/io/ktor/network/selector/SelectableJvm.kt +++ b/ktor-network/jvm/src/io/ktor/network/selector/SelectableJvm.kt @@ -1,4 +1,7 @@ -// ktlint-disable filename +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.selector import kotlinx.atomicfu.* diff --git a/ktor-network/jvmAndPosix/src/io/ktor/network/sockets/Builders.kt b/ktor-network/jvmAndPosix/src/io/ktor/network/sockets/Builders.kt index bc80354e9b0..81c4a1306c1 100644 --- a/ktor-network/jvmAndPosix/src/io/ktor/network/sockets/Builders.kt +++ b/ktor-network/jvmAndPosix/src/io/ktor/network/sockets/Builders.kt @@ -1,6 +1,7 @@ /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.sockets import io.ktor.network.selector.* diff --git a/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/ConnectionTest.kt b/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/ConnectionTest.kt index f214c1db900..6bb77794df8 100644 --- a/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/ConnectionTest.kt +++ b/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/ConnectionTest.kt @@ -1,8 +1,7 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable experimental:argument-list-wrapping package io.ktor.network.tls import io.ktor.network.selector.* @@ -25,8 +24,6 @@ import java.security.* import java.security.cert.* import javax.net.ssl.* import kotlin.test.* -import kotlin.test.Ignore -import kotlin.test.Test @Suppress("UNCHECKED_CAST") @CoroutinesTimeout(20_000) diff --git a/ktor-network/ktor-network-tls/posix/src/io/ktor/network/tls/TLSConfigNative.kt b/ktor-network/ktor-network-tls/posix/src/io/ktor/network/tls/TLSConfigNative.kt index f3bf682429c..3b7954fd388 100644 --- a/ktor-network/ktor-network-tls/posix/src/io/ktor/network/tls/TLSConfigNative.kt +++ b/ktor-network/ktor-network-tls/posix/src/io/ktor/network/tls/TLSConfigNative.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.network.tls diff --git a/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt b/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt index a3c439ee97d..1768151b7bb 100644 --- a/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt +++ b/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/nix/src/io/ktor/network/selector/SelectUtilsNix.kt b/ktor-network/nix/src/io/ktor/network/selector/SelectUtilsNix.kt index 0b4874a47f1..6c4bafa3293 100644 --- a/ktor-network/nix/src/io/ktor/network/selector/SelectUtilsNix.kt +++ b/ktor-network/nix/src/io/ktor/network/selector/SelectUtilsNix.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.selector import io.ktor.network.interop.* diff --git a/ktor-network/posix/src/io/ktor/network/selector/SelectUtils.kt b/ktor-network/posix/src/io/ktor/network/selector/SelectUtils.kt index 6cc52efe37e..65961afcdf3 100644 --- a/ktor-network/posix/src/io/ktor/network/selector/SelectUtils.kt +++ b/ktor-network/posix/src/io/ktor/network/selector/SelectUtils.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.selector import kotlinx.coroutines.* diff --git a/ktor-network/posix/src/io/ktor/network/selector/WorkerSelectorManager.kt b/ktor-network/posix/src/io/ktor/network/selector/WorkerSelectorManager.kt index fe7c2cf4360..7f36cbac0e2 100644 --- a/ktor-network/posix/src/io/ktor/network/selector/WorkerSelectorManager.kt +++ b/ktor-network/posix/src/io/ktor/network/selector/WorkerSelectorManager.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.selector import kotlinx.coroutines.* diff --git a/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt b/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt index 33725ad7923..f709a544351 100644 --- a/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt +++ b/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt b/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt index 97f84b0a1a8..3837a950bd3 100644 --- a/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt +++ b/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-server/common/src/Stub.kt b/ktor-server/common/src/Stub.kt index 1525c247cbe..d0706de3a1a 100644 --- a/ktor-server/common/src/Stub.kt +++ b/ktor-server/common/src/Stub.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server internal fun stub() { diff --git a/ktor-server/ktor-server-cio/jvmAndPosix/test/io/ktor/tests/server/cio/CIOEngineTest.kt b/ktor-server/ktor-server-cio/jvmAndPosix/test/io/ktor/tests/server/cio/CIOEngineTest.kt index 32ee17291db..c2072804580 100644 --- a/ktor-server/ktor-server-cio/jvmAndPosix/test/io/ktor/tests/server/cio/CIOEngineTest.kt +++ b/ktor-server/ktor-server-cio/jvmAndPosix/test/io/ktor/tests/server/cio/CIOEngineTest.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.server.cio diff --git a/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt b/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt index 15e38de624c..f02a9fa69bc 100644 --- a/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt +++ b/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.config.yaml import io.ktor.server.config.* diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/application/CommonApplicationEnvironment.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/application/CommonApplicationEnvironment.kt index 7660479dc70..f2fb3fd3805 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/application/CommonApplicationEnvironment.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/application/CommonApplicationEnvironment.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.server.application diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/application/KtorCallContexts.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/application/KtorCallContexts.kt index 606b1c85d63..641478b9c1f 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/application/KtorCallContexts.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/application/KtorCallContexts.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.application import io.ktor.server.response.* diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt index c5eb0e69d2c..22006c70e68 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.engine @@ -10,7 +9,6 @@ import io.ktor.http.content.* import io.ktor.server.application.* import io.ktor.server.engine.internal.* import io.ktor.server.http.* -import io.ktor.server.plugins.* import io.ktor.server.response.* import io.ktor.util.* import io.ktor.util.cio.* diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/EmbeddedServer.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/EmbeddedServer.kt index 36138c1f71c..8ff29daec65 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/EmbeddedServer.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/EmbeddedServer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.engine @@ -78,7 +78,8 @@ public fun CoroutineScope.embeddedServer( // ktlint-disable max-line-length +@Suppress("ktlint:standard:max-line-length") +public fun CoroutineScope.embeddedServer( factory: ApplicationEngineFactory, port: Int = 80, host: String = "0.0.0.0", @@ -104,7 +105,8 @@ public fun CoroutineScope.embeddedServer( // ktlint-disable max-line-length +@Suppress("ktlint:standard:max-line-length") +public fun CoroutineScope.embeddedServer( factory: ApplicationEngineFactory, vararg connectors: EngineConnectorConfig = arrayOf(), watchPaths: List = listOf(WORKING_DIRECTORY_PATH), diff --git a/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/application/ApplicationEnvironment.jsAndWasmShared.kt b/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/application/ApplicationEnvironment.jsAndWasmShared.kt index bac01c336c8..15ec46cad12 100644 --- a/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/application/ApplicationEnvironment.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/application/ApplicationEnvironment.jsAndWasmShared.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.application diff --git a/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/engine/ApplicationEngineEnvironment.jsAndWasmShared.kt b/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/engine/ApplicationEngineEnvironment.jsAndWasmShared.kt index e72c097406e..e9f704e6b81 100644 --- a/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/engine/ApplicationEngineEnvironment.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-core/jsAndWasmShared/src/io/ktor/server/engine/ApplicationEngineEnvironment.jsAndWasmShared.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.engine diff --git a/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/ApplicationEnvironmentJvm.kt b/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/ApplicationEnvironmentJvm.kt index d6d022d4788..58512371801 100644 --- a/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/ApplicationEnvironmentJvm.kt +++ b/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/ApplicationEnvironmentJvm.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.engine @@ -10,7 +9,6 @@ import io.ktor.server.application.* import io.ktor.server.config.* import io.ktor.utils.io.* import org.slf4j.* -import kotlin.coroutines.* /** * Builder for configuring the environment of the Ktor application. diff --git a/ktor-server/ktor-server-core/posix/src/io/ktor/server/application/NixApplicationEnvironment.kt b/ktor-server/ktor-server-core/posix/src/io/ktor/server/application/NixApplicationEnvironment.kt index bac01c336c8..15ec46cad12 100644 --- a/ktor-server/ktor-server-core/posix/src/io/ktor/server/application/NixApplicationEnvironment.kt +++ b/ktor-server/ktor-server-core/posix/src/io/ktor/server/application/NixApplicationEnvironment.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.application diff --git a/ktor-server/ktor-server-core/posix/src/io/ktor/server/engine/ApplicationEngineEnvironmentNix.kt b/ktor-server/ktor-server-core/posix/src/io/ktor/server/engine/ApplicationEngineEnvironmentNix.kt index 34f065be23e..e9f704e6b81 100644 --- a/ktor-server/ktor-server-core/posix/src/io/ktor/server/engine/ApplicationEngineEnvironmentNix.kt +++ b/ktor-server/ktor-server-core/posix/src/io/ktor/server/engine/ApplicationEngineEnvironmentNix.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.engine @@ -10,7 +9,6 @@ import io.ktor.server.application.* import io.ktor.server.config.* import io.ktor.util.logging.* import io.ktor.utils.io.* -import kotlin.coroutines.* /** * Engine environment configuration builder diff --git a/ktor-server/ktor-server-host-common/common/src/Stub.kt b/ktor-server/ktor-server-host-common/common/src/Stub.kt index 0d2c79738f9..c48ad0f3564 100644 --- a/ktor-server/ktor-server-host-common/common/src/Stub.kt +++ b/ktor-server/ktor-server-host-common/common/src/Stub.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.host.common internal fun stub() { diff --git a/ktor-server/ktor-server-jetty-jakarta/jvm/src/io/ktor/server/jetty/jakarta/Embedded.kt b/ktor-server/ktor-server-jetty-jakarta/jvm/src/io/ktor/server/jetty/jakarta/Embedded.kt index c5f6f87d851..32b8f0003d4 100644 --- a/ktor-server/ktor-server-jetty-jakarta/jvm/src/io/ktor/server/jetty/jakarta/Embedded.kt +++ b/ktor-server/ktor-server-jetty-jakarta/jvm/src/io/ktor/server/jetty/jakarta/Embedded.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.jetty.jakarta diff --git a/ktor-server/ktor-server-jetty/jvm/src/io/ktor/server/jetty/Embedded.kt b/ktor-server/ktor-server-jetty/jvm/src/io/ktor/server/jetty/Embedded.kt index 4471028735d..cb50a95e4b9 100644 --- a/ktor-server/ktor-server-jetty/jvm/src/io/ktor/server/jetty/Embedded.kt +++ b/ktor-server/ktor-server-jetty/jvm/src/io/ktor/server/jetty/Embedded.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.jetty diff --git a/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/Embedded.kt b/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/Embedded.kt index 7568d9cc53b..84d91913ec7 100644 --- a/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/Embedded.kt +++ b/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/Embedded.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.netty diff --git a/ktor-server/ktor-server-plugins/ktor-server-auth/common/test/io/ktor/tests/auth/OAuth2Test.kt b/ktor-server/ktor-server-plugins/ktor-server-auth/common/test/io/ktor/tests/auth/OAuth2Test.kt index 16a387b771a..340c50a6cd0 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-auth/common/test/io/ktor/tests/auth/OAuth2Test.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-auth/common/test/io/ktor/tests/auth/OAuth2Test.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.auth @@ -349,7 +349,7 @@ class OAuth2Test { call.authentication.allFailures.all { it is OAuth2RedirectError && it.error == "access_denied" } - } // ktlint-disable max-line-length + } } } val call = noRedirectsClient().get( diff --git a/ktor-server/ktor-server-plugins/ktor-server-body-limit/common/test/io/ktor/server/plugins/bodylimit/RequestBodyLimitTest.kt b/ktor-server/ktor-server-plugins/ktor-server-body-limit/common/test/io/ktor/server/plugins/bodylimit/RequestBodyLimitTest.kt index d27d23a840e..25a173465dd 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-body-limit/common/test/io/ktor/server/plugins/bodylimit/RequestBodyLimitTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-body-limit/common/test/io/ktor/server/plugins/bodylimit/RequestBodyLimitTest.kt @@ -1,6 +1,7 @@ /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.plugins.bodylimit import io.ktor.client.request.* diff --git a/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/test/io/ktor/server/plugins/calllogging/CallLoggingTest.kt b/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/test/io/ktor/server/plugins/calllogging/CallLoggingTest.kt index 36d8d67cf55..f2873d553ba 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/test/io/ktor/server/plugins/calllogging/CallLoggingTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/test/io/ktor/server/plugins/calllogging/CallLoggingTest.kt @@ -520,9 +520,10 @@ class CallLoggingTest { client.get("/").apply { assertEquals(HttpStatusCode.BadRequest, status) + @Suppress("ktlint:standard:max-line-length") assertContains( messages, - "DEBUG: Unhandled: GET - /. Exception class io.ktor.server.plugins.BadRequestException: Message of exception" // ktlint-disable max-line-length + "DEBUG: Unhandled: GET - /. Exception class io.ktor.server.plugins.BadRequestException: Message of exception" ) } } diff --git a/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/common/test/RequestConverterTest.kt b/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/common/test/RequestConverterTest.kt index 35d9a102d7c..c6867223d3a 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/common/test/RequestConverterTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/common/test/RequestConverterTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.contentnegotiation @@ -78,8 +78,9 @@ class RequestConverterTest { }.bodyAsText() try { + @Suppress("ktlint:standard:max-line-length") assertEquals( - "Cannot transform this request's content to io.ktor.server.plugins.contentnegotiation.NonSerializableClass", // ktlint-disable max-line-length + "Cannot transform this request's content to io.ktor.server.plugins.contentnegotiation.NonSerializableClass", responseFoo ) } catch (cause: Throwable) { diff --git a/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/jvm/test/ContentNegotiationJvmTest.kt b/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/jvm/test/ContentNegotiationJvmTest.kt index d5030193b62..4cbcf2de77b 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/jvm/test/ContentNegotiationJvmTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-content-negotiation/jvm/test/ContentNegotiationJvmTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.plugins.contentnegotiation import io.ktor.client.request.* diff --git a/ktor-server/ktor-server-plugins/ktor-server-double-receive/common/src/io/ktor/server/plugins/doublereceive/ByteArrayCache.kt b/ktor-server/ktor-server-plugins/ktor-server-double-receive/common/src/io/ktor/server/plugins/doublereceive/ByteArrayCache.kt index 169bf3e32c6..f93f92c70cc 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-double-receive/common/src/io/ktor/server/plugins/doublereceive/ByteArrayCache.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-double-receive/common/src/io/ktor/server/plugins/doublereceive/ByteArrayCache.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.doublereceive diff --git a/ktor-server/ktor-server-plugins/ktor-server-double-receive/jsAndWasmShared/src/io/ktor/server/plugins/doublereceive/FileCache.jsAndWasmShared.kt b/ktor-server/ktor-server-plugins/ktor-server-double-receive/jsAndWasmShared/src/io/ktor/server/plugins/doublereceive/FileCache.jsAndWasmShared.kt index 4648d18e5f2..e78d3b14e28 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-double-receive/jsAndWasmShared/src/io/ktor/server/plugins/doublereceive/FileCache.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-double-receive/jsAndWasmShared/src/io/ktor/server/plugins/doublereceive/FileCache.jsAndWasmShared.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.doublereceive diff --git a/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/src/io/ktor/server/plugins/doublereceive/FileCacheJvm.kt b/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/src/io/ktor/server/plugins/doublereceive/FileCacheJvm.kt index 30b9a1ffa7a..0783e8fd0c4 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/src/io/ktor/server/plugins/doublereceive/FileCacheJvm.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/src/io/ktor/server/plugins/doublereceive/FileCacheJvm.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.doublereceive diff --git a/ktor-server/ktor-server-plugins/ktor-server-double-receive/posix/src/io/ktor/server/plugins/doublereceive/FileCacheNix.kt b/ktor-server/ktor-server-plugins/ktor-server-double-receive/posix/src/io/ktor/server/plugins/doublereceive/FileCacheNix.kt index 4648d18e5f2..e78d3b14e28 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-double-receive/posix/src/io/ktor/server/plugins/doublereceive/FileCacheNix.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-double-receive/posix/src/io/ktor/server/plugins/doublereceive/FileCacheNix.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.doublereceive diff --git a/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionTransportCookie.kt b/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionTransportCookie.kt index 38003006731..ed6ee613ac9 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionTransportCookie.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionTransportCookie.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.sessions import io.ktor.http.* diff --git a/ktor-server/ktor-server-plugins/ktor-server-sessions/jvm/src/io/ktor/server/sessions/SessionSerializerReflection.kt b/ktor-server/ktor-server-plugins/ktor-server-sessions/jvm/src/io/ktor/server/sessions/SessionSerializerReflection.kt index 2b07c2f9299..e22c345d6f1 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-sessions/jvm/src/io/ktor/server/sessions/SessionSerializerReflection.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-sessions/jvm/src/io/ktor/server/sessions/SessionSerializerReflection.kt @@ -1,8 +1,7 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable experimental:argument-list-wrapping package io.ktor.server.sessions import io.ktor.http.* diff --git a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/BaseTestJvm.kt b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/BaseTestJvm.kt index c193ced8e55..3c388152563 100644 --- a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/BaseTestJvm.kt +++ b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/BaseTestJvm.kt @@ -2,7 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable filename package io.ktor.server.test.base import io.ktor.junit.* diff --git a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt index 5b008d8e6f9..c31a9e92e54 100644 --- a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt +++ b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt @@ -2,7 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable filename package io.ktor.server.test.base import io.ktor.client.* diff --git a/ktor-server/ktor-server-test-host/jsAndWasmShared/src/io/ktor/server/testing/client/TestHttpClientEngineBridge.jsAndWasmShared.kt b/ktor-server/ktor-server-test-host/jsAndWasmShared/src/io/ktor/server/testing/client/TestHttpClientEngineBridge.jsAndWasmShared.kt index ddd907c0e1e..17d1d11bf97 100644 --- a/ktor-server/ktor-server-test-host/jsAndWasmShared/src/io/ktor/server/testing/client/TestHttpClientEngineBridge.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-test-host/jsAndWasmShared/src/io/ktor/server/testing/client/TestHttpClientEngineBridge.jsAndWasmShared.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.testing.client diff --git a/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeJvm.kt b/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeJvm.kt index 17f266f4f9a..7ff3be1d161 100644 --- a/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeJvm.kt +++ b/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeJvm.kt @@ -2,7 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable filename package io.ktor.server.testing.client import io.ktor.client.engine.* diff --git a/ktor-server/ktor-server-test-host/posix/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeNix.kt b/ktor-server/ktor-server-test-host/posix/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeNix.kt index b64c2a948f1..69a9964c3b9 100644 --- a/ktor-server/ktor-server-test-host/posix/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeNix.kt +++ b/ktor-server/ktor-server-test-host/posix/src/io/ktor/server/testing/client/TestHttpClientEngineBridgeNix.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.testing.client diff --git a/ktor-server/ktor-server-tests/common/src/Stub.kt b/ktor-server/ktor-server-tests/common/src/Stub.kt index b48bfaacd20..0ff3ed10564 100644 --- a/ktor-server/ktor-server-tests/common/src/Stub.kt +++ b/ktor-server/ktor-server-tests/common/src/Stub.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.server.tests internal fun stub() { diff --git a/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/plugins/ConditionalHeadersTests.kt b/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/plugins/ConditionalHeadersTests.kt index 00b500ed172..08b2dad2b39 100644 --- a/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/plugins/ConditionalHeadersTests.kt +++ b/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/plugins/ConditionalHeadersTests.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.server.plugins diff --git a/ktor-server/ktor-server-tests/jvm/test/io/ktor/server/http/ApplicationRequestContentTestJvm.kt b/ktor-server/ktor-server-tests/jvm/test/io/ktor/server/http/ApplicationRequestContentTestJvm.kt index b2b47d6f9f3..a75f2b33dcd 100644 --- a/ktor-server/ktor-server-tests/jvm/test/io/ktor/server/http/ApplicationRequestContentTestJvm.kt +++ b/ktor-server/ktor-server-tests/jvm/test/io/ktor/server/http/ApplicationRequestContentTestJvm.kt @@ -2,7 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -// ktlint-disable filename package io.ktor.server.http import io.ktor.client.request.* diff --git a/ktor-server/ktor-server-tomcat-jakarta/jvm/src/io/ktor/server/tomcat/jakarta/Embedded.kt b/ktor-server/ktor-server-tomcat-jakarta/jvm/src/io/ktor/server/tomcat/jakarta/Embedded.kt index 9cf99f151bb..0f418a11c38 100644 --- a/ktor-server/ktor-server-tomcat-jakarta/jvm/src/io/ktor/server/tomcat/jakarta/Embedded.kt +++ b/ktor-server/ktor-server-tomcat-jakarta/jvm/src/io/ktor/server/tomcat/jakarta/Embedded.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.tomcat.jakarta diff --git a/ktor-server/ktor-server-tomcat/jvm/src/io/ktor/server/tomcat/Embedded.kt b/ktor-server/ktor-server-tomcat/jvm/src/io/ktor/server/tomcat/Embedded.kt index 9325996582c..d6c2b3b1e3e 100644 --- a/ktor-server/ktor-server-tomcat/jvm/src/io/ktor/server/tomcat/Embedded.kt +++ b/ktor-server/ktor-server-tomcat/jvm/src/io/ktor/server/tomcat/Embedded.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.tomcat diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborContextualSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborContextualSerializationTest.kt index ba9e7d46055..f2760963682 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborContextualSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborContextualSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborSerializationTest.kt index ed059822c28..fd2c51964a9 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/common/test/CborSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborClientKotlinxSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborClientKotlinxSerializationTest.kt index 307a4975d3a..a1fb262589b 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborClientKotlinxSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborClientKotlinxSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.cbor import io.ktor.client.plugins.contentnegotiation.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborServerKotlinxSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborServerKotlinxSerializationTest.kt index 39fd578d103..d88f0f4e301 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborServerKotlinxSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-cbor/jvm/test/CborServerKotlinxSerializationTest.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.serialization.kotlinx.test.cbor import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonContextualSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonContextualSerializationTest.kt index 63be74d9ced..e331e6d60f6 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonContextualSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonContextualSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonSerializationTest.kt index 1029795ec13..0b008a008b9 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/common/test/JsonSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.client.engine.mock.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationJsonJvmTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationJsonJvmTest.kt index 579a737fa43..c230339c4aa 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationJsonJvmTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationJsonJvmTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.client.call.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationTest.kt index e23918fc38a..7ef2684c450 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonClientKotlinxSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.client.plugins.contentnegotiation.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonServerKotlinxSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonServerKotlinxSerializationTest.kt index 7170edbf1dd..f46595cc22b 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonServerKotlinxSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-json/jvm/test/JsonServerKotlinxSerializationTest.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.serialization.kotlinx.test.json import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractContextualSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractContextualSerializationTest.kt index 11ac94f6221..1059dd3f274 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractContextualSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractContextualSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractSerializationTest.kt index b570adf533e..ef51e3c1778 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/common/src/AbstractSerializationTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test import io.ktor.http.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/jvm/src/AbstractServerSerializationKotlinxTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/jvm/src/AbstractServerSerializationKotlinxTest.kt index 4b9c6d696b2..67b0dd4e3d9 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/jvm/src/AbstractServerSerializationKotlinxTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-tests/jvm/src/AbstractServerSerializationKotlinxTest.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.kotlinx.test import io.ktor.serialization.test.* diff --git a/ktor-shared/ktor-serialization/ktor-serialization-tests/jvm/src/AbstractServerSerializationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-tests/jvm/src/AbstractServerSerializationTest.kt index 511d3548b32..9233683cbd4 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-tests/jvm/src/AbstractServerSerializationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-tests/jvm/src/AbstractServerSerializationTest.kt @@ -1,6 +1,7 @@ /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.serialization.test import io.ktor.client.request.* diff --git a/ktor-shared/ktor-websockets/jsAndWasmShared/src/io/ktor/websocket/FrameJs.kt b/ktor-shared/ktor-websockets/jsAndWasmShared/src/io/ktor/websocket/FrameJs.kt index 151ce6b0e81..dd40a1e5ec7 100644 --- a/ktor-shared/ktor-websockets/jsAndWasmShared/src/io/ktor/websocket/FrameJs.kt +++ b/ktor-shared/ktor-websockets/jsAndWasmShared/src/io/ktor/websocket/FrameJs.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.websocket diff --git a/ktor-shared/ktor-websockets/posix/src/io/ktor/websocket/FrameNative.kt b/ktor-shared/ktor-websockets/posix/src/io/ktor/websocket/FrameNative.kt index 0ba4945ca75..fbbe55569ac 100644 --- a/ktor-shared/ktor-websockets/posix/src/io/ktor/websocket/FrameNative.kt +++ b/ktor-shared/ktor-websockets/posix/src/io/ktor/websocket/FrameNative.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.websocket diff --git a/ktor-utils/common/src/io/ktor/util/CaseInsensitiveSet.kt b/ktor-utils/common/src/io/ktor/util/CaseInsensitiveSet.kt index bd1c4058bf1..8c1da1e7ac2 100644 --- a/ktor-utils/common/src/io/ktor/util/CaseInsensitiveSet.kt +++ b/ktor-utils/common/src/io/ktor/util/CaseInsensitiveSet.kt @@ -1,6 +1,7 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.util import io.ktor.utils.io.* diff --git a/ktor-utils/js/src/io/ktor/util/PlatformUtils.js.kt b/ktor-utils/js/src/io/ktor/util/PlatformUtils.js.kt index 55644611118..7ddcdb1518b 100644 --- a/ktor-utils/js/src/io/ktor/util/PlatformUtils.js.kt +++ b/ktor-utils/js/src/io/ktor/util/PlatformUtils.js.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.util diff --git a/ktor-utils/jsAndWasmShared/src/io/ktor/util/PlatformUtilsJs.kt b/ktor-utils/jsAndWasmShared/src/io/ktor/util/PlatformUtilsJs.kt index 9f1f57d862d..871652d0c4b 100644 --- a/ktor-utils/jsAndWasmShared/src/io/ktor/util/PlatformUtilsJs.kt +++ b/ktor-utils/jsAndWasmShared/src/io/ktor/util/PlatformUtilsJs.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.util diff --git a/ktor-utils/jsAndWasmShared/src/io/ktor/util/collections/ConcurrentMapJs.kt b/ktor-utils/jsAndWasmShared/src/io/ktor/util/collections/ConcurrentMapJs.kt index e27709fca72..ab18a4f3928 100644 --- a/ktor-utils/jsAndWasmShared/src/io/ktor/util/collections/ConcurrentMapJs.kt +++ b/ktor-utils/jsAndWasmShared/src/io/ktor/util/collections/ConcurrentMapJs.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.collections diff --git a/ktor-utils/jsAndWasmShared/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJs.kt b/ktor-utils/jsAndWasmShared/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJs.kt index 37f3662e8bc..614a2d07d8c 100644 --- a/ktor-utils/jsAndWasmShared/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJs.kt +++ b/ktor-utils/jsAndWasmShared/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJs.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.debug diff --git a/ktor-utils/jsAndWasmShared/src/io/ktor/util/logging/LoggerJs.kt b/ktor-utils/jsAndWasmShared/src/io/ktor/util/logging/LoggerJs.kt index 8ab1f6a5b32..43c72d4f78a 100644 --- a/ktor-utils/jsAndWasmShared/src/io/ktor/util/logging/LoggerJs.kt +++ b/ktor-utils/jsAndWasmShared/src/io/ktor/util/logging/LoggerJs.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.logging diff --git a/ktor-utils/jvm/src/io/ktor/util/collections/ConcurrentMapJvm.kt b/ktor-utils/jvm/src/io/ktor/util/collections/ConcurrentMapJvm.kt index 7d1733836c6..be5b2ae05ed 100644 --- a/ktor-utils/jvm/src/io/ktor/util/collections/ConcurrentMapJvm.kt +++ b/ktor-utils/jvm/src/io/ktor/util/collections/ConcurrentMapJvm.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.collections diff --git a/ktor-utils/jvm/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJvm.kt b/ktor-utils/jvm/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJvm.kt index 13e668d6e20..04514410310 100644 --- a/ktor-utils/jvm/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJvm.kt +++ b/ktor-utils/jvm/src/io/ktor/util/debug/IntellijIdeaDebugDetectorJvm.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.debug diff --git a/ktor-utils/jvm/src/io/ktor/util/logging/LoggerJvm.kt b/ktor-utils/jvm/src/io/ktor/util/logging/LoggerJvm.kt index 1c1f8c7e5bf..d3eed5767e6 100644 --- a/ktor-utils/jvm/src/io/ktor/util/logging/LoggerJvm.kt +++ b/ktor-utils/jvm/src/io/ktor/util/logging/LoggerJvm.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.logging diff --git a/ktor-utils/posix/src/io/ktor/util/PlatformUtilsNative.kt b/ktor-utils/posix/src/io/ktor/util/PlatformUtilsNative.kt index d715059313b..c3972f89d26 100644 --- a/ktor-utils/posix/src/io/ktor/util/PlatformUtilsNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/PlatformUtilsNative.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.util diff --git a/ktor-utils/posix/src/io/ktor/util/collections/ConcurrentMapNative.kt b/ktor-utils/posix/src/io/ktor/util/collections/ConcurrentMapNative.kt index f1275c5c38d..daa781ce2de 100644 --- a/ktor-utils/posix/src/io/ktor/util/collections/ConcurrentMapNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/collections/ConcurrentMapNative.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.collections diff --git a/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt b/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt index c4f9f317b6e..b758c1a2047 100644 --- a/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt @@ -1,6 +1,7 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ + package io.ktor.util.collections import io.ktor.utils.io.* diff --git a/ktor-utils/posix/src/io/ktor/util/debug/IntellijIdeaDebugDetectorNative.kt b/ktor-utils/posix/src/io/ktor/util/debug/IntellijIdeaDebugDetectorNative.kt index 37f3662e8bc..614a2d07d8c 100644 --- a/ktor-utils/posix/src/io/ktor/util/debug/IntellijIdeaDebugDetectorNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/debug/IntellijIdeaDebugDetectorNative.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.debug diff --git a/ktor-utils/posix/src/io/ktor/util/logging/LogLevelNative.kt b/ktor-utils/posix/src/io/ktor/util/logging/LogLevelNative.kt index 10c118b2592..e44d7a148f0 100644 --- a/ktor-utils/posix/src/io/ktor/util/logging/LogLevelNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/logging/LogLevelNative.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.logging diff --git a/ktor-utils/posix/src/io/ktor/util/logging/LoggerNative.kt b/ktor-utils/posix/src/io/ktor/util/logging/LoggerNative.kt index f75af04ea94..2a55b061d33 100644 --- a/ktor-utils/posix/src/io/ktor/util/logging/LoggerNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/logging/LoggerNative.kt @@ -1,6 +1,5 @@ -// ktlint-disable filename /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.logging diff --git a/ktor-utils/wasmJs/src/io/ktor/util/PlatformUtils.wasmJs.kt b/ktor-utils/wasmJs/src/io/ktor/util/PlatformUtils.wasmJs.kt index 247758eb317..9a9b00cd917 100644 --- a/ktor-utils/wasmJs/src/io/ktor/util/PlatformUtils.wasmJs.kt +++ b/ktor-utils/wasmJs/src/io/ktor/util/PlatformUtils.wasmJs.kt @@ -1,7 +1,6 @@ -// ktlint-disable filename /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.util From 5c97f165d80adfc60979660d010615379da97c08 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 10:30:29 +0100 Subject: [PATCH 03/11] Fix license headers --- buildSrc/src/main/kotlin/KtorBuildProperties.kt | 4 ---- .../src/main/kotlin/test/server/tests/WebSockets.kt | 4 ++++ .../common/src/io/ktor/client/engine/ProxyConfig.kt | 4 ++++ .../ktor-client-core/common/test/CookiesTest.kt | 8 ++++---- .../common/test/DefaultRequestTest.kt | 8 ++++---- .../ktor-client-core/common/test/FormDslTest.kt | 8 ++++---- .../ktor-client-core/common/test/HttpStatementTest.kt | 8 ++++---- .../common/test/MultiPartFormDataContentTest.kt | 9 ++++----- .../ktor-client-core/common/test/TestEngine.kt | 8 ++++---- .../src/io/ktor/client/engine/ProxyConfigJs.kt | 4 ++++ .../jvm/src/io/ktor/client/engine/ProxyConfigJvm.kt | 4 ++++ .../src/io/ktor/client/engine/ProxyConfigNative.kt | 4 ++++ .../darwin/test/DarwinLegacyEngineTest.kt | 7 +++---- .../client/engine/darwin/internal/DarwinSession.kt | 4 ++++ .../ktor-client-mock/common/test/MockUtilsTest.kt | 8 ++++---- .../ktor-client-auth/build.gradle.kts | 8 ++++---- .../build.gradle.kts | 6 ------ .../io/ktor/client/tests/DefaultTransformJvmTest.kt | 6 +----- ktor-io/common/src/io/ktor/utils/io/bits/ByteOrder.kt | 4 ++++ .../common/src/io/ktor/utils/io/charsets/Encoding.kt | 5 ++++- ktor-io/common/src/io/ktor/utils/io/core/Buffer.kt | 4 ++++ .../common/src/io/ktor/utils/io/core/BufferAppend.kt | 6 +++++- ktor-io/common/src/io/ktor/utils/io/core/Buffers.kt | 4 ++++ ktor-io/common/src/io/ktor/utils/io/core/Builder.kt | 4 ++++ ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt | 4 ++++ .../src/io/ktor/utils/io/core/BytePacketBuilder.kt | 4 ++++ .../src/io/ktor/utils/io/core/ByteReadPacket.kt | 4 ++++ ktor-io/common/src/io/ktor/utils/io/core/Copy.kt | 4 ++++ ktor-io/common/src/io/ktor/utils/io/core/Output.kt | 6 +++++- ktor-io/common/src/io/ktor/utils/io/core/Packet.kt | 4 ++++ ktor-io/common/src/io/ktor/utils/io/core/Strings.kt | 4 ++++ .../src/io/ktor/utils/io/core/internal/ChunkBuffer.kt | 4 ++++ .../src/io/ktor/utils/io/core/internal/Numbers.kt | 4 ++++ ktor-io/common/src/io/ktor/utils/io/pool/Pool.kt | 4 ++++ ktor-io/common/test/ByteChannelTest.kt | 8 ++++---- ktor-io/common/test/ByteReadChannelOperationsTest.kt | 9 ++++----- ktor-io/common/test/CoroutinesTest.kt | 8 ++++---- ktor-io/common/test/ReadUtf8LineTest.kt | 8 ++++---- ktor-io/common/test/WriterReaderTest.kt | 8 ++++---- .../src/io/ktor/utils/io/charsets/TextEncoder.js.kt | 4 ++++ .../src/io/ktor/utils/io/charsets/ISO88591.kt | 4 ++++ .../src/io/ktor/utils/io/core/BufferPrimitivesJvm.kt | 4 ++++ .../jvm/src/io/ktor/utils/io/jvm/javaio/Reading.kt | 5 ++++- .../jvm/src/io/ktor/utils/io/jvm/javaio/Writing.kt | 4 ++++ ktor-io/jvm/test/ByteChannelConcurrentTest.kt | 4 ---- ktor-io/jvm/test/ByteReadChannelOperationsJvmTest.kt | 8 ++++---- ktor-io/jvm/test/ByteReadChannelReadTest.jvm.kt | 9 ++++----- ktor-io/jvm/test/ByteReadPacketExtensionsJvmTest.kt | 8 ++++---- ktor-io/jvm/test/LookAheadSessionTest.kt | 8 ++++---- .../src/io/ktor/network/selector/Selectable.kt | 4 ++++ .../io/ktor/network/selector/SelectorManagerCommon.kt | 4 ++++ .../jvm/test/io/ktor/network/tls/HostnameUtilsTest.kt | 4 ++++ .../io/ktor/network/sockets/SocketAddressNative.kt | 4 ++++ .../jvm/test/DoubleReceiveTestJvm.kt | 8 ++++---- .../jvm/src/io/ktor/server/webjars/Webjars.kt | 4 ++++ .../jvm/src/io/ktor/server/webjars/WebjarsUtils.kt | 6 +----- .../jvm/test/GsonContentNegotiationTest.kt | 8 ++++---- .../jvm/test/GsonWebsocketTest.kt | 8 ++++---- .../jvm/test/JacksonContentNegotiationTest.kt | 8 ++++---- .../jvm/test/JacksonWebsocketTest.kt | 8 ++++---- .../serialization/kotlinx/protobuf/ProtoBufSupport.kt | 4 ++++ .../src/io/ktor/util/internal/LockFreeLinkedList.kt | 11 ++++------- 62 files changed, 231 insertions(+), 130 deletions(-) diff --git a/buildSrc/src/main/kotlin/KtorBuildProperties.kt b/buildSrc/src/main/kotlin/KtorBuildProperties.kt index 183950b200f..1a64cd5654c 100644 --- a/buildSrc/src/main/kotlin/KtorBuildProperties.kt +++ b/buildSrc/src/main/kotlin/KtorBuildProperties.kt @@ -7,10 +7,6 @@ import org.gradle.api.tasks.testing.* import org.gradle.jvm.toolchain.* import org.gradle.kotlin.dsl.* -/* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - private val java_version: String = System.getProperty("java.version", "8.0.0") private val versionComponents = java_version diff --git a/buildSrc/src/main/kotlin/test/server/tests/WebSockets.kt b/buildSrc/src/main/kotlin/test/server/tests/WebSockets.kt index dca951162c8..f2e5f6432ba 100644 --- a/buildSrc/src/main/kotlin/test/server/tests/WebSockets.kt +++ b/buildSrc/src/main/kotlin/test/server/tests/WebSockets.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package test.server.tests import io.ktor.server.application.* diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/engine/ProxyConfig.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/engine/ProxyConfig.kt index 46ddce25756..cd80d4b676c 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/engine/ProxyConfig.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/engine/ProxyConfig.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.engine import io.ktor.http.* diff --git a/ktor-client/ktor-client-core/common/test/CookiesTest.kt b/ktor-client/ktor-client-core/common/test/CookiesTest.kt index 166bab3b642..17ed065d704 100644 --- a/ktor-client/ktor-client-core/common/test/CookiesTest.kt +++ b/ktor-client/ktor-client-core/common/test/CookiesTest.kt @@ -1,13 +1,13 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.plugins.cookies.* import io.ktor.client.request.* import io.ktor.http.* import io.ktor.test.dispatcher.* import kotlin.test.* -/* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ - class CookiesTest { @Test diff --git a/ktor-client/ktor-client-core/common/test/DefaultRequestTest.kt b/ktor-client/ktor-client-core/common/test/DefaultRequestTest.kt index 2a08ea2de28..2f7cc823bae 100644 --- a/ktor-client/ktor-client-core/common/test/DefaultRequestTest.kt +++ b/ktor-client/ktor-client-core/common/test/DefaultRequestTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.* import io.ktor.client.engine.mock.* import io.ktor.client.plugins.* @@ -8,10 +12,6 @@ import io.ktor.test.dispatcher.* import io.ktor.util.* import kotlin.test.* -/* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class DefaultRequestTest { @Test diff --git a/ktor-client/ktor-client-core/common/test/FormDslTest.kt b/ktor-client/ktor-client-core/common/test/FormDslTest.kt index 76aa8330123..95f8d6f27ce 100644 --- a/ktor-client/ktor-client-core/common/test/FormDslTest.kt +++ b/ktor-client/ktor-client-core/common/test/FormDslTest.kt @@ -1,11 +1,11 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.request.forms.* import io.ktor.http.* import kotlin.test.* -/* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ - class FormDslTest { @Test diff --git a/ktor-client/ktor-client-core/common/test/HttpStatementTest.kt b/ktor-client/ktor-client-core/common/test/HttpStatementTest.kt index 9cb7e387966..33754c945ab 100644 --- a/ktor-client/ktor-client-core/common/test/HttpStatementTest.kt +++ b/ktor-client/ktor-client-core/common/test/HttpStatementTest.kt @@ -1,12 +1,12 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.* import io.ktor.client.request.* import io.ktor.client.statement.* import kotlin.test.* -/* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ - class HttpStatementTest { @Test diff --git a/ktor-client/ktor-client-core/common/test/MultiPartFormDataContentTest.kt b/ktor-client/ktor-client-core/common/test/MultiPartFormDataContentTest.kt index 31953e57577..cfded8308cf 100644 --- a/ktor-client/ktor-client-core/common/test/MultiPartFormDataContentTest.kt +++ b/ktor-client/ktor-client-core/common/test/MultiPartFormDataContentTest.kt @@ -1,16 +1,15 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.request.forms.* import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import io.ktor.utils.io.charsets.* -import io.ktor.utils.io.core.* import kotlinx.coroutines.* import kotlinx.io.* import kotlin.test.* -/* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ - class MultiPartFormDataContentTest { @OptIn(InternalAPI::class) diff --git a/ktor-client/ktor-client-core/common/test/TestEngine.kt b/ktor-client/ktor-client-core/common/test/TestEngine.kt index 6f34a15ddb1..b7fa9614313 100644 --- a/ktor-client/ktor-client-core/common/test/TestEngine.kt +++ b/ktor-client/ktor-client-core/common/test/TestEngine.kt @@ -1,13 +1,13 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.engine.* import io.ktor.client.request.* import io.ktor.utils.io.* import kotlinx.coroutines.* import kotlin.coroutines.* -/* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ - internal object TestEngine : HttpClientEngine { override val dispatcher: CoroutineDispatcher get() = Dispatchers.Default diff --git a/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/ProxyConfigJs.kt b/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/ProxyConfigJs.kt index 7443308f410..73008b88c00 100644 --- a/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/ProxyConfigJs.kt +++ b/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/ProxyConfigJs.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.engine import io.ktor.http.* diff --git a/ktor-client/ktor-client-core/jvm/src/io/ktor/client/engine/ProxyConfigJvm.kt b/ktor-client/ktor-client-core/jvm/src/io/ktor/client/engine/ProxyConfigJvm.kt index 7d580b9afc3..417f1f0a6b5 100644 --- a/ktor-client/ktor-client-core/jvm/src/io/ktor/client/engine/ProxyConfigJvm.kt +++ b/ktor-client/ktor-client-core/jvm/src/io/ktor/client/engine/ProxyConfigJvm.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.engine import io.ktor.http.* diff --git a/ktor-client/ktor-client-core/posix/src/io/ktor/client/engine/ProxyConfigNative.kt b/ktor-client/ktor-client-core/posix/src/io/ktor/client/engine/ProxyConfigNative.kt index 3e321a78887..92f67fc9783 100644 --- a/ktor-client/ktor-client-core/posix/src/io/ktor/client/engine/ProxyConfigNative.kt +++ b/ktor-client/ktor-client-core/posix/src/io/ktor/client/engine/ProxyConfigNative.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.engine import io.ktor.http.* diff --git a/ktor-client/ktor-client-darwin-legacy/darwin/test/DarwinLegacyEngineTest.kt b/ktor-client/ktor-client-darwin-legacy/darwin/test/DarwinLegacyEngineTest.kt index 5ee463c6365..fd3d68e610b 100644 --- a/ktor-client/ktor-client-darwin-legacy/darwin/test/DarwinLegacyEngineTest.kt +++ b/ktor-client/ktor-client-darwin-legacy/darwin/test/DarwinLegacyEngineTest.kt @@ -1,3 +1,6 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ import io.ktor.client.* import io.ktor.client.engine.darwin.* @@ -12,10 +15,6 @@ import platform.Foundation.NSHTTPCookieStorage.Companion.sharedHTTPCookieStorage import kotlin.coroutines.* import kotlin.test.* -/* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class DarwinLegacyEngineTest { val testCoroutineContext: CoroutineContext = Dispatchers.Default diff --git a/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinSession.kt b/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinSession.kt index d599c78919f..25386fcca24 100644 --- a/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinSession.kt +++ b/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinSession.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.engine.darwin.internal import io.ktor.client.engine.darwin.* diff --git a/ktor-client/ktor-client-mock/common/test/MockUtilsTest.kt b/ktor-client/ktor-client-mock/common/test/MockUtilsTest.kt index 0f567d5b897..5e12702c587 100644 --- a/ktor-client/ktor-client-mock/common/test/MockUtilsTest.kt +++ b/ktor-client/ktor-client-mock/common/test/MockUtilsTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.client.engine.mock import io.ktor.http.content.* @@ -5,10 +9,6 @@ import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import kotlin.test.* -/* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class MockUtilsTest { @Test diff --git a/ktor-client/ktor-client-plugins/ktor-client-auth/build.gradle.kts b/ktor-client/ktor-client-plugins/ktor-client-auth/build.gradle.kts index 84423b6effb..3e75aed1ce7 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-auth/build.gradle.kts +++ b/ktor-client/ktor-client-plugins/ktor-client-auth/build.gradle.kts @@ -1,8 +1,8 @@ -import test.server.* - /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +import test.server.* description = "Ktor client Auth support" diff --git a/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/build.gradle.kts b/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/build.gradle.kts index a00b3189ace..45bd658f8b1 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/build.gradle.kts +++ b/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/build.gradle.kts @@ -2,12 +2,6 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -import org.jetbrains.kotlin.gradle.targets.jvm.tasks.* - -/* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - description = "Common tests for client content negotiation" plugins { diff --git a/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/DefaultTransformJvmTest.kt b/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/DefaultTransformJvmTest.kt index 95b072b8230..e0f159cfaec 100644 --- a/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/DefaultTransformJvmTest.kt +++ b/ktor-client/ktor-client-tests/jvm/test/io/ktor/client/tests/DefaultTransformJvmTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests @@ -15,10 +15,6 @@ import io.ktor.utils.io.* import java.io.* import kotlin.test.* -/* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class DefaultTransformJvmTest { @Test diff --git a/ktor-io/common/src/io/ktor/utils/io/bits/ByteOrder.kt b/ktor-io/common/src/io/ktor/utils/io/bits/ByteOrder.kt index 07c1b3a4204..a57e3f21829 100644 --- a/ktor-io/common/src/io/ktor/utils/io/bits/ByteOrder.kt +++ b/ktor-io/common/src/io/ktor/utils/io/bits/ByteOrder.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.bits /** diff --git a/ktor-io/common/src/io/ktor/utils/io/charsets/Encoding.kt b/ktor-io/common/src/io/ktor/utils/io/charsets/Encoding.kt index a985e86afb8..1fd20fcf549 100644 --- a/ktor-io/common/src/io/ktor/utils/io/charsets/Encoding.kt +++ b/ktor-io/common/src/io/ktor/utils/io/charsets/Encoding.kt @@ -1,9 +1,12 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.charsets import io.ktor.utils.io.core.* import io.ktor.utils.io.core.internal.* import kotlinx.io.* -import kotlinx.io.IOException public expect abstract class Charset { public abstract fun newEncoder(): CharsetEncoder diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Buffer.kt b/ktor-io/common/src/io/ktor/utils/io/core/Buffer.kt index cf763d4fad4..f54fd85b51d 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Buffer.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Buffer.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + @file:Suppress("NOTHING_TO_INLINE") package io.ktor.utils.io.core diff --git a/ktor-io/common/src/io/ktor/utils/io/core/BufferAppend.kt b/ktor-io/common/src/io/ktor/utils/io/core/BufferAppend.kt index 5c1bd6cc928..fa24dbdb8cb 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/BufferAppend.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/BufferAppend.kt @@ -1,6 +1,10 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core -import io.ktor.utils.io.IO_DEPRECATION_MESSAGE +import io.ktor.utils.io.* import kotlinx.io.Buffer import kotlin.math.* diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Buffers.kt b/ktor-io/common/src/io/ktor/utils/io/core/Buffers.kt index 76d701844b6..0d13f2af7db 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Buffers.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Buffers.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core import kotlinx.io.* diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Builder.kt b/ktor-io/common/src/io/ktor/utils/io/core/Builder.kt index 8deedc71ba8..88b25573e99 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Builder.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Builder.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core import kotlinx.io.* diff --git a/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt b/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt index 80a7b5cabfc..f569ae262fd 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core public expect enum class ByteOrder { diff --git a/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt b/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt index 1570a3e31aa..b7210eb90e8 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + @file:Suppress("RedundantModalityModifier") package io.ktor.utils.io.core diff --git a/ktor-io/common/src/io/ktor/utils/io/core/ByteReadPacket.kt b/ktor-io/common/src/io/ktor/utils/io/core/ByteReadPacket.kt index db384f0cdb6..4fc4b885125 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/ByteReadPacket.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/ByteReadPacket.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + @file:Suppress("RedundantModalityModifier", "FunctionName") package io.ktor.utils.io.core diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Copy.kt b/ktor-io/common/src/io/ktor/utils/io/core/Copy.kt index fae935d2fcc..efb8933f388 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Copy.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Copy.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core import kotlinx.io.* diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Output.kt b/ktor-io/common/src/io/ktor/utils/io/core/Output.kt index f7ee4b1b100..2d848a4e843 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Output.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Output.kt @@ -1,6 +1,10 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core -import io.ktor.utils.io.IO_DEPRECATION_MESSAGE +import io.ktor.utils.io.* /** * This shouldn't be implemented directly. Inherit [Output] instead. diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Packet.kt b/ktor-io/common/src/io/ktor/utils/io/core/Packet.kt index c408f6fb287..df9543fed96 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Packet.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Packet.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + @file:Suppress("RedundantModalityModifier") package io.ktor.utils.io.core diff --git a/ktor-io/common/src/io/ktor/utils/io/core/Strings.kt b/ktor-io/common/src/io/ktor/utils/io/core/Strings.kt index f5ecf206c4b..9a1d694f7b9 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/Strings.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/Strings.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core import io.ktor.utils.io.charsets.* diff --git a/ktor-io/common/src/io/ktor/utils/io/core/internal/ChunkBuffer.kt b/ktor-io/common/src/io/ktor/utils/io/core/internal/ChunkBuffer.kt index 5106477abb9..2644e669fe8 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/internal/ChunkBuffer.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/internal/ChunkBuffer.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core.internal import io.ktor.utils.io.* diff --git a/ktor-io/common/src/io/ktor/utils/io/core/internal/Numbers.kt b/ktor-io/common/src/io/ktor/utils/io/core/internal/Numbers.kt index 1bbf3b9ff47..c92e26df217 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/internal/Numbers.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/internal/Numbers.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core.internal @PublishedApi diff --git a/ktor-io/common/src/io/ktor/utils/io/pool/Pool.kt b/ktor-io/common/src/io/ktor/utils/io/pool/Pool.kt index 75cd1a9640b..d5e79924433 100644 --- a/ktor-io/common/src/io/ktor/utils/io/pool/Pool.kt +++ b/ktor-io/common/src/io/ktor/utils/io/pool/Pool.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.pool import kotlinx.atomicfu.* diff --git a/ktor-io/common/test/ByteChannelTest.kt b/ktor-io/common/test/ByteChannelTest.kt index 6965217b650..a5d9948eb4d 100644 --- a/ktor-io/common/test/ByteChannelTest.kt +++ b/ktor-io/common/test/ByteChannelTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import io.ktor.utils.io.core.* @@ -5,10 +9,6 @@ import kotlinx.coroutines.* import kotlinx.io.* import kotlin.test.* -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class ByteChannelTest { @Test diff --git a/ktor-io/common/test/ByteReadChannelOperationsTest.kt b/ktor-io/common/test/ByteReadChannelOperationsTest.kt index 775c286fa54..45d8370df89 100644 --- a/ktor-io/common/test/ByteReadChannelOperationsTest.kt +++ b/ktor-io/common/test/ByteReadChannelOperationsTest.kt @@ -1,18 +1,17 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import io.ktor.utils.io.core.* import kotlinx.coroutines.* import kotlinx.coroutines.test.runTest import kotlinx.io.* -import kotlinx.io.IOException import kotlinx.io.bytestring.* import kotlin.test.* import kotlin.time.Duration.Companion.seconds -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class ByteReadChannelOperationsTest { @Test diff --git a/ktor-io/common/test/CoroutinesTest.kt b/ktor-io/common/test/CoroutinesTest.kt index 337559f707d..f4a1a23873d 100644 --- a/ktor-io/common/test/CoroutinesTest.kt +++ b/ktor-io/common/test/CoroutinesTest.kt @@ -1,12 +1,12 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import kotlinx.coroutines.* import kotlin.test.* -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class CoroutinesTest { @OptIn(DelicateCoroutinesApi::class) diff --git a/ktor-io/common/test/ReadUtf8LineTest.kt b/ktor-io/common/test/ReadUtf8LineTest.kt index 83ee8b96a07..049fc4a1d3b 100644 --- a/ktor-io/common/test/ReadUtf8LineTest.kt +++ b/ktor-io/common/test/ReadUtf8LineTest.kt @@ -1,13 +1,13 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import io.ktor.utils.io.charsets.* import kotlinx.coroutines.* import kotlin.test.* -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class ReadUtf8LineTest { @Test diff --git a/ktor-io/common/test/WriterReaderTest.kt b/ktor-io/common/test/WriterReaderTest.kt index 295b1c308f3..e97ab995af9 100644 --- a/ktor-io/common/test/WriterReaderTest.kt +++ b/ktor-io/common/test/WriterReaderTest.kt @@ -1,13 +1,13 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.test.dispatcher.* import io.ktor.utils.io.* import io.ktor.utils.io.CancellationException import kotlinx.coroutines.* import kotlin.test.* -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class WriterReaderTest { @OptIn(DelicateCoroutinesApi::class) diff --git a/ktor-io/js/src/io/ktor/utils/io/charsets/TextEncoder.js.kt b/ktor-io/js/src/io/ktor/utils/io/charsets/TextEncoder.js.kt index 5a265e1bf49..74d5625e18f 100644 --- a/ktor-io/js/src/io/ktor/utils/io/charsets/TextEncoder.js.kt +++ b/ktor-io/js/src/io/ktor/utils/io/charsets/TextEncoder.js.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.charsets import org.khronos.webgl.* diff --git a/ktor-io/jsAndWasmShared/src/io/ktor/utils/io/charsets/ISO88591.kt b/ktor-io/jsAndWasmShared/src/io/ktor/utils/io/charsets/ISO88591.kt index c755fe65309..e0555d34a51 100644 --- a/ktor-io/jsAndWasmShared/src/io/ktor/utils/io/charsets/ISO88591.kt +++ b/ktor-io/jsAndWasmShared/src/io/ktor/utils/io/charsets/ISO88591.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.charsets import kotlinx.io.* diff --git a/ktor-io/jvm/src/io/ktor/utils/io/core/BufferPrimitivesJvm.kt b/ktor-io/jvm/src/io/ktor/utils/io/core/BufferPrimitivesJvm.kt index 1ce739f2186..57efee9506c 100644 --- a/ktor-io/jvm/src/io/ktor/utils/io/core/BufferPrimitivesJvm.kt +++ b/ktor-io/jvm/src/io/ktor/utils/io/core/BufferPrimitivesJvm.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.core import kotlinx.io.* diff --git a/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Reading.kt b/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Reading.kt index 4640d1d91af..4c890f0d34d 100644 --- a/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Reading.kt +++ b/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Reading.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.jvm.javaio import io.ktor.utils.io.* @@ -10,7 +14,6 @@ import kotlinx.io.EOFException import kotlinx.io.IOException import java.io.* import java.nio.* -import java.nio.channels.* import kotlin.coroutines.* /** diff --git a/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Writing.kt b/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Writing.kt index 3a356b81c4f..be84138613e 100644 --- a/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Writing.kt +++ b/ktor-io/jvm/src/io/ktor/utils/io/jvm/javaio/Writing.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.utils.io.jvm.javaio import io.ktor.utils.io.* diff --git a/ktor-io/jvm/test/ByteChannelConcurrentTest.kt b/ktor-io/jvm/test/ByteChannelConcurrentTest.kt index ca8bfd502ac..609c0bbe12b 100644 --- a/ktor-io/jvm/test/ByteChannelConcurrentTest.kt +++ b/ktor-io/jvm/test/ByteChannelConcurrentTest.kt @@ -7,10 +7,6 @@ import kotlinx.coroutines.* import kotlinx.coroutines.test.* import kotlin.test.* -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class ByteChannelConcurrentTest { @OptIn(DelicateCoroutinesApi::class) diff --git a/ktor-io/jvm/test/ByteReadChannelOperationsJvmTest.kt b/ktor-io/jvm/test/ByteReadChannelOperationsJvmTest.kt index c9ccd46a195..7b6514c37c3 100644 --- a/ktor-io/jvm/test/ByteReadChannelOperationsJvmTest.kt +++ b/ktor-io/jvm/test/ByteReadChannelOperationsJvmTest.kt @@ -1,11 +1,11 @@ -import io.ktor.utils.io.* -import kotlinx.coroutines.* -import kotlin.test.* - /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +import io.ktor.utils.io.* +import kotlinx.coroutines.* +import kotlin.test.* + class ByteReadChannelOperationsJvmTest { @Test diff --git a/ktor-io/jvm/test/ByteReadChannelReadTest.jvm.kt b/ktor-io/jvm/test/ByteReadChannelReadTest.jvm.kt index 047a9de82dc..3728e1b3f47 100644 --- a/ktor-io/jvm/test/ByteReadChannelReadTest.jvm.kt +++ b/ktor-io/jvm/test/ByteReadChannelReadTest.jvm.kt @@ -1,13 +1,12 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.utils.io.* -import kotlinx.coroutines.* import kotlinx.coroutines.test.* import java.nio.* import kotlin.test.* -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class ByteReadChannelReadTest { @Test diff --git a/ktor-io/jvm/test/ByteReadPacketExtensionsJvmTest.kt b/ktor-io/jvm/test/ByteReadPacketExtensionsJvmTest.kt index f9f764261ef..b5bb11b5ab9 100644 --- a/ktor-io/jvm/test/ByteReadPacketExtensionsJvmTest.kt +++ b/ktor-io/jvm/test/ByteReadPacketExtensionsJvmTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.utils.io.core.* import kotlinx.coroutines.test.* import kotlinx.io.* @@ -7,10 +11,6 @@ import kotlin.random.* import kotlin.test.* import kotlin.text.String -/* - * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class ByteReadPacketExtensionsJvmTest { @Test diff --git a/ktor-io/jvm/test/LookAheadSessionTest.kt b/ktor-io/jvm/test/LookAheadSessionTest.kt index 7209bac1dae..27a95166b4c 100644 --- a/ktor-io/jvm/test/LookAheadSessionTest.kt +++ b/ktor-io/jvm/test/LookAheadSessionTest.kt @@ -1,11 +1,11 @@ -import io.ktor.utils.io.* -import kotlinx.coroutines.* -import kotlin.test.* - /* * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +import io.ktor.utils.io.* +import kotlinx.coroutines.* +import kotlin.test.* + class LookAheadSessionTest { @Test diff --git a/ktor-network/jvmAndPosix/src/io/ktor/network/selector/Selectable.kt b/ktor-network/jvmAndPosix/src/io/ktor/network/selector/Selectable.kt index c3a9024ee26..5d035b5c8ae 100644 --- a/ktor-network/jvmAndPosix/src/io/ktor/network/selector/Selectable.kt +++ b/ktor-network/jvmAndPosix/src/io/ktor/network/selector/Selectable.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.selector import kotlinx.coroutines.* diff --git a/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt b/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt index 72790f980ae..beb54cbb3ac 100644 --- a/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt +++ b/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.selector import io.ktor.utils.io.core.* diff --git a/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/HostnameUtilsTest.kt b/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/HostnameUtilsTest.kt index dfb6fc2e87d..d668fa0593d 100644 --- a/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/HostnameUtilsTest.kt +++ b/ktor-network/ktor-network-tls/jvm/test/io/ktor/network/tls/HostnameUtilsTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.tls import io.mockk.* diff --git a/ktor-network/posix/src/io/ktor/network/sockets/SocketAddressNative.kt b/ktor-network/posix/src/io/ktor/network/sockets/SocketAddressNative.kt index 9fef0d9e069..366d00b31e7 100644 --- a/ktor-network/posix/src/io/ktor/network/sockets/SocketAddressNative.kt +++ b/ktor-network/posix/src/io/ktor/network/sockets/SocketAddressNative.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.network.sockets public actual sealed class SocketAddress diff --git a/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/test/DoubleReceiveTestJvm.kt b/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/test/DoubleReceiveTestJvm.kt index c8e574236de..865278ad703 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/test/DoubleReceiveTestJvm.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-double-receive/jvm/test/DoubleReceiveTestJvm.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.server.plugins.doublereceive.* import io.ktor.utils.io.* import kotlinx.coroutines.* @@ -5,10 +9,6 @@ import kotlinx.io.* import kotlin.coroutines.* import kotlin.test.* -/* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class DoubleReceiveTestJvm { @Test diff --git a/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/Webjars.kt b/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/Webjars.kt index a275e9f4220..15ba18eec1b 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/Webjars.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/Webjars.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.server.webjars import io.ktor.http.* diff --git a/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/WebjarsUtils.kt b/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/WebjarsUtils.kt index c1a327d0d60..39559fa657f 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/WebjarsUtils.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-webjars/jvm/src/io/ktor/server/webjars/WebjarsUtils.kt @@ -1,9 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -/* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.webjars diff --git a/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonContentNegotiationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonContentNegotiationTest.kt index e13e6f3f5bf..cacdf44f00c 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonContentNegotiationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonContentNegotiationTest.kt @@ -1,11 +1,11 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.plugins.contentnegotiation.tests.* import io.ktor.serialization.gson.* import kotlin.test.* -/* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class GsonContentNegotiationTest : JsonContentNegotiationTest(GsonConverter()) { @Ignore override fun testJsonWithNullValue() {} diff --git a/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonWebsocketTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonWebsocketTest.kt index 2c5d693215a..b03d171e6f5 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonWebsocketTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-gson/jvm/test/GsonWebsocketTest.kt @@ -1,8 +1,8 @@ -import io.ktor.client.plugins.contentnegotiation.tests.* -import io.ktor.serialization.gson.* - /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +import io.ktor.client.plugins.contentnegotiation.tests.* +import io.ktor.serialization.gson.* + class GsonWebsocketTest : JsonWebsocketsTest(GsonWebsocketContentConverter()) diff --git a/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonContentNegotiationTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonContentNegotiationTest.kt index c2abb4b289e..900fca8d5a3 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonContentNegotiationTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonContentNegotiationTest.kt @@ -1,11 +1,11 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + import io.ktor.client.plugins.contentnegotiation.tests.* import io.ktor.http.* import io.ktor.serialization.jackson.* -/* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - class JacksonContentNegotiationTest : JsonContentNegotiationTest(JacksonConverter()) { override val extraFieldResult = HttpStatusCode.BadRequest } diff --git a/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonWebsocketTest.kt b/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonWebsocketTest.kt index f8b8a376d29..1670d080ca4 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonWebsocketTest.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-jackson/jvm/test/JacksonWebsocketTest.kt @@ -1,8 +1,8 @@ -import io.ktor.client.plugins.contentnegotiation.tests.* -import io.ktor.serialization.jackson.* - /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +import io.ktor.client.plugins.contentnegotiation.tests.* +import io.ktor.serialization.jackson.* + class JacksonWebsocketTest : JsonWebsocketsTest(JacksonWebsocketContentConverter()) diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-protobuf/common/src/io/ktor/serialization/kotlinx/protobuf/ProtoBufSupport.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-protobuf/common/src/io/ktor/serialization/kotlinx/protobuf/ProtoBufSupport.kt index d7a4dabedbb..fc4ec323d6f 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-protobuf/common/src/io/ktor/serialization/kotlinx/protobuf/ProtoBufSupport.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/ktor-serialization-kotlinx-protobuf/common/src/io/ktor/serialization/kotlinx/protobuf/ProtoBufSupport.kt @@ -1,3 +1,7 @@ +/* + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + package io.ktor.serialization.kotlinx.protobuf import io.ktor.http.* diff --git a/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt b/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt index f0c27354d71..311e211b4e2 100644 --- a/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt +++ b/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt @@ -1,19 +1,16 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.internal +import kotlinx.atomicfu.* +import kotlin.jvm.* + /* - * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - * * Copied from kotlinx.coroutines */ -import kotlinx.atomicfu.* -import kotlin.jvm.* -import kotlin.native.concurrent.* - private typealias Node = LockFreeLinkedListNode @PublishedApi From 6996484001b681543498a72e6b751c4e0971f750 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 10:59:51 +0100 Subject: [PATCH 04/11] Fix enum-wrapping --- .../src/io/ktor/client/plugins/cache/HttpCacheEntry.kt | 8 +++++--- .../ktor-client-encoding/common/src/ContentEncoding.kt | 8 +++++--- ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt | 3 ++- ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt | 3 ++- .../posix/src/io/ktor/utils/io/core/ByteOrderNative.kt | 3 ++- .../wasmJs/src/io/ktor/utils/io/core/ByteOrder.wasmJs.kt | 3 ++- .../io/ktor/network/selector/SelectorManagerCommon.kt | 5 ++++- .../src/io/ktor/network/tls/certificates/Certificates.kt | 8 ++++---- .../src/io/ktor/network/selector/SelectorManager.kt | 9 ++++++--- .../common/src/io/ktor/server/auth/OAuthCommon.kt | 5 +++-- .../jvm/src/io/ktor/server/plugins/compression/Config.kt | 6 ++++-- .../common/src/io/ktor/server/plugins/cors/CORS.kt | 6 ++++-- .../common/test/io/ktor/tests/resources/ResourcesTest.kt | 6 ++++-- .../common/src/io/ktor/server/testing/TestApplication.kt | 5 ++++- 14 files changed, 51 insertions(+), 27 deletions(-) diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/cache/HttpCacheEntry.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/cache/HttpCacheEntry.kt index 44e5ff38ddd..5122db87ca6 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/cache/HttpCacheEntry.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/cache/HttpCacheEntry.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.plugins.cache @@ -137,5 +137,7 @@ internal fun shouldValidate( } internal enum class ValidateStatus { - ShouldValidate, ShouldNotValidate, ShouldWarn + ShouldValidate, + ShouldNotValidate, + ShouldWarn, } diff --git a/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt b/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt index 1b26092c504..5a308e15f7f 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.plugins.compression @@ -26,7 +26,9 @@ private val LOGGER = KtorSimpleLogger("io.ktor.client.plugins.compression.Conten public class ContentEncodingConfig { public enum class Mode(internal val request: Boolean, internal val response: Boolean) { - CompressRequest(true, false), DecompressResponse(false, true), All(true, true) + CompressRequest(true, false), + DecompressResponse(false, true), + All(true, true), } internal val encoders: MutableMap = CaseInsensitiveMap() diff --git a/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt b/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt index f569ae262fd..4d5f749681d 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/ByteOrder.kt @@ -5,7 +5,8 @@ package io.ktor.utils.io.core public expect enum class ByteOrder { - BIG_ENDIAN, LITTLE_ENDIAN; + BIG_ENDIAN, + LITTLE_ENDIAN; public companion object { public fun nativeOrder(): ByteOrder diff --git a/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt b/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt index 091922de291..016ba35a60f 100644 --- a/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt +++ b/ktor-io/js/src/io/ktor/utils/io/core/ByteOrderJS.kt @@ -7,7 +7,8 @@ package io.ktor.utils.io.core import org.khronos.webgl.* public actual enum class ByteOrder { - BIG_ENDIAN, LITTLE_ENDIAN; + BIG_ENDIAN, + LITTLE_ENDIAN; public actual companion object { private val native: ByteOrder diff --git a/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt b/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt index 8b7447dcc15..56a23ed58a5 100644 --- a/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt +++ b/ktor-io/posix/src/io/ktor/utils/io/core/ByteOrderNative.kt @@ -7,7 +7,8 @@ package io.ktor.utils.io.core import kotlin.experimental.* public actual enum class ByteOrder { - BIG_ENDIAN, LITTLE_ENDIAN; + BIG_ENDIAN, + LITTLE_ENDIAN; public actual companion object { @OptIn(ExperimentalNativeApi::class) diff --git a/ktor-io/wasmJs/src/io/ktor/utils/io/core/ByteOrder.wasmJs.kt b/ktor-io/wasmJs/src/io/ktor/utils/io/core/ByteOrder.wasmJs.kt index 091922de291..016ba35a60f 100644 --- a/ktor-io/wasmJs/src/io/ktor/utils/io/core/ByteOrder.wasmJs.kt +++ b/ktor-io/wasmJs/src/io/ktor/utils/io/core/ByteOrder.wasmJs.kt @@ -7,7 +7,8 @@ package io.ktor.utils.io.core import org.khronos.webgl.* public actual enum class ByteOrder { - BIG_ENDIAN, LITTLE_ENDIAN; + BIG_ENDIAN, + LITTLE_ENDIAN; public actual companion object { private val native: ByteOrder diff --git a/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt b/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt index beb54cbb3ac..fd4984bda25 100644 --- a/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt +++ b/ktor-network/jvmAndPosix/src/io/ktor/network/selector/SelectorManagerCommon.kt @@ -43,7 +43,10 @@ public expect interface SelectorManager : CoroutineScope, Closeable { * Select interest kind. */ public expect enum class SelectInterest { - READ, WRITE, ACCEPT, CONNECT; + READ, + WRITE, + ACCEPT, + CONNECT; public companion object { public val AllInterests: Array diff --git a/ktor-network/ktor-network-tls/ktor-network-tls-certificates/jvm/src/io/ktor/network/tls/certificates/Certificates.kt b/ktor-network/ktor-network-tls/ktor-network-tls-certificates/jvm/src/io/ktor/network/tls/certificates/Certificates.kt index 08d306311be..5dbca80f59a 100644 --- a/ktor-network/ktor-network-tls/ktor-network-tls-certificates/jvm/src/io/ktor/network/tls/certificates/Certificates.kt +++ b/ktor-network/ktor-network-tls/ktor-network-tls-certificates/jvm/src/io/ktor/network/tls/certificates/Certificates.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.network.tls.certificates @@ -8,8 +8,6 @@ import io.ktor.network.tls.* import io.ktor.network.tls.extensions.* import io.ktor.utils.io.core.* import kotlinx.io.* -import kotlinx.io.Sink -import kotlinx.io.writeUByte import java.io.* import java.math.* import java.net.* @@ -115,7 +113,9 @@ internal fun generateX509Certificate( } public enum class KeyType { - CA, Server, Client + CA, + Server, + Client, } /** diff --git a/ktor-network/posix/src/io/ktor/network/selector/SelectorManager.kt b/ktor-network/posix/src/io/ktor/network/selector/SelectorManager.kt index 55746637530..55b1ed24050 100644 --- a/ktor-network/posix/src/io/ktor/network/selector/SelectorManager.kt +++ b/ktor-network/posix/src/io/ktor/network/selector/SelectorManager.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.network.selector @@ -40,7 +40,10 @@ public actual interface SelectorManager : CoroutineScope, Closeable { */ @Suppress("KDocMissingDocumentation", "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING") public actual enum class SelectInterest { - READ, WRITE, ACCEPT, CONNECT; + READ, + WRITE, + ACCEPT, + CONNECT; public actual companion object { public actual val AllInterests: Array diff --git a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/OAuthCommon.kt b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/OAuthCommon.kt index 017b8de3488..4a5e22c5b4c 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/OAuthCommon.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/OAuthCommon.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.auth @@ -14,7 +14,8 @@ import io.ktor.util.* */ public enum class OAuthVersion { - V10a, V20 + V10a, + V20, } /** diff --git a/ktor-server/ktor-server-plugins/ktor-server-compression/jvm/src/io/ktor/server/plugins/compression/Config.kt b/ktor-server/ktor-server-plugins/ktor-server-compression/jvm/src/io/ktor/server/plugins/compression/Config.kt index 6bc4326a4c0..9a52c269aa6 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-compression/jvm/src/io/ktor/server/plugins/compression/Config.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-compression/jvm/src/io/ktor/server/plugins/compression/Config.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.compression @@ -49,7 +49,9 @@ public data class CompressionEncoderConfig( public class CompressionConfig : ConditionsHolderBuilder { public enum class Mode(internal val request: Boolean, internal val response: Boolean) { - CompressResponse(false, true), DecompressRequest(true, false), All(true, true) + CompressResponse(false, true), + DecompressRequest(true, false), + All(true, true), } /** diff --git a/ktor-server/ktor-server-plugins/ktor-server-cors/common/src/io/ktor/server/plugins/cors/CORS.kt b/ktor-server/ktor-server-plugins/ktor-server-cors/common/src/io/ktor/server/plugins/cors/CORS.kt index 9eecb1d38cc..dc6765585d0 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-cors/common/src/io/ktor/server/plugins/cors/CORS.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-cors/common/src/io/ktor/server/plugins/cors/CORS.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.cors @@ -155,7 +155,9 @@ internal fun PluginBuilder.buildPlugin() { } private enum class OriginCheckResult { - OK, SkipCORS, Failed + OK, + SkipCORS, + Failed, } private fun checkOrigin( diff --git a/ktor-server/ktor-server-plugins/ktor-server-resources/common/test/io/ktor/tests/resources/ResourcesTest.kt b/ktor-server/ktor-server-plugins/ktor-server-resources/common/test/io/ktor/tests/resources/ResourcesTest.kt index e54e1e4cc30..0ed0acd64a4 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-resources/common/test/io/ktor/tests/resources/ResourcesTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-resources/common/test/io/ktor/tests/resources/ResourcesTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.resources @@ -413,7 +413,9 @@ class ResourcesTest { } enum class resourceEnum { - A, B, C + A, + B, + C, } @Resource("/") diff --git a/ktor-server/ktor-server-test-host/common/src/io/ktor/server/testing/TestApplication.kt b/ktor-server/ktor-server-test-host/common/src/io/ktor/server/testing/TestApplication.kt index bd89b10a1c2..967682d4682 100644 --- a/ktor-server/ktor-server-test-host/common/src/io/ktor/server/testing/TestApplication.kt +++ b/ktor-server/ktor-server-test-host/common/src/io/ktor/server/testing/TestApplication.kt @@ -58,7 +58,10 @@ public class TestApplication internal constructor( ) : ClientProvider by builder { internal enum class State { - Created, Starting, Started, Stopped + Created, + Starting, + Started, + Stopped, } private val state = atomic(State.Created) From dbbcf2a0ebaa03f37790935aa9269b22dd4069a4 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 11:00:28 +0100 Subject: [PATCH 05/11] Fix comments --- .../client/engine/cio/ConnectionPipeline.kt | 4 +- .../js/src/io/ktor/client/fetch/LibDom.kt | 40 +++++++++---------- .../js/src/io/ktor/client/fetch/LibEs5.kt | 8 ++-- .../wasmJs/src/io/ktor/client/fetch/LibDom.kt | 40 +++++++++---------- .../wasmJs/src/io/ktor/client/fetch/LibEs5.kt | 8 ++-- .../engine/curl/internal/CurlAdapters.kt | 5 +-- .../AbstractClientContentNegotiationTest.kt | 3 +- .../io/ktor/client/tests/HttpTimeoutTest.kt | 3 +- .../ktor/client/tests/LoggingMockedTests.kt | 9 +++-- .../client/tests/utils/ClientLoaderJvm.kt | 2 +- .../common/src/io/ktor/http/URLBuilder.kt | 19 ++++++--- .../test/io/ktor/tests/http/CodecTest.kt | 4 +- .../ktor/network/sockets/SocketAddressJvm.kt | 5 ++- .../tls/extensions/SignatureAlgorithm.kt | 8 +--- .../io/ktor/server/sessions/SessionData.kt | 4 +- .../testing/suites/SustainabilityTestSuite.kt | 9 +++-- .../server/routing/RoutingResolveTest.kt | 6 +-- .../common/src/io/ktor/util/date/Date.kt | 5 +-- .../ktor/util/internal/LockFreeLinkedList.kt | 15 +++++-- ktor-utils/js/src/io/ktor/util/date/DateJs.kt | 4 +- .../wasmJs/src/io/ktor/util/date/DateWasm.kt | 6 +-- 21 files changed, 106 insertions(+), 101 deletions(-) diff --git a/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt b/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt index 678fc8ec3b7..d5dd71348d5 100644 --- a/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt +++ b/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt @@ -61,9 +61,7 @@ internal actual class ConnectionPipeline actual constructor( } catch (_: CancellationException) { } finally { responseChannel.close() - /** - * Workaround bug with socket.close - */ + // Workaround bug with socket.close // outputChannel.close() } } diff --git a/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibDom.kt b/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibDom.kt index da5f34d3bfa..6de06849fc5 100644 --- a/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibDom.kt +++ b/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibDom.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.fetch @@ -11,17 +11,17 @@ import kotlin.js.Promise public external fun fetch(input: String, init: RequestInit? = definedExternally): Promise public external interface Request : Body { - /* "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" */ + // "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" public var cache: dynamic get() = definedExternally set(value) = definedExternally - /* "omit" | "same-origin" | "include" */ + // "omit" | "same-origin" | "include" public var credentials: dynamic get() = definedExternally set(value) = definedExternally - /* "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt" */ + // "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt" public var destination: dynamic get() = definedExternally set(value) = definedExternally @@ -32,18 +32,18 @@ public external interface Request : Body { public var keepalive: Boolean public var method: String - /* "navigate" | "same-origin" | "no-cors" | "cors" */ + // "navigate" | "same-origin" | "no-cors" | "cors" public var mode: dynamic get() = definedExternally set(value) = definedExternally - /* "follow" | "error" | "manual" */ + // "follow" | "error" | "manual" public var redirect: dynamic get() = definedExternally set(value) = definedExternally public var referrer: String - /* "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" */ + // "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" public var referrerPolicy: dynamic get() = definedExternally set(value) = definedExternally @@ -63,7 +63,7 @@ public external interface Response : Body { public var statusText: String public var trailer: Promise - /* "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect" */ + // "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect" public var type: dynamic get() = definedExternally set(value) = definedExternally @@ -89,14 +89,14 @@ public external interface FormData { public fun append(name: String, value: Blob, fileName: String? = definedExternally) public fun delete(name: String) - /* File | String */ - public fun get(name: String): dynamic - public fun getAll(name: String): Array + public fun get(name: String): dynamic // File | String + public fun getAll(name: String): Array // File | String public fun has(name: String): Boolean public fun set(name: String, value: String, fileName: String? = definedExternally) public fun set(name: String, value: Blob, fileName: String? = definedExternally) public fun forEach( - callbackfn: (value: dynamic /* File | String */, key: String, parent: FormData) -> Unit, + // value: File | String + callbackfn: (value: dynamic, key: String, parent: FormData) -> Unit, thisArg: Any? = definedExternally ) } @@ -121,7 +121,7 @@ public external interface ReadableStream { public fun pipeTo(dest: WritableStream, options: PipeOptions? = definedExternally): Promise - /* JsTuple, ReadableStream> */ + // JsTuple, ReadableStream> public fun tee(): dynamic } @@ -190,22 +190,22 @@ public external interface Headers { } public external interface RequestInit { - /* Blob | ArrayBufferView | ArrayBuffer | FormData | URLSearchParams | ReadableStream | String */ + // Blob | ArrayBufferView | ArrayBuffer | FormData | URLSearchParams | ReadableStream | String public var body: dynamic get() = definedExternally set(value) = definedExternally - /* "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" */ + // "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" public var cache: dynamic get() = definedExternally set(value) = definedExternally - /* "omit" | "same-origin" | "include" */ + // "omit" | "same-origin" | "include" public var credentials: dynamic get() = definedExternally set(value) = definedExternally - /* Headers | Array> | Record */ + // Headers | Array> | Record public var headers: dynamic get() = definedExternally set(value) = definedExternally @@ -222,12 +222,12 @@ public external interface RequestInit { get() = definedExternally set(value) = definedExternally - /* "navigate" | "same-origin" | "no-cors" | "cors" */ + // "navigate" | "same-origin" | "no-cors" | "cors" public var mode: dynamic get() = definedExternally set(value) = definedExternally - /* "follow" | "error" | "manual" */ + // "follow" | "error" | "manual" public var redirect: dynamic get() = definedExternally set(value) = definedExternally @@ -235,7 +235,7 @@ public external interface RequestInit { get() = definedExternally set(value) = definedExternally - /* "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" */ + // "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" public var referrerPolicy: dynamic get() = definedExternally set(value) = definedExternally diff --git a/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibEs5.kt b/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibEs5.kt index bb2d31bd329..625917e7d63 100644 --- a/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibEs5.kt +++ b/ktor-client/ktor-client-core/js/src/io/ktor/client/fetch/LibEs5.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.fetch @@ -30,7 +30,7 @@ public external interface Uint8Array { public var byteLength: Number public var byteOffset: Number - public fun copyWithin(target: Number, start: Number, end: Number? = definedExternally): Uint8Array /* this */ + public fun copyWithin(target: Number, start: Number, end: Number? = definedExternally): Uint8Array // this public fun every( callbackfn: (value: Number, index: Number, array: Uint8Array) -> Any, thisArg: Any? = definedExternally @@ -40,7 +40,7 @@ public external interface Uint8Array { value: Number, start: Number? = definedExternally, end: Number? = definedExternally - ): Uint8Array /* this */ + ): Uint8Array // this public fun filter( callbackfn: (value: Number, index: Number, array: Uint8Array) -> Any, @@ -101,7 +101,7 @@ public external interface Uint8Array { thisArg: Any? = definedExternally ): Boolean - public fun sort(compareFn: ((a: Number, b: Number) -> Number)? = definedExternally): Uint8Array /* this */ + public fun sort(compareFn: ((a: Number, b: Number) -> Number)? = definedExternally): Uint8Array // this public fun subarray(begin: Number? = definedExternally, end: Number? = definedExternally): Uint8Array public fun toLocaleString(): String override fun toString(): String diff --git a/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibDom.kt b/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibDom.kt index f54fdf00e3d..1f88e909ade 100644 --- a/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibDom.kt +++ b/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibDom.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.fetch @@ -12,17 +12,17 @@ import kotlin.js.Promise public external fun fetch(input: String, init: RequestInit? = definedExternally): Promise public external interface Request : Body { - /* "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" */ + // "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" public var cache: JsAny? get() = definedExternally set(value) = definedExternally - /* "omit" | "same-origin" | "include" */ + // "omit" | "same-origin" | "include" public var credentials: JsAny? get() = definedExternally set(value) = definedExternally - /* "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt" */ + // "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt" public var destination: JsAny? get() = definedExternally set(value) = definedExternally @@ -33,18 +33,18 @@ public external interface Request : Body { public var keepalive: Boolean public var method: String - /* "navigate" | "same-origin" | "no-cors" | "cors" */ + // "navigate" | "same-origin" | "no-cors" | "cors" public var mode: JsAny? get() = definedExternally set(value) = definedExternally - /* "follow" | "error" | "manual" */ + // "follow" | "error" | "manual" public var redirect: JsAny? get() = definedExternally set(value) = definedExternally public var referrer: String - /* "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" */ + // "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" public var referrerPolicy: JsAny? get() = definedExternally set(value) = definedExternally @@ -64,7 +64,7 @@ public external interface Response : Body { public var statusText: String public var trailer: Promise - /* "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect" */ + // "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect" public var type: JsAny? get() = definedExternally set(value) = definedExternally @@ -90,14 +90,14 @@ public external interface FormData : JsAny { public fun append(name: String, value: Blob, fileName: String? = definedExternally) public fun delete(name: String) - /* File | String */ - public fun get(name: String): JsAny? - public fun getAll(name: String): ArrayLike /* File | String */ + public fun get(name: String): JsAny? // File | String + public fun getAll(name: String): ArrayLike // File | String public fun has(name: String): Boolean public fun set(name: String, value: String, fileName: String? = definedExternally) public fun set(name: String, value: Blob, fileName: String? = definedExternally) public fun forEach( - callbackfn: (value: JsAny? /* File | String */, key: String, parent: FormData) -> Unit, + // value: File | String + callbackfn: (value: JsAny?, key: String, parent: FormData) -> Unit, thisArg: JsAny? = definedExternally ) } @@ -122,7 +122,7 @@ public external interface ReadableStream : JsAny { public fun pipeTo(dest: WritableStream, options: PipeOptions? = definedExternally): Promise - /* JsTuple, ReadableStream> */ + // JsTuple, ReadableStream> public fun tee(): JsAny? } @@ -191,22 +191,22 @@ public external interface Headers : JsAny { } public external interface RequestInit : JsAny { - /* Blob | ArrayBufferView | ArrayBuffer | FormData | URLSearchParams | ReadableStream | String */ + // Blob | ArrayBufferView | ArrayBuffer | FormData | URLSearchParams | ReadableStream | String public var body: JsAny? get() = definedExternally set(value) = definedExternally - /* "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" */ + // "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached" public var cache: JsAny? get() = definedExternally set(value) = definedExternally - /* "omit" | "same-origin" | "include" */ + // "omit" | "same-origin" | "include" public var credentials: JsAny? get() = definedExternally set(value) = definedExternally - /* Headers | Array> | Record */ + // Headers | Array> | Record public var headers: JsAny? get() = definedExternally set(value) = definedExternally @@ -223,12 +223,12 @@ public external interface RequestInit : JsAny { get() = definedExternally set(value) = definedExternally - /* "navigate" | "same-origin" | "no-cors" | "cors" */ + // "navigate" | "same-origin" | "no-cors" | "cors" public var mode: JsAny? get() = definedExternally set(value) = definedExternally - /* "follow" | "error" | "manual" */ + // "follow" | "error" | "manual" public var redirect: JsAny? get() = definedExternally set(value) = definedExternally @@ -236,7 +236,7 @@ public external interface RequestInit : JsAny { get() = definedExternally set(value) = definedExternally - /* "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" */ + // "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" public var referrerPolicy: JsAny? get() = definedExternally set(value) = definedExternally diff --git a/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibEs5.kt b/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibEs5.kt index f54464daf2b..086cc79868b 100644 --- a/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibEs5.kt +++ b/ktor-client/ktor-client-core/wasmJs/src/io/ktor/client/fetch/LibEs5.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.fetch @@ -34,7 +34,7 @@ public external interface Uint8Array : JsAny { target: JsNumber, start: JsNumber, end: JsNumber? = definedExternally - ): Uint8Array /* this */ + ): Uint8Array // this public fun every( callbackfn: (value: JsNumber, index: JsNumber, array: Uint8Array) -> JsAny, @@ -45,7 +45,7 @@ public external interface Uint8Array : JsAny { value: JsNumber, start: JsNumber? = definedExternally, end: JsNumber? = definedExternally - ): Uint8Array /* this */ + ): Uint8Array // this public fun filter( callbackfn: (value: JsNumber, index: JsNumber, array: Uint8Array) -> JsAny, @@ -147,7 +147,7 @@ public external interface Uint8Array : JsAny { thisArg: JsAny? = definedExternally ): Boolean - public fun sort(compareFn: ((a: JsNumber, b: JsNumber) -> JsNumber)? = definedExternally): Uint8Array /* this */ + public fun sort(compareFn: ((a: JsNumber, b: JsNumber) -> JsNumber)? = definedExternally): Uint8Array // this public fun subarray(begin: JsNumber? = definedExternally, end: JsNumber? = definedExternally): Uint8Array diff --git a/ktor-client/ktor-client-curl/desktop/src/io/ktor/client/engine/curl/internal/CurlAdapters.kt b/ktor-client/ktor-client-curl/desktop/src/io/ktor/client/engine/curl/internal/CurlAdapters.kt index ca25667c919..6cfb7418c49 100644 --- a/ktor-client/ktor-client-curl/desktop/src/io/ktor/client/engine/curl/internal/CurlAdapters.kt +++ b/ktor-client/ktor-client-curl/desktop/src/io/ktor/client/engine/curl/internal/CurlAdapters.kt @@ -1,11 +1,10 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.curl.internal import io.ktor.client.engine.* -import io.ktor.client.engine.curl.* import io.ktor.client.request.* import io.ktor.http.* import io.ktor.utils.io.* @@ -82,6 +81,6 @@ internal fun UInt.fromCurl(): HttpProtocolVersion = when (this) { CURL_HTTP_VERSION_1_0 -> HttpProtocolVersion.HTTP_1_0 CURL_HTTP_VERSION_1_1 -> HttpProtocolVersion.HTTP_1_1 CURL_HTTP_VERSION_2_0 -> HttpProtocolVersion.HTTP_2_0 - /* old curl fallback */ + // old curl fallback else -> HttpProtocolVersion.HTTP_1_1 } diff --git a/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt b/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt index f63682855c7..06f031d0139 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-content-negotiation/ktor-client-content-negotiation-tests/jvm/src/io/ktor/client/plugins/contentnegotiation/tests/AbstractClientContentNegotiationTest.kt @@ -96,7 +96,8 @@ abstract class AbstractClientContentNegotiationTest : TestWithKtor() { Response.serializer(ListSerializer(User.serializer())) ) } - get("/users-x") { // route for testing custom content type, namely "application/x-${contentSubtype}" + // route for testing custom content type, namely "application/x-${contentSubtype}" + get("/users-x") { call.respond( """{"ok":true,"result":[{"name":"x","age":10},{"name":"y","age":45}]}""", customContentType, diff --git a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/HttpTimeoutTest.kt b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/HttpTimeoutTest.kt index 7b603940353..18c0af4b9c8 100644 --- a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/HttpTimeoutTest.kt +++ b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/HttpTimeoutTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests @@ -440,7 +440,6 @@ class HttpTimeoutTest : ClientLoader() { try { client.get("http://localhost:11").body() } catch (_: ConnectTimeoutException) { - /* Ignore. */ } } } diff --git a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/LoggingMockedTests.kt b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/LoggingMockedTests.kt index 28facc13bd3..399fad24101 100644 --- a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/LoggingMockedTests.kt +++ b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/LoggingMockedTests.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.tests @@ -18,6 +18,7 @@ import io.ktor.utils.io.core.* import kotlinx.coroutines.* import kotlinx.coroutines.flow.* import kotlin.test.* +import kotlin.time.Duration.Companion.seconds class LoggingMockedTests { @@ -299,7 +300,6 @@ class LoggingMockedTests { } } - @OptIn(InternalAPI::class) @Test fun testCanStream() = testWithEngine(MockEngine) { val channel = ByteChannel(autoFlush = true) @@ -332,7 +332,8 @@ class LoggingMockedTests { channel.writeStringUtf8("Hello world!\n") - withTimeout(5_000) { // the bug will cause this to timeout + // the bug will cause this to timeout + withTimeout(5.seconds) { content.collect { channel.close() } diff --git a/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/ClientLoaderJvm.kt b/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/ClientLoaderJvm.kt index 07ee187b3b0..b21b2e55cf2 100644 --- a/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/ClientLoaderJvm.kt +++ b/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/ClientLoaderJvm.kt @@ -83,8 +83,8 @@ actual abstract class ClientLoader actual constructor(val timeoutSeconds: Int) { * Issues to fix before unlock: * 1. Pinger & Ponger in ws * 2. Nonce generator + * Then @After should be added to the function */ - // @After @OptIn(ExperimentalCoroutinesApi::class) fun waitForAllCoroutines() { check(DebugProbes.isInstalled) { diff --git a/ktor-http/common/src/io/ktor/http/URLBuilder.kt b/ktor-http/common/src/io/ktor/http/URLBuilder.kt index 8e73ed58c11..721c4c2671c 100644 --- a/ktor-http/common/src/io/ktor/http/URLBuilder.kt +++ b/ktor-http/common/src/io/ktor/http/URLBuilder.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.http @@ -44,7 +44,9 @@ public class URLBuilder( public var protocolOrNull: URLProtocol? = protocol public var protocol: URLProtocol get() = protocolOrNull ?: URLProtocol.HTTP - set(value) { protocolOrNull = value } + set(value) { + protocolOrNull = value + } public var encodedUser: String? = user?.encodeURLParameter() @@ -88,14 +90,13 @@ public class URLBuilder( /** * Build a URL string */ - // note: 256 should fit 99.5% of all urls according to http://www.supermind.org/blog/740/average-length-of-a-url-part-2 public fun buildString(): String { applyOrigin() - return appendTo(StringBuilder(256)).toString() + return appendTo(StringBuilder(INITIAL_CAPACITY)).toString() } override fun toString(): String { - return appendTo(StringBuilder(256)).toString() + return appendTo(StringBuilder(INITIAL_CAPACITY)).toString() } /** @@ -127,6 +128,12 @@ public class URLBuilder( // Required to write external extension function public companion object { private val originUrl = Url(origin) + + /** + * Initial capacity of StringBuilder. + * Note: 256 should fit 99.5% of all urls according to http://www.supermind.org/blog/740/average-length-of-a-url-part-2 + */ + private const val INITIAL_CAPACITY = 256 } } diff --git a/ktor-http/common/test/io/ktor/tests/http/CodecTest.kt b/ktor-http/common/test/io/ktor/tests/http/CodecTest.kt index 669b9c49ad1..59240ce4752 100644 --- a/ktor-http/common/test/io/ktor/tests/http/CodecTest.kt +++ b/ktor-http/common/test/io/ktor/tests/http/CodecTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.http @@ -14,7 +14,7 @@ class CodecTest { private val urlPath = "/wikipedia/commons/9/9c/University_of_Illinois_at_Urbana\u2013Champaign_logo.svg" private val surrogateSymbolUrlPath = "/path/🐕" - @Test /*(timeout = 1000L)*/ + @Test @Ignore fun testDecodeRandom() { val chars = "+%0123abc" diff --git a/ktor-network/jvm/src/io/ktor/network/sockets/SocketAddressJvm.kt b/ktor-network/jvm/src/io/ktor/network/sockets/SocketAddressJvm.kt index ae11b7bbf72..e7dd82ab464 100644 --- a/ktor-network/jvm/src/io/ktor/network/sockets/SocketAddressJvm.kt +++ b/ktor-network/jvm/src/io/ktor/network/sockets/SocketAddressJvm.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.network.sockets @@ -56,7 +56,8 @@ public actual class InetSocketAddress internal constructor( } public actual class UnixSocketAddress internal constructor( - override val address: java.net.SocketAddress // actually: java.net.UnixDomainSocketAddress + // actually: java.net.UnixDomainSocketAddress + override val address: java.net.SocketAddress ) : SocketAddress() { init { diff --git a/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt b/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt index d1a700860fe..e8c2d64d87e 100644 --- a/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt +++ b/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt @@ -8,16 +8,13 @@ import io.ktor.network.tls.* import io.ktor.utils.io.core.* import kotlinx.io.* -/** - * See also: [https://www.iana.org/assignments/tls-parameters/tls-parameters.txt] - */ +// See also: https://www.iana.org/assignments/tls-parameters/tls-parameters.txt /** * Hash algorithms * @property code numeric hash algorithm code * @property openSSLName is a name used in openssl for this algorithm */ - public enum class HashAlgorithm(public val code: Byte, public val openSSLName: String, public val macName: String) { NONE(0, "", ""), MD5(1, "MD5", "HmacMD5"), @@ -43,7 +40,6 @@ public enum class HashAlgorithm(public val code: Byte, public val openSSLName: S * Signature algorithms * @property code numeric algorithm codes */ - public enum class SignatureAlgorithm(public val code: Byte) { ANON(0), RSA(1), @@ -69,7 +65,6 @@ public enum class SignatureAlgorithm(public val code: Byte) { * @property sign algorithm. * @property oid [object identifier](https://en.wikipedia.org/wiki/Object_identifier). */ - public data class HashAndSign(val hash: HashAlgorithm, val sign: SignatureAlgorithm, val oid: OID? = null) { /** * String representation of this algorithms pair @@ -91,7 +86,6 @@ internal fun HashAndSign(hashValue: Byte, signValue: Byte, oidValue: String? = n /** * List of supported combinations of hash and signature algorithms */ - public val SupportedSignatureAlgorithms: List = listOf( HashAndSign(HashAlgorithm.SHA384, SignatureAlgorithm.ECDSA, OID.ECDSAwithSHA384Encryption), HashAndSign(HashAlgorithm.SHA256, SignatureAlgorithm.ECDSA, OID.ECDSAwithSHA256Encryption), diff --git a/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionData.kt b/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionData.kt index c7a5b912f6a..f431b146132 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionData.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-sessions/common/src/io/ktor/server/sessions/SessionData.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.sessions @@ -161,7 +161,7 @@ internal suspend fun SessionProviderData.sendSessionData(call: Appl } incoming && oldValue == null -> { - /* Deleted session should be cleared off */ + // Deleted session should be cleared off provider.transport.clear(call) provider.tracker.clear(call) } diff --git a/ktor-server/ktor-server-test-suites/jvm/src/io/ktor/server/testing/suites/SustainabilityTestSuite.kt b/ktor-server/ktor-server-test-suites/jvm/src/io/ktor/server/testing/suites/SustainabilityTestSuite.kt index f50ebb82ed9..187f6852753 100644 --- a/ktor-server/ktor-server-test-suites/jvm/src/io/ktor/server/testing/suites/SustainabilityTestSuite.kt +++ b/ktor-server/ktor-server-test-suites/jvm/src/io/ktor/server/testing/suites/SustainabilityTestSuite.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.server.testing.suites @@ -510,7 +510,7 @@ abstract class SustainabilityTestSuite val server = createServer(log = logger) { intercept(phase) { diff --git a/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/routing/RoutingResolveTest.kt b/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/routing/RoutingResolveTest.kt index eb1432b0b1d..34a8c6e3342 100644 --- a/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/routing/RoutingResolveTest.kt +++ b/ktor-server/ktor-server-tests/common/test/io/ktor/tests/server/routing/RoutingResolveTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.server.routing @@ -7,7 +7,7 @@ package io.ktor.tests.server.routing import io.ktor.client.request.* import io.ktor.client.statement.* import io.ktor.http.* -import io.ktor.server.application.Application +import io.ktor.server.application.* import io.ktor.server.plugins.* import io.ktor.server.response.* import io.ktor.server.routing.* @@ -171,7 +171,7 @@ class RoutingResolveTest { } @Test - fun routing_with_foo() = testRouting() { root -> + fun routing_with_foo() = testRouting { root -> val fooEntry = root.handle(PathSegmentConstantRouteSelector("foo")) on("resolving /foo") { diff --git a/ktor-utils/common/src/io/ktor/util/date/Date.kt b/ktor-utils/common/src/io/ktor/util/date/Date.kt index 2d789cead0a..885b8fd076b 100644 --- a/ktor-utils/common/src/io/ktor/util/date/Date.kt +++ b/ktor-utils/common/src/io/ktor/util/date/Date.kt @@ -7,10 +7,7 @@ package io.ktor.util.date import kotlinx.serialization.* import kotlin.time.* -/** - * According to: - * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html - */ +// According to: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html /** * Day of week diff --git a/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt b/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt index 311e211b4e2..6b3cbc1ba9f 100644 --- a/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt +++ b/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt @@ -250,13 +250,22 @@ public open class LockFreeLinkedListNode { } } + /** + * Adds the specified [node] at the end of the list atomically if the previous node matches the given [predicate]. + * + * @param node the node to be added + * @param predicate a function that evaluates the previous node + * @param condition an atomic condition that must be `true` for the node to be added + * @return `true` if the node was added, `false` otherwise + */ public inline fun addLastIfPrevAndIf( node: Node, - predicate: (Node) -> Boolean, // prev node predicate - crossinline condition: () -> Boolean // atomically checked condition + predicate: (Node) -> Boolean, + crossinline condition: () -> Boolean, ): Boolean { val condAdd = makeCondAddOp(node, condition) - while (true) { // lock-free loop on prev.next + // lock-free loop on prev.next + while (true) { val prev = prev as Node // sentinel node is never removed, so prev is always defined if (!predicate(prev)) return false when (prev.tryCondAddNext(node, this, condAdd)) { diff --git a/ktor-utils/js/src/io/ktor/util/date/DateJs.kt b/ktor-utils/js/src/io/ktor/util/date/DateJs.kt index 5036aa47356..15530a93039 100644 --- a/ktor-utils/js/src/io/ktor/util/date/DateJs.kt +++ b/ktor-utils/js/src/io/ktor/util/date/DateJs.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.date @@ -16,7 +16,7 @@ public actual fun GMTDate(timestamp: Long?): GMTDate { if (date.getTime().isNaN()) throw InvalidTimestampException(timestamp!!) with(date) { - /* from SUNDAY 0 -> MONDAY 0 */ + // from SUNDAY 0 -> MONDAY 0 val dayOfWeek = WeekDay.from((getUTCDay() + 6) % 7) val month = Month.from(getUTCMonth()) diff --git a/ktor-utils/wasmJs/src/io/ktor/util/date/DateWasm.kt b/ktor-utils/wasmJs/src/io/ktor/util/date/DateWasm.kt index d1fb131ba1f..582ce8b9409 100644 --- a/ktor-utils/wasmJs/src/io/ktor/util/date/DateWasm.kt +++ b/ktor-utils/wasmJs/src/io/ktor/util/date/DateWasm.kt @@ -1,11 +1,9 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.date -import kotlin.js.* - /** * Create new gmt date from the [timestamp]. * @param timestamp is a number of epoch milliseconds (it is `now` by default). @@ -16,7 +14,7 @@ public actual fun GMTDate(timestamp: Long?): GMTDate { if (date.getTime().isNaN()) throw InvalidTimestampException(timestamp!!) with(date) { - /* from SUNDAY 0 -> MONDAY 0 */ + // from SUNDAY 0 -> MONDAY 0 val dayOfWeek = WeekDay.from((getUTCDay() + 6) % 7) val month = Month.from(getUTCMonth()) From f3b92bbb551883b84d648df2f617ebcd2af25d62 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 11:42:10 +0100 Subject: [PATCH 06/11] Fix backing-property-naming --- .../io/ktor/client/engine/mock/MockEngine.kt | 8 ++-- .../auth/providers/BasicAuthProvider.kt | 10 ++-- .../auth/providers/BearerAuthProvider.kt | 16 +++---- .../auth/providers/DigestAuthProvider.kt | 7 ++- .../network/selector/LockFreeMPSCQueue.kt | 46 +++++++++---------- .../network/sockets/DatagramSocketNative.kt | 12 ++--- .../ktor/network/sockets/TCPSocketNative.kt | 14 +++--- .../server/engine/BaseApplicationResponse.kt | 6 +-- .../ktor/server/engine/EmbeddedServerJvm.kt | 36 +++++++-------- .../ktor/server/auth/AuthenticationContext.kt | 11 +++-- .../plugins/defaultheaders/DefaultHeaders.kt | 12 ++--- .../base/EngineTestBase.jsAndWasmShared.kt | 4 +- .../server/test/base/EngineTestBaseJvm.kt | 5 +- .../server/test/base/EngineTestBaseNix.kt | 4 +- .../serialization/kotlinx/ExtensionsNative.kt | 1 + .../ktor/util/internal/LockFreeLinkedList.kt | 16 +++---- .../src/io/ktor/util/pipeline/Pipeline.kt | 9 +--- .../src/io/ktor/util/CryptoJs.kt | 5 +- .../collections/LockFreeMPSCQueueNative.kt | 46 +++++++++---------- 19 files changed, 128 insertions(+), 140 deletions(-) diff --git a/ktor-client/ktor-client-mock/common/src/io/ktor/client/engine/mock/MockEngine.kt b/ktor-client/ktor-client-mock/common/src/io/ktor/client/engine/mock/MockEngine.kt index 17750020def..081525483b3 100644 --- a/ktor-client/ktor-client-mock/common/src/io/ktor/client/engine/mock/MockEngine.kt +++ b/ktor-client/ktor-client-mock/common/src/io/ktor/client/engine/mock/MockEngine.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.mock @@ -25,7 +25,7 @@ public class MockEngine(override val config: MockEngineConfig) : HttpClientEngin private val mutex = SynchronizedObject() private val contextState: CompletableJob = Job() - private val _requestsHistory: MutableList = mutableListOf() + private val _requestHistory: MutableList = mutableListOf() private val _responseHistory: MutableList = mutableListOf() private var invocationCount: Int = 0 @@ -39,7 +39,7 @@ public class MockEngine(override val config: MockEngineConfig) : HttpClientEngin /** * History of executed requests. */ - public val requestHistory: List get() = _requestsHistory + public val requestHistory: List get() = _requestHistory /** * History of sent responses. @@ -67,7 +67,7 @@ public class MockEngine(override val config: MockEngineConfig) : HttpClientEngin } synchronized(mutex) { - _requestsHistory.add(data) + _requestHistory.add(data) _responseHistory.add(response) } diff --git a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BasicAuthProvider.kt b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BasicAuthProvider.kt index 83b96974702..1e62ef8e70c 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BasicAuthProvider.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BasicAuthProvider.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins.auth.providers @@ -20,7 +20,7 @@ import io.ktor.utils.io.core.* @KtorDsl public fun AuthConfig.basic(block: BasicAuthConfig.() -> Unit) { with(BasicAuthConfig().apply(block)) { - this@basic.providers.add(BasicAuthProvider(_credentials, realm, _sendWithoutRequest)) + this@basic.providers.add(BasicAuthProvider(credentials, realm, _sendWithoutRequest)) } } @@ -52,11 +52,11 @@ public class BasicAuthConfig { */ public var realm: String? = null - @Suppress("DEPRECATION_ERROR") + @Suppress("DEPRECATION_ERROR", "PropertyName") internal var _sendWithoutRequest: (HttpRequestBuilder) -> Boolean = { sendWithoutRequest } @Suppress("DEPRECATION_ERROR") - internal var _credentials: suspend () -> BasicAuthCredentials? = { + internal var credentials: suspend () -> BasicAuthCredentials? = { BasicAuthCredentials(username = username, password = password) } @@ -71,7 +71,7 @@ public class BasicAuthConfig { * Allows you to specify authentication credentials. */ public fun credentials(block: suspend () -> BasicAuthCredentials?) { - _credentials = block + credentials = block } } diff --git a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BearerAuthProvider.kt b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BearerAuthProvider.kt index 33fb1c2c056..879cb47929d 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BearerAuthProvider.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BearerAuthProvider.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins.auth.providers @@ -17,7 +17,7 @@ import io.ktor.utils.io.* */ public fun AuthConfig.bearer(block: BearerAuthConfig.() -> Unit) { with(BearerAuthConfig().apply(block)) { - this@bearer.providers.add(BearerAuthProvider(_refreshTokens, _loadTokens, _sendWithoutRequest, realm)) + this@bearer.providers.add(BearerAuthProvider(refreshTokens, loadTokens, sendWithoutRequest, realm)) } } @@ -48,9 +48,9 @@ public class RefreshTokensParams( */ @KtorDsl public class BearerAuthConfig { - internal var _refreshTokens: suspend RefreshTokensParams.() -> BearerTokens? = { null } - internal var _loadTokens: suspend () -> BearerTokens? = { null } - internal var _sendWithoutRequest: (HttpRequestBuilder) -> Boolean = { true } + internal var refreshTokens: suspend RefreshTokensParams.() -> BearerTokens? = { null } + internal var loadTokens: suspend () -> BearerTokens? = { null } + internal var sendWithoutRequest: (HttpRequestBuilder) -> Boolean = { true } public var realm: String? = null @@ -58,7 +58,7 @@ public class BearerAuthConfig { * Configures a callback that refreshes a token when the 401 status code is received. */ public fun refreshTokens(block: suspend RefreshTokensParams.() -> BearerTokens?) { - _refreshTokens = block + refreshTokens = block } /** @@ -66,14 +66,14 @@ public class BearerAuthConfig { * Note: Using the same client instance here to make a request will result in a deadlock. */ public fun loadTokens(block: suspend () -> BearerTokens?) { - _loadTokens = block + loadTokens = block } /** * Sends credentials without waiting for [HttpStatusCode.Unauthorized]. */ public fun sendWithoutRequest(block: (HttpRequestBuilder) -> Boolean) { - _sendWithoutRequest = block + sendWithoutRequest = block } } diff --git a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/DigestAuthProvider.kt b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/DigestAuthProvider.kt index 1d57c85e752..6e1e5001dc3 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/DigestAuthProvider.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/DigestAuthProvider.kt @@ -9,7 +9,6 @@ import io.ktor.client.request.* import io.ktor.client.statement.* import io.ktor.http.* import io.ktor.http.auth.* -import io.ktor.http.auth.HeaderValueEncoding import io.ktor.util.* import io.ktor.utils.io.* import io.ktor.utils.io.charsets.* @@ -22,7 +21,7 @@ import kotlinx.atomicfu.* public fun AuthConfig.digest(block: DigestAuthConfig.() -> Unit) { val config = DigestAuthConfig().apply(block) with(config) { - this@digest.providers += DigestAuthProvider(_credentials, realm, algorithmName) + this@digest.providers += DigestAuthProvider(credentials, realm, algorithmName) } } @@ -52,7 +51,7 @@ public class DigestAuthConfig { public var realm: String? = null @Suppress("DEPRECATION_ERROR") - internal var _credentials: suspend () -> DigestAuthCredentials? = { + internal var credentials: suspend () -> DigestAuthCredentials? = { DigestAuthCredentials(username = username, password = password) } @@ -60,7 +59,7 @@ public class DigestAuthConfig { * Allows you to specify authentication credentials. */ public fun credentials(block: suspend () -> DigestAuthCredentials?) { - _credentials = block + credentials = block } } diff --git a/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt b/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt index 77611629423..0d1e6093664 100644 --- a/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt +++ b/ktor-network/jvm/src/io/ktor/network/selector/LockFreeMPSCQueue.kt @@ -21,34 +21,34 @@ private typealias Core = LockFreeMPSCQueueCore * ``` */ internal class LockFreeMPSCQueue { - private val _cur = atomic(Core(Core.INITIAL_CAPACITY)) + private val curRef = atomic(Core(Core.INITIAL_CAPACITY)) // Note: it is not atomic w.r.t. remove operation (remove can transiently fail when isEmpty is false) - val isEmpty: Boolean get() = _cur.value.isEmpty + val isEmpty: Boolean get() = curRef.value.isEmpty fun close() { - _cur.loop { cur -> + curRef.loop { cur -> if (cur.close()) return // closed this copy - _cur.compareAndSet(cur, cur.next()) // move to next + curRef.compareAndSet(cur, cur.next()) // move to next } } fun addLast(element: E): Boolean { - _cur.loop { cur -> + curRef.loop { cur -> when (cur.addLast(element)) { Core.ADD_SUCCESS -> return true Core.ADD_CLOSED -> return false - Core.ADD_FROZEN -> _cur.compareAndSet(cur, cur.next()) // move to next + Core.ADD_FROZEN -> curRef.compareAndSet(cur, cur.next()) // move to next } } } @Suppress("UNCHECKED_CAST") fun removeFirstOrNull(): E? { - _cur.loop { cur -> + curRef.loop { cur -> val result = cur.removeFirstOrNull() if (result !== Core.REMOVE_FROZEN) return result as E? - _cur.compareAndSet(cur, cur.next()) + curRef.compareAndSet(cur, cur.next()) } } } @@ -61,8 +61,8 @@ internal class LockFreeMPSCQueue { */ private class LockFreeMPSCQueueCore(private val capacity: Int) { private val mask = capacity - 1 - private val _next = atomic?>(null) - private val _state = atomic(0L) + private val nextRef = atomic?>(null) + private val stateRef = atomic(0L) private val array = AtomicReferenceArray(capacity) init { @@ -71,10 +71,10 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { } // Note: it is not atomic w.r.t. remove operation (remove can transiently fail when isEmpty is false) - val isEmpty: Boolean get() = _state.value.withState { head, tail -> head == tail } + val isEmpty: Boolean get() = stateRef.value.withState { head, tail -> head == tail } fun close(): Boolean { - _state.update { state -> + stateRef.update { state -> if (state and CLOSED_MASK != 0L) return true // ok - already closed if (state and FROZEN_MASK != 0L) return false // frozen -- try next state or CLOSED_MASK // try set closed bit @@ -84,20 +84,20 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { // ADD_CLOSED | ADD_FROZEN | ADD_SUCCESS fun addLast(element: E): Int { - _state.loop { state -> + stateRef.loop { state -> if (state and (FROZEN_MASK or CLOSED_MASK) != 0L) return state.addFailReason() // cannot add state.withState { head, tail -> // there could be one REMOVE element beyond head that we cannot stump up, // so we check for full queue with an extra margin of one element if ((tail + 2) and mask == head and mask) return ADD_FROZEN // overfull, so do freeze & copy val newTail = (tail + 1) and MAX_CAPACITY_MASK - if (_state.compareAndSet(state, state.updateTail(newTail))) { + if (stateRef.compareAndSet(state, state.updateTail(newTail))) { // successfully added array[tail and mask] = element // could have been frozen & copied before this item was set -- correct it by filling placeholder var cur = this while (true) { - if (cur._state.value and FROZEN_MASK == 0L) break // all fine -- not frozen yet + if (cur.stateRef.value and FROZEN_MASK == 0L) break // all fine -- not frozen yet cur = cur.next().fillPlaceholder(tail, element) ?: break } return ADD_SUCCESS // added successfully @@ -130,7 +130,7 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { // SINGLE CONSUMER // REMOVE_FROZEN | null (EMPTY) | E (SUCCESS) fun removeFirstOrNull(): Any? { - _state.loop { state -> + stateRef.loop { state -> if (state and FROZEN_MASK != 0L) return REMOVE_FROZEN // frozen -- cannot modify state.withState { head, tail -> if ((tail and mask) == (head and mask)) return null // empty @@ -139,7 +139,7 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { if (element is Placeholder) return null // same story -- consider it not added yet // we cannot put null into array here, because copying thread could replace it with Placeholder and that is a disaster val newHead = (head + 1) and MAX_CAPACITY_MASK - if (_state.compareAndSet(state, state.updateHead(newHead))) { + if (stateRef.compareAndSet(state, state.updateHead(newHead))) { array[head and mask] = null // now can safely put null (state was updated) return element // successfully removed in fast-path } @@ -154,14 +154,14 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { } private fun removeSlowPath(oldHead: Int, newHead: Int): Core? { - _state.loop { state -> + stateRef.loop { state -> state.withState { head, _ -> check(head == oldHead) { "This queue can have only one consumer" } if (state and FROZEN_MASK != 0L) { // state was already frozen, so removed element was copied to next return next() // continue to correct head in next } - if (_state.compareAndSet(state, state.updateHead(newHead))) { + if (stateRef.compareAndSet(state, state.updateHead(newHead))) { array[head and mask] = null // now can safely put null (state was updated) return null } @@ -172,15 +172,15 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { fun next(): LockFreeMPSCQueueCore = allocateOrGetNextCopy(markFrozen()) private fun markFrozen(): Long = - _state.updateAndGet { state -> + stateRef.updateAndGet { state -> if (state and FROZEN_MASK != 0L) return state // already marked state or FROZEN_MASK } private fun allocateOrGetNextCopy(state: Long): Core { - _next.loop { next -> + nextRef.loop { next -> if (next != null) return next // already allocated & copied - _next.compareAndSet(null, allocateNextCopy(state)) + nextRef.compareAndSet(null, allocateNextCopy(state)) } } @@ -193,7 +193,7 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { next.array[index and next.mask] = array[index and mask] ?: Placeholder(index) index++ } - next._state.value = state wo FROZEN_MASK + next.stateRef.value = state wo FROZEN_MASK } return next } diff --git a/ktor-network/posix/src/io/ktor/network/sockets/DatagramSocketNative.kt b/ktor-network/posix/src/io/ktor/network/sockets/DatagramSocketNative.kt index 77dd5379cbb..6f175e6e883 100644 --- a/ktor-network/posix/src/io/ktor/network/sockets/DatagramSocketNative.kt +++ b/ktor-network/posix/src/io/ktor/network/sockets/DatagramSocketNative.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.network.sockets @@ -23,12 +23,12 @@ internal class DatagramSocketNative( private val remote: SocketAddress?, parent: CoroutineContext = EmptyCoroutineContext ) : BoundDatagramSocket, ConnectedDatagramSocket, CoroutineScope { - private val _context: CompletableJob = Job(parent[Job]) + private val context: CompletableJob = Job(parent[Job]) - override val coroutineContext: CoroutineContext = parent + Dispatchers.Unconfined + _context + override val coroutineContext: CoroutineContext = parent + Dispatchers.Unconfined + context override val socketContext: Job - get() = _context + get() = context override val localAddress: SocketAddress get() = getLocalAddress(descriptor).toSocketAddress() @@ -61,8 +61,8 @@ internal class DatagramSocketNative( override fun close() { receiver.cancel() - _context.complete() - _context.invokeOnCompletion { + context.complete() + context.invokeOnCompletion { ktor_shutdown(descriptor, ShutdownCommands.Both) // Descriptor is closed by the selector manager selector.notifyClosed(selectable) diff --git a/ktor-network/posix/src/io/ktor/network/sockets/TCPSocketNative.kt b/ktor-network/posix/src/io/ktor/network/sockets/TCPSocketNative.kt index f4bad145d32..50895a2a291 100644 --- a/ktor-network/posix/src/io/ktor/network/sockets/TCPSocketNative.kt +++ b/ktor-network/posix/src/io/ktor/network/sockets/TCPSocketNative.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.network.sockets @@ -18,12 +18,12 @@ internal class TCPSocketNative( override val localAddress: SocketAddress, parent: CoroutineContext = EmptyCoroutineContext ) : Socket, CoroutineScope { - private val _context: CompletableJob = Job(parent[Job]) + private val context: CompletableJob = Job(parent[Job]) - override val coroutineContext: CoroutineContext = parent + Dispatchers.Unconfined + _context + override val coroutineContext: CoroutineContext = parent + Dispatchers.Unconfined + context override val socketContext: Job - get() = _context + get() = context override fun attachForReading(channel: ByteChannel): WriterJob = attachForReadingImpl(channel, descriptor, selectable, selector) @@ -32,8 +32,8 @@ internal class TCPSocketNative( attachForWritingImpl(channel, descriptor, selectable, selector) override fun close() { - _context.complete() - _context.invokeOnCompletion { + context.complete() + context.invokeOnCompletion { ktor_shutdown(descriptor, ShutdownCommands.Both) // Descriptor is closed by the selector manager selector.notifyClosed(selectable) diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt index 22006c70e68..b5c25dc2698 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/engine/BaseApplicationResponse.kt @@ -19,7 +19,7 @@ import kotlinx.coroutines.* public abstract class BaseApplicationResponse( final override val call: PipelineCall ) : PipelineResponse { - private var _status: HttpStatusCode? = null + private var status: HttpStatusCode? = null override val isCommitted: Boolean get() = responded @@ -31,9 +31,9 @@ public abstract class BaseApplicationResponse( ResponseCookies(this) } - override fun status(): HttpStatusCode? = _status + override fun status(): HttpStatusCode? = status override fun status(value: HttpStatusCode) { - _status = value + status = value setStatus(value) } diff --git a/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/EmbeddedServerJvm.kt b/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/EmbeddedServerJvm.kt index 0e8b31c045d..a97d8059040 100644 --- a/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/EmbeddedServerJvm.kt +++ b/ktor-server/ktor-server-core/jvm/src/io/ktor/server/engine/EmbeddedServerJvm.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.engine @@ -44,7 +44,7 @@ actual constructor( public actual val engineConfig: TConfiguration = engineFactory.configuration(engineConfigBlock) private val applicationInstanceLock = ReentrantReadWriteLock() private var recreateInstance: Boolean = false - private var _applicationClassLoader: ClassLoader? = null + private var applicationClassLoader: ClassLoader? = null private var packageWatchKeys = emptyList() private val configuredWatchPath = environment.config.propertyOrNull("ktor.deployment.watch")?.getList().orEmpty() @@ -56,7 +56,7 @@ actual constructor( private val modulesNames: List = configModulesNames - private var _applicationInstance: Application? = Application( + private var applicationInstance: Application? = Application( environment, rootConfig.developmentMode, rootConfig.rootPath, @@ -88,13 +88,13 @@ actual constructor( applicationInstanceLock.write { destroyApplication() val (application, classLoader) = createApplication() - _applicationInstance = application - _applicationClassLoader = classLoader + applicationInstance = application + applicationClassLoader = classLoader } } private fun currentApplication(): Application = applicationInstanceLock.read { - val currentApplication = _applicationInstance ?: error("EmbeddedServer was stopped") + val currentApplication = applicationInstance ?: error("EmbeddedServer was stopped") if (!rootConfig.developmentMode) { return@read currentApplication @@ -125,11 +125,11 @@ actual constructor( applicationInstanceLock.write { destroyApplication() val (application, classLoader) = createApplication() - _applicationInstance = application - _applicationClassLoader = classLoader + applicationInstance = application + applicationClassLoader = classLoader } - return@read _applicationInstance ?: error("EmbeddedServer was stopped") + return@read applicationInstance ?: error("EmbeddedServer was stopped") } private fun createApplication(): Pair { @@ -199,16 +199,16 @@ actual constructor( } private fun destroyApplication() { - val currentApplication = _applicationInstance - val applicationClassLoader = _applicationClassLoader - _applicationInstance = null - _applicationClassLoader = null + val currentApplication = applicationInstance + val currentApplicationClassLoader = applicationClassLoader + applicationInstance = null + applicationClassLoader = null if (currentApplication != null) { safeRaiseEvent(ApplicationStopping, currentApplication) try { currentApplication.dispose() - (applicationClassLoader as? OverridingClassLoader)?.close() + (currentApplicationClassLoader as? OverridingClassLoader)?.close() } catch (e: Throwable) { environment.log.error("Failed to destroy application instance.", e) } @@ -277,8 +277,8 @@ actual constructor( throw cause } - _applicationInstance = application - _applicationClassLoader = classLoader + applicationInstance = application + applicationClassLoader = classLoader } CoroutineScope(application.coroutineContext).launch { @@ -313,7 +313,7 @@ actual constructor( } private fun instantiateAndConfigureApplication(currentClassLoader: ClassLoader): Application { - val newInstance = if (recreateInstance || _applicationInstance == null) { + val newInstance = if (recreateInstance || applicationInstance == null) { Application( environment, rootConfig.developmentMode, @@ -324,7 +324,7 @@ actual constructor( ) } else { recreateInstance = true - _applicationInstance!! + applicationInstance!! } safeRaiseEvent(ApplicationStarting, newInstance) diff --git a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/AuthenticationContext.kt b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/AuthenticationContext.kt index 6bdff4d5aab..4f47f8edfdc 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/AuthenticationContext.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/AuthenticationContext.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.auth @@ -17,8 +17,9 @@ public class AuthenticationContext(call: ApplicationCall) { public var call: ApplicationCall = call private set - private val _errors = HashMap() + private val errors = HashMap() + @Suppress("PropertyName") internal val _principal: CombinedPrincipal = CombinedPrincipal() /** @@ -36,19 +37,19 @@ public class AuthenticationContext(call: ApplicationCall) { * All registered errors during auth procedure (only [AuthenticationFailedCause.Error]). */ public val allErrors: List - get() = _errors.values.filterIsInstance() + get() = errors.values.filterIsInstance() /** * All authentication failures during auth procedure including missing or invalid credentials. */ public val allFailures: List - get() = _errors.values.toList() + get() = errors.values.toList() /** * Appends an error to the errors list. Overwrites if already registered for the same [key]. */ public fun error(key: Any, cause: AuthenticationFailedCause) { - _errors[key] = cause + errors[key] = cause } /** diff --git a/ktor-server/ktor-server-plugins/ktor-server-default-headers/common/src/io/ktor/server/plugins/defaultheaders/DefaultHeaders.kt b/ktor-server/ktor-server-plugins/ktor-server-default-headers/common/src/io/ktor/server/plugins/defaultheaders/DefaultHeaders.kt index 19f7abd6ee7..aa765cecc00 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-default-headers/common/src/io/ktor/server/plugins/defaultheaders/DefaultHeaders.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-default-headers/common/src/io/ktor/server/plugins/defaultheaders/DefaultHeaders.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.server.plugins.defaultheaders @@ -43,13 +43,7 @@ public class DefaultHeadersConfig { public fun now(): Long } - private val _cachedDateText = atomic("") - - internal var cachedDateText: String - get() = _cachedDateText.value - set(value) { - _cachedDateText.value = value - } + internal var cachedDateText: String by atomic("") } /** diff --git a/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt b/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt index fe9b632b017..e3f1e9140ad 100644 --- a/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt @@ -68,7 +68,7 @@ actual constructor( parent: CoroutineContext = EmptyCoroutineContext, module: Application.() -> Unit ): EmbeddedServer { - val _port = this.port + val savedPort = this.port val environment = applicationEnvironment { val delegate = KtorSimpleLogger("io.ktor.test") this.log = log ?: object : Logger by delegate { @@ -89,7 +89,7 @@ actual constructor( } return embeddedServer(applicationEngineFactory, properties) { - connector { port = _port } + connector { port = savedPort } shutdownGracePeriod = 1000 shutdownTimeout = 1000 } diff --git a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt index c31a9e92e54..9d14a47bbd4 100644 --- a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt +++ b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt @@ -43,7 +43,6 @@ actual abstract class EngineTestBase< ) : BaseTest(), CoroutineScope { private val testJob = Job() - @OptIn(ExperimentalCoroutinesApi::class) protected val testDispatcher = Dispatchers.IO.limitedParallelism(32) protected val isUnderDebugger: Boolean = @@ -112,7 +111,7 @@ actual abstract class EngineTestBase< parent: CoroutineContext = EmptyCoroutineContext, module: Application.() -> Unit ): EmbeddedServer { - val _port = this.port + val savedPort = this.port val environment = applicationEnvironment { val delegate = LoggerFactory.getLogger("io.ktor.test") this.log = log ?: object : Logger by delegate { @@ -138,7 +137,7 @@ actual abstract class EngineTestBase< shutdownGracePeriod = 1000 shutdownTimeout = 1000 - connector { port = _port } + connector { port = savedPort } if (enableSsl) { sslConnector(keyStore, "mykey", { "changeit".toCharArray() }, { "changeit".toCharArray() }) { this.port = sslPort diff --git a/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt b/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt index b575aa151b8..a2323d849fa 100644 --- a/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt +++ b/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt @@ -79,7 +79,7 @@ actual constructor( parent: CoroutineContext = EmptyCoroutineContext, module: Application.() -> Unit ): EmbeddedServer { - val _port = this.port + val savedPort = this.port val environment = applicationEnvironment { val delegate = KtorSimpleLogger("io.ktor.test") this.log = log ?: object : Logger by delegate { @@ -100,7 +100,7 @@ actual constructor( } return embeddedServer(applicationEngineFactory, properties) { - connector { port = _port } + connector { port = savedPort } shutdownGracePeriod = 1000 shutdownTimeout = 1000 } diff --git a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/posix/src/io/ktor/serialization/kotlinx/ExtensionsNative.kt b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/posix/src/io/ktor/serialization/kotlinx/ExtensionsNative.kt index 61275cedfeb..955bd03ae3c 100644 --- a/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/posix/src/io/ktor/serialization/kotlinx/ExtensionsNative.kt +++ b/ktor-shared/ktor-serialization/ktor-serialization-kotlinx/posix/src/io/ktor/serialization/kotlinx/ExtensionsNative.kt @@ -6,6 +6,7 @@ package io.ktor.serialization.kotlinx import io.ktor.utils.io.* +@Suppress("ObjectPropertyName") private val _providers: MutableList = mutableListOf() internal actual val providers: List = _providers diff --git a/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt b/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt index 6b3cbc1ba9f..4c409ee0b68 100644 --- a/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt +++ b/ktor-utils/common/src/io/ktor/util/internal/LockFreeLinkedList.kt @@ -74,16 +74,16 @@ private val NO_DECISION: Any = Symbol("NO_DECISION") * @suppress **This is unstable API and it is subject to change.** */ public abstract class AtomicOp : OpDescriptor() { - private val _consensus = atomic(NO_DECISION) + private val consensus = atomic(NO_DECISION) - public val isDecided: Boolean get() = _consensus.value !== NO_DECISION + public val isDecided: Boolean get() = consensus.value !== NO_DECISION public fun tryDecide(decision: Any?): Boolean { check(decision !== NO_DECISION) - return _consensus.compareAndSet(NO_DECISION, decision) + return consensus.compareAndSet(NO_DECISION, decision) } - private fun decide(decision: Any?): Any? = if (tryDecide(decision)) decision else _consensus.value + private fun decide(decision: Any?): Any? = if (tryDecide(decision)) decision else consensus.value public abstract fun prepare(affected: T): Any? // `null` if Ok, or failure reason @@ -92,8 +92,8 @@ public abstract class AtomicOp : OpDescriptor() { // returns `null` on success @Suppress("UNCHECKED_CAST") public final override fun perform(affected: Any?): Any? { - // make decision on status - var decision = this._consensus.value + // make a decision on status + var decision = consensus.value if (decision === NO_DECISION) { decision = decide(prepare(affected as T)) } @@ -142,10 +142,10 @@ public open class LockFreeLinkedListNode { private val _prev = atomic(this) // lazily cached removed ref to this - private val _removedRef = atomic(null) + private val removedRef = atomic(null) private fun removed(): Removed = - _removedRef.value ?: Removed(this).also { _removedRef.lazySet(it) } + removedRef.value ?: Removed(this).also { removedRef.lazySet(it) } @PublishedApi internal abstract class CondAddOp( diff --git a/ktor-utils/common/src/io/ktor/util/pipeline/Pipeline.kt b/ktor-utils/common/src/io/ktor/util/pipeline/Pipeline.kt index 1617d932e2b..a03265f5637 100644 --- a/ktor-utils/common/src/io/ktor/util/pipeline/Pipeline.kt +++ b/ktor-utils/common/src/io/ktor/util/pipeline/Pipeline.kt @@ -59,14 +59,7 @@ public open class Pipeline( public val isEmpty: Boolean get() = interceptorsQuantity == 0 - private val _interceptors: AtomicRef>?> = - atomic(null) - - private var interceptors: List>? - get() = _interceptors.value - set(value) { - _interceptors.value = value - } + private var interceptors: List>? by atomic(null) private var interceptorsListShared: Boolean = false diff --git a/ktor-utils/jsAndWasmShared/src/io/ktor/util/CryptoJs.kt b/ktor-utils/jsAndWasmShared/src/io/ktor/util/CryptoJs.kt index 9460e953f3e..144934773e3 100644 --- a/ktor-utils/jsAndWasmShared/src/io/ktor/util/CryptoJs.kt +++ b/ktor-utils/jsAndWasmShared/src/io/ktor/util/CryptoJs.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.util @@ -40,6 +40,7 @@ public actual fun Digest(name: String): Digest = object : Digest { // Variable is renamed to `_crypto` so it wouldn't clash with existing `crypto` variable. // JS IR backend doesn't reserve names accessed inside js("") calls +@Suppress("ObjectPropertyName") private val _crypto: Crypto = js("(globalThis ? globalThis.crypto : (window.crypto || window.msCrypto))") private external class Crypto { diff --git a/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt b/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt index b758c1a2047..ca8d4de7995 100644 --- a/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt +++ b/ktor-utils/posix/src/io/ktor/util/collections/LockFreeMPSCQueueNative.kt @@ -22,18 +22,18 @@ private typealias Core = LockFreeMPSCQueueCore */ @InternalAPI public class LockFreeMPSCQueue { - private val _cur = atomic(Core(Core.INITIAL_CAPACITY)) + private val curRef = atomic(Core(Core.INITIAL_CAPACITY)) private val closed = atomic(0) // Note: it is not atomic w.r.t. remove operation (remove can transiently fail when isEmpty is false) - public val isEmpty: Boolean get() = _cur.value.isEmpty + public val isEmpty: Boolean get() = curRef.value.isEmpty public val isClosed: Boolean get() = closed.value == 1 public fun close() { try { - _cur.loop { cur -> + curRef.loop { cur -> if (cur.close()) return // closed this copy - _cur.compareAndSet(cur, cur.next()) // move to next + curRef.compareAndSet(cur, cur.next()) // move to next } } finally { if (!closed.compareAndSet(0, 1)) return @@ -41,21 +41,21 @@ public class LockFreeMPSCQueue { } public fun addLast(element: E): Boolean { - _cur.loop { cur -> + curRef.loop { cur -> when (cur.addLast(element)) { Core.ADD_SUCCESS -> return true Core.ADD_CLOSED -> return false - Core.ADD_FROZEN -> _cur.compareAndSet(cur, cur.next()) // move to next + Core.ADD_FROZEN -> curRef.compareAndSet(cur, cur.next()) // move to next } } } @Suppress("UNCHECKED_CAST") public fun removeFirstOrNull(): E? { - _cur.loop { cur -> + curRef.loop { cur -> val result = cur.removeFirstOrNull() if (result !== Core.REMOVE_FROZEN) return result as E? - _cur.compareAndSet(cur, cur.next()) + curRef.compareAndSet(cur, cur.next()) } } } @@ -68,8 +68,8 @@ public class LockFreeMPSCQueue { */ private class LockFreeMPSCQueueCore(private val capacity: Int) { private val mask = capacity - 1 - private val _next = atomic?>(null) - private val _state = atomic(0L) + private val nextRef = atomic?>(null) + private val stateRef = atomic(0L) private val array = atomicArrayOfNulls(capacity) private fun setArrayValueHelper(index: Int, value: Any?) { @@ -82,10 +82,10 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { } // Note: it is not atomic w.r.t. remove operation (remove can transiently fail when isEmpty is false) - val isEmpty: Boolean get() = _state.value.withState { head, tail -> head == tail } + val isEmpty: Boolean get() = stateRef.value.withState { head, tail -> head == tail } fun close(): Boolean { - _state.update { state -> + stateRef.update { state -> if (state and CLOSED_MASK != 0L) return true // ok - already closed if (state and FROZEN_MASK != 0L) return false // frozen -- try next state or CLOSED_MASK // try set closed bit @@ -95,20 +95,20 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { // ADD_CLOSED | ADD_FROZEN | ADD_SUCCESS fun addLast(element: E): Int { - _state.loop { state -> + stateRef.loop { state -> if (state and (FROZEN_MASK or CLOSED_MASK) != 0L) return state.addFailReason() // cannot add state.withState { head, tail -> // there could be one REMOVE element beyond head that we cannot stump up, // so we check for full queue with an extra margin of one element if ((tail + 2) and mask == head and mask) return ADD_FROZEN // overfull, so do freeze & copy val newTail = (tail + 1) and MAX_CAPACITY_MASK - if (_state.compareAndSet(state, state.updateTail(newTail))) { + if (stateRef.compareAndSet(state, state.updateTail(newTail))) { // successfully added array[tail and mask].value = element // could have been frozen & copied before this item was set -- correct it by filling placeholder var cur = this while (true) { - if (cur._state.value and FROZEN_MASK == 0L) break // all fine -- not frozen yet + if (cur.stateRef.value and FROZEN_MASK == 0L) break // all fine -- not frozen yet cur = cur.next().fillPlaceholder(tail, element) ?: break } return ADD_SUCCESS // added successfully @@ -141,7 +141,7 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { // SINGLE CONSUMER // REMOVE_FROZEN | null (EMPTY) | E (SUCCESS) fun removeFirstOrNull(): Any? { - _state.loop { state -> + stateRef.loop { state -> if (state and FROZEN_MASK != 0L) return REMOVE_FROZEN // frozen -- cannot modify state.withState { head, tail -> if ((tail and mask) == (head and mask)) return null // empty @@ -150,7 +150,7 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { if (element is Placeholder) return null // same story -- consider it not added yet // we cannot put null into array here, because copying thread could replace it with Placeholder and that is a disaster val newHead = (head + 1) and MAX_CAPACITY_MASK - if (_state.compareAndSet(state, state.updateHead(newHead))) { + if (stateRef.compareAndSet(state, state.updateHead(newHead))) { array[head and mask].value = null // now can safely put null (state was updated) return element // successfully removed in fast-path } @@ -165,14 +165,14 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { } private fun removeSlowPath(oldHead: Int, newHead: Int): Core? { - _state.loop { state -> + stateRef.loop { state -> state.withState { head, _ -> check(head == oldHead) { "This queue can have only one consumer" } if (state and FROZEN_MASK != 0L) { // state was already frozen, so removed element was copied to next return next() // continue to correct head in next } - if (_state.compareAndSet(state, state.updateHead(newHead))) { + if (stateRef.compareAndSet(state, state.updateHead(newHead))) { array[head and mask].value = null // now can safely put null (state was updated) return null } @@ -183,15 +183,15 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { fun next(): LockFreeMPSCQueueCore = allocateOrGetNextCopy(markFrozen()) private fun markFrozen(): Long = - _state.updateAndGet { state -> + stateRef.updateAndGet { state -> if (state and FROZEN_MASK != 0L) return state // already marked state or FROZEN_MASK } private fun allocateOrGetNextCopy(state: Long): Core { - _next.loop { next -> + nextRef.loop { next -> if (next != null) return next // already allocated & copied - _next.compareAndSet(null, allocateNextCopy(state)) + nextRef.compareAndSet(null, allocateNextCopy(state)) } } @@ -205,7 +205,7 @@ private class LockFreeMPSCQueueCore(private val capacity: Int) { next.setArrayValueHelper(index and next.mask, value ?: Placeholder(index)) index++ } - next._state.value = state wo FROZEN_MASK + next.stateRef.value = state wo FROZEN_MASK } return next } From 4dc662eee7e31bc069d12428c77c2b1d6e924356 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 11:52:06 +0100 Subject: [PATCH 07/11] Disable some rules --- .editorconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.editorconfig b/.editorconfig index 1be295016c4..774dcf3db5f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,6 +16,7 @@ ij_kotlin_packages_to_use_import_on_demand = java.util.*, io.ktor.** ktlint_standard_no-wildcard-imports = disabled ktlint_standard_trailing-comma-on-call-site = disabled ktlint_standard_trailing-comma-on-declaration-site = disabled +ktlint_standard_no-empty-first-line-in-class-body = disabled ktlint_standard_filename = disabled ktlint_standard_class-naming = disabled ktlint_standard_annotation = disabled From 2812b7511d9453086654729e343cb1a028b7f445 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 13:32:21 +0100 Subject: [PATCH 08/11] Fix function-naming --- .../client/engine/apache5/ApacheRequestProducer.kt | 3 ++- .../src/io/ktor/client/plugins/HttpCallValidator.kt | 7 ++++--- .../common/src/io/ktor/client/plugins/UserAgent.kt | 6 ++++-- .../src/io/ktor/client/plugins/sse/builders.kt | 5 +++-- .../src/io/ktor/client/plugins/websocket/builders.kt | 5 +++-- .../src/io/ktor/client/engine/js/Js.kt | 3 ++- .../client/plugins/cache/storage/FileCacheStorage.kt | 3 ++- .../common/src/io/ktor/client/plugins/auth/Auth.kt | 3 ++- .../common/src/ContentEncoding.kt | 1 + .../src/io/ktor/client/plugins/json/JsonPlugin.kt | 1 + .../io/ktor/client/plugins/logging/KtorMDCContext.kt | 1 + .../src/io/ktor/client/plugins/logging/Logging.kt | 3 ++- .../logging/KtorMDCContext.jsAndWasmShared.kt | 1 + .../client/plugins/logging/KtorMDCContext.jvm.kt | 2 +- .../client/plugins/logging/KtorMDCContext.posix.kt | 1 + .../test/io/ktor/tests/http/HttpStatusCodeTest.kt | 12 ++++++------ .../src/io/ktor/utils/io/core/BytePacketBuilder.kt | 1 + .../ktor/network/util/SocketUtils.androidNative.kt | 2 ++ .../src/SocketUtils.androidNative32.kt | 5 +++-- .../src/SocketUtils.androidNative64.kt | 6 +++--- .../src/io/ktor/network/util/SocketUtils.darwin.kt | 2 ++ .../ios/src/io/ktor/network/util/SocketUtilsIos.kt | 2 ++ .../jvm/src/io/ktor/network/tls/Hashes.kt | 4 +++- .../network/tls/extensions/SignatureAlgorithm.kt | 6 +++--- .../src/io/ktor/network/util/SocketUtils.linux.kt | 2 ++ .../src/io/ktor/network/util/SocketUtilsMacos.kt | 2 ++ .../nix/src/io/ktor/network/util/SocketUtils.nix.kt | 2 ++ .../posix/src/io/ktor/network/util/SocketUtils.kt | 4 +++- .../tvos/src/io/ktor/network/util/SocketUtilsTvos.kt | 2 ++ .../src/io/ktor/network/util/SocketUtilsWatchos.kt | 2 ++ .../src/io/ktor/network/util/SocketUtilsWindows.kt | 2 ++ .../src/io/ktor/server/config/yaml/YamlConfigJvm.kt | 3 ++- .../src/io/ktor/server/config/yaml/YamlConfig.kt | 1 + .../src/io/ktor/server/config/yaml/YamlConfigNix.kt | 5 +++-- .../io/ktor/server/http/content/LocalFileContent.kt | 3 ++- .../io/ktor/server/plugins/calllogging/MDCHook.kt | 3 ++- .../test/io/ktor/tests/websocket/RawWebSocketTest.kt | 6 +++--- ktor-utils/wasmJs/src/io/ktor/util/date/Date.kt | 3 ++- 38 files changed, 85 insertions(+), 40 deletions(-) diff --git a/ktor-client/ktor-client-apache5/jvm/src/io/ktor/client/engine/apache5/ApacheRequestProducer.kt b/ktor-client/ktor-client-apache5/jvm/src/io/ktor/client/engine/apache5/ApacheRequestProducer.kt index 53df59059db..deceaf29bd9 100644 --- a/ktor-client/ktor-client-apache5/jvm/src/io/ktor/client/engine/apache5/ApacheRequestProducer.kt +++ b/ktor-client/ktor-client-apache5/jvm/src/io/ktor/client/engine/apache5/ApacheRequestProducer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.apache5 @@ -22,6 +22,7 @@ import java.nio.* import java.util.concurrent.* import kotlin.coroutines.* +@Suppress("FunctionName") @OptIn(InternalAPI::class) internal fun ApacheRequestProducer( requestData: HttpRequestData, diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpCallValidator.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpCallValidator.kt index 168e9ec5edd..7d8a202a4e1 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpCallValidator.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpCallValidator.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.plugins @@ -155,7 +155,7 @@ internal object ReceiveError : ClientHook Th } } -private fun HttpRequest(builder: HttpRequestBuilder) = object : HttpRequest { +private fun HttpRequest(builder: HttpRequestBuilder): HttpRequest = object : HttpRequest { override val call: HttpClientCall get() = error("Call is not initialized") override val method: HttpMethod = builder.method override val url: Url = builder.url.build() @@ -169,6 +169,7 @@ private fun HttpRequest(builder: HttpRequestBuilder) = object : HttpRequest { /** * Install [HttpCallValidator] with [block] configuration. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.HttpResponseValidator(block: HttpCallValidatorConfig.() -> Unit) { install(HttpCallValidator, block) } diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/UserAgent.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/UserAgent.kt index 6b096f9e6eb..98e30d59ff4 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/UserAgent.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/UserAgent.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.plugins @@ -35,6 +35,7 @@ public val UserAgent: ClientPlugin = createClientPlugin("UserAg /** * Installs the [UserAgent] plugin with a browser-like user agent. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.BrowserUserAgent() { install(UserAgent) { agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) " + @@ -45,6 +46,7 @@ public fun HttpClientConfig<*>.BrowserUserAgent() { /** * Installs the [UserAgent] plugin with a CURL user agent. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.CurlUserAgent() { install(UserAgent) { agent = "curl/7.61.0" diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/sse/builders.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/sse/builders.kt index e8c4e8f82bc..df22ae7ee70 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/sse/builders.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/sse/builders.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.plugins.sse @@ -21,6 +21,7 @@ internal val showRetryEventsAttr = AttributeKey("SSEShowRetryEvents") /** * Installs the [SSE] plugin using the [config] as configuration. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.SSE(config: SSEConfig.() -> Unit) { install(SSE) { config() diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt index 6da82ec46e6..8dbf76c5b81 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.plugins.websocket @@ -14,6 +14,7 @@ import kotlinx.coroutines.* /** * Installs the [WebSockets] plugin using the [config] as configuration. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.WebSockets(config: WebSockets.Config.() -> Unit) { install(WebSockets) { config() diff --git a/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/js/Js.kt b/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/js/Js.kt index a579421500b..76d19cd4e10 100644 --- a/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/js/Js.kt +++ b/ktor-client/ktor-client-core/jsAndWasmShared/src/io/ktor/client/engine/js/Js.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.js @@ -28,5 +28,6 @@ public expect open class JsClientEngineConfig : HttpClientEngineConfig /** * Creates a [Js] client engine. */ +@Suppress("FunctionName") @JsName("JsClient") public fun JsClient(): HttpClientEngineFactory = Js diff --git a/ktor-client/ktor-client-core/jvm/src/io/ktor/client/plugins/cache/storage/FileCacheStorage.kt b/ktor-client/ktor-client-core/jvm/src/io/ktor/client/plugins/cache/storage/FileCacheStorage.kt index 40887edfb05..ffb13916159 100644 --- a/ktor-client/ktor-client-core/jvm/src/io/ktor/client/plugins/cache/storage/FileCacheStorage.kt +++ b/ktor-client/ktor-client-core/jvm/src/io/ktor/client/plugins/cache/storage/FileCacheStorage.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins.cache.storage @@ -22,6 +22,7 @@ import java.security.* * @param directory directory to store cache data. * @param dispatcher dispatcher to use for file operations. */ +@Suppress("FunctionName") public fun FileStorage( directory: File, dispatcher: CoroutineDispatcher = Dispatchers.IO diff --git a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt index 1fd57fa6d25..1bdc315d6f1 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins.auth @@ -156,6 +156,7 @@ public val Auth: ClientPlugin = createClientPlugin("Auth", ::AuthCon /** * Install [Auth] plugin. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.Auth(block: AuthConfig.() -> Unit) { install(Auth, block) } diff --git a/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt b/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt index 5a308e15f7f..ca876d6ec59 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-encoding/common/src/ContentEncoding.kt @@ -215,6 +215,7 @@ internal object ReceiveStateHook : ClientHook HttpResp * * @param block: a [ContentEncoding] configuration. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.ContentEncoding( mode: ContentEncodingConfig.Mode = ContentEncodingConfig.Mode.DecompressResponse, block: ContentEncodingConfig.() -> Unit = { diff --git a/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonPlugin.kt b/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonPlugin.kt index bacc893efe3..0830659513c 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonPlugin.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-json/common/src/io/ktor/client/plugins/json/JsonPlugin.kt @@ -232,6 +232,7 @@ public class JsonPlugin internal constructor( /** * Install [JsonPlugin]. */ +@Suppress("FunctionName") @Deprecated( "Please use ContentNegotiation plugin: https://ktor.io/docs/migration-to-20x.html#serialization-client", level = DeprecationLevel.ERROR diff --git a/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/KtorMDCContext.kt b/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/KtorMDCContext.kt index d0131ca9cdd..a3a84222c9f 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/KtorMDCContext.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/KtorMDCContext.kt @@ -7,5 +7,6 @@ package io.ktor.client.plugins.logging import io.ktor.utils.io.* import kotlin.coroutines.* +@Suppress("FunctionName") @InternalAPI public expect fun MDCContext(): CoroutineContext.Element diff --git a/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/Logging.kt b/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/Logging.kt index df08d200cbe..2665b76d500 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/Logging.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/Logging.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins.logging @@ -242,6 +242,7 @@ public val Logging: ClientPlugin = createClientPlugin("Logging", /** * Configures and installs [Logging] in [HttpClient]. */ +@Suppress("FunctionName") public fun HttpClientConfig<*>.Logging(block: LoggingConfig.() -> Unit = {}) { install(Logging, block) } diff --git a/ktor-client/ktor-client-plugins/ktor-client-logging/jsAndWasmShared/src/io/ktor/client/plugins/logging/KtorMDCContext.jsAndWasmShared.kt b/ktor-client/ktor-client-plugins/ktor-client-logging/jsAndWasmShared/src/io/ktor/client/plugins/logging/KtorMDCContext.jsAndWasmShared.kt index 44ed24d4d55..8571a6315b1 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-logging/jsAndWasmShared/src/io/ktor/client/plugins/logging/KtorMDCContext.jsAndWasmShared.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-logging/jsAndWasmShared/src/io/ktor/client/plugins/logging/KtorMDCContext.jsAndWasmShared.kt @@ -7,6 +7,7 @@ package io.ktor.client.plugins.logging import io.ktor.utils.io.* import kotlin.coroutines.* +@Suppress("FunctionName") @InternalAPI public actual fun MDCContext(): CoroutineContext.Element = MDCContextElement diff --git a/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/src/io/ktor/client/plugins/logging/KtorMDCContext.jvm.kt b/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/src/io/ktor/client/plugins/logging/KtorMDCContext.jvm.kt index 85f830518a7..db83ca21e54 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/src/io/ktor/client/plugins/logging/KtorMDCContext.jvm.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-logging/jvm/src/io/ktor/client/plugins/logging/KtorMDCContext.jvm.kt @@ -5,9 +5,9 @@ package io.ktor.client.plugins.logging import io.ktor.utils.io.* -import kotlinx.coroutines.slf4j.* import kotlin.coroutines.* +@Suppress("FunctionName") @InternalAPI public actual fun MDCContext(): CoroutineContext.Element { return kotlinx.coroutines.slf4j.MDCContext() diff --git a/ktor-client/ktor-client-plugins/ktor-client-logging/posix/src/io/ktor/client/plugins/logging/KtorMDCContext.posix.kt b/ktor-client/ktor-client-plugins/ktor-client-logging/posix/src/io/ktor/client/plugins/logging/KtorMDCContext.posix.kt index 44ed24d4d55..8571a6315b1 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-logging/posix/src/io/ktor/client/plugins/logging/KtorMDCContext.posix.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-logging/posix/src/io/ktor/client/plugins/logging/KtorMDCContext.posix.kt @@ -7,6 +7,7 @@ package io.ktor.client.plugins.logging import io.ktor.utils.io.* import kotlin.coroutines.* +@Suppress("FunctionName") @InternalAPI public actual fun MDCContext(): CoroutineContext.Element = MDCContextElement diff --git a/ktor-http/common/test/io/ktor/tests/http/HttpStatusCodeTest.kt b/ktor-http/common/test/io/ktor/tests/http/HttpStatusCodeTest.kt index 46e047010a9..20c038baf35 100644 --- a/ktor-http/common/test/io/ktor/tests/http/HttpStatusCodeTest.kt +++ b/ktor-http/common/test/io/ktor/tests/http/HttpStatusCodeTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.http @@ -9,27 +9,27 @@ import kotlin.test.* class HttpStatusCodeTest { @Test - fun HttpStatusCodeAll() { + fun httpStatusCodeAll() { assertEquals(53, HttpStatusCode.allStatusCodes.size) } @Test - fun HttpStatusCodeFromValue() { + fun httpStatusCodeFromValue() { assertEquals(HttpStatusCode.NotFound, HttpStatusCode.fromValue(404)) } @Test - fun HttpStatusCodeConstructed() { + fun httpStatusCodeConstructed() { assertEquals(HttpStatusCode.NotFound, HttpStatusCode(404, "Not Found")) } @Test - fun HttpStatusCodeWithDescription() { + fun httpStatusCodeWithDescription() { assertEquals(HttpStatusCode.NotFound, HttpStatusCode.NotFound.description("Missing Resource")) } @Test - fun HttpStatusCodeToString() { + fun httpStatusCodeToString() { assertEquals("404 Not Found", HttpStatusCode.NotFound.toString()) } } diff --git a/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt b/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt index b7210eb90e8..ea4e3d4e428 100644 --- a/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt +++ b/ktor-io/common/src/io/ktor/utils/io/core/BytePacketBuilder.kt @@ -18,6 +18,7 @@ public typealias BytePacketBuilder = Sink @OptIn(InternalIoApi::class) public val Sink.size: Int get() = buffer.size.toInt() +@Suppress("FunctionName") public fun BytePacketBuilder(): Sink = kotlinx.io.Buffer() public fun Sink.append(value: CharSequence, startIndex: Int = 0, endIndex: Int = value.length) { diff --git a/ktor-network/androidNative/src/io/ktor/network/util/SocketUtils.androidNative.kt b/ktor-network/androidNative/src/io/ktor/network/util/SocketUtils.androidNative.kt index 5fc38c42575..d9afe21a9ee 100644 --- a/ktor-network/androidNative/src/io/ktor/network/util/SocketUtils.androidNative.kt +++ b/ktor-network/androidNative/src/io/ktor/network/util/SocketUtils.androidNative.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import io.ktor.network.interop.* diff --git a/ktor-network/androidNative32/src/SocketUtils.androidNative32.kt b/ktor-network/androidNative32/src/SocketUtils.androidNative32.kt index a513f2508b7..b78117d4237 100644 --- a/ktor-network/androidNative32/src/SocketUtils.androidNative32.kt +++ b/ktor-network/androidNative32/src/SocketUtils.androidNative32.kt @@ -2,13 +2,14 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* -import kotlinx.cinterop.ByteVar import platform.posix.* -@OptIn(UnsafeNumber::class, ExperimentalForeignApi::class) +@OptIn(ExperimentalForeignApi::class) internal actual fun ktor_recvfrom( __fd: Int, __buf: CValuesRef?, diff --git a/ktor-network/androidNative64/src/SocketUtils.androidNative64.kt b/ktor-network/androidNative64/src/SocketUtils.androidNative64.kt index 3bb52983ee4..eb229ebb639 100644 --- a/ktor-network/androidNative64/src/SocketUtils.androidNative64.kt +++ b/ktor-network/androidNative64/src/SocketUtils.androidNative64.kt @@ -2,14 +2,14 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* -import kotlinx.cinterop.ByteVar -import kotlinx.cinterop.convert import platform.posix.* -@OptIn(UnsafeNumber::class, ExperimentalForeignApi::class) +@OptIn(ExperimentalForeignApi::class) internal actual fun ktor_recvfrom( __fd: Int, __buf: CValuesRef?, diff --git a/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt b/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt index 245881ee1f3..ecae8d694fe 100644 --- a/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt +++ b/ktor-network/darwin/src/io/ktor/network/util/SocketUtils.darwin.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt b/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt index 2fe51947562..5a6a1e3caa3 100644 --- a/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt +++ b/ktor-network/ios/src/io/ktor/network/util/SocketUtilsIos.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/ktor-network-tls/jvm/src/io/ktor/network/tls/Hashes.kt b/ktor-network/ktor-network-tls/jvm/src/io/ktor/network/tls/Hashes.kt index 570edb438b4..e02853b133a 100644 --- a/ktor-network/ktor-network-tls/jvm/src/io/ktor/network/tls/Hashes.kt +++ b/ktor-network/ktor-network-tls/jvm/src/io/ktor/network/tls/Hashes.kt @@ -1,7 +1,9 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.tls import javax.crypto.* diff --git a/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt b/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt index e8c2d64d87e..d170233d516 100644 --- a/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt +++ b/ktor-network/ktor-network-tls/jvmAndPosix/src/io/ktor/network/tls/extensions/SignatureAlgorithm.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.network.tls.extensions @@ -74,7 +74,7 @@ public data class HashAndSign(val hash: HashAlgorithm, val sign: SignatureAlgori public companion object } -@Suppress("CONFLICTING_OVERLOADS") +@Suppress("CONFLICTING_OVERLOADS", "ktlint:standard:function-naming") internal fun HashAndSign(hashValue: Byte, signValue: Byte, oidValue: String? = null): HashAndSign? { val hash = HashAlgorithm.byCode(hashValue) val sign = SignatureAlgorithm.byCode(signValue) ?: return null diff --git a/ktor-network/linux/src/io/ktor/network/util/SocketUtils.linux.kt b/ktor-network/linux/src/io/ktor/network/util/SocketUtils.linux.kt index 4830261db76..10fb68d58ce 100644 --- a/ktor-network/linux/src/io/ktor/network/util/SocketUtils.linux.kt +++ b/ktor-network/linux/src/io/ktor/network/util/SocketUtils.linux.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt b/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt index 1768151b7bb..2e1004d6730 100644 --- a/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt +++ b/ktor-network/macos/src/io/ktor/network/util/SocketUtilsMacos.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/nix/src/io/ktor/network/util/SocketUtils.nix.kt b/ktor-network/nix/src/io/ktor/network/util/SocketUtils.nix.kt index fbce018be44..4730c749b7c 100644 --- a/ktor-network/nix/src/io/ktor/network/util/SocketUtils.nix.kt +++ b/ktor-network/nix/src/io/ktor/network/util/SocketUtils.nix.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/posix/src/io/ktor/network/util/SocketUtils.kt b/ktor-network/posix/src/io/ktor/network/util/SocketUtils.kt index afe694a670b..b62ac1c2b99 100644 --- a/ktor-network/posix/src/io/ktor/network/util/SocketUtils.kt +++ b/ktor-network/posix/src/io/ktor/network/util/SocketUtils.kt @@ -1,7 +1,9 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import io.ktor.utils.io.bits.* diff --git a/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt b/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt index f709a544351..1290cf499eb 100644 --- a/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt +++ b/ktor-network/tvos/src/io/ktor/network/util/SocketUtilsTvos.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt b/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt index 3837a950bd3..73925d11c41 100644 --- a/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt +++ b/ktor-network/watchos/src/io/ktor/network/util/SocketUtilsWatchos.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-network/windows/src/io/ktor/network/util/SocketUtilsWindows.kt b/ktor-network/windows/src/io/ktor/network/util/SocketUtilsWindows.kt index 01babff7ac9..df65f333fbd 100644 --- a/ktor-network/windows/src/io/ktor/network/util/SocketUtilsWindows.kt +++ b/ktor-network/windows/src/io/ktor/network/util/SocketUtilsWindows.kt @@ -2,6 +2,8 @@ * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ +@file:Suppress("FunctionName") + package io.ktor.network.util import kotlinx.cinterop.* diff --git a/ktor-server/ktor-server-config-yaml/jvm/src/io/ktor/server/config/yaml/YamlConfigJvm.kt b/ktor-server/ktor-server-config-yaml/jvm/src/io/ktor/server/config/yaml/YamlConfigJvm.kt index a86aaf08ff5..cb2b8f7945b 100644 --- a/ktor-server/ktor-server-config-yaml/jvm/src/io/ktor/server/config/yaml/YamlConfigJvm.kt +++ b/ktor-server/ktor-server-config-yaml/jvm/src/io/ktor/server/config/yaml/YamlConfigJvm.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.config.yaml @@ -13,6 +13,7 @@ import java.io.* * On JVM, loads a configuration from application resources, if exist; otherwise, reads a configuration from a file. * On Native, always reads a configuration from a file. */ +@Suppress("ktlint:standard:function-naming") public actual fun YamlConfig(path: String?): YamlConfig? { val resolvedPath = when { path == null -> DEFAULT_YAML_FILENAME diff --git a/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt b/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt index f02a9fa69bc..33106c618b3 100644 --- a/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt +++ b/ktor-server/ktor-server-config-yaml/jvmAndPosix/src/io/ktor/server/config/yaml/YamlConfig.kt @@ -28,6 +28,7 @@ public class YamlConfigLoader : ConfigLoader { * On JVM, loads a configuration from application resources, if exists; otherwise, reads a configuration from a file. * On Native, always reads a configuration from a file. */ +@Suppress("ktlint:standard:function-naming") public expect fun YamlConfig(path: String?): YamlConfig? /** diff --git a/ktor-server/ktor-server-config-yaml/posix/src/io/ktor/server/config/yaml/YamlConfigNix.kt b/ktor-server/ktor-server-config-yaml/posix/src/io/ktor/server/config/yaml/YamlConfigNix.kt index 642eeb3f657..a8216697bef 100644 --- a/ktor-server/ktor-server-config-yaml/posix/src/io/ktor/server/config/yaml/YamlConfigNix.kt +++ b/ktor-server/ktor-server-config-yaml/posix/src/io/ktor/server/config/yaml/YamlConfigNix.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.config.yaml @@ -16,7 +16,7 @@ private fun init() { addConfigLoader(YamlConfigLoader()) } -@Suppress("DEPRECATION") +@Suppress("DEPRECATION", "unused") @OptIn(ExperimentalStdlibApi::class) @EagerInitialization private val initHook = init() @@ -26,6 +26,7 @@ private val initHook = init() * On JVM, loads a configuration from application resources, if exist; otherwise, reads a configuration from a file. * On Native, always reads a configuration from a file. */ +@Suppress("ktlint:standard:function-naming") public actual fun YamlConfig(path: String?): YamlConfig? { val resolvedPath = when { path != null && path.endsWith(".yaml") -> path diff --git a/ktor-server/ktor-server-core/jvm/src/io/ktor/server/http/content/LocalFileContent.kt b/ktor-server/ktor-server-core/jvm/src/io/ktor/server/http/content/LocalFileContent.kt index c441d452572..abf59447551 100644 --- a/ktor-server/ktor-server-core/jvm/src/io/ktor/server/http/content/LocalFileContent.kt +++ b/ktor-server/ktor-server-core/jvm/src/io/ktor/server/http/content/LocalFileContent.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.http.content @@ -53,6 +53,7 @@ public fun LocalFileContent( /** * Creates an instance of [LocalPathContent] for a path designated by [relativePath] in a [baseDir] */ +@Suppress("FunctionName") @Deprecated( "Use LocalPathContent instead", ReplaceWith("LocalPathContent(baseDir, relativePath, contentType)", "io.ktor.server.http.content.LocalPathContent") diff --git a/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/MDCHook.kt b/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/MDCHook.kt index ddb745cf0ab..35d9310a375 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/MDCHook.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/MDCHook.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.calllogging @@ -9,6 +9,7 @@ import io.ktor.server.response.* import io.ktor.util.* import io.ktor.util.pipeline.* +@Suppress("FunctionName") internal fun MDCHook(phase: PipelinePhase) = object : Hook Unit) -> Unit> { override fun install( pipeline: ApplicationCallPipeline, diff --git a/ktor-server/ktor-server-plugins/ktor-server-websockets/common/test/io/ktor/tests/websocket/RawWebSocketTest.kt b/ktor-server/ktor-server-plugins/ktor-server-websockets/common/test/io/ktor/tests/websocket/RawWebSocketTest.kt index 21c4d4991bd..558102d089a 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-websockets/common/test/io/ktor/tests/websocket/RawWebSocketTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-websockets/common/test/io/ktor/tests/websocket/RawWebSocketTest.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.tests.websocket @@ -36,7 +36,7 @@ class RawWebSocketTest { } @AfterTest - fun _verifyErrors() { + fun verifyErrors() { if (errors.isEmpty()) return val error = IllegalStateException( diff --git a/ktor-utils/wasmJs/src/io/ktor/util/date/Date.kt b/ktor-utils/wasmJs/src/io/ktor/util/date/Date.kt index 0e522334124..25dc5097ee0 100644 --- a/ktor-utils/wasmJs/src/io/ktor/util/date/Date.kt +++ b/ktor-utils/wasmJs/src/io/ktor/util/date/Date.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.util.date @@ -27,6 +27,7 @@ internal external class Date() { fun getUTCSeconds(): Int companion object { + @Suppress("FunctionName") fun UTC(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int): Double } } From b4879c8db6d30ae5d88bf6b71a561e81fe505a42 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 13:39:28 +0100 Subject: [PATCH 09/11] Fix if-else-wrapping and if-else-bracing --- .../ktor/client/engine/cio/ConnectionPipeline.kt | 10 ++++++---- .../client/plugins/websocket/cio/buildersCio.kt | 6 ++++-- .../src/io/ktor/client/plugins/HttpRequestRetry.kt | 6 ++++-- .../io/ktor/client/plugins/websocket/builders.kt | 4 +++- .../darwin/internal/DarwinWebsocketSession.kt | 12 ++++++++---- .../io/ktor/tests/server/cio/IntegrationTest.kt | 7 +++++-- .../ktor/server/routing/RoutingResolveContext.kt | 6 ++++-- .../jvm/src/io/ktor/server/netty/CIO.kt | 6 ++++-- .../src/io/ktor/server/netty/NettyDirectEncoder.kt | 6 ++++-- .../common/src/io/ktor/server/auth/Principal.kt | 6 ++++-- .../common/src/io/ktor/server/auth/SessionAuth.kt | 6 ++++-- .../plugins/calllogging/CallLoggingConfig.kt | 6 ++++-- .../requestvalidation/RequestValidationTest.kt | 14 ++++++++++---- .../io/ktor/server/servlet/jakarta/AsyncServlet.kt | 6 ++++-- .../jvm/src/io/ktor/server/servlet/AsyncServlet.kt | 8 +++++--- .../testing/client/TestEngineWebsocketSession.kt | 6 ++++-- 16 files changed, 77 insertions(+), 38 deletions(-) diff --git a/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt b/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt index d5dd71348d5..0d75c9bb267 100644 --- a/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt +++ b/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/engine/cio/ConnectionPipeline.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.client.engine.cio @@ -18,7 +18,7 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.channels.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.sync.* -import kotlinx.io.EOFException +import kotlinx.io.* import java.nio.channels.* import kotlin.coroutines.* import io.ktor.utils.io.ByteChannel as KtorByteChannel @@ -107,7 +107,9 @@ internal actual class ConnectionPipeline actual constructor( val proxyChannel = KtorByteChannel() skipTask = skipCancels(responseChannel, proxyChannel) proxyChannel - } else ByteReadChannel.Empty + } else { + ByteReadChannel.Empty + } callJob.invokeOnCompletion { body.cancel() diff --git a/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/plugins/websocket/cio/buildersCio.kt b/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/plugins/websocket/cio/buildersCio.kt index 76aec2967b2..c3fd6d563ff 100644 --- a/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/plugins/websocket/cio/buildersCio.kt +++ b/ktor-client/ktor-client-cio/jvm/src/io/ktor/client/plugins/websocket/cio/buildersCio.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins.websocket.cio @@ -37,7 +37,9 @@ public suspend fun HttpClient.webSocketRawSession( session.outgoing.invokeOnClose { if (it != null) { sessionCompleted.completeExceptionally(it) - } else sessionCompleted.complete(Unit) + } else { + sessionCompleted.complete(Unit) + } } sessionCompleted.await() } diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpRequestRetry.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpRequestRetry.kt index 6644d8b3f08..b091d58b53b 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpRequestRetry.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpRequestRetry.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.plugins @@ -264,7 +264,9 @@ public val HttpRequestRetry: ClientPlugin = createClient val subRequestJob = subRequest.executionContext as CompletableJob if (cause == null) { subRequestJob.complete() - } else subRequestJob.completeExceptionally(cause) + } else { + subRequestJob.completeExceptionally(cause) + } } return subRequest } diff --git a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt index 8dbf76c5b81..12337c04fe6 100644 --- a/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt +++ b/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/websocket/builders.kt @@ -45,7 +45,9 @@ public suspend fun HttpClient.webSocketSession( session.outgoing.invokeOnClose { if (it != null) { sessionCompleted.completeExceptionally(it) - } else sessionCompleted.complete(Unit) + } else { + sessionCompleted.complete(Unit) + } } sessionCompleted.await() } diff --git a/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinWebsocketSession.kt b/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinWebsocketSession.kt index 00de3dc5093..5880c402c8d 100644 --- a/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinWebsocketSession.kt +++ b/ktor-client/ktor-client-darwin/darwin/src/io/ktor/client/engine/darwin/internal/DarwinWebsocketSession.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.darwin.internal @@ -100,17 +100,21 @@ internal class DarwinWebsocketSession( ) { error -> if (error == null) { continuation.resume(Unit) - } else continuation.resumeWithException(DarwinHttpRequestException(error)) + } else { + continuation.resumeWithException(DarwinHttpRequestException(error)) + } } } } FrameType.BINARY -> { - suspendCancellableCoroutine { continuation -> + suspendCancellableCoroutine { continuation -> task.sendMessage(NSURLSessionWebSocketMessage(frame.data.toNSData())) { error -> if (error == null) { continuation.resume(Unit) - } else continuation.resumeWithException(DarwinHttpRequestException(error)) + } else { + continuation.resumeWithException(DarwinHttpRequestException(error)) + } } } } diff --git a/ktor-server/ktor-server-cio/jvm/test/io/ktor/tests/server/cio/IntegrationTest.kt b/ktor-server/ktor-server-cio/jvm/test/io/ktor/tests/server/cio/IntegrationTest.kt index 925c6e7cfac..e8d7b991d39 100644 --- a/ktor-server/ktor-server-cio/jvm/test/io/ktor/tests/server/cio/IntegrationTest.kt +++ b/ktor-server/ktor-server-cio/jvm/test/io/ktor/tests/server/cio/IntegrationTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.tests.server.cio @@ -38,7 +38,10 @@ class IntegrationTest { s.invokeOnCompletion { t -> if (t != null) { server.completeExceptionally(t) - } else server.complete(@OptIn(ExperimentalCoroutinesApi::class) s.getCompleted()) + } else { + @OptIn(ExperimentalCoroutinesApi::class) + server.complete(s.getCompleted()) + } } j.invokeOnCompletion { diff --git a/ktor-server/ktor-server-core/common/src/io/ktor/server/routing/RoutingResolveContext.kt b/ktor-server/ktor-server-core/common/src/io/ktor/server/routing/RoutingResolveContext.kt index 3f638fcc923..8d26667ca37 100644 --- a/ktor-server/ktor-server-core/common/src/io/ktor/server/routing/RoutingResolveContext.kt +++ b/ktor-server/ktor-server-core/common/src/io/ktor/server/routing/RoutingResolveContext.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.routing @@ -187,7 +187,9 @@ public class RoutingResolveContext( val partQuality = if (part.quality == RouteSelectorEvaluation.qualityTransparent) { RouteSelectorEvaluation.qualityConstant - } else part.quality + } else { + part.quality + } quality = minOf(quality, partQuality) } diff --git a/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/CIO.kt b/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/CIO.kt index 54af222a316..ef6e390f842 100644 --- a/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/CIO.kt +++ b/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/CIO.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.netty @@ -33,7 +33,9 @@ public suspend fun Future.suspendAwait(): T { private val wrappingErrorHandler = { t: Throwable, c: Continuation<*> -> if (t is IOException) { c.resumeWithException(ChannelWriteException("Write operation future failed", t)) - } else c.resumeWithException(t) + } else { + c.resumeWithException(t) + } } /** diff --git a/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/NettyDirectEncoder.kt b/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/NettyDirectEncoder.kt index 0efe027fc05..21ac50dd28e 100644 --- a/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/NettyDirectEncoder.kt +++ b/ktor-server/ktor-server-netty/jvm/src/io/ktor/server/netty/NettyDirectEncoder.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.netty @@ -20,6 +20,8 @@ internal class NettyDirectEncoder : MessageToByteEncoder() { Unpooled.EMPTY_BUFFER } else if (preferDirect) { ctx.alloc().ioBuffer(size) - } else ctx.alloc().heapBuffer(size) + } else { + ctx.alloc().heapBuffer(size) + } } } diff --git a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/Principal.kt b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/Principal.kt index 9bfe75a99c0..240a5be8963 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/Principal.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/Principal.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.auth @@ -31,7 +31,9 @@ internal class CombinedPrincipal { .firstOrNull { (name, principal) -> if (provider != null) { name == provider && klass.isInstance(principal) - } else klass.isInstance(principal) + } else { + klass.isInstance(principal) + } }?.second as? T } diff --git a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/SessionAuth.kt b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/SessionAuth.kt index e9941e3fc97..8ad18b78764 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/SessionAuth.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-auth/common/src/io/ktor/server/auth/SessionAuth.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.auth @@ -38,7 +38,9 @@ public class SessionAuthenticationProvider private constructor( val cause = if (session == null) { AuthenticationFailedCause.NoCredentials - } else AuthenticationFailedCause.InvalidCredentials + } else { + AuthenticationFailedCause.InvalidCredentials + } @Suppress("NAME_SHADOWING") context.challenge(SessionAuthChallengeKey, cause) { challenge, call -> diff --git a/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/CallLoggingConfig.kt b/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/CallLoggingConfig.kt index 87100810ccb..354858456b8 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/CallLoggingConfig.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/calllogging/CallLoggingConfig.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.calllogging @@ -135,5 +135,7 @@ public class CallLoggingConfig { private fun colored(value: Any, color: Ansi.Color): String = if (isColorsEnabled) { Ansi.ansi().fg(color).a(value).reset().toString() - } else value.toString() // ignore color + } else { + value.toString() // ignore color + } } diff --git a/ktor-server/ktor-server-plugins/ktor-server-request-validation/common/test/io/ktor/server/plugins/requestvalidation/RequestValidationTest.kt b/ktor-server/ktor-server-plugins/ktor-server-request-validation/common/test/io/ktor/server/plugins/requestvalidation/RequestValidationTest.kt index a3b0f129442..f001df1c323 100644 --- a/ktor-server/ktor-server-plugins/ktor-server-request-validation/common/test/io/ktor/server/plugins/requestvalidation/RequestValidationTest.kt +++ b/ktor-server/ktor-server-plugins/ktor-server-request-validation/common/test/io/ktor/server/plugins/requestvalidation/RequestValidationTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.plugins.requestvalidation @@ -23,12 +23,16 @@ class RequestValidationTest { validate { if (!it.startsWith("+")) { ValidationResult.Invalid(listOf("$it should start with \"+\"")) - } else ValidationResult.Valid + } else { + ValidationResult.Valid + } } validate { if (!it.endsWith("!")) { ValidationResult.Invalid(listOf("$it should end with \"!\"")) - } else ValidationResult.Valid + } else { + ValidationResult.Valid + } } } install(StatusPages) { @@ -96,7 +100,9 @@ class RequestValidationTest { val intValue = it.decodeToString(0, 0 + it.size).toInt() if (intValue < 0) { ValidationResult.Invalid("Value is negative") - } else ValidationResult.Valid + } else { + ValidationResult.Valid + } } } } diff --git a/ktor-server/ktor-server-servlet-jakarta/jvm/src/io/ktor/server/servlet/jakarta/AsyncServlet.kt b/ktor-server/ktor-server-servlet-jakarta/jvm/src/io/ktor/server/servlet/jakarta/AsyncServlet.kt index 10da3669163..aa0b5a815d8 100644 --- a/ktor-server/ktor-server-servlet-jakarta/jvm/src/io/ktor/server/servlet/jakarta/AsyncServlet.kt +++ b/ktor-server/ktor-server-servlet-jakarta/jvm/src/io/ktor/server/servlet/jakarta/AsyncServlet.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.servlet.jakarta @@ -64,7 +64,9 @@ public class AsyncServletApplicationRequest( if (!upgraded) { val contentLength = servletRequest.contentLength servletReader(servletRequest.inputStream, contentLength).channel - } else ByteReadChannel.Empty + } else { + ByteReadChannel.Empty + } } override val engineReceiveChannel: ByteReadChannel get() = inputStreamChannel diff --git a/ktor-server/ktor-server-servlet/jvm/src/io/ktor/server/servlet/AsyncServlet.kt b/ktor-server/ktor-server-servlet/jvm/src/io/ktor/server/servlet/AsyncServlet.kt index de5daf34bfa..df6447c9713 100644 --- a/ktor-server/ktor-server-servlet/jvm/src/io/ktor/server/servlet/AsyncServlet.kt +++ b/ktor-server/ktor-server-servlet/jvm/src/io/ktor/server/servlet/AsyncServlet.kt @@ -1,6 +1,6 @@ /* -* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. -*/ + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ package io.ktor.server.servlet @@ -64,7 +64,9 @@ public class AsyncServletApplicationRequest( if (!upgraded) { val contentLength = servletRequest.contentLength servletReader(servletRequest.inputStream, contentLength).channel - } else ByteReadChannel.Empty + } else { + ByteReadChannel.Empty + } } override val engineReceiveChannel: ByteReadChannel get() = inputStreamChannel diff --git a/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestEngineWebsocketSession.kt b/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestEngineWebsocketSession.kt index 8a0234194a3..29ef02c0d07 100644 --- a/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestEngineWebsocketSession.kt +++ b/ktor-server/ktor-server-test-host/jvm/src/io/ktor/server/testing/client/TestEngineWebsocketSession.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.testing.client @@ -33,7 +33,9 @@ internal class TestEngineWebsocketSession( outgoing.invokeOnClose { if (it != null) { socketJob.completeExceptionally(it) - } else socketJob.complete() + } else { + socketJob.complete() + } } socketJob.join() } From d455c8fef4b16401c5f45e3c12572820628656c5 Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 13:45:22 +0100 Subject: [PATCH 10/11] Fix no-empty-file --- buildSrc/src/main/kotlin/KotlinExtensions.kt | 12 +----------- buildSrc/src/main/kotlin/TargetsConfig.kt | 10 ++-------- .../ktor-client-js/js/.gitkeep | 0 ktor-client/ktor-client-js/js/src/Js.kt | 3 --- .../ktor-client-js/wasmJs/.gitkeep | 0 ktor-client/ktor-client-js/wasmJs/src/Wasm.kt | 3 --- 6 files changed, 3 insertions(+), 25 deletions(-) rename ktor-server/ktor-server-tests/jvmAndNix/test/io/ktor/tests/server/plugins/CORSTest.kt => ktor-client/ktor-client-js/js/.gitkeep (100%) delete mode 100644 ktor-client/ktor-client-js/js/src/Js.kt rename ktor-utils/jsAndWasmShared/test/io.ktor.util/KtorSimpleLoggerTest.kt => ktor-client/ktor-client-js/wasmJs/.gitkeep (100%) delete mode 100644 ktor-client/ktor-client-js/wasmJs/src/Wasm.kt diff --git a/buildSrc/src/main/kotlin/KotlinExtensions.kt b/buildSrc/src/main/kotlin/KotlinExtensions.kt index 610463b7f20..72c6def8fb1 100644 --- a/buildSrc/src/main/kotlin/KotlinExtensions.kt +++ b/buildSrc/src/main/kotlin/KotlinExtensions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ import org.gradle.api.* import org.gradle.kotlin.dsl.* @@ -47,16 +47,6 @@ fun NamedDomainObjectContainer.jvmAndPosixTest(block: KotlinSou block(sourceSet) } -fun NamedDomainObjectContainer.jvmAndNixMain(block: KotlinSourceSet.() -> Unit) { - val sourceSet = findByName("jvmAndNixMain") ?: getByName("jvmMain") - block(sourceSet) -} - -fun NamedDomainObjectContainer.jvmAndNixTest(block: KotlinSourceSet.() -> Unit) { - val sourceSet = findByName("jvmAndNixTest") ?: getByName("jvmTest") - block(sourceSet) -} - fun NamedDomainObjectContainer.nixTest(block: KotlinSourceSet.() -> Unit) { val sourceSet = findByName("nixTest") ?: return block(sourceSet) diff --git a/buildSrc/src/main/kotlin/TargetsConfig.kt b/buildSrc/src/main/kotlin/TargetsConfig.kt index d82cb47dfe3..2293c5b70f8 100644 --- a/buildSrc/src/main/kotlin/TargetsConfig.kt +++ b/buildSrc/src/main/kotlin/TargetsConfig.kt @@ -15,10 +15,9 @@ import java.io.* private val Project.files: Array get() = project.projectDir.listFiles() ?: emptyArray() val Project.hasCommon: Boolean get() = files.any { it.name == "common" } val Project.hasJvmAndPosix: Boolean get() = hasCommon || files.any { it.name == "jvmAndPosix" } -val Project.hasJvmAndNix: Boolean get() = hasCommon || files.any { it.name == "jvmAndNix" } val Project.hasPosix: Boolean get() = hasCommon || hasJvmAndPosix || files.any { it.name == "posix" } val Project.hasDesktop: Boolean get() = hasPosix || files.any { it.name == "desktop" } -val Project.hasNix: Boolean get() = hasPosix || hasJvmAndNix || files.any { it.name == "nix" } +val Project.hasNix: Boolean get() = hasPosix || files.any { it.name == "nix" } val Project.hasLinux: Boolean get() = hasNix || files.any { it.name == "linux" } val Project.hasDarwin: Boolean get() = hasNix || files.any { it.name == "darwin" } val Project.hasAndroidNative: Boolean get() = hasPosix || files.any { it.name == "androidNative" } @@ -26,7 +25,7 @@ val Project.hasWindows: Boolean get() = hasPosix || files.any { it.name == "wind val Project.hasJsAndWasmShared: Boolean get() = files.any { it.name == "jsAndWasmShared" } val Project.hasJs: Boolean get() = hasCommon || files.any { it.name == "js" } || hasJsAndWasmShared val Project.hasWasmJs: Boolean get() = hasCommon || files.any { it.name == "wasmJs" } || hasJsAndWasmShared -val Project.hasJvm: Boolean get() = hasCommon || hasJvmAndNix || hasJvmAndPosix || files.any { it.name == "jvm" } +val Project.hasJvm: Boolean get() = hasCommon || hasJvmAndPosix || files.any { it.name == "jvm" } val Project.hasExplicitNative: Boolean get() = hasNix || hasPosix || hasLinux || hasAndroidNative || hasDarwin || hasDesktop || hasWindows @@ -110,11 +109,6 @@ private val hierarchyTemplate = KotlinHierarchyTemplate { group("posix") } - group("jvmAndNix") { - withJvm() - group("nix") - } - group("desktop") { group("linux") group("windows") diff --git a/ktor-server/ktor-server-tests/jvmAndNix/test/io/ktor/tests/server/plugins/CORSTest.kt b/ktor-client/ktor-client-js/js/.gitkeep similarity index 100% rename from ktor-server/ktor-server-tests/jvmAndNix/test/io/ktor/tests/server/plugins/CORSTest.kt rename to ktor-client/ktor-client-js/js/.gitkeep diff --git a/ktor-client/ktor-client-js/js/src/Js.kt b/ktor-client/ktor-client-js/js/src/Js.kt deleted file mode 100644 index 9d9ed90fbfa..00000000000 --- a/ktor-client/ktor-client-js/js/src/Js.kt +++ /dev/null @@ -1,3 +0,0 @@ -/* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ diff --git a/ktor-utils/jsAndWasmShared/test/io.ktor.util/KtorSimpleLoggerTest.kt b/ktor-client/ktor-client-js/wasmJs/.gitkeep similarity index 100% rename from ktor-utils/jsAndWasmShared/test/io.ktor.util/KtorSimpleLoggerTest.kt rename to ktor-client/ktor-client-js/wasmJs/.gitkeep diff --git a/ktor-client/ktor-client-js/wasmJs/src/Wasm.kt b/ktor-client/ktor-client-js/wasmJs/src/Wasm.kt deleted file mode 100644 index e88e11fb9d9..00000000000 --- a/ktor-client/ktor-client-js/wasmJs/src/Wasm.kt +++ /dev/null @@ -1,3 +0,0 @@ -/* - * Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ From 60befa67288d1a8c7387f66f70ed1cd6d5fd877a Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Tue, 19 Nov 2024 14:17:02 +0100 Subject: [PATCH 11/11] Fix try-catch-finally-spacing --- .../io/ktor/client/engine/cio/ConnectErrorsTest.kt | 6 +++--- .../io/ktor/client/tests/plugins/WebSocketTest.kt | 5 +++-- .../src/io/ktor/server/cio/backend/ServerPipeline.kt | 11 ++++++----- .../test/base/EngineTestBase.jsAndWasmShared.kt | 2 +- .../src/io/ktor/server/test/base/EngineTestBaseJvm.kt | 2 +- .../src/io/ktor/server/test/base/EngineTestBaseNix.kt | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/ConnectErrorsTest.kt b/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/ConnectErrorsTest.kt index a401f5703e7..33911cbe0e4 100644 --- a/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/ConnectErrorsTest.kt +++ b/ktor-client/ktor-client-cio/jvm/test/io/ktor/client/engine/cio/ConnectErrorsTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.engine.cio @@ -18,7 +18,6 @@ import io.ktor.server.engine.* import io.ktor.server.netty.* import io.ktor.server.response.* import io.ktor.server.routing.* -import io.ktor.utils.io.* import kotlinx.coroutines.* import kotlinx.coroutines.debug.junit5.* import org.junit.jupiter.api.extension.* @@ -102,7 +101,8 @@ class ConnectErrorsTest { } client.getInputStream().readBytes() } - } catch (_: Exception) { } + } catch (_: Exception) { + } } assertEquals("OK", client.get("http://localhost:${serverSocket.localPort}/").body()) thread.join() diff --git a/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketTest.kt b/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketTest.kt index fa39d86ba80..2e15d5f5843 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketTest.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-websockets/common/test/io/ktor/client/tests/plugins/WebSocketTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.client.tests.plugins @@ -34,7 +34,8 @@ class WebSocketTest { path = "/websocket" ) { } - } catch (_: Throwable) {} + } catch (_: Throwable) { + } assertEquals(443, port) } diff --git a/ktor-server/ktor-server-cio/jvmAndPosix/src/io/ktor/server/cio/backend/ServerPipeline.kt b/ktor-server/ktor-server-cio/jvmAndPosix/src/io/ktor/server/cio/backend/ServerPipeline.kt index 678d9dabd11..7ab47ceed65 100644 --- a/ktor-server/ktor-server-cio/jvmAndPosix/src/io/ktor/server/cio/backend/ServerPipeline.kt +++ b/ktor-server/ktor-server-cio/jvmAndPosix/src/io/ktor/server/cio/backend/ServerPipeline.kt @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.server.cio.backend @@ -12,11 +12,10 @@ import io.ktor.util.cio.* import io.ktor.utils.io.* import io.ktor.utils.io.charsets.* import io.ktor.utils.io.core.* -import io.ktor.utils.io.errors.* import kotlinx.coroutines.* import kotlinx.coroutines.CancellationException import kotlinx.coroutines.channels.* -import kotlinx.io.IOException +import kotlinx.io.* import kotlin.time.* /** @@ -64,7 +63,8 @@ public fun CoroutineScope.startServerConnectionPipeline( throw io } catch (cancelled: CancellationException) { throw cancelled - } catch (parseFailed: Throwable) { // try to write 400 Bad Request + } catch (parseFailed: Throwable) { + // try to write 400 Bad Request respondBadRequest(actorChannel) break // end pipeline loop } @@ -176,7 +176,8 @@ public fun CoroutineScope.startServerConnectionPipeline( if (isLastHttpRequest(version, connectionOptions)) break } - } catch (cause: IOException) { // already handled + } catch (cause: IOException) { + // already handled coroutineContext.cancel() } finally { actorChannel.close() diff --git a/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt b/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt index e3f1e9140ad..c688ed37db0 100644 --- a/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt +++ b/ktor-server/ktor-server-test-base/jsAndWasmShared/src/io/ktor/server/test/base/EngineTestBase.jsAndWasmShared.kt @@ -110,7 +110,7 @@ actual constructor( starting.join() @OptIn(ExperimentalCoroutinesApi::class) starting.getCompletionExceptionOrNull()?.let { listOf(it) } ?: emptyList() - } catch (t: Throwable) { // InterruptedException? + } catch (t: Throwable) { starting.cancel() listOf(t) } diff --git a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt index 9d14a47bbd4..86aef1f6bca 100644 --- a/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt +++ b/ktor-server/ktor-server-test-base/jvm/src/io/ktor/server/test/base/EngineTestBaseJvm.kt @@ -216,7 +216,7 @@ actual abstract class EngineTestBase< starting.join() @OptIn(ExperimentalCoroutinesApi::class) starting.getCompletionExceptionOrNull()?.let { listOf(it) } ?: emptyList() - } catch (t: Throwable) { // InterruptedException? + } catch (t: Throwable) { starting.cancel() listOf(t) } diff --git a/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt b/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt index a2323d849fa..6e8967fe3ce 100644 --- a/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt +++ b/ktor-server/ktor-server-test-base/posix/src/io/ktor/server/test/base/EngineTestBaseNix.kt @@ -121,7 +121,7 @@ actual constructor( starting.join() @OptIn(ExperimentalCoroutinesApi::class) starting.getCompletionExceptionOrNull()?.let { listOf(it) } ?: emptyList() - } catch (t: Throwable) { // InterruptedException? + } catch (t: Throwable) { starting.cancel() listOf(t) }