From 3d4101a720880ffd193a1c0fc67188d8b342f396 Mon Sep 17 00:00:00 2001 From: Jo Date: Mon, 2 Mar 2026 11:39:32 +0200 Subject: [PATCH] [Swift6] Fix TSan race condition in Swift6 SynchronizedDictionary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem SynchronizedDictionary is a struct held as a var property on shared singleton classes (URLSessionRequestBuilderConfiguration and AlamofireRequestBuilderConfiguration). When multiple concurrent network requests mutate credentialStore or managerStore from different threads, Swift's memory exclusivity rules treat each subscript mutation as a modifying access to the entire struct — causing a real ThreadSanitizer "Swift access race". Changes struct → class (SynchronizedDictionary.mustache + 13 sample files) Changing SynchronizedDictionary from a value type to a reference type makes mutations go through pointer indirection. Concurrent subscript writes now only touch the object's internal state (already protected by NSRecursiveLock), rather than triggering a modifying access on the owning class's stored property. var → let (URLSessionImplementations.mustache + 11 sample files, AlamofireImplementations.mustache + 2 sample files) Since SynchronizedDictionary is now a class, the properties credentialStore and managerStore only need to hold a stable reference — they never get reassigned. Declaring them as let makes this intent explicit and prevents any residual exclusivity issues on the property itself. --- .../src/main/resources/swift6/SynchronizedDictionary.mustache | 2 +- .../libraries/alamofire/AlamofireImplementations.mustache | 2 +- .../libraries/urlsession/URLSessionImplementations.mustache | 2 +- .../Infrastructure/AlamofireImplementations.swift | 2 +- .../PetstoreClient/Infrastructure/SynchronizedDictionary.swift | 2 +- .../Infrastructure/AlamofireImplementations.swift | 2 +- .../PetstoreClient/Infrastructure/SynchronizedDictionary.swift | 2 +- .../PetstoreClient/Infrastructure/SynchronizedDictionary.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/SynchronizedDictionary.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../CombineLibrary/Infrastructure/SynchronizedDictionary.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../PetstoreClient/Infrastructure/SynchronizedDictionary.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../PetstoreClient/Infrastructure/SynchronizedDictionary.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/SynchronizedDictionary.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/SynchronizedDictionary.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/SynchronizedDictionary.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/SynchronizedDictionary.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../PetstoreClient/Infrastructure/SynchronizedDictionary.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/SynchronizedDictionary.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift6/SynchronizedDictionary.mustache b/modules/openapi-generator/src/main/resources/swift6/SynchronizedDictionary.mustache index 24a1f3224a19..0d2714ca7b02 100644 --- a/modules/openapi-generator/src/main/resources/swift6/SynchronizedDictionary.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/SynchronizedDictionary.mustache @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache index a92eb8c13add..a5c62c80203d 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/alamofire/AlamofireImplementations.mustache @@ -24,7 +24,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { static let shared = AlamofireRequestBuilderConfiguration() // Store manager to retain its reference - var managerStore = SynchronizedDictionary() + let managerStore = SynchronizedDictionary() } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache index 59b4aecbedd2..6ff9328dd7c8 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift index 1efeb37227d1..331acf68cb07 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -24,7 +24,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { static let shared = AlamofireRequestBuilderConfiguration() // Store manager to retain its reference - var managerStore = SynchronizedDictionary() + let managerStore = SynchronizedDictionary() } open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift index 1efeb37227d1..331acf68cb07 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/AlamofireImplementations.swift @@ -24,7 +24,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable { static let shared = AlamofireRequestBuilderConfiguration() // Store manager to retain its reference - var managerStore = SynchronizedDictionary() + let managerStore = SynchronizedDictionary() } open class AlamofireRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 53841c2b711f..04303b9a0237 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift index 24a1f3224a19..0d2714ca7b02 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/SynchronizedDictionary.swift @@ -6,7 +6,7 @@ import Foundation -internal struct SynchronizedDictionary : @unchecked Sendable { +internal class SynchronizedDictionary : @unchecked Sendable { private var dictionary = [K: V]() private let lock = NSRecursiveLock() diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 30cff02eb977..d6f1ac09c429 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -66,7 +66,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { let defaultURLSession: URLSession // Store current URLCredential for every URLSessionTask - var credentialStore = SynchronizedDictionary() + let credentialStore = SynchronizedDictionary() } open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable {