Skip to content

Commit 39b9500

Browse files
committed
消除/修复警告
1 parent 62b67a7 commit 39b9500

File tree

2 files changed

+7
-8
lines changed
  • simbot-apis/simbot-api/src/main/kotlin/love/forte/simbot
  • simbot-cores/simbot-core/src/main/kotlin/love/forte/simbot/core/event

2 files changed

+7
-8
lines changed

simbot-apis/simbot-api/src/main/kotlin/love/forte/simbot/IDMaps.kt

+6-7
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,26 @@ public fun <V> emptyIDMap(): IDMaps<V> = EmptyIDMap as IDMaps<V>
4444

4545
public fun <V> idMapOf(): IDMaps<V> = emptyIDMap()
4646

47-
public fun <V> idMapOf(vararg pairs: Pair<ID, V>): IDMaps<V> =
47+
public fun <V : Any> idMapOf(vararg pairs: Pair<ID, V>): IDMaps<V> =
4848
when {
4949
pairs.isEmpty() -> emptyIDMap()
5050
pairs.size == 1 -> SignalPairIDMap(pairs[0].first, pairs[0].second)
5151
else -> CharSequenceIDMap(pairs.toMap(mutableMapOf()))
5252
}
5353

54-
public fun <V> idMapOf(map: Map<ID, V>): IDMaps<V> =
54+
public fun <V : Any> idMapOf(map: Map<ID, V>): IDMaps<V> =
5555
when {
5656
map.isEmpty() -> emptyIDMap()
5757
map.size == 1 -> map.entries.first().let { SignalPairIDMap(it.key, it.value) }
5858
else -> CharSequenceIDMap(map.toMutableMap())
5959
}
6060

6161

62-
public fun <V> mutableIDMapOf(): MutableIDMaps<V> = CharSequenceIDMap(mutableMapOf())
62+
public fun <V : Any> mutableIDMapOf(): MutableIDMaps<V> = CharSequenceIDMap(mutableMapOf())
6363

64-
public fun <V> mutableIDMapOf(vararg pairs: Pair<ID, V>): MutableIDMaps<V> = CharSequenceIDMap(pairs.toMap(mutableMapOf()))
64+
public fun <V : Any> mutableIDMapOf(vararg pairs: Pair<ID, V>): MutableIDMaps<V> = CharSequenceIDMap(pairs.toMap(mutableMapOf()))
6565

66-
public fun <V> mutableIDMapOf(map: Map<ID, V>): MutableIDMaps<V> = CharSequenceIDMap(map.toMutableMap())
66+
public fun <V : Any> mutableIDMapOf(map: Map<ID, V>): MutableIDMaps<V> = CharSequenceIDMap(map.toMutableMap())
6767

6868

6969
/**
@@ -112,7 +112,7 @@ private class SignalPairIDMap<V>(val id: ID, val value: V) : IDMaps<V> {
112112
}
113113

114114

115-
private class CharSequenceIDMap<V>(private val delegate: MutableMap<ID, V>) : MutableIDMaps<V> {
115+
private class CharSequenceIDMap<V : Any>(private val delegate: MutableMap<ID, V>) : MutableIDMaps<V> {
116116
override val entries: MutableSet<MutableMap.MutableEntry<ID, V>>
117117
get() = delegate.entries.toMutableSet()
118118

@@ -177,7 +177,6 @@ private class CharSequenceIDMap<V>(private val delegate: MutableMap<ID, V>) : Mu
177177
return delegate.computeIfAbsent(key, mappingFunction)
178178
}
179179

180-
@Suppress("WRONG_TYPE_PARAMETER_NULLABILITY_FOR_JAVA_OVERRIDE")
181180
override fun computeIfPresent(key: ID, remappingFunction: BiFunction<in ID, in V, out V?>): V? {
182181
return delegate.computeIfPresent(key, remappingFunction)
183182
}

simbot-cores/simbot-core/src/main/kotlin/love/forte/simbot/core/event/CoreListeners.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public fun <E : Event> blockingCoreListener(
142142
isAsync = isAsync,
143143
) { t, u ->
144144
val result = func.apply(t, u)
145-
145+
logger.let {}
146146
if (result is EventResult) {
147147
result
148148
} else {

0 commit comments

Comments
 (0)