From 8dd5d45f2845ca614e11453ebea95973cdae1e81 Mon Sep 17 00:00:00 2001 From: Edoardo Luppi Date: Mon, 2 Sep 2024 15:06:12 +0200 Subject: [PATCH] refactor: make WeakHashMap internal --- .../kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt | 2 +- .../kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt | 4 ++-- .../kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt | 4 ++-- .../kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt | 4 ++-- .../kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/antlr-kotlin-runtime/src/commonMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt b/antlr-kotlin-runtime/src/commonMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt index 6325641f..faf38fb9 100644 --- a/antlr-kotlin-runtime/src/commonMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt +++ b/antlr-kotlin-runtime/src/commonMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt @@ -2,7 +2,7 @@ // Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause. package com.strumenta.antlrkotlin.runtime -public expect class WeakHashMap() : MutableMap { +internal expect class WeakHashMap() : MutableMap { override val size: Int override val entries: MutableSet> override val keys: MutableSet diff --git a/antlr-kotlin-runtime/src/jsAndWasmSharedMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt b/antlr-kotlin-runtime/src/jsAndWasmSharedMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt index b3ac1b0b..621eaff2 100644 --- a/antlr-kotlin-runtime/src/jsAndWasmSharedMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt +++ b/antlr-kotlin-runtime/src/jsAndWasmSharedMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt @@ -1,8 +1,8 @@ // Copyright 2017-present Strumenta and contributors, licensed under Apache 2.0. // Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause. - package com.strumenta.antlrkotlin.runtime // Note(Edoardo): this is implemented as an HashMap in the JS target, // so let's keep it as it is -public actual typealias WeakHashMap = HashMap +@Suppress("ACTUAL_WITHOUT_EXPECT") +internal actual typealias WeakHashMap = HashMap diff --git a/antlr-kotlin-runtime/src/jvmMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt b/antlr-kotlin-runtime/src/jvmMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt index 7b10a01f..3a213fe8 100644 --- a/antlr-kotlin-runtime/src/jvmMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt +++ b/antlr-kotlin-runtime/src/jvmMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt @@ -1,8 +1,8 @@ // Copyright 2017-present Strumenta and contributors, licensed under Apache 2.0. // Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause. - package com.strumenta.antlrkotlin.runtime import java.util.WeakHashMap as JavaWeakHashMap -public actual typealias WeakHashMap = JavaWeakHashMap +@Suppress("ACTUAL_WITHOUT_EXPECT") +internal actual typealias WeakHashMap = JavaWeakHashMap diff --git a/antlr-kotlin-runtime/src/nativeMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt b/antlr-kotlin-runtime/src/nativeMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt index fd1e482f..0db9df9e 100644 --- a/antlr-kotlin-runtime/src/nativeMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt +++ b/antlr-kotlin-runtime/src/nativeMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt @@ -1,9 +1,9 @@ // Copyright 2017-present Strumenta and contributors, licensed under Apache 2.0. // Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause. - package com.strumenta.antlrkotlin.runtime // TODO(Edoardo): implement real weak keys. // See kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.ref // for classes and functions useful for a possible implementation -public actual typealias WeakHashMap = HashMap +@Suppress("ACTUAL_WITHOUT_EXPECT") +internal actual typealias WeakHashMap = HashMap diff --git a/antlr-kotlin-runtime/src/wasmWasiMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt b/antlr-kotlin-runtime/src/wasmWasiMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt index f0e206ac..b09e309f 100644 --- a/antlr-kotlin-runtime/src/wasmWasiMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt +++ b/antlr-kotlin-runtime/src/wasmWasiMain/kotlin/com/strumenta/antlrkotlin/runtime/WeakHashMap.kt @@ -3,4 +3,5 @@ package com.strumenta.antlrkotlin.runtime // TODO(Edoardo): implement real weak keys -public actual typealias WeakHashMap = HashMap +@Suppress("ACTUAL_WITHOUT_EXPECT") +internal actual typealias WeakHashMap = HashMap