File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed
Samples/JavaKitSampleApp/Sources/JavaKitExample Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 2
2
"classes" : {
3
3
"com.example.swift.HelloSwift" : "HelloSwift",
4
4
"com.example.swift.HelloSubclass" : "HelloSubclass",
5
- "com.example.swift.JavaKitSampleMain" : "JavaKitSampleMain"
5
+ "com.example.swift.JavaKitSampleMain" : "JavaKitSampleMain",
6
+ "com.example.swift.ThreadSafeHelperClass" : "ThreadSafeHelperClass"
6
7
}
7
8
}
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ extension HelloSwift: HelloSwiftNativeMethods {
76
76
print ( " Caught Java error: \( error) " )
77
77
}
78
78
79
+ // Make sure that the thread safe class is sendable
80
+ let threadSafe : Sendable = ThreadSafeHelperClass ( environment: javaEnvironment)
81
+
79
82
return i * j
80
83
}
81
84
Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
6
+ // Licensed under Apache License v2.0
7
+ //
8
+ // See LICENSE.txt for license information
9
+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10
+ //
11
+ // SPDX-License-Identifier: Apache-2.0
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+
15
+ package com .example .swift ;
16
+
17
+ import java .lang .annotation .Retention ;
18
+ import java .lang .annotation .RetentionPolicy ;
19
+
20
+ @ Retention (RetentionPolicy .RUNTIME )
21
+ public @interface ThreadSafe {
22
+ }
Original file line number Diff line number Diff line change
1
+ package com .example .swift ;
2
+
3
+ @ ThreadSafe
4
+ public class ThreadSafeHelperClass {
5
+ public ThreadSafeHelperClass () { }
6
+ }
You can’t perform that action at this time.
0 commit comments