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 @@ -76,6 +76,9 @@ extension HelloSwift: HelloSwiftNativeMethods {
7676 print ( " Caught Java error: \( error) " )
7777 }
7878
79+ // Make sure that the thread safe class is sendable
80+ let threadSafe : Sendable = ThreadSafeHelperClass ( environment: javaEnvironment)
81+
7982 return i * j
8083 }
8184
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+ }
Original file line number Diff line number Diff line change 22 "classes" : {
33 "com.example.swift.HelloSwift" : "HelloSwift",
44 "com.example.swift.HelloSubclass" : "HelloSubclass",
5- "com.example.swift.JavaKitSampleMain" : "JavaKitSampleMain"
5+ "com.example.swift.JavaKitSampleMain" : "JavaKitSampleMain",
6+ "com.example.swift.ThreadSafeHelperClass" : "ThreadSafeHelperClass"
67 }
78}
You can’t perform that action at this time.
0 commit comments