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+ // 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 public val desc: String get() = descriptor
@Deprecated( @Deprecated(
"asString() is deprecated as redundant. Use toString() instead", "asString() is deprecated as redundant. Use toString() instead",
ReplaceWith("toString()"), ReplaceWith("toString()"),
level = DeprecationLevel.WARNING level = DeprecationLevel.ERROR
) )
public fun asString(): String = toString() public fun asString(): String = toString()
} }
@@ -22,7 +22,7 @@ public fun ClassName.toJvmInternalName(): String =
@Deprecated( @Deprecated(
"Renamed to toJvmInternalName() to avoid confusion with String properties", "Renamed to toJvmInternalName() to avoid confusion with String properties",
ReplaceWith("toJvmInternalName()"), ReplaceWith("toJvmInternalName()"),
level = DeprecationLevel.WARNING level = DeprecationLevel.ERROR
) )
public val ClassName.jvmInternalName: String get() = toJvmInternalName() public val ClassName.jvmInternalName: String get() = toJvmInternalName()
@@ -25,7 +25,7 @@ import java.util.Arrays;
@kotlin.Deprecated( @kotlin.Deprecated(
message = "Kotlin clients should instantiate Metadata annotation directly", message = "Kotlin clients should instantiate Metadata annotation directly",
replaceWith = @ReplaceWith(expression = "Metadata", imports = {}), replaceWith = @ReplaceWith(expression = "Metadata", imports = {}),
level = DeprecationLevel.WARNING level = DeprecationLevel.ERROR
) )
public final class KotlinClassHeader implements Metadata { public final class KotlinClassHeader implements Metadata {
private final int k; 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)", expression = "kotlinx.metadata.jvm.Metadata(kind, metadataVersion, data1, data2, extraString, packageName, extraInt)",
imports = {} imports = {}
), ),
level = DeprecationLevel.WARNING level = DeprecationLevel.ERROR
) )
public KotlinClassHeader( public KotlinClassHeader(
@Nullable Integer kind, @Nullable Integer kind,
@@ -72,7 +72,7 @@ public sealed class KotlinClassMetadata(internal val annotationData: Metadata) {
@Deprecated( @Deprecated(
"To avoid excessive copying, use .kmClass property instead. Note that it returns a view and not a copy.", "To avoid excessive copying, use .kmClass property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmClass"), ReplaceWith("kmClass"),
DeprecationLevel.WARNING DeprecationLevel.ERROR
) )
public fun toKmClass(): KmClass = KmClass().also { newKm -> kmClass.accept(newKm) } // defensive copy 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( @Deprecated(
"To avoid excessive copying, use .kmPackage property instead. Note that it returns a view and not a copy.", "To avoid excessive copying, use .kmPackage property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmPackage"), ReplaceWith("kmPackage"),
DeprecationLevel.WARNING DeprecationLevel.ERROR
) )
public fun toKmPackage(): KmPackage = KmPackage().also { newPkg -> kmPackage.accept(newPkg) } public fun toKmPackage(): KmPackage = KmPackage().also { newPkg -> kmPackage.accept(newPkg) }
@@ -216,7 +216,7 @@ public sealed class KotlinClassMetadata(internal val annotationData: Metadata) {
@Deprecated( @Deprecated(
"To avoid excessive copying, use .kmLambda property instead. Note that it returns a view and not a copy.", "To avoid excessive copying, use .kmLambda property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmLambda"), ReplaceWith("kmLambda"),
DeprecationLevel.WARNING DeprecationLevel.ERROR
) )
public fun toKmLambda(): KmLambda? = if (isLambda) KmLambda().apply(this::accept) else null 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( @Deprecated(
"To avoid excessive copying, use .kmPackage property instead. Note that it returns a view and not a copy.", "To avoid excessive copying, use .kmPackage property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmPackage"), ReplaceWith("kmPackage"),
DeprecationLevel.WARNING DeprecationLevel.ERROR
) )
public fun toKmPackage(): KmPackage = KmPackage().also { newKmp -> kmPackage.accept(newKmp) } public fun toKmPackage(): KmPackage = KmPackage().also { newKmp -> kmPackage.accept(newKmp) }
@@ -56,7 +56,7 @@ public class KotlinModuleMetadata private constructor(
@Deprecated( @Deprecated(
"To avoid excessive copying, use .kmModule property instead. Note that it returns a view and not a copy.", "To avoid excessive copying, use .kmModule property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmModule"), ReplaceWith("kmModule"),
DeprecationLevel.WARNING DeprecationLevel.ERROR
) )
public fun toKmModule(): KmModule = KmModule().apply { kmModule.accept(this) } 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. * 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) 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. * 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)) public var KmProperty.hasGetter: Boolean by propertyBooleanFlag(FlagImpl(ProtoFlags.HAS_GETTER))
/** /**
* Indicates that the corresponding property has a setter. * 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)) public var KmProperty.hasSetter: Boolean by propertyBooleanFlag(FlagImpl(ProtoFlags.HAS_SETTER))
/** /**
@@ -29,6 +29,6 @@ public fun ClassName.isLocalClassName(): Boolean = this.startsWith(".")
@Deprecated( @Deprecated(
"Renamed to isLocalClassName() to avoid confusion with String properties", "Renamed to isLocalClassName() to avoid confusion with String properties",
ReplaceWith("isLocalClassName()"), ReplaceWith("isLocalClassName()"),
level = DeprecationLevel.WARNING level = DeprecationLevel.ERROR
) )
public val ClassName.isLocal: Boolean get() = isLocalClassName() public val ClassName.isLocal: Boolean get() = isLocalClassName()
@@ -30,7 +30,7 @@ public class KotlinCommonMetadata private constructor(proto: ProtoBuf.PackageFra
@Deprecated( @Deprecated(
"To avoid excessive copying, use .kmModuleFragment property instead. Note that it returns a view and not a copy.", "To avoid excessive copying, use .kmModuleFragment property instead. Note that it returns a view and not a copy.",
ReplaceWith("kmModuleFragment"), ReplaceWith("kmModuleFragment"),
DeprecationLevel.WARNING DeprecationLevel.ERROR
) )
public fun toKmModuleFragment(): KmModuleFragment = public fun toKmModuleFragment(): KmModuleFragment =
KmModuleFragment().apply { kmModuleFragment.accept(this) } KmModuleFragment().apply { kmModuleFragment.accept(this) }