Add stdlib-gen DSL support for DeprecatedSinceKotlin annotation
This commit is contained in:
@@ -136,7 +136,9 @@ enum class SequenceClass {
|
||||
stateful
|
||||
}
|
||||
|
||||
data class Deprecation(val message: String, val replaceWith: String? = null, val level: DeprecationLevel = DeprecationLevel.WARNING)
|
||||
data class Deprecation(
|
||||
val message: String, val replaceWith: String? = null, val level: DeprecationLevel = DeprecationLevel.WARNING,
|
||||
val warningSince: String? = null, val errorSince: String? = null, val hiddenSince: String? = null)
|
||||
val forBinaryCompatibility = Deprecation("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
|
||||
data class ThrowsException(val exceptionType: String, val reason: String)
|
||||
|
||||
@@ -327,7 +327,15 @@ class MemberBuilder(
|
||||
deprecated.replaceWith?.let { "ReplaceWith(\"$it\")" },
|
||||
deprecated.level.let { if (it != DeprecationLevel.WARNING) "level = DeprecationLevel.$it" else null }
|
||||
)
|
||||
builder.append("@Deprecated(${args.joinToString(", ")})\n")
|
||||
builder.appendLine("@Deprecated(${args.joinToString(", ")})")
|
||||
val versionArgs = listOfNotNull(
|
||||
deprecated.warningSince?.let { "warningSince = \"$it\"" },
|
||||
deprecated.errorSince?.let { "errorSince = \"$it\"" },
|
||||
deprecated.hiddenSince?.let { "hiddenSince = \"$it\"" }
|
||||
)
|
||||
if (versionArgs.any()) {
|
||||
builder.appendLine("@DeprecatedSinceKotlin(${versionArgs.joinToString(", ")})")
|
||||
}
|
||||
}
|
||||
|
||||
if (!f.isPrimitiveSpecialization && primitive != null) {
|
||||
|
||||
Reference in New Issue
Block a user