File tree Expand file tree Collapse file tree 2 files changed +38
-27
lines changed Expand file tree Collapse file tree 2 files changed +38
-27
lines changed 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) 2025 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
+ import JavaTypes
16
+
17
+ extension JavaType {
18
+ var jniTypeSignature : String {
19
+ switch self {
20
+ case . boolean: " Z "
21
+ case . byte: " B "
22
+ case . char: " C "
23
+ case . short: " S "
24
+ case . int: " I "
25
+ case . long: " J "
26
+ case . float: " F "
27
+ case . double: " D "
28
+ case . class( let package , let name) :
29
+ if let package {
30
+ " L \( package . replacingOccurrences ( of: " . " , with: " / " ) ) / \( name) ; "
31
+ } else {
32
+ " L \( name) ; "
33
+ }
34
+ case . array( let javaType) : " [ \( javaType. jniTypeSignature) "
35
+ case . void: fatalError ( " There is no type signature for 'void' " )
36
+ }
37
+ }
38
+ }
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- #if canImport(FoundationEssentials)
16
- import FoundationEssentials
17
- #else
18
- import Foundation
19
- #endif
20
-
21
15
extension JavaType {
22
16
/// Map this Java type to the appropriate JNI type name.
23
17
package var jniTypeName : String {
@@ -63,25 +57,4 @@ extension JavaType {
63
57
case . void: fatalError ( " There is no field name for 'void' " )
64
58
}
65
59
}
66
-
67
- package var jniTypeSignature : String {
68
- switch self {
69
- case . boolean: " Z "
70
- case . byte: " B "
71
- case . char: " C "
72
- case . short: " S "
73
- case . int: " I "
74
- case . long: " J "
75
- case . float: " F "
76
- case . double: " D "
77
- case . class( let package , let name) :
78
- if let package {
79
- " L \( package . replacingOccurrences ( of: " . " , with: " / " ) ) / \( name) ; "
80
- } else {
81
- " L \( name) ; "
82
- }
83
- case . array( let javaType) : " [ \( javaType. jniTypeSignature) "
84
- case . void: fatalError ( " There is no type signature for 'void' " )
85
- }
86
- }
87
60
}
You can’t perform that action at this time.
0 commit comments