Make properties in MessageKey with @JvmField to allow @JvmField in inherited classes

This commit is contained in:
Him188 2021-01-06 08:13:22 +08:00
parent c307da1225
commit bfd21cbb92

View File

@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 Mamoe Technologies and contributors.
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
@ -36,6 +36,7 @@ public interface MessageKey<out M : SingleMessage> {
* @see AbstractPolymorphicMessageKey
*/
public abstract class AbstractMessageKey<out M : SingleMessage>(
@JvmField
override val safeCast: (SingleMessage) -> M?,
) : MessageKey<M>
@ -73,6 +74,7 @@ public abstract class AbstractPolymorphicMessageKey<out B : SingleMessage, out M
baseKey: MessageKey<B>,
safeCast: (SingleMessage) -> M?,
) : MessageKey<M>, AbstractMessageKey<M>(safeCast) {
@JvmField
internal val topmostKey: MessageKey<*> =
if (baseKey is AbstractPolymorphicMessageKey<*, *>) baseKey.topmostKey else baseKey
}