Commit af7a094
authored
Avoid ObjC runtime warnings about duplicate class definitions for Serializer type (#1444)
This is a workaround meant to avoid Objective-C runtime warnings about
duplicate classes stemming from our internal `Serializer` type which was
added in #1390.
### Motivation:
In some usage scenarios there can be two or more copies of the testing
library loaded into a runner process. When this happens on platforms
such as Darwin which use the Objective-C runtime, this can cause
duplicate class definition warnings logged to the console because class
types and (non-generic) actor types are implemented within the
Objective-C runtime as classes. This can look something like the
following:
> objc[44611]: Class _TtC7Testing10Serializer is implemented in both
../path/to/libTesting.dylib (0x1011ac050) and
path/to/swift-testing/.build/arm64-apple-macosx/debug/swift-testingPackageTests.xctest/Contents/MacOS/swift-testingPackageTests
(0x10cc3ab88). This may cause spurious casting failures and mysterious
crashes. One of the duplicates must be removed or renamed.
### Modifications:
I considered several potential fixes, but decided the simplest and most
likely to work in all usage scenarios is to make the `Serializer` type
generic by adding an unused generic type parameter `T`.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.1 parent 56c2ad0 commit af7a094
2 files changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | | - | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
0 commit comments