Promote most deprecations in kotlinx-metadata-jvm to ERROR

because WARNING versions of them were already released at some point.

The following declarations were not promoted and have to be promoted later:

- KmProperty.hasGetter, .hasSetter
- Deprecations from readStrict/readLenient/write() rework

#KT-63157 In progress
This commit is contained in:
Leonid Startsev
2023-11-09 19:22:20 +01:00
committed by Space Team
parent af63763da2
commit 477c668c80
8 changed files with 15 additions and 15 deletions
@@ -29,13 +29,13 @@ public sealed class JvmMemberSignature {
// Two following declarations are deprecated since 0.6.1, should be error in 0.7.0+
@Deprecated("Deprecated for removal. Use descriptor instead", ReplaceWith("descriptor"), level = DeprecationLevel.WARNING)
@Deprecated("Deprecated for removal. Use descriptor instead", ReplaceWith("descriptor"), level = DeprecationLevel.ERROR)
public val desc: String get() = descriptor
@Deprecated(
"asString() is deprecated as redundant. Use toString() instead",
ReplaceWith("toString()"),
level = DeprecationLevel.WARNING
level = DeprecationLevel.ERROR
)
public fun asString(): String = toString()
}
@@ -22,7 +22,7 @@ public fun ClassName.toJvmInternalName(): String =
@Deprecated(
"Renamed to toJvmInternalName() to avoid confusion with String properties",
ReplaceWith("toJvmInternalName()"),
level = DeprecationLevel.WARNING
level = DeprecationLevel.ERROR
)
public val ClassName.jvmInternalName: String get() = toJvmInternalName()
@@ -25,7 +25,7 @@ import java.util.Arrays;
@kotlin.Deprecated(
message = "Kotlin clients should instantiate Metadata annotation directly",
replaceWith = @ReplaceWith(expression = "Metadata", imports = {}),
level = DeprecationLevel.WARNING
level = DeprecationLevel.ERROR
)
public final class KotlinClassHeader implements Metadata {
private final int k;
@@ -52,7 +52,7 @@ public final class KotlinClassHeader implements Metadata {
expression = "kotlinx.metadata.jvm.Metadata(kind, metadataVersion, data1, data2, extraString, packageName, extraInt)",
imports = {}
),
level = DeprecationLevel.WARNING
level = DeprecationLevel.ERROR
)
public KotlinClassHeader(
@Nullable Integer kind,
@@ -72,7 +72,7 @@ public sealed class KotlinClassMetadata(internal val annotationData: Metadata) {
@Deprecated(
"To avoid excessive copying, use .kmClass property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmClass"),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun toKmClass(): KmClass = KmClass().also { newKm -> kmClass.accept(newKm) } // defensive copy
@@ -140,7 +140,7 @@ public sealed class KotlinClassMetadata(internal val annotationData: Metadata) {
@Deprecated(
"To avoid excessive copying, use .kmPackage property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmPackage"),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun toKmPackage(): KmPackage = KmPackage().also { newPkg -> kmPackage.accept(newPkg) }
@@ -216,7 +216,7 @@ public sealed class KotlinClassMetadata(internal val annotationData: Metadata) {
@Deprecated(
"To avoid excessive copying, use .kmLambda property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmLambda"),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun toKmLambda(): KmLambda? = if (isLambda) KmLambda().apply(this::accept) else null
@@ -374,7 +374,7 @@ public sealed class KotlinClassMetadata(internal val annotationData: Metadata) {
@Deprecated(
"To avoid excessive copying, use .kmPackage property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmPackage"),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun toKmPackage(): KmPackage = KmPackage().also { newKmp -> kmPackage.accept(newKmp) }
@@ -56,7 +56,7 @@ public class KotlinModuleMetadata private constructor(
@Deprecated(
"To avoid excessive copying, use .kmModule property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmModule"),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun toKmModule(): KmModule = KmModule().apply { kmModule.accept(this) }
@@ -262,7 +262,7 @@ public class KmModule : KmModuleVisitor() {
*
* Currently, Kotlin does not provide functionality to specify annotations on modules.
*/
@Deprecated("This list is always empty and will be removed", level = DeprecationLevel.WARNING)
@Deprecated("This list is always empty and will be removed", level = DeprecationLevel.ERROR)
public val annotations: MutableList<KmAnnotation> = ArrayList(0)
/**
@@ -298,13 +298,13 @@ public var KmProperty.isVar: Boolean by propertyBooleanFlag(FlagImpl(ProtoFlags.
/**
* Indicates that the corresponding property has a getter.
*/
@Deprecated("Kotlin properties always have getters", ReplaceWith("true"), DeprecationLevel.WARNING)
@Deprecated("Kotlin properties always have getters", ReplaceWith("true"), DeprecationLevel.WARNING) // Deprecated in 0.8.0
public var KmProperty.hasGetter: Boolean by propertyBooleanFlag(FlagImpl(ProtoFlags.HAS_GETTER))
/**
* Indicates that the corresponding property has a setter.
*/
@Deprecated("Check .setter for nullability instead", ReplaceWith("this.setter != null"), DeprecationLevel.WARNING)
@Deprecated("Check .setter for nullability instead", ReplaceWith("this.setter != null"), DeprecationLevel.WARNING) // Deprecated in 0.8.0
public var KmProperty.hasSetter: Boolean by propertyBooleanFlag(FlagImpl(ProtoFlags.HAS_SETTER))
/**
@@ -29,6 +29,6 @@ public fun ClassName.isLocalClassName(): Boolean = this.startsWith(".")
@Deprecated(
"Renamed to isLocalClassName() to avoid confusion with String properties",
ReplaceWith("isLocalClassName()"),
level = DeprecationLevel.WARNING
level = DeprecationLevel.ERROR
)
public val ClassName.isLocal: Boolean get() = isLocalClassName()
@@ -30,7 +30,7 @@ public class KotlinCommonMetadata private constructor(proto: ProtoBuf.PackageFra
@Deprecated(
"To avoid excessive copying, use .kmModuleFragment property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmModuleFragment"),
DeprecationLevel.WARNING
DeprecationLevel.ERROR
)
public fun toKmModuleFragment(): KmModuleFragment =
KmModuleFragment().apply { kmModuleFragment.accept(this) }