-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
swiftlang/swift-java
#416Description
Steps to reproduce:
- Download the project and follow the install instructions
- Make sure
hello-swift-java-hashing-appbuilds successfully on Android Studio - Add the following code
public enum CustomerSupportStoreAction: Sendable {
case fetchProfile
case setAccountName(String)
}OR
public struct CustomerSupportState: Sendable {
public var accountTierName: String?
public var priorityTierColor: String?
public var isLoggedIn: Bool
public init(accountTierName: String?, priorityTierColor: String?, isLoggedIn: Bool) {
self.accountTierName = accountTierName
self.priorityTierColor = priorityTierColor
self.isLoggedIn = isLoggedIn
}
}- Delete the folder
.buildinsidehashing-libotherwise Android studio won't pick up the swift changes - Build
hello-swift-java-hashing-appagain from Android Studio
The following error is thrown
[700/703] Compiling SwiftHashing SwiftHashing+SwiftJava.swift
/Users/gregorio/Downloads/swift-android-examples-main/hello-swift-java/hashing-lib/.build/plugins/outputs/hashing-lib/SwiftHashing/destination/JExtractSwiftPlugin/Sources/SwiftHashing+SwiftJava.swift:63:10: error: failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
61 | let method$ = _JNIMethodIDCache.Method(name: "<init>", signature: "(Ljava/lang/String;)V")
62 | let constructorID$ = cache$[method$]
63 | return withVaList([_0.getJNIValue(in: environment!) ?? 0]) {
| `- error: failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
64 | return environment.interface.NewObjectV(environment, class$, constructorID$, $0)
65 | }The function where the error is reported
@_cdecl("Java_com_example_swifthashing_CustomerSupportStoreAction__00024getAsSetProfile__J")
func Java_com_example_swifthashing_CustomerSupportStoreAction__00024getAsSetProfile__J(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, self: jlong) -> jobject? {
assert(self != 0, "self memory address was null")
let selfBits$ = Int(Int64(fromJNI: self, in: environment!))
let self$ = UnsafeMutablePointer<CustomerSupportStoreAction>(bitPattern: selfBits$)
guard let self$ else {
fatalError("self memory address was null in call to \(#function)!")
}
guard case .setProfile(let _0) = self$.pointee else {
fatalError("Expected enum case 'setProfile', but was '\(self$.pointee)'!")
}
let cache$ = _JNI_CustomerSupportStoreAction.customerSupportStoreActionSetProfileCache
let class$ = cache$.javaClass
let method$ = _JNIMethodIDCache.Method(name: "<init>", signature: "(Ljava/lang/String;)V")
let constructorID$ = cache$[method$]
return withVaList([_0.getJNIValue(in: environment!) ?? 0]) {
return environment.interface.NewObjectV(environment, class$, constructorID$, $0)
}
} // printCDecl(_:javaMethodName:parentName:parameters:resultType:_:) @ JExtractSwiftLib/JNISwift2JavaGenerator+SwiftThunkPrinting.swift:439Metadata
Metadata
Assignees
Labels
No labels