Skip to content

Commit 17427b6

Browse files
committed
(113200224) JSON/PropertyList coders userInfo should require Sendable values
1 parent 2f4f5b8 commit 17427b6

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

Sources/FoundationEssentials/JSON/JSONDecoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ open class JSONDecoder {
257257
}
258258

259259
/// Contextual user-provided information for use during decoding.
260-
open var userInfo: [CodingUserInfoKey : Any] {
260+
@preconcurrency
261+
open var userInfo: [CodingUserInfoKey : any Sendable] {
261262
get {
262263
optionsLock.lock()
263264
defer { optionsLock.unlock() }
@@ -309,7 +310,7 @@ open class JSONDecoder {
309310
var dataDecodingStrategy: DataDecodingStrategy = .base64
310311
var nonConformingFloatDecodingStrategy: NonConformingFloatDecodingStrategy = .throw
311312
var keyDecodingStrategy: KeyDecodingStrategy = .useDefaultKeys
312-
var userInfo: [CodingUserInfoKey : Any] = [:]
313+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
313314
var json5: Bool = false
314315
}
315316

Sources/FoundationEssentials/JSON/JSONEncoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ open class JSONEncoder {
295295
}
296296

297297
/// Contextual user-provided information for use during encoding.
298-
open var userInfo: [CodingUserInfoKey : Any] {
298+
@preconcurrency
299+
open var userInfo: [CodingUserInfoKey : any Sendable] {
299300
get {
300301
optionsLock.lock()
301302
defer { optionsLock.unlock() }
@@ -324,7 +325,7 @@ open class JSONEncoder {
324325
var dataEncodingStrategy: DataEncodingStrategy = .base64
325326
var nonConformingFloatEncodingStrategy: NonConformingFloatEncodingStrategy = .throw
326327
var keyEncodingStrategy: KeyEncodingStrategy = .useDefaultKeys
327-
var userInfo: [CodingUserInfoKey : Any] = [:]
328+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
328329
}
329330

330331
/// The options set on the top-level encoder.

Sources/FoundationEssentials/PropertyList/PlistDecoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ open class PropertyListDecoder {
3838
// MARK: Options
3939

4040
/// Contextual user-provided information for use during decoding.
41-
open var userInfo: [CodingUserInfoKey : Any] {
41+
@preconcurrency
42+
open var userInfo: [CodingUserInfoKey : any Sendable] {
4243
get {
4344
optionsLock.lock()
4445
defer { optionsLock.unlock() }
@@ -62,7 +63,7 @@ open class PropertyListDecoder {
6263

6364
/// Options set on the top-level encoder to pass down the decoding hierarchy.
6465
internal struct _Options {
65-
var userInfo: [CodingUserInfoKey : Any] = [:]
66+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
6667
}
6768

6869
/// The options set on the top-level decoder.

Sources/FoundationEssentials/PropertyList/PlistEncoder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ open class PropertyListEncoder {
5151
}
5252

5353
/// Contextual user-provided information for use during encoding.
54-
open var userInfo: [CodingUserInfoKey : Any] {
54+
@preconcurrency
55+
open var userInfo: [CodingUserInfoKey : any Sendable] {
5556
get {
5657
optionsLock.lock()
5758
defer { optionsLock.unlock() }
@@ -76,7 +77,7 @@ open class PropertyListEncoder {
7677
/// Options set on the top-level encoder to pass down the encoding hierarchy.
7778
internal struct _Options {
7879
var outputFormat: PropertyListDecoder.PropertyListFormat = .binary
79-
var userInfo: [CodingUserInfoKey : Any] = [:]
80+
var userInfo: [CodingUserInfoKey : any Sendable] = [:]
8081
}
8182

8283
/// The options set on the top-level encoder.

0 commit comments

Comments
 (0)