From 61a8d21f11174b68cebf9a9f4604268557c7c42a Mon Sep 17 00:00:00 2001 From: Ben Dean-Kawamura Date: Thu, 18 May 2023 20:01:40 -0400 Subject: [PATCH] Kotlin: Add an upper-bound for UniFfiHandleMap Without this a user could pass a null value, which isn't correct. This prevents compiler errors when I try to use the new UniFFI version with application-services. --- uniffi_bindgen/src/bindings/kotlin/templates/Helpers.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uniffi_bindgen/src/bindings/kotlin/templates/Helpers.kt b/uniffi_bindgen/src/bindings/kotlin/templates/Helpers.kt index c928564a0b..77648ddcd3 100644 --- a/uniffi_bindgen/src/bindings/kotlin/templates/Helpers.kt +++ b/uniffi_bindgen/src/bindings/kotlin/templates/Helpers.kt @@ -127,7 +127,7 @@ public class USize(value: Long = 0) : IntegerType(Native.SIZE_T_SIZE, value, tru // Rust when it needs an opaque pointer. // // TODO: refactor callbacks to use this class -internal class UniFfiHandleMap { +internal class UniFfiHandleMap { private val map = ConcurrentHashMap() // Use AtomicInteger for our counter, since we may be on a 32-bit system. 4 billion possible // values seems like enough. If somehow we generate 4 billion handles, then this will wrap