Lower deprecation notice for KotlinClassHeader and improve migration path

This commit is contained in:
Leonid Startsev
2022-10-06 15:03:32 +02:00
committed by Space Team
parent 96279364de
commit b974b283a3
2 changed files with 14 additions and 2 deletions
@@ -22,7 +22,11 @@ import java.util.Arrays;
* Kotlin clients should be able to instantiate annotation directly and therefore should not use this class. * Kotlin clients should be able to instantiate annotation directly and therefore should not use this class.
*/ */
@SuppressWarnings("ClassExplicitlyAnnotation") @SuppressWarnings("ClassExplicitlyAnnotation")
@kotlin.Deprecated(message = "Kotlin clients should instantiate Metadata annotation directly", replaceWith = @ReplaceWith(expression = "Metadata", imports = {}), level = DeprecationLevel.ERROR) @kotlin.Deprecated(
message = "Kotlin clients should instantiate Metadata annotation directly",
replaceWith = @ReplaceWith(expression = "Metadata", imports = {}),
level = DeprecationLevel.WARNING
)
public final class KotlinClassHeader implements Metadata { public final class KotlinClassHeader implements Metadata {
private final int k; private final int k;
@NotNull private final int[] mv; @NotNull private final int[] mv;
@@ -42,6 +46,14 @@ public final class KotlinClassHeader implements Metadata {
* @param extraInt see {@link Metadata#xi()} * @param extraInt see {@link Metadata#xi()}
*/ */
@SuppressWarnings("SSBasedInspection") @SuppressWarnings("SSBasedInspection")
@kotlin.Deprecated(
message = "Kotlin clients should instantiate Metadata annotation directly",
replaceWith = @ReplaceWith(
expression = "kotlinx.metadata.jvm.Metadata(kind, metadataVersion, data1, data2, extraString, packageName, extraInt)",
imports = {}
),
level = DeprecationLevel.WARNING
)
public KotlinClassHeader( public KotlinClassHeader(
@Nullable Integer kind, @Nullable Integer kind,
@Nullable int[] metadataVersion, @Nullable int[] metadataVersion,
@@ -22,7 +22,7 @@ import kotlin.LazyThreadSafetyMode.PUBLICATION
* Represents the parsed metadata of a Kotlin JVM class file. * Represents the parsed metadata of a Kotlin JVM class file.
* *
* To create an instance of [KotlinClassMetadata], first obtain an instance of [Metadata] annotation on a class file, and then call [KotlinClassMetadata.read]. * To create an instance of [KotlinClassMetadata], first obtain an instance of [Metadata] annotation on a class file, and then call [KotlinClassMetadata.read].
* [Metadata] annotation can be obtained either via reflection or created from data from a binary class file, using its constructor or helper function. * [Metadata] annotation can be obtained either via reflection or created from data from a binary class file, using its constructor or helper function [kotlinx.metadata.jvm.Metadata].
*/ */
sealed class KotlinClassMetadata(val header: Metadata) { sealed class KotlinClassMetadata(val header: Metadata) {
/** /**