Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提高所有过时内容(@Deprecated)的过时等级为 ERROR #398

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class Attribute<T : Any> private constructor(


@Suppress("UNUSED_PARAMETER")
@Deprecated("Use of(name)", ReplaceWith("of(name)"))
@Deprecated("Use of(name)", ReplaceWith("of(name)"), level = DeprecationLevel.ERROR)
@JvmSynthetic
public fun <T : Any> of(name: String, type: KClass<T>): Attribute<T> = of(name)

Expand Down Expand Up @@ -117,7 +117,7 @@ public class Attribute<T : Any> private constructor(

@Suppress("UNUSED_PARAMETER")
@JvmSynthetic
@Deprecated("Use attribute(name)", ReplaceWith("attribute(name)"))
@Deprecated("Use attribute(name)", ReplaceWith("attribute(name)"), level = DeprecationLevel.ERROR)
public fun <T : Any> attribute(name: String, type: KClass<T>): Attribute<T> = attribute(name)

/**
Expand All @@ -130,7 +130,7 @@ public fun <T : Any> attribute(name: String, type: KClass<T>): Attribute<T> = at
*/
public fun <T : Any> attribute(name: String): Attribute<T> = Attribute.of(name)

@Deprecated("Use attribute(name)", ReplaceWith("attribute(name)"))
@Deprecated("Use attribute(name)", ReplaceWith("attribute(name)"), level = DeprecationLevel.ERROR)
public inline fun <reified T : Any> attribute(): Attribute<T> =
with(T::class) { Attribute.of(this.qualifiedName ?: this.simpleName ?: this.jvmName) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2021-2022 ForteScarlet <ForteScarlet@163.com>
*
* 本文件是 simply-robot ( simple robot的v3版本,因此亦可称为 simple-robot v3 、simbot v3 等) 的一部分。
* 本文件是 simply-robot (或称 simple-robot 3.x 、simbot 3.x ) 的一部分。
*
* simply-robot 是自由软件:你可以再分发之和/或依照由自由软件基金会发布的 GNU 通用公共许可证修改之,无论是版本 3 许可证,还是(按你的决定)任何以后版都可以。
*
Expand All @@ -12,7 +12,6 @@
* https://www.gnu.org/licenses/gpl-3.0-standalone.html
* https://www.gnu.org/licenses/lgpl-3.0-standalone.html
*
*
*/

package love.forte.simbot
Expand All @@ -32,7 +31,7 @@ import love.forte.simbot.definition.IDContainer
*
* @author ForteScarlet
*/
@Deprecated("No longer used")
@Deprecated("No longer used", level = DeprecationLevel.ERROR)
public interface Scope : IDContainer {

/**
Expand All @@ -48,7 +47,7 @@ public interface Scope : IDContainer {
/**
* 判断提供的 [作用域][scope] 是否囊括在当前作用域范围内。
*/
@Suppress("DEPRECATION")
@Suppress("DEPRECATION_ERROR")
public operator fun contains(scope: Scope): Boolean

}
Expand All @@ -64,9 +63,9 @@ public interface Scope : IDContainer {
*
* @see love.forte.simbot.definition.Category
*/
@Suppress("DEPRECATION")
@Suppress("DEPRECATION_ERROR")
@Serializable
@Deprecated("No longer used, function replaced by Category", ReplaceWith("Category", "love.forte.simbot.definition.Category"))
@Deprecated("No longer used, function replaced by Category", ReplaceWith("Category", "love.forte.simbot.definition.Category"), level = DeprecationLevel.ERROR)
public open class Grouping(
@Serializable(ID.AsCharSequenceIDSerializer::class)
override val id: ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public interface ReplySupport {
/**
* “回复”回执。
*/
@Deprecated("No longer use")
@Deprecated("No longer use", level = DeprecationLevel.ERROR)
public interface MessageReplyReceipt : MessageReceipt {
override val id: ID
override val isSuccess: Boolean
Expand Down Expand Up @@ -223,7 +223,7 @@ public interface MessageReactSupport {
* 对于标记回执的 [id][ReactReceipt.id],有可能是这个回执所属ID,也有可能是被标记消息的ID。
*
*/
@Deprecated("No longer use")
@Deprecated("No longer use", level = DeprecationLevel.ERROR)
public interface ReactReceipt : MessageReceipt {
override val id: ID
override val isSuccess: Boolean
Expand Down Expand Up @@ -323,7 +323,7 @@ public suspend fun Event.replyIfSupport(message: String): MessageReceipt? =
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend fun Objective.replyIfSupport(message: Message): MessageReceipt? =
if (this is ReplySupport) reply(message) else null

Expand All @@ -333,7 +333,7 @@ public suspend fun Objective.replyIfSupport(message: Message): MessageReceipt? =
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend fun MessageContainer.replyIfSupport(message: Message): MessageReceipt? =
if (this is ReplySupport) reply(message) else null

Expand All @@ -342,7 +342,7 @@ public suspend fun MessageContainer.replyIfSupport(message: Message): MessageRec
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend inline fun Objective.replyIfSupport(message: () -> Message): MessageReceipt? =
if (this is ReplySupport) reply(message()) else null

Expand All @@ -352,7 +352,7 @@ public suspend inline fun Objective.replyIfSupport(message: () -> Message): Mess
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend inline fun MessageContainer.replyIfSupport(message: () -> Message): MessageReceipt? =
if (this is ReplySupport) reply(message()) else null

Expand All @@ -362,7 +362,7 @@ public suspend inline fun MessageContainer.replyIfSupport(message: () -> Message
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend fun Objective.replyIfSupport(message: MessageContent): MessageReceipt? =
if (this is ReplySupport) reply(message) else null

Expand All @@ -372,7 +372,7 @@ public suspend fun Objective.replyIfSupport(message: MessageContent): MessageRec
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend fun MessageContainer.replyIfSupport(message: MessageContent): MessageReceipt? =
if (this is ReplySupport) reply(message) else null

Expand All @@ -382,7 +382,7 @@ public suspend fun MessageContainer.replyIfSupport(message: MessageContent): Mes
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend fun Objective.replyIfSupport(message: String): MessageReceipt? =
if (this is ReplySupport) reply(message) else null

Expand All @@ -392,7 +392,7 @@ public suspend fun Objective.replyIfSupport(message: String): MessageReceipt? =
*/
@JvmSynthetic
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("ReplySupport通常由Event类型实现")
@Deprecated("ReplySupport通常由Event类型实现", level = DeprecationLevel.ERROR)
public suspend fun MessageContainer.replyIfSupport(message: String): MessageReceipt? =
if (this is ReplySupport) reply(message) else null
//endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public interface Application : CoroutineScope {
*/
@Deprecated(
"Use getComponentOrNull(String)",
ReplaceWith("getComponent(id.literal)", "love.forte.simbot.literal")
ReplaceWith("getComponent(id.literal)", "love.forte.simbot.literal"),
level = DeprecationLevel.ERROR
)
public fun getComponent(id: ID): Component = getComponent(id.literal)

Expand All @@ -75,7 +76,8 @@ public interface Application : CoroutineScope {
*/
@Deprecated(
"Use getComponentOrNull(String)",
ReplaceWith("getComponentOrNull(id.literal)", "love.forte.simbot.literal")
ReplaceWith("getComponentOrNull(id.literal)", "love.forte.simbot.literal"),
level = DeprecationLevel.ERROR
)
public fun getComponentOrNull(id: ID): Component? = getComponentOrNull(id.literal)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public interface Bot : User, Survivable,
@JvmSynthetic
@Deprecated(
"Just use Resource.toImage",
ReplaceWith("resource.toImage()", "love.forte.simbot.message.Image.Key.toImage")
ReplaceWith("resource.toImage()", "love.forte.simbot.message.Image.Key.toImage"),
level = DeprecationLevel.ERROR
)
public suspend fun uploadImage(resource: Resource): Image<*> = resource.toImage()

Expand All @@ -119,7 +120,11 @@ public interface Bot : User, Survivable,
* @see uploadImage
*/
@Api4J
@Deprecated("Just use Image.of(Resource)", ReplaceWith("resource.toImage()", "love.forte.simbot.message.Image.Key.toImage"))
@Deprecated(
"Just use Image.of(Resource)",
ReplaceWith("resource.toImage()", "love.forte.simbot.message.Image.Key.toImage"),
level = DeprecationLevel.ERROR
)
public fun uploadImageBlocking(resource: Resource): Image<*> = resource.toImage()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ public object OriginBotManager : Set<BotManager<*>> {
*/
@Deprecated(
"Use getManagers(String)",
ReplaceWith("getManagers(componentId.literal)", "love.forte.simbot.bot.OriginBotManager.getManagers")
ReplaceWith("getManagers(componentId.literal)", "love.forte.simbot.bot.OriginBotManager.getManagers"),
level = DeprecationLevel.ERROR
)
public fun getManagers(componentId: ID): List<BotManager<*>> = getManagers(componentId.literal)

Expand Down Expand Up @@ -200,7 +201,8 @@ public object OriginBotManager : Set<BotManager<*>> {
"Use getFirstManagerOrNull(String)", ReplaceWith(
"getFirstManagerOrNull(componentId.literal)",
"love.forte.simbot.bot.OriginBotManager.getFirstManagerOrNull"
)
),
level = DeprecationLevel.ERROR
)
public fun getFirstManager(componentId: ID): BotManager<*>? = getFirstManagerOrNull(componentId.literal)

Expand Down Expand Up @@ -249,7 +251,7 @@ public object OriginBotManager : Set<BotManager<*>> {
"Use getBot(ID, String?)", ReplaceWith(
"getBotOrNull(id, componentId?.literal)",
"love.forte.simbot.bot.OriginBotManager.getBotOrNull"
)
), level = DeprecationLevel.ERROR
)
public fun getBot(id: ID, componentId: ID? = null): Bot? = getBotOrNull(id, componentId?.literal)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public interface Contact : User, SendSupport, BotContainer {
* 直接使用 [sendBlocking].
*/
@Api4J
@Deprecated("Just use sendBlocking.", ReplaceWith("sendBlocking(message)"))
@Deprecated("Just use sendBlocking.", ReplaceWith("sendBlocking(message)"), level = DeprecationLevel.ERROR)
override fun sendIfSupportBlocking(message: Message): MessageReceipt = sendBlocking(message)

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public interface FriendInfo : UserInfo {
*
* @see category
*/
@Suppress("DEPRECATION")
@Suppress("DEPRECATION_ERROR")
@Deprecated(
"No longer used and will be removed. Please refer to 'love.forte.simbot.definition.Category'",
ReplaceWith("category", "love.forte.simbot.definition.Category")
ReplaceWith("category", "love.forte.simbot.definition.Category"), level = DeprecationLevel.ERROR
)
public val grouping: love.forte.simbot.Grouping get() = love.forte.simbot.Grouping.EMPTY

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public sealed interface Objective : BotContainer, IDContainer {
"if (this is SendSupport) runInBlocking { send(message) } else null",
"love.forte.simbot.action.SendSupport",
"love.forte.simbot.utils.runInBlocking"
)
), level = DeprecationLevel.ERROR
)
public fun sendIfSupportBlocking(message: Message): MessageReceipt? =
if (this is SendSupport) runInBlocking { send(message) } else null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import love.forte.simbot.utils.runInBlocking
*
* @author ForteScarlet
*/
@Deprecated("No longer use")
@Deprecated("No longer use", level = DeprecationLevel.ERROR)
public interface Structured<P, N> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public interface Event : BotContainer, IDContainer, ComponentContainer {
* 此属性意义不大,未来可能会移除。
*
*/
@Suppress("DEPRECATION")
@Deprecated("此属性意义不大,未来可能会移除。", ReplaceWith("VisibleScope.PUBLIC", "love.forte.simbot.event.Event.VisibleScope"))
@Suppress("DEPRECATION_ERROR")
@Deprecated("此属性意义不大,未来可能会移除。", ReplaceWith("VisibleScope.PUBLIC", "love.forte.simbot.event.Event.VisibleScope"), level = DeprecationLevel.ERROR)
public val visibleScope: VisibleScope get() = VisibleScope.PUBLIC


Expand Down Expand Up @@ -256,7 +256,7 @@ public interface Event : BotContainer, IDContainer, ComponentContainer {
*
* _Deprecated: 含义不明确,缺少应用场景,未来可能会移除_
*/
@Deprecated("Ambiguous meaning, lack of application scenarios, may be removed in the future")
@Deprecated("Ambiguous meaning, lack of application scenarios, may be removed in the future", level = DeprecationLevel.ERROR)
public enum class VisibleScope {

/**
Expand Down Expand Up @@ -365,7 +365,7 @@ public fun <T : Event> KClass<T>.getKey(): Event.Key<T> = Event.Key.getKey(this)
*
*/
@Deprecated("Just use '... isSub ...'",
ReplaceWith("this isSub parentMaybe", "love.forte.simbot.event.Event.Key.Companion.isSub"))
ReplaceWith("this isSub parentMaybe", "love.forte.simbot.event.Event.Key.Companion.isSub"), level = DeprecationLevel.ERROR)
public infix fun Event.Key<*>.isSubFrom(parentMaybe: Event.Key<*>): Boolean {
return this isSub parentMaybe
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface EventListenerContainer {
*/
public operator fun get(id: String): EventListener?

@Deprecated("Just use get(String)", ReplaceWith("get(id.literal)", "love.forte.simbot.literal"))
@Deprecated("Just use get(String)", ReplaceWith("get(id.literal)", "love.forte.simbot.literal"), level = DeprecationLevel.ERROR)
public operator fun get(id: ID): EventListener? = get(id.literal)

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public interface EventProcessingContext : CoroutineContext.Element, InstantScope
*/
@Deprecated(
"Just use love.forte.simbot.core.scope.SimpleScope",
ReplaceWith("SimpleScope", "love.forte.simbot.core.scope.SimpleScope")
ReplaceWith("SimpleScope", "love.forte.simbot.core.scope.SimpleScope"), level = DeprecationLevel.ERROR
)
public object Scope {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface ChatRoomMessageEvent : MessageEvent, OrganizationEvent, RemoteM
* @see messageContent
*/
@JvmSynthetic
@Deprecated("Use messageContent.delete()", ReplaceWith("messageContent.delete()"))
@Deprecated("Use messageContent.delete()", ReplaceWith("messageContent.delete()"), level = DeprecationLevel.ERROR)
public suspend fun delete(): Boolean = messageContent.delete()

/**
Expand All @@ -230,7 +230,7 @@ public interface ChatRoomMessageEvent : MessageEvent, OrganizationEvent, RemoteM
* @see messageContent
*/
@Api4J
@Deprecated("Use getMessageContent().deleteBlocking()", ReplaceWith("messageContent.deleteBlocking()"))
@Deprecated("Use getMessageContent().deleteBlocking()", ReplaceWith("messageContent.deleteBlocking()"), level = DeprecationLevel.ERROR)
public fun deleteBlocking(): Boolean = messageContent.deleteBlocking()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public data class At @JvmOverloads constructor(
override val key: Message.Key<At> get() = Key


@Deprecated("Please use type", ReplaceWith("type"))
@Deprecated("Please use type", ReplaceWith("type"), level = DeprecationLevel.ERROR)
public val atType: String get() = type

override fun equals(other: Any?): Boolean {
Expand Down Expand Up @@ -357,8 +357,8 @@ public data class Face(
* [RemoteResource] 代表一个携带 [url] 信息的远程资源。常见为文件或图片等形式。
*
*/
@Suppress("DEPRECATION")
@Deprecated("Unused type")
@Suppress("DEPRECATION_ERROR")
@Deprecated("Unused type", level = DeprecationLevel.ERROR)
public interface RemoteResource<E : RemoteResource<E>> : StandardMessage<E>, IDContainer {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public interface MessageReceipt : IDContainer, DeleteSupport {
* @return 删除成功为true,失败或不可删除均为null。
*/
@Api4J
@Deprecated("Just use deleteBlocking()", ReplaceWith("deleteBlocking()"))
@Deprecated("Just use deleteBlocking()", ReplaceWith("deleteBlocking()"), level = DeprecationLevel.ERROR)
public fun deleteIfSupportBlocking(): Boolean = deleteBlocking() // if (this is DeleteSupport) runInBlocking { delete() } else false
}

Expand All @@ -63,5 +63,5 @@ public interface MessageReceipt : IDContainer, DeleteSupport {
* @return 删除成功为true,失败或不可删除均为null。
*/
@JvmSynthetic
@Deprecated("Just use delete()", ReplaceWith("delete()"))
@Deprecated("Just use delete()", ReplaceWith("delete()"), level = DeprecationLevel.ERROR)
public suspend fun MessageReceipt.deleteIfSupport(): Boolean = delete()
Loading