Skip to content

Commit

Permalink
Raise deprecation levels:
Browse files Browse the repository at this point in the history
- RichMessageOrigin
- SingleMessage.Serializer
- ForceOfflineException
- MessageSubscribersBuilder.sentByTemp
- subscribeTempMessages
- TempMessageSubscribersBuilder
- TempMessageEvent
- TempMessagePostSendEvent
- TempMessagePreSendEvent

close #1296
  • Loading branch information
Him188 committed Sep 12, 2021
1 parent 21513a9 commit 062b876
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ public class net/mamoe/mirai/event/MessageSubscribersBuilder {
public final fun sentByOwner ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentByStranger ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentByStranger (Lkotlin/jvm/functions/Function3;)Ljava/lang/Object;
public final fun sentByTemp ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final synthetic fun sentByTemp ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentFrom (J)Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentFrom (Lnet/mamoe/mirai/contact/Group;)Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun startsWith (Ljava/lang/String;Z)Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
Expand Down Expand Up @@ -1890,7 +1890,7 @@ public final class net/mamoe/mirai/event/SubscribeMessagesKt {
public static synthetic fun subscribeOtherClientMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun subscribeStrangerMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun subscribeStrangerMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun subscribeTempMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final synthetic fun subscribeTempMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun subscribeTempMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun subscribeUserMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun subscribeUserMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -5139,7 +5139,7 @@ public final class net/mamoe/mirai/message/data/RichMessageOrigin : net/mamoe/mi
public static final field Key Lnet/mamoe/mirai/message/data/RichMessageOrigin$Key;
public static final field SERIAL_NAME Ljava/lang/String;
public synthetic fun <init> (ILnet/mamoe/mirai/message/data/RichMessage;Ljava/lang/String;Lnet/mamoe/mirai/message/data/RichMessageKind;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun <init> (Lnet/mamoe/mirai/message/data/RichMessage;Ljava/lang/String;Lnet/mamoe/mirai/message/data/RichMessageKind;)V
public synthetic fun <init> (Lnet/mamoe/mirai/message/data/RichMessage;Ljava/lang/String;Lnet/mamoe/mirai/message/data/RichMessageKind;)V
public fun contentToString ()Ljava/lang/String;
public fun equals (Ljava/lang/Object;)Z
public synthetic fun getKey ()Lnet/mamoe/mirai/message/data/MessageKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ public class net/mamoe/mirai/event/MessageSubscribersBuilder {
public final fun sentByOwner ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentByStranger ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentByStranger (Lkotlin/jvm/functions/Function3;)Ljava/lang/Object;
public final fun sentByTemp ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final synthetic fun sentByTemp ()Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentFrom (J)Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun sentFrom (Lnet/mamoe/mirai/contact/Group;)Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
public final fun startsWith (Ljava/lang/String;Z)Lnet/mamoe/mirai/event/MessageSubscribersBuilder$ListeningFilter;
Expand Down Expand Up @@ -1890,7 +1890,7 @@ public final class net/mamoe/mirai/event/SubscribeMessagesKt {
public static synthetic fun subscribeOtherClientMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun subscribeStrangerMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun subscribeStrangerMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun subscribeTempMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final synthetic fun subscribeTempMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun subscribeTempMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun subscribeUserMessages (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun subscribeUserMessages$default (Lnet/mamoe/mirai/event/EventChannel;Lkotlin/coroutines/CoroutineContext;Lnet/mamoe/mirai/event/ConcurrencyKind;Lnet/mamoe/mirai/event/EventPriority;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -5139,7 +5139,7 @@ public final class net/mamoe/mirai/message/data/RichMessageOrigin : net/mamoe/mi
public static final field Key Lnet/mamoe/mirai/message/data/RichMessageOrigin$Key;
public static final field SERIAL_NAME Ljava/lang/String;
public synthetic fun <init> (ILnet/mamoe/mirai/message/data/RichMessage;Ljava/lang/String;Lnet/mamoe/mirai/message/data/RichMessageKind;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun <init> (Lnet/mamoe/mirai/message/data/RichMessage;Ljava/lang/String;Lnet/mamoe/mirai/message/data/RichMessageKind;)V
public synthetic fun <init> (Lnet/mamoe/mirai/message/data/RichMessage;Ljava/lang/String;Lnet/mamoe/mirai/message/data/RichMessageKind;)V
public fun contentToString ()Ljava/lang/String;
public fun equals (Ljava/lang/Object;)Z
public synthetic fun getKey ()Lnet/mamoe/mirai/message/data/MessageKey;
Expand Down
4 changes: 2 additions & 2 deletions mirai-core-api/src/commonMain/kotlin/contact/Group.kt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public interface Group : Contact, CoroutineScope, FileSupported, AudioSupported
"use uploadAudio",
replaceWith = ReplaceWith("uploadAudio(resource)"),
level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
public suspend fun uploadVoice(resource: ExternalResource): Voice

/**
Expand Down Expand Up @@ -241,7 +241,7 @@ public interface GroupSettings {
@Deprecated(
level = DeprecationLevel.WARNING,
message = "group.announcements.asFlow().filter { it.parameters.sendToNewMember }.firstOrNull()",
)
) // deprecated since 2.7
public var entranceAnnouncement: String

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public open class MessageSubscribersBuilder<M : MessageEvent, out Ret, R : RR, R

/** 如果是群临时会话消息 */
@MessageDsl
@Deprecated("use sentByGroupTemp()", ReplaceWith("sentByGroupTemp()"), DeprecationLevel.ERROR)
@Deprecated("use sentByGroupTemp()", ReplaceWith("sentByGroupTemp()"), DeprecationLevel.HIDDEN)
public fun sentByTemp(): ListeningFilter = sentByGroupTemp()

/** 如果是群临时会话消息 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public class GroupMessageEvent(
@Deprecated(
"mirai 正计划支持其他渠道发起的临时会话, 届时此事件会变动. 原 TempMessageEvent 已更改为 GroupTempMessageEvent",
replaceWith = ReplaceWith("GroupTempMessageEvent", "net.mamoe.mirai.event.events.GroupTempMessageEvent"),
DeprecationLevel.ERROR
DeprecationLevel.HIDDEN
)
public sealed class TempMessageEvent constructor(
public override val sender: NormalMember,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public data class FriendMessagePostSendEvent @MiraiInternalApi constructor(
"GroupTempMessagePostSendEvent",
"net.mamoe.mirai.event.events.GroupTempMessagePostSendEvent"
),
DeprecationLevel.ERROR
DeprecationLevel.HIDDEN
)
public sealed class TempMessagePostSendEvent @MiraiInternalApi constructor(
/** 发信目标. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public data class FriendMessagePreSendEvent @MiraiInternalApi constructor(
"GroupTempMessagePreSendEvent",
"net.mamoe.mirai.event.events.GroupTempMessagePreSendEvent"
),
DeprecationLevel.ERROR
DeprecationLevel.HIDDEN
)
public sealed class TempMessagePreSendEvent @MiraiInternalApi constructor(
/** 发信目标. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public fun <R> EventChannel<*>.subscribeUserMessages(
"GroupTempMessageSubscribersBuilder",
"net.mamoe.mirai.event.GroupTempMessageSubscribersBuilder"
),
DeprecationLevel.ERROR
DeprecationLevel.HIDDEN
)
public typealias TempMessageSubscribersBuilder = MessageSubscribersBuilder<GroupTempMessageEvent, Listener<GroupTempMessageEvent>, Unit, Unit>

Expand All @@ -165,7 +165,7 @@ public typealias TempMessageSubscribersBuilder = MessageSubscribersBuilder<Group
"subscribeGroupTempMessages(coroutineContext, concurrencyKind, priority, listeners)",
"net.mamoe.mirai.event.subscribeGroupTempMessages"
),
DeprecationLevel.ERROR
DeprecationLevel.HIDDEN
)
public fun <R> EventChannel<*>.subscribeTempMessages(
coroutineContext: CoroutineContext = EmptyCoroutineContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import net.mamoe.mirai.utils.safeCast
"MessageOrigin",
"net.mamoe.mirai.message.data.MessageOrigin",
),
level = DeprecationLevel.ERROR
level = DeprecationLevel.HIDDEN
)
public class RichMessageOrigin
@Deprecated(
Expand All @@ -44,7 +44,7 @@ public class RichMessageOrigin
"MessageOrigin(origin, resourceId, kind)",
"net.mamoe.mirai.message.data.MessageOrigin",
),
level = DeprecationLevel.ERROR
level = DeprecationLevel.HIDDEN
)
constructor(
/**
Expand Down Expand Up @@ -104,7 +104,7 @@ constructor(
"MessageOrigin",
"net.mamoe.mirai.message.data.MessageOrigin",
),
level = DeprecationLevel.ERROR
level = DeprecationLevel.HIDDEN
)
@Suppress("DEPRECATION_ERROR")
public companion object Key : AbstractMessageKey<RichMessageOrigin>({ it.safeCast() }) {
Expand All @@ -120,7 +120,7 @@ constructor(
@Deprecated(
"Use MessageOriginKind",
ReplaceWith("MessageOriginKind", "net.mamoe.mirai.message.data.MessageOriginKind"),
level = DeprecationLevel.ERROR
level = DeprecationLevel.HIDDEN
)
public enum class RichMessageKind {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public interface SingleMessage : Message {
"kotlinx.serialization.PolymorphicSerializer",
"net.mamoe.mirai.message.data.SingleMessage",
),
level = DeprecationLevel.WARNING
)
level = DeprecationLevel.ERROR // ERROR since 2.8
) // error since 2.8
public object Serializer : KSerializer<SingleMessage> by PolymorphicSerializer(SingleMessage::class)
}

Expand Down
6 changes: 3 additions & 3 deletions mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public abstract class PttMessage : MessageContent {
"Please use Audio instead.",
replaceWith = ReplaceWith("Audio", "net.mamoe.mirai.message.data.Audio"),
level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
public open class Voice @MiraiInternalApi constructor(
@MiraiExperimentalApi public override val fileName: String,
@MiraiExperimentalApi public override val md5: ByteArray,
Expand All @@ -96,7 +96,7 @@ public open class Voice @MiraiInternalApi constructor(
@Deprecated(
"Please consider migrating to Audio",
level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
@JvmStatic
public fun fromAudio(audio: Audio): Voice {
audio.run {
Expand Down Expand Up @@ -179,6 +179,6 @@ public open class Voice @MiraiInternalApi constructor(
@Deprecated(
"Please migrate to Audio",
level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
@JvmSynthetic
public inline fun Audio.toVoice(): Voice = Voice.fromAudio(this)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import net.mamoe.mirai.Bot
/**
* 当 [Bot] 被迫下线时抛出, 作为 [Job.cancel] 的 `cause`
*/
@Deprecated("Not used anymore since 2.7", level = DeprecationLevel.WARNING)
@Deprecated("Not used anymore since 2.7", level = DeprecationLevel.ERROR) // deprecated since 2.7, error since 2.8
public class ForceOfflineException
@JvmOverloads constructor(
public override val message: String? = null,
Expand Down
10 changes: 8 additions & 2 deletions mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,17 @@ public open class BotConfiguration { // open for Java
public var heartbeatTimeoutMillis: Long = 5.secondsToMillis

/** 心跳失败后的第一次重连前的等待时间. */
@Deprecated("Useless since new network. Please just remove this.", level = DeprecationLevel.WARNING)
@Deprecated(
"Useless since new network. Please just remove this.",
level = DeprecationLevel.ERROR
) // deprecated since 2.7, error since 2.8
public var firstReconnectDelayMillis: Long = 5.secondsToMillis

/** 重连失败后, 继续尝试的每次等待时间 */
@Deprecated("Useless since new network. Please just remove this.", level = DeprecationLevel.WARNING)
@Deprecated(
"Useless since new network. Please just remove this.",
level = DeprecationLevel.ERROR
) // deprecated since 2.7, error since 2.8
public var reconnectPeriodMillis: Long = 5.secondsToMillis

/** 最多尝试多少次重连 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ public interface ExternalResource : Closeable {
@Suppress("DEPRECATION")
@JvmBlockingBridge
@JvmStatic
@Deprecated("Use `contact.uploadAudio(resource)` instead", level = DeprecationLevel.WARNING)
@Deprecated(
"Use `contact.uploadAudio(resource)` instead",
level = DeprecationLevel.WARNING
) // deprecated since 2.7
public suspend fun ExternalResource.uploadAsVoice(contact: Contact): net.mamoe.mirai.message.data.Voice {
@Suppress("DEPRECATION")
if (contact is Group) return contact.uploadVoice(this)
Expand Down
6 changes: 3 additions & 3 deletions mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public interface MiraiLogger {
*/
@MiraiInternalApi
@MiraiExperimentalApi
@Deprecated("Deprecated.")
@Deprecated("Deprecated.") // deprecated since 2.7
public val TopLevel: MiraiLogger by lazy { Factory.create(MiraiLogger::class, "Mirai") }

/**
Expand All @@ -104,7 +104,7 @@ public interface MiraiLogger {
@Deprecated(
"Please set factory by providing an service of type net.mamoe.mirai.utils.MiraiLogger.Factory",
level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
@JvmStatic
public fun setDefaultLoggerCreator(creator: (identity: String?) -> MiraiLogger) {
DefaultFactoryOverrides.override { _, identity -> creator(identity) }
Expand All @@ -120,7 +120,7 @@ public interface MiraiLogger {
"MiraiLogger.Factory.create(YourClass::class, identity)",
"net.mamoe.mirai.utils.MiraiLogger"
), level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
@JvmStatic
public fun create(identity: String?): MiraiLogger = Factory.create(MiraiLogger::class, identity)
}
Expand Down
2 changes: 1 addition & 1 deletion mirai-core-api/src/commonMain/kotlin/utils/RemoteFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public interface RemoteFile {
"Use moveTo(RemoteFile) instead.",
replaceWith = ReplaceWith("this.moveTo(this.resolveSibling(path))"),
level = DeprecationLevel.WARNING
)
) // deprecated since 2.7
public suspend fun moveTo(path: String): Boolean {
// Impl notes:
// if `path` is absolute, this works as intended.
Expand Down
2 changes: 1 addition & 1 deletion mirai-core-utils/src/commonMain/kotlin/CoroutineUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import kotlin.coroutines.EmptyCoroutineContext
@Deprecated(
message = "Use runBIO which delegates to `runInterruptible`. " +
"Technically remove suspend call in `block` and remove CoroutineScope parameter usages.",
level = DeprecationLevel.WARNING
level = DeprecationLevel.HIDDEN
)
@kotlin.internal.LowPriorityInOverloadResolution
public suspend inline fun <R> runBIO(
Expand Down
16 changes: 0 additions & 16 deletions mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,6 @@ internal class GroupImpl constructor(
override fun toString(): String = "Group($id)"
}

@Deprecated("use addNewNormalMember or newAnonymousMember")
internal fun Group.newMember(memberInfo: MemberInfo): Member {
this.checkIsGroupImpl()
memberInfo.anonymousId?.let {
return AnonymousMemberImpl(
this, this.coroutineContext,
memberInfo
)
}
return NormalMemberImpl(
this,
this.coroutineContext,
memberInfo
)
}

internal fun Group.addNewNormalMember(memberInfo: MemberInfo): NormalMemberImpl? {
if (members.contains(memberInfo.uin)) return null
return newNormalMember(memberInfo).also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal suspend inline fun <P : Packet?> IncomingPacketFactory<P>.decode(
@Deprecated(
"Kept for binary compatibility.",
ReplaceWith("PacketCodec.PacketLogger", "net.mamoe.mirai.internal.network.components.PacketCodec"),
level = DeprecationLevel.ERROR,
level = DeprecationLevel.HIDDEN,
)
@PublishedApi
internal val PacketLogger: MiraiLoggerWithSwitch
Expand Down

0 comments on commit 062b876

Please sign in to comment.