Skip to content

Commit

Permalink
Bump DeprecationLevels after 0.13.0 (kordlib#908)
Browse files Browse the repository at this point in the history
WARNING -> ERROR
ERROR -> HIDDEN
HIDDEN -> remove
  • Loading branch information
lukellmann authored Jan 11, 2024
1 parent cc24314 commit b89838c
Show file tree
Hide file tree
Showing 112 changed files with 778 additions and 3,616 deletions.
297 changes: 10 additions & 287 deletions common/api/common.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
@file:Suppress(names = arrayOf("IncorrectFormatting", "ReplaceArrayOfWithLiteral",
"SpellCheckingInspection", "GrazieInspection"))

package dev.kord.common.entity

import dev.kord.common.Class
import dev.kord.common.java
import kotlin.LazyThreadSafetyMode.PUBLICATION
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
import kotlin.jvm.JvmField
import kotlin.jvm.JvmName
import kotlin.jvm.JvmStatic
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
Expand Down Expand Up @@ -45,60 +42,23 @@ public sealed class ActivityFlag(
* [flag].
*/
public operator fun plus(flag: ActivityFlag): ActivityFlags =
ActivityFlags(this.value or flag.value, null)
ActivityFlags(this.value or flag.value)

/**
* Returns an instance of [ActivityFlags] that has all bits set that are set in `this` and
* [flags].
*/
public operator fun plus(flags: ActivityFlags): ActivityFlags =
ActivityFlags(this.value or flags.value, null)
ActivityFlags(this.value or flags.value)

final override fun equals(other: Any?): Boolean = this === other ||
(other is ActivityFlag && this.shift == other.shift)

final override fun hashCode(): Int = shift.hashCode()

final override fun toString(): String = if (this is Unknown)
"ActivityFlag.Unknown(shift=$shift)" else "ActivityFlag.${this::class.simpleName}"

/**
* @suppress
*/
@Suppress(names = arrayOf("DeprecatedCallableAddReplaceWith"))
@Deprecated(message =
"ActivityFlag is no longer an enum class. Deprecated without a replacement.", level = DeprecationLevel.HIDDEN)
public fun name(): String = this::class.simpleName!!

/**
* @suppress
*/
@Suppress(names = arrayOf("DeprecatedCallableAddReplaceWith"))
@Deprecated(message =
"ActivityFlag is no longer an enum class. Deprecated without a replacement.", level = DeprecationLevel.HIDDEN)
public fun ordinal(): Int = when (this) {
Instance -> 0
Join -> 1
Spectate -> 2
JoinRequest -> 3
Sync -> 4
Play -> 5
PartyPrivacyFriends -> 6
PartyPrivacyVoiceChannel -> 7
Embedded -> 8
is Unknown -> Int.MAX_VALUE
}

/**
* @suppress
*/
@Deprecated(
message = "ActivityFlag is no longer an enum class.",
replaceWith = ReplaceWith(expression = "ActivityFlag::class.java", imports =
arrayOf("dev.kord.common.entity.ActivityFlag")),
DeprecationLevel.HIDDEN,
)
public fun getDeclaringClass(): Class<ActivityFlag> = ActivityFlag::class.java
final override fun toString(): String =
if (this is Unknown) "ActivityFlag.Unknown(shift=$shift)"
else "ActivityFlag.${this::class.simpleName}"

/**
* An unknown [ActivityFlag].
Expand Down Expand Up @@ -146,48 +106,6 @@ public sealed class ActivityFlag(
}


@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Binary compatibility",
)
@JvmField
public val Instance: ActivityFlag = Instance

@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Binary compatibility",
)
@JvmField
public val Join: ActivityFlag = Join

@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Binary compatibility",
)
@JvmField
public val Spectate: ActivityFlag = Spectate

@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Binary compatibility",
)
@JvmField
public val JoinRequest: ActivityFlag = JoinRequest

@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Binary compatibility",
)
@JvmField
public val Sync: ActivityFlag = Sync

@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Binary compatibility",
)
@JvmField
public val Play: ActivityFlag = Play

/**
* Returns an instance of [ActivityFlag] with [ActivityFlag.shift] equal to the specified
* [shift].
Expand All @@ -206,39 +124,6 @@ public sealed class ActivityFlag(
8 -> Embedded
else -> Unknown(shift)
}

/**
* @suppress
*/
@Suppress(names = arrayOf("NON_FINAL_MEMBER_IN_OBJECT", "DeprecatedCallableAddReplaceWith"))
@Deprecated(message =
"ActivityFlag is no longer an enum class. Deprecated without a replacement.", level = DeprecationLevel.HIDDEN)
@JvmStatic
public open fun valueOf(name: String): ActivityFlag = when (name) {
"Instance" -> Instance
"Join" -> Join
"Spectate" -> Spectate
"JoinRequest" -> JoinRequest
"Sync" -> Sync
"Play" -> Play
"PartyPrivacyFriends" -> PartyPrivacyFriends
"PartyPrivacyVoiceChannel" -> PartyPrivacyVoiceChannel
"Embedded" -> Embedded
else -> throw IllegalArgumentException(name)
}

/**
* @suppress
*/
@Suppress(names = arrayOf("NON_FINAL_MEMBER_IN_OBJECT"))
@Deprecated(
message = "ActivityFlag is no longer an enum class.",
replaceWith = ReplaceWith(expression = "ActivityFlag.entries.toTypedArray()", imports =
arrayOf("dev.kord.common.entity.ActivityFlag")),
DeprecationLevel.HIDDEN,
)
@JvmStatic
public open fun values(): Array<ActivityFlag> = entries.toTypedArray()
}
}

Expand Down Expand Up @@ -312,18 +197,7 @@ public class ActivityFlags internal constructor(
* The raw value used by Discord.
*/
public val `value`: Int,
@Suppress("UNUSED_PARAMETER") unused: Nothing?,
) {
// TODO uncomment annotation in DiscordActivity.kt and delete this file when this constructor is removed after
// deprecation cycle
@Deprecated(
"Don't construct an instance of 'ActivityFlags' from a raw value. Use the factory functions described in the " +
"documentation instead.",
ReplaceWith("ActivityFlags.Builder(value).build()", "dev.kord.common.entity.ActivityFlags"),
DeprecationLevel.HIDDEN,
)
public constructor(value: Int) : this(value, null)

/**
* A [Set] of all [ActivityFlag]s contained in this instance of [ActivityFlags].
*/
Expand All @@ -338,17 +212,6 @@ public class ActivityFlags internal constructor(
}
}

/**
* @suppress
*/
@Deprecated(
message = "Renamed to 'values'.",
replaceWith = ReplaceWith(expression = "this.values", imports = arrayOf()),
DeprecationLevel.HIDDEN,
)
public val flags: Set<ActivityFlag>
get() = values

/**
* Checks if this instance of [ActivityFlags] has all bits set that are set in [flag].
*/
Expand All @@ -366,28 +229,28 @@ public class ActivityFlags internal constructor(
* [flag].
*/
public operator fun plus(flag: ActivityFlag): ActivityFlags =
ActivityFlags(this.value or flag.value, null)
ActivityFlags(this.value or flag.value)

/**
* Returns an instance of [ActivityFlags] that has all bits set that are set in `this` and
* [flags].
*/
public operator fun plus(flags: ActivityFlags): ActivityFlags =
ActivityFlags(this.value or flags.value, null)
ActivityFlags(this.value or flags.value)

/**
* Returns an instance of [ActivityFlags] that has all bits set that are set in `this` except
* the bits that are set in [flag].
*/
public operator fun minus(flag: ActivityFlag): ActivityFlags =
ActivityFlags(this.value and flag.value.inv(), null)
ActivityFlags(this.value and flag.value.inv())

/**
* Returns an instance of [ActivityFlags] that has all bits set that are set in `this` except
* the bits that are set in [flags].
*/
public operator fun minus(flags: ActivityFlags): ActivityFlags =
ActivityFlags(this.value and flags.value.inv(), null)
ActivityFlags(this.value and flags.value.inv())

/**
* Returns a copy of this instance of [ActivityFlags] modified with [builder].
Expand Down Expand Up @@ -439,7 +302,7 @@ public class ActivityFlags internal constructor(
* Returns an instance of [ActivityFlags] that has all bits set that are currently set in
* this [Builder].
*/
public fun build(): ActivityFlags = ActivityFlags(value, null)
public fun build(): ActivityFlags = ActivityFlags(value)
}

internal object Serializer : KSerializer<ActivityFlags> {
Expand All @@ -453,7 +316,7 @@ public class ActivityFlags internal constructor(
}

override fun deserialize(decoder: Decoder): ActivityFlags =
ActivityFlags(decoder.decodeSerializableValue(delegate), null)
ActivityFlags(decoder.decodeSerializableValue(delegate))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,7 @@ public sealed class ActivityType(
*/
public class Unknown internal constructor(
code: Int,
@Suppress(names = arrayOf("UNUSED_PARAMETER"))
unused: Nothing?,
) : ActivityType(code) {
@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Replaced by 'ActivityType.from()'.",
replaceWith = ReplaceWith(expression = "ActivityType.from(code)", imports =
arrayOf("dev.kord.common.entity.ActivityType")),
)
public constructor(code: Int) : this(code, null)
}
) : ActivityType(code)

public object Game : ActivityType(0)

Expand Down Expand Up @@ -101,7 +91,7 @@ public sealed class ActivityType(
3 -> Watching
4 -> Custom
5 -> Competing
else -> Unknown(code, null)
else -> Unknown(code)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,7 @@ public sealed class AllowedMentionType(
*/
public class Unknown internal constructor(
`value`: String,
@Suppress(names = arrayOf("UNUSED_PARAMETER"))
unused: Nothing?,
) : AllowedMentionType(value) {
@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Replaced by 'AllowedMentionType.from()'.",
replaceWith = ReplaceWith(expression = "AllowedMentionType.from(value)", imports =
arrayOf("dev.kord.common.entity.AllowedMentionType")),
)
public constructor(`value`: String) : this(value, null)
}
) : AllowedMentionType(value)

/**
* Controls role mentions.
Expand Down Expand Up @@ -101,7 +91,7 @@ public sealed class AllowedMentionType(
"roles" -> RoleMentions
"users" -> UserMentions
"everyone" -> EveryoneMentions
else -> Unknown(value, null)
else -> Unknown(value)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@ public sealed class ApplicationCommandOptionType(
*/
public class Unknown internal constructor(
type: Int,
@Suppress(names = arrayOf("UNUSED_PARAMETER"))
unused: Nothing?,
) : ApplicationCommandOptionType(type) {
@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Replaced by 'ApplicationCommandOptionType.from()'.",
replaceWith = ReplaceWith(expression = "ApplicationCommandOptionType.from(type)",
imports = arrayOf("dev.kord.common.entity.ApplicationCommandOptionType")),
)
public constructor(type: Int) : this(type, null)
}
) : ApplicationCommandOptionType(type)

public object SubCommand : ApplicationCommandOptionType(1)

Expand Down Expand Up @@ -137,7 +127,7 @@ public sealed class ApplicationCommandOptionType(
9 -> Mentionable
10 -> Number
11 -> Attachment
else -> Unknown(type, null)
else -> Unknown(type)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,7 @@ public sealed class ApplicationCommandPermissionType(
*/
public class Unknown internal constructor(
`value`: Int,
@Suppress(names = arrayOf("UNUSED_PARAMETER"))
unused: Nothing?,
) : ApplicationCommandPermissionType(value) {
@Deprecated(
level = DeprecationLevel.HIDDEN,
message = "Replaced by 'ApplicationCommandPermissionType.from()'.",
replaceWith = ReplaceWith(expression = "ApplicationCommandPermissionType.from(value)",
imports =
arrayOf("dev.kord.common.entity.ApplicationCommandPermissionType")),
)
public constructor(`value`: Int) : this(value, null)
}
) : ApplicationCommandPermissionType(value)

public object Role : ApplicationCommandPermissionType(1)

Expand Down Expand Up @@ -94,7 +83,7 @@ public sealed class ApplicationCommandPermissionType(
1 -> Role
2 -> User
3 -> Channel
else -> Unknown(value, null)
else -> Unknown(value)
}
}
}
Loading

0 comments on commit b89838c

Please sign in to comment.