Fix various review comments: rephrase deprecations, update KDocs,
remove unnecessary deprecations and unused functions.
This commit is contained in:
committed by
Space Team
parent
474ef921d8
commit
21d2211dcd
@@ -21,8 +21,8 @@ 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 a [KotlinClassHeader] instance by loading the contents
|
* To create an instance of [KotlinClassMetadata], first obtain an instance of [Metadata] annotation on a class file, and then call [KotlinClassMetadata.read].
|
||||||
* of the [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.
|
||||||
*/
|
*/
|
||||||
sealed class KotlinClassMetadata(val header: Metadata) {
|
sealed class KotlinClassMetadata(val header: Metadata) {
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,7 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
*
|
*
|
||||||
* @param v the visitor that must visit this class
|
* @param v the visitor that must visit this class
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(v: KmClassVisitor) {
|
fun accept(v: KmClassVisitor) {
|
||||||
val (strings, proto) = classData
|
val (strings, proto) = classData
|
||||||
proto.accept(v, strings)
|
proto.accept(v, strings)
|
||||||
@@ -56,22 +56,20 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* A [KmClassVisitor] that generates the metadata of a Kotlin class.
|
* A [KmClassVisitor] that generates the metadata of a Kotlin class.
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
writerApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeClass(kmClass, metadataVersion, extraInt)",
|
||||||
ReplaceWith("KotlinClassMetadata.writeClass(kmClass, metadataVersion, extraInt)"),
|
|
||||||
)
|
)
|
||||||
class Writer : ClassWriter(JvmStringTable()) {
|
class Writer : ClassWriter(JvmStringTable()) {
|
||||||
/**
|
/**
|
||||||
* Returns the metadata of the class that was written with this writer.
|
* Returns the metadata of the class that was written with this writer.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
writerApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeClass(kmClass, metadataVersion, extraInt)",
|
||||||
ReplaceWith("KotlinClassMetadata.writeClass(kmClass, metadataVersion, extraInt)"),
|
|
||||||
)
|
)
|
||||||
fun write(
|
fun write(
|
||||||
metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION,
|
metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION,
|
||||||
@@ -106,7 +104,7 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
*
|
*
|
||||||
* @param v the visitor that must visit this file facade
|
* @param v the visitor that must visit this file facade
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(v: KmPackageVisitor) {
|
fun accept(v: KmPackageVisitor) {
|
||||||
val (strings, proto) = packageData
|
val (strings, proto) = packageData
|
||||||
proto.accept(v, strings)
|
proto.accept(v, strings)
|
||||||
@@ -116,22 +114,20 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* A [KmPackageVisitor] that generates the metadata of a Kotlin file facade.
|
* A [KmPackageVisitor] that generates the metadata of a Kotlin file facade.
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
visitorApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeFileFacade(kmPackage, metadataVersion, extraInt)",
|
||||||
ReplaceWith("KotlinClassMetadata.writeFileFacade(kmPackage, metadataVersion, extraInt)")
|
|
||||||
)
|
)
|
||||||
class Writer : PackageWriter(JvmStringTable()) {
|
class Writer : PackageWriter(JvmStringTable()) {
|
||||||
/**
|
/**
|
||||||
* Returns the metadata of the file facade that was written with this writer.
|
* Returns the metadata of the file facade that was written with this writer.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
visitorApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeFileFacade(kmPackage, metadataVersion, extraInt)",
|
||||||
ReplaceWith("KotlinClassMetadata.writeFileFacade(kmPackage, metadataVersion, extraInt)")
|
|
||||||
)
|
)
|
||||||
fun write(
|
fun write(
|
||||||
metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION,
|
metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION,
|
||||||
@@ -178,7 +174,7 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
*
|
*
|
||||||
* @param v the visitor that must visit this lambda
|
* @param v the visitor that must visit this lambda
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(v: KmLambdaVisitor) {
|
fun accept(v: KmLambdaVisitor) {
|
||||||
if (!isLambda) throw IllegalStateException(
|
if (!isLambda) throw IllegalStateException(
|
||||||
"accept(KmLambdaVisitor) is only possible for synthetic classes which are lambdas (isLambda = true)"
|
"accept(KmLambdaVisitor) is only possible for synthetic classes which are lambdas (isLambda = true)"
|
||||||
@@ -194,20 +190,20 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* the resulting metadata will represent a _non-lambda_ synthetic class.
|
* the resulting metadata will represent a _non-lambda_ synthetic class.
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"Visitor API is deprecated as excessive and cumbersome. Please use KotlinClassMetadata.writeLambda(kmLambda, metadataVersion, extraInt) " +
|
WRITER_API_MESSAGE + ": KotlinClassMetadata.writeLambda(kmLambda, metadataVersion, extraInt) " +
|
||||||
"or KotlinClassMetadata.writeSyntheticClass(metadataVersion, extraInt) for a non-lambda synthetic class",
|
"or KotlinClassMetadata.writeSyntheticClass(metadataVersion, extraInt) for a non-lambda synthetic class",
|
||||||
)
|
)
|
||||||
class Writer : LambdaWriter(JvmStringTable()) {
|
class Writer : LambdaWriter(JvmStringTable()) {
|
||||||
/**
|
/**
|
||||||
* Returns the metadata of the synthetic class that was written with this writer.
|
* Returns the metadata of the synthetic class that was written with this writer.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"Visitor API is deprecated as excessive and cumbersome. Please use KotlinClassMetadata.writeLambda(kmLambda, metadataVersion, extraInt) " +
|
WRITER_API_MESSAGE + ": KotlinClassMetadata.writeLambda(kmLambda, metadataVersion, extraInt) " +
|
||||||
"or KotlinClassMetadata.writeSyntheticClass(metadataVersion, extraInt) for a non-lambda synthetic class",
|
"or KotlinClassMetadata.writeSyntheticClass(metadataVersion, extraInt) for a non-lambda synthetic class",
|
||||||
)
|
)
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@@ -241,22 +237,20 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* A writer that generates the metadata of a multi-file class facade.
|
* A writer that generates the metadata of a multi-file class facade.
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
writerApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassFacade(partClassNames, metadataVersion, extraInt)",
|
||||||
ReplaceWith("KotlinClassMetadata.writeMultiFileClassFacade(partClassNames, metadataVersion, extraInt)"),
|
|
||||||
)
|
)
|
||||||
class Writer {
|
class Writer {
|
||||||
/**
|
/**
|
||||||
* Returns the metadata of the multi-file class facade that was written with this writer.
|
* Returns the metadata of the multi-file class facade that was written with this writer.
|
||||||
*
|
*
|
||||||
* @param partClassNames JVM internal names of the part classes which this multi-file class combines
|
* @param partClassNames JVM internal names of the part classes which this multi-file class combines
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
writerApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassFacade(partClassNames, metadataVersion, extraInt)",
|
||||||
ReplaceWith("KotlinClassMetadata.writeMultiFileClassFacade(partClassNames, metadataVersion, extraInt)"),
|
|
||||||
)
|
)
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun write(
|
fun write(
|
||||||
@@ -304,7 +298,7 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
*
|
*
|
||||||
* @param v the visitor that must visit this multi-file class part
|
* @param v the visitor that must visit this multi-file class part
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(v: KmPackageVisitor) {
|
fun accept(v: KmPackageVisitor) {
|
||||||
val (strings, proto) = packageData
|
val (strings, proto) = packageData
|
||||||
proto.accept(v, strings)
|
proto.accept(v, strings)
|
||||||
@@ -314,22 +308,20 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* A [KmPackageVisitor] that generates the metadata of a multi-file class part.
|
* A [KmPackageVisitor] that generates the metadata of a multi-file class part.
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
writerApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassPart(kmPackage, facadeClassName, metadataVersion, extraInt)"
|
||||||
ReplaceWith("KotlinClassMetadata.writeMultiFileClassPart(kmPackage, facadeClassName, metadataVersion, extraInt)")
|
|
||||||
)
|
)
|
||||||
class Writer : PackageWriter(JvmStringTable()) {
|
class Writer : PackageWriter(JvmStringTable()) {
|
||||||
/**
|
/**
|
||||||
* Returns the metadata of the multi-file class part that was written with this writer.
|
* Returns the metadata of the multi-file class part that was written with this writer.
|
||||||
*
|
*
|
||||||
* @param facadeClassName JVM internal name of the corresponding multi-file class facade
|
* @param facadeClassName JVM internal name of the corresponding multi-file class facade
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
writerApiMessage,
|
"$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassPart(kmPackage, facadeClassName, metadataVersion, extraInt)"
|
||||||
ReplaceWith("KotlinClassMetadata.writeMultiFileClassPart(kmPackage, facadeClassName, metadataVersion, extraInt)")
|
|
||||||
)
|
)
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun write(
|
fun write(
|
||||||
@@ -357,9 +349,9 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
/**
|
/**
|
||||||
* Writes contents of [kmClass] as the class metadata.
|
* Writes contents of [kmClass] as the class metadata.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
fun writeClass(
|
fun writeClass(
|
||||||
@@ -371,9 +363,9 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
/**
|
/**
|
||||||
* Writes [kmPackage] contents as the file facade metadata.
|
* Writes [kmPackage] contents as the file facade metadata.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
fun writeFileFacade(
|
fun writeFileFacade(
|
||||||
@@ -385,9 +377,9 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
/**
|
/**
|
||||||
* Writes [kmLambda] as the synthetic class metadata.
|
* Writes [kmLambda] as the synthetic class metadata.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
fun writeLambda(
|
fun writeLambda(
|
||||||
@@ -399,9 +391,9 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
/**
|
/**
|
||||||
* Writes synthetic class metadata.
|
* Writes synthetic class metadata.
|
||||||
*
|
*
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
fun writeSyntheticClass(
|
fun writeSyntheticClass(
|
||||||
@@ -413,9 +405,9 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* Writes metadata of the multi-file class facade.
|
* Writes metadata of the multi-file class facade.
|
||||||
*
|
*
|
||||||
* @param partClassNames JVM internal names of the part classes which this multi-file class combines
|
* @param partClassNames JVM internal names of the part classes which this multi-file class combines
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
fun writeMultiFileClassFacade(
|
fun writeMultiFileClassFacade(
|
||||||
@@ -427,9 +419,9 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
* Writes the metadata of the multi-file class part.
|
* Writes the metadata of the multi-file class part.
|
||||||
*
|
*
|
||||||
* @param facadeClassName JVM internal name of the corresponding multi-file class facade
|
* @param facadeClassName JVM internal name of the corresponding multi-file class facade
|
||||||
* @param metadataVersion metadata version to be written to the metadata (see [KotlinClassHeader.metadataVersion]),
|
* @param metadataVersion metadata version to be written to the metadata (see [Metadata.metadataVersion]),
|
||||||
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
* [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default. Cannot be less (lexicographically) than `[1, 4]`
|
||||||
* @param extraInt the value of the class-level flags to be written to the metadata (see [KotlinClassHeader.extraInt]),
|
* @param extraInt the value of the class-level flags to be written to the metadata (see [Metadata.extraInt]),
|
||||||
* 0 by default
|
* 0 by default
|
||||||
*/
|
*/
|
||||||
fun writeMultiFileClassPart(
|
fun writeMultiFileClassPart(
|
||||||
@@ -531,8 +523,8 @@ sealed class KotlinClassMetadata(val header: Metadata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal const val visitorApiMessage =
|
internal const val VISITOR_API_MESSAGE =
|
||||||
"Visitor API is deprecated as excessive and cumbersome. Please use nodes (such as KmClass) and their properties."
|
"Visitor API is deprecated as excessive and cumbersome. Please use nodes (such as KmClass) and their properties."
|
||||||
|
|
||||||
internal const val writerApiMessage =
|
internal const val WRITER_API_MESSAGE =
|
||||||
"Visitor API is deprecated as excessive and cumbersome. Please use companion functions on KotlinClassMetadata, such as KotlinClassMetadata.writeClass."
|
"Visitor Writer API is deprecated as excessive and cumbersome. Please use member functions of KotlinClassMetadata.Companion"
|
||||||
@@ -93,7 +93,7 @@ class KotlinModuleMetadata(@Suppress("CanBeParameter", "MemberVisibilityCanBePri
|
|||||||
*
|
*
|
||||||
* @param v the visitor that must visit this module file
|
* @param v the visitor that must visit this module file
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(v: KmModuleVisitor) {
|
fun accept(v: KmModuleVisitor) {
|
||||||
for ((fqName, parts) in data.packageFqName2Parts) {
|
for ((fqName, parts) in data.packageFqName2Parts) {
|
||||||
val (fileFacades, multiFileClassParts) = parts.parts.partition { parts.getMultifileFacadeName(it) == null }
|
val (fileFacades, multiFileClassParts) = parts.parts.partition { parts.getMultifileFacadeName(it) == null }
|
||||||
@@ -150,7 +150,7 @@ class KotlinModuleMetadata(@Suppress("CanBeParameter", "MemberVisibilityCanBePri
|
|||||||
*
|
*
|
||||||
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) {
|
abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
* Visits the table of all single- and multi-file facades declared in some package of this module.
|
* Visits the table of all single- and multi-file facades declared in some package of this module.
|
||||||
@@ -220,17 +220,17 @@ class KmModule : KmModuleVisitor() {
|
|||||||
*/
|
*/
|
||||||
val optionalAnnotationClasses: MutableList<KmClass> = ArrayList(0)
|
val optionalAnnotationClasses: MutableList<KmClass> = ArrayList(0)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitPackageParts(fqName: String, fileFacades: List<String>, multiFileClassParts: Map<String, String>) {
|
override fun visitPackageParts(fqName: String, fileFacades: List<String>, multiFileClassParts: Map<String, String>) {
|
||||||
packageParts[fqName] = KmPackageParts(fileFacades.toMutableList(), multiFileClassParts.toMutableMap())
|
packageParts[fqName] = KmPackageParts(fileFacades.toMutableList(), multiFileClassParts.toMutableMap())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitAnnotation(annotation: KmAnnotation) {
|
override fun visitAnnotation(annotation: KmAnnotation) {
|
||||||
annotations.add(annotation)
|
annotations.add(annotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitOptionalAnnotationClass(): KmClass =
|
override fun visitOptionalAnnotationClass(): KmClass =
|
||||||
KmClass().also(optionalAnnotationClasses::add)
|
KmClass().also(optionalAnnotationClasses::add)
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ class KmModule : KmModuleVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this module.
|
* @param visitor the visitor which will visit data in this module.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmModuleVisitor) {
|
fun accept(visitor: KmModuleVisitor) {
|
||||||
for ((fqName, parts) in packageParts) {
|
for ((fqName, parts) in packageParts) {
|
||||||
visitor.visitPackageParts(fqName, parts.fileFacades, parts.multiFileClassParts)
|
visitor.visitPackageParts(fqName, parts.fileFacades, parts.multiFileClassParts)
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
|
|||||||
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
|
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
|
||||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
|
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
|
||||||
|
|
||||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
@Suppress("DEPRECATION")
|
||||||
internal class JvmMetadataExtensions : MetadataExtensions {
|
internal class JvmMetadataExtensions : MetadataExtensions {
|
||||||
override fun readClassExtensions(v: KmClassVisitor, proto: ProtoBuf.Class, c: ReadContext) {
|
override fun readClassExtensions(v: KmClassVisitor, proto: ProtoBuf.Class, c: ReadContext) {
|
||||||
val ext = v.visitExtensions(JvmClassExtensionVisitor.TYPE) as? JvmClassExtensionVisitor ?: return
|
val ext = v.visitExtensions(JvmClassExtensionVisitor.TYPE) as? JvmClassExtensionVisitor ?: return
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
|
|||||||
/**
|
/**
|
||||||
* A visitor containing the common code to visit JVM extensions for Kotlin declaration containers, such as classes and package fragments.
|
* A visitor containing the common code to visit JVM extensions for Kotlin declaration containers, such as classes and package fragments.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor(
|
abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor(
|
||||||
protected open val delegate: JvmDeclarationContainerExtensionVisitor? = null
|
protected open val delegate: JvmDeclarationContainerExtensionVisitor? = null
|
||||||
) : KmDeclarationContainerExtensionVisitor {
|
) : KmDeclarationContainerExtensionVisitor {
|
||||||
@@ -46,7 +46,7 @@ abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a class.
|
* A visitor to visit JVM extensions for a class.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmClassExtensionVisitor @JvmOverloads constructor(
|
open class JvmClassExtensionVisitor @JvmOverloads constructor(
|
||||||
delegate: JvmClassExtensionVisitor? = null
|
delegate: JvmClassExtensionVisitor? = null
|
||||||
) : KmClassExtensionVisitor, JvmDeclarationContainerExtensionVisitor(delegate) {
|
) : KmClassExtensionVisitor, JvmDeclarationContainerExtensionVisitor(delegate) {
|
||||||
@@ -92,7 +92,7 @@ open class JvmClassExtensionVisitor @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a package fragment.
|
* A visitor to visit JVM extensions for a package fragment.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmPackageExtensionVisitor @JvmOverloads constructor(
|
open class JvmPackageExtensionVisitor @JvmOverloads constructor(
|
||||||
delegate: JvmPackageExtensionVisitor? = null
|
delegate: JvmPackageExtensionVisitor? = null
|
||||||
) : KmPackageExtensionVisitor, JvmDeclarationContainerExtensionVisitor(delegate) {
|
) : KmPackageExtensionVisitor, JvmDeclarationContainerExtensionVisitor(delegate) {
|
||||||
@@ -123,7 +123,7 @@ open class JvmPackageExtensionVisitor @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a function.
|
* A visitor to visit JVM extensions for a function.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmFunctionExtensionVisitor @JvmOverloads constructor(
|
open class JvmFunctionExtensionVisitor @JvmOverloads constructor(
|
||||||
private val delegate: JvmFunctionExtensionVisitor? = null
|
private val delegate: JvmFunctionExtensionVisitor? = null
|
||||||
) : KmFunctionExtensionVisitor {
|
) : KmFunctionExtensionVisitor {
|
||||||
@@ -170,7 +170,7 @@ open class JvmFunctionExtensionVisitor @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a property.
|
* A visitor to visit JVM extensions for a property.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmPropertyExtensionVisitor @JvmOverloads constructor(
|
open class JvmPropertyExtensionVisitor @JvmOverloads constructor(
|
||||||
private val delegate: JvmPropertyExtensionVisitor? = null
|
private val delegate: JvmPropertyExtensionVisitor? = null
|
||||||
) : KmPropertyExtensionVisitor {
|
) : KmPropertyExtensionVisitor {
|
||||||
@@ -259,7 +259,7 @@ open class JvmPropertyExtensionVisitor @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a constructor.
|
* A visitor to visit JVM extensions for a constructor.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmConstructorExtensionVisitor @JvmOverloads constructor(
|
open class JvmConstructorExtensionVisitor @JvmOverloads constructor(
|
||||||
private val delegate: JvmConstructorExtensionVisitor? = null
|
private val delegate: JvmConstructorExtensionVisitor? = null
|
||||||
) : KmConstructorExtensionVisitor {
|
) : KmConstructorExtensionVisitor {
|
||||||
@@ -291,7 +291,7 @@ open class JvmConstructorExtensionVisitor @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a type parameter.
|
* A visitor to visit JVM extensions for a type parameter.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor(
|
open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor(
|
||||||
private val delegate: JvmTypeParameterExtensionVisitor? = null
|
private val delegate: JvmTypeParameterExtensionVisitor? = null
|
||||||
) : KmTypeParameterExtensionVisitor {
|
) : KmTypeParameterExtensionVisitor {
|
||||||
@@ -328,7 +328,7 @@ open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit JVM extensions for a type.
|
* A visitor to visit JVM extensions for a type.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
open class JvmTypeExtensionVisitor @JvmOverloads constructor(
|
open class JvmTypeExtensionVisitor @JvmOverloads constructor(
|
||||||
private val delegate: JvmTypeExtensionVisitor? = null
|
private val delegate: JvmTypeExtensionVisitor? = null
|
||||||
) : KmTypeExtensionVisitor {
|
) : KmTypeExtensionVisitor {
|
||||||
|
|||||||
@@ -191,7 +191,6 @@ class MetadataSmokeTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Suppress("DEPRECATION_ERROR")
|
|
||||||
fun metadataVersionEarlierThan1_4() {
|
fun metadataVersionEarlierThan1_4() {
|
||||||
val dummy = (KotlinClassMetadata.read(MetadataSmokeTest::class.java.readMetadata()) as KotlinClassMetadata.Class).toKmClass()
|
val dummy = (KotlinClassMetadata.read(MetadataSmokeTest::class.java.readMetadata()) as KotlinClassMetadata.Class).toKmClass()
|
||||||
val mv = intArrayOf(1, 3)
|
val mv = intArrayOf(1, 3)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class KmExtensionType(private val klass: KClass<out KmExtensionVisitor>) {
|
|||||||
/**
|
/**
|
||||||
* A base interface for all extension visitors.
|
* A base interface for all extension visitors.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmExtensionVisitor {
|
interface KmExtensionVisitor {
|
||||||
/**
|
/**
|
||||||
* Type of this extension visitor.
|
* Type of this extension visitor.
|
||||||
@@ -54,65 +54,65 @@ interface KmExtensionVisitor {
|
|||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a declaration container, such as a class or a package fragment.
|
* A visitor to visit platform-specific extensions for a declaration container, such as a class or a package fragment.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmDeclarationContainerExtensionVisitor : KmExtensionVisitor
|
interface KmDeclarationContainerExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a class.
|
* A visitor to visit platform-specific extensions for a class.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmClassExtensionVisitor : KmDeclarationContainerExtensionVisitor
|
interface KmClassExtensionVisitor : KmDeclarationContainerExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a package fragment.
|
* A visitor to visit platform-specific extensions for a package fragment.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmPackageExtensionVisitor : KmDeclarationContainerExtensionVisitor
|
interface KmPackageExtensionVisitor : KmDeclarationContainerExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a module fragment.
|
* A visitor to visit platform-specific extensions for a module fragment.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmModuleFragmentExtensionVisitor : KmExtensionVisitor
|
interface KmModuleFragmentExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a function.
|
* A visitor to visit platform-specific extensions for a function.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmFunctionExtensionVisitor : KmExtensionVisitor
|
interface KmFunctionExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a property.
|
* A visitor to visit platform-specific extensions for a property.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmPropertyExtensionVisitor : KmExtensionVisitor
|
interface KmPropertyExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a constructor.
|
* A visitor to visit platform-specific extensions for a constructor.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmConstructorExtensionVisitor : KmExtensionVisitor
|
interface KmConstructorExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a type parameter.
|
* A visitor to visit platform-specific extensions for a type parameter.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmTypeParameterExtensionVisitor : KmExtensionVisitor
|
interface KmTypeParameterExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a type.
|
* A visitor to visit platform-specific extensions for a type.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmTypeExtensionVisitor : KmExtensionVisitor
|
interface KmTypeExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a type alias.
|
* A visitor to visit platform-specific extensions for a type alias.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmTypeAliasExtensionVisitor : KmExtensionVisitor
|
interface KmTypeAliasExtensionVisitor : KmExtensionVisitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor to visit platform-specific extensions for a value parameter.
|
* A visitor to visit platform-specific extensions for a value parameter.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
interface KmValueParameterExtensionVisitor : KmExtensionVisitor
|
interface KmValueParameterExtensionVisitor : KmExtensionVisitor
|
||||||
|
|||||||
+1
-2
@@ -11,8 +11,7 @@ import kotlinx.metadata.impl.WriteContext
|
|||||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
// TODO: this intrerface should be marked with @InternalAPI or something
|
@Suppress("DEPRECATION")
|
||||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
|
||||||
interface MetadataExtensions {
|
interface MetadataExtensions {
|
||||||
fun readClassExtensions(v: KmClassVisitor, proto: ProtoBuf.Class, c: ReadContext)
|
fun readClassExtensions(v: KmClassVisitor, proto: ProtoBuf.Class, c: ReadContext)
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ class ReadContext(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
@OptIn(ExperimentalContextReceivers::class)
|
@OptIn(ExperimentalContextReceivers::class)
|
||||||
fun ProtoBuf.Class.accept(
|
fun ProtoBuf.Class.accept(
|
||||||
v: KmClassVisitor,
|
v: KmClassVisitor,
|
||||||
@@ -131,7 +130,6 @@ private fun ProtoBuf.Class.loadInlineClassUnderlyingType(c: ReadContext): ProtoB
|
|||||||
?.returnType(c.types)
|
?.returnType(c.types)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
fun ProtoBuf.Package.accept(
|
fun ProtoBuf.Package.accept(
|
||||||
v: KmPackageVisitor,
|
v: KmPackageVisitor,
|
||||||
strings: NameResolver,
|
strings: NameResolver,
|
||||||
@@ -153,7 +151,6 @@ fun ProtoBuf.Package.accept(
|
|||||||
v.visitEnd()
|
v.visitEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
fun ProtoBuf.PackageFragment.accept(
|
fun ProtoBuf.PackageFragment.accept(
|
||||||
v: KmModuleFragmentVisitor,
|
v: KmModuleFragmentVisitor,
|
||||||
strings: NameResolver,
|
strings: NameResolver,
|
||||||
@@ -200,7 +197,6 @@ private fun KmDeclarationContainerVisitor.visitDeclarations(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
fun ProtoBuf.Function.accept(v: KmLambdaVisitor, strings: NameResolver) {
|
fun ProtoBuf.Function.accept(v: KmLambdaVisitor, strings: NameResolver) {
|
||||||
val c = ReadContext(strings, TypeTable(typeTable), VersionRequirementTable.EMPTY)
|
val c = ReadContext(strings, TypeTable(typeTable), VersionRequirementTable.EMPTY)
|
||||||
|
|
||||||
@@ -209,7 +205,6 @@ fun ProtoBuf.Function.accept(v: KmLambdaVisitor, strings: NameResolver) {
|
|||||||
v.visitEnd()
|
v.visitEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
private fun ProtoBuf.Constructor.accept(v: KmConstructorVisitor, c: ReadContext) {
|
private fun ProtoBuf.Constructor.accept(v: KmConstructorVisitor, c: ReadContext) {
|
||||||
for (parameter in valueParameterList) {
|
for (parameter in valueParameterList) {
|
||||||
v.visitValueParameter(parameter.flags, c[parameter.name])?.let { parameter.accept(it, c) }
|
v.visitValueParameter(parameter.flags, c[parameter.name])?.let { parameter.accept(it, c) }
|
||||||
@@ -266,7 +261,6 @@ private fun ProtoBuf.Function.accept(v: KmFunctionVisitor, outer: ReadContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalContextReceivers::class)
|
@OptIn(ExperimentalContextReceivers::class)
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
fun ProtoBuf.Property.accept(v: KmPropertyVisitor, outer: ReadContext) {
|
fun ProtoBuf.Property.accept(v: KmPropertyVisitor, outer: ReadContext) {
|
||||||
val c = outer.withTypeParameters(typeParameterList)
|
val c = outer.withTypeParameters(typeParameterList)
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ private fun writeFunction(c: WriteContext, flags: Flags, name: String, output: (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
fun writeProperty(
|
fun writeProperty(
|
||||||
c: WriteContext, flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags, output: (ProtoBuf.Property.Builder) -> Unit
|
c: WriteContext, flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags, output: (ProtoBuf.Property.Builder) -> Unit
|
||||||
): KmPropertyVisitor = object : KmPropertyVisitor() {
|
): KmPropertyVisitor = object : KmPropertyVisitor() {
|
||||||
@@ -423,7 +422,6 @@ private fun writeEffectExpression(c: WriteContext, output: (ProtoBuf.Expression.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
open class ClassWriter(stringTable: StringTable, contextExtensions: List<WriteContextExtension> = emptyList()) : KmClassVisitor() {
|
open class ClassWriter(stringTable: StringTable, contextExtensions: List<WriteContextExtension> = emptyList()) : KmClassVisitor() {
|
||||||
protected val t = ProtoBuf.Class.newBuilder()!!
|
protected val t = ProtoBuf.Class.newBuilder()!!
|
||||||
protected val c: WriteContext = WriteContext(stringTable, contextExtensions)
|
protected val c: WriteContext = WriteContext(stringTable, contextExtensions)
|
||||||
@@ -497,7 +495,6 @@ open class ClassWriter(stringTable: StringTable, contextExtensions: List<WriteCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
open class PackageWriter(stringTable: StringTable, contextExtensions: List<WriteContextExtension> = emptyList()) : KmPackageVisitor() {
|
open class PackageWriter(stringTable: StringTable, contextExtensions: List<WriteContextExtension> = emptyList()) : KmPackageVisitor() {
|
||||||
protected val t = ProtoBuf.Package.newBuilder()!!
|
protected val t = ProtoBuf.Package.newBuilder()!!
|
||||||
protected val c: WriteContext = WriteContext(stringTable, contextExtensions)
|
protected val c: WriteContext = WriteContext(stringTable, contextExtensions)
|
||||||
@@ -523,7 +520,6 @@ open class PackageWriter(stringTable: StringTable, contextExtensions: List<Write
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
open class ModuleFragmentWriter(stringTable: StringTable, contextExtensions: List<WriteContextExtension> = emptyList()) :
|
open class ModuleFragmentWriter(stringTable: StringTable, contextExtensions: List<WriteContextExtension> = emptyList()) :
|
||||||
KmModuleFragmentVisitor() {
|
KmModuleFragmentVisitor() {
|
||||||
protected val t = ProtoBuf.PackageFragment.newBuilder()!!
|
protected val t = ProtoBuf.PackageFragment.newBuilder()!!
|
||||||
@@ -549,7 +545,6 @@ open class ModuleFragmentWriter(stringTable: StringTable, contextExtensions: Lis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
|
||||||
open class LambdaWriter(stringTable: StringTable) : KmLambdaVisitor() {
|
open class LambdaWriter(stringTable: StringTable) : KmLambdaVisitor() {
|
||||||
protected var t: ProtoBuf.Function.Builder? = null
|
protected var t: ProtoBuf.Function.Builder? = null
|
||||||
protected val c = WriteContext(stringTable)
|
protected val c = WriteContext(stringTable)
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.metadata.builtins.readBuiltinsPackageFragment
|
|||||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
|
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
|
|
||||||
// TODO: decide what to with this piece
|
// TODO: stabilize
|
||||||
class KotlinCommonMetadata private constructor(private val proto: ProtoBuf.PackageFragment) {
|
class KotlinCommonMetadata private constructor(private val proto: ProtoBuf.PackageFragment) {
|
||||||
fun toKmModuleFragment(): KmModuleFragment =
|
fun toKmModuleFragment(): KmModuleFragment =
|
||||||
KmModuleFragment().apply(this::accept)
|
KmModuleFragment().apply(this::accept)
|
||||||
|
|||||||
@@ -119,75 +119,75 @@ class KmClass : KmClassVisitor(), KmDeclarationContainer {
|
|||||||
private val extensions: List<KmClassExtension> =
|
private val extensions: List<KmClassExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createClassExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createClassExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visit(flags: Flags, name: ClassName) {
|
override fun visit(flags: Flags, name: ClassName) {
|
||||||
this.flags = flags
|
this.flags = flags
|
||||||
this.name = name
|
this.name = name
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
||||||
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitSupertype(flags: Flags): KmTypeVisitor =
|
override fun visitSupertype(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).addTo(supertypes)
|
KmType(flags).addTo(supertypes)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor =
|
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor =
|
||||||
KmFunction(flags, name).addTo(functions)
|
KmFunction(flags, name).addTo(functions)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitProperty(flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags): KmPropertyVisitor =
|
override fun visitProperty(flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags): KmPropertyVisitor =
|
||||||
KmProperty(flags, name, getterFlags, setterFlags).addTo(properties)
|
KmProperty(flags, name, getterFlags, setterFlags).addTo(properties)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeAlias(flags: Flags, name: String): KmTypeAliasVisitor =
|
override fun visitTypeAlias(flags: Flags, name: String): KmTypeAliasVisitor =
|
||||||
KmTypeAlias(flags, name).addTo(typeAliases)
|
KmTypeAlias(flags, name).addTo(typeAliases)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitConstructor(flags: Flags): KmConstructorVisitor =
|
override fun visitConstructor(flags: Flags): KmConstructorVisitor =
|
||||||
KmConstructor(flags).addTo(constructors)
|
KmConstructor(flags).addTo(constructors)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitCompanionObject(name: String) {
|
override fun visitCompanionObject(name: String) {
|
||||||
this.companionObject = name
|
this.companionObject = name
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitNestedClass(name: String) {
|
override fun visitNestedClass(name: String) {
|
||||||
nestedClasses.add(name)
|
nestedClasses.add(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitEnumEntry(name: String) {
|
override fun visitEnumEntry(name: String) {
|
||||||
enumEntries.add(name)
|
enumEntries.add(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitSealedSubclass(name: ClassName) {
|
override fun visitSealedSubclass(name: ClassName) {
|
||||||
sealedSubclasses.add(name)
|
sealedSubclasses.add(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitInlineClassUnderlyingPropertyName(name: String) {
|
override fun visitInlineClassUnderlyingPropertyName(name: String) {
|
||||||
inlineClassUnderlyingPropertyName = name
|
inlineClassUnderlyingPropertyName = name
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitInlineClassUnderlyingType(flags: Flags): KmTypeVisitor =
|
override fun visitInlineClassUnderlyingType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { inlineClassUnderlyingType = it }
|
KmType(flags).also { inlineClassUnderlyingType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@ExperimentalContextReceivers
|
@ExperimentalContextReceivers
|
||||||
override fun visitContextReceiverType(flags: Flags): KmTypeVisitor =
|
override fun visitContextReceiverType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).addTo(contextReceiverTypes)
|
KmType(flags).addTo(contextReceiverTypes)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
||||||
KmVersionRequirement().addTo(versionRequirements)
|
KmVersionRequirement().addTo(versionRequirements)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmClassExtensionVisitor =
|
override fun visitExtensions(type: KmExtensionType): KmClassExtensionVisitor =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ class KmClass : KmClassVisitor(), KmDeclarationContainer {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this class
|
* @param visitor the visitor which will visit data in this class
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@OptIn(ExperimentalContextReceivers::class)
|
@OptIn(ExperimentalContextReceivers::class)
|
||||||
fun accept(visitor: KmClassVisitor) {
|
fun accept(visitor: KmClassVisitor) {
|
||||||
visitor.visit(flags, name)
|
visitor.visit(flags, name)
|
||||||
@@ -242,19 +242,19 @@ class KmPackage : KmPackageVisitor(), KmDeclarationContainer {
|
|||||||
private val extensions: List<KmPackageExtension> =
|
private val extensions: List<KmPackageExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createPackageExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createPackageExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor =
|
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor =
|
||||||
KmFunction(flags, name).addTo(functions)
|
KmFunction(flags, name).addTo(functions)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitProperty(flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags): KmPropertyVisitor =
|
override fun visitProperty(flags: Flags, name: String, getterFlags: Flags, setterFlags: Flags): KmPropertyVisitor =
|
||||||
KmProperty(flags, name, getterFlags, setterFlags).addTo(properties)
|
KmProperty(flags, name, getterFlags, setterFlags).addTo(properties)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeAlias(flags: Flags, name: String): KmTypeAliasVisitor =
|
override fun visitTypeAlias(flags: Flags, name: String): KmTypeAliasVisitor =
|
||||||
KmTypeAlias(flags, name).addTo(typeAliases)
|
KmTypeAlias(flags, name).addTo(typeAliases)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmPackageExtensionVisitor =
|
override fun visitExtensions(type: KmExtensionType): KmPackageExtensionVisitor =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ class KmPackage : KmPackageVisitor(), KmDeclarationContainer {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this package fragment
|
* @param visitor the visitor which will visit data in this package fragment
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmPackageVisitor) {
|
fun accept(visitor: KmPackageVisitor) {
|
||||||
functions.forEach { visitor.visitFunction(it.flags, it.name)?.let(it::accept) }
|
functions.forEach { visitor.visitFunction(it.flags, it.name)?.let(it::accept) }
|
||||||
properties.forEach { visitor.visitProperty(it.flags, it.name, it.getterFlags, it.setterFlags)?.let(it::accept) }
|
properties.forEach { visitor.visitProperty(it.flags, it.name, it.getterFlags, it.setterFlags)?.let(it::accept) }
|
||||||
@@ -292,15 +292,15 @@ class KmModuleFragment : KmModuleFragmentVisitor() {
|
|||||||
private val extensions: List<KmModuleFragmentExtension> =
|
private val extensions: List<KmModuleFragmentExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createModuleFragmentExtensions)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createModuleFragmentExtensions)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitPackage(): KmPackageVisitor? =
|
override fun visitPackage(): KmPackageVisitor? =
|
||||||
KmPackage().also { pkg = it }
|
KmPackage().also { pkg = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmModuleFragmentExtensionVisitor? =
|
override fun visitExtensions(type: KmExtensionType): KmModuleFragmentExtensionVisitor? =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitClass(): KmClassVisitor? =
|
override fun visitClass(): KmClassVisitor? =
|
||||||
KmClass().addTo(classes)
|
KmClass().addTo(classes)
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ class KmModuleFragment : KmModuleFragmentVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in the module fragment.
|
* @param visitor the visitor which will visit data in the module fragment.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmModuleFragmentVisitor) {
|
fun accept(visitor: KmModuleFragmentVisitor) {
|
||||||
pkg?.let { visitor.visitPackage()?.let(it::accept) }
|
pkg?.let { visitor.visitPackage()?.let(it::accept) }
|
||||||
classes.forEach { visitor.visitClass()?.let(it::accept) }
|
classes.forEach { visitor.visitClass()?.let(it::accept) }
|
||||||
@@ -328,7 +328,7 @@ class KmLambda : KmLambdaVisitor() {
|
|||||||
*/
|
*/
|
||||||
lateinit var function: KmFunction
|
lateinit var function: KmFunction
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor =
|
override fun visitFunction(flags: Flags, name: String): KmFunctionVisitor =
|
||||||
KmFunction(flags, name).also { function = it }
|
KmFunction(flags, name).also { function = it }
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ class KmLambda : KmLambdaVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this lambda
|
* @param visitor the visitor which will visit data in this lambda
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmLambdaVisitor) {
|
fun accept(visitor: KmLambdaVisitor) {
|
||||||
visitor.visitFunction(function.flags, function.name)?.let(function::accept)
|
visitor.visitFunction(function.flags, function.name)?.let(function::accept)
|
||||||
visitor.visitEnd()
|
visitor.visitEnd()
|
||||||
@@ -364,15 +364,15 @@ class KmConstructor(var flags: Flags) : KmConstructorVisitor() {
|
|||||||
private val extensions: List<KmConstructorExtension> =
|
private val extensions: List<KmConstructorExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createConstructorExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createConstructorExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitValueParameter(flags: Flags, name: String): KmValueParameterVisitor =
|
override fun visitValueParameter(flags: Flags, name: String): KmValueParameterVisitor =
|
||||||
KmValueParameter(flags, name).addTo(valueParameters)
|
KmValueParameter(flags, name).addTo(valueParameters)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
||||||
KmVersionRequirement().addTo(versionRequirements)
|
KmVersionRequirement().addTo(versionRequirements)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmConstructorExtensionVisitor =
|
override fun visitExtensions(type: KmExtensionType): KmConstructorExtensionVisitor =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ class KmConstructor(var flags: Flags) : KmConstructorVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this class
|
* @param visitor the visitor which will visit data in this class
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmConstructorVisitor) {
|
fun accept(visitor: KmConstructorVisitor) {
|
||||||
valueParameters.forEach { visitor.visitValueParameter(it.flags, it.name)?.let(it::accept) }
|
valueParameters.forEach { visitor.visitValueParameter(it.flags, it.name)?.let(it::accept) }
|
||||||
versionRequirements.forEach { visitor.visitVersionRequirement()?.let(it::accept) }
|
versionRequirements.forEach { visitor.visitVersionRequirement()?.let(it::accept) }
|
||||||
@@ -441,37 +441,37 @@ class KmFunction(
|
|||||||
private val extensions: List<KmFunctionExtension> =
|
private val extensions: List<KmFunctionExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createFunctionExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createFunctionExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
||||||
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitReceiverParameterType(flags: Flags): KmTypeVisitor =
|
override fun visitReceiverParameterType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { receiverParameterType = it }
|
KmType(flags).also { receiverParameterType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@ExperimentalContextReceivers
|
@ExperimentalContextReceivers
|
||||||
override fun visitContextReceiverType(flags: Flags): KmTypeVisitor =
|
override fun visitContextReceiverType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).addTo(contextReceiverTypes)
|
KmType(flags).addTo(contextReceiverTypes)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitValueParameter(flags: Flags, name: String): KmValueParameterVisitor =
|
override fun visitValueParameter(flags: Flags, name: String): KmValueParameterVisitor =
|
||||||
KmValueParameter(flags, name).addTo(valueParameters)
|
KmValueParameter(flags, name).addTo(valueParameters)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitReturnType(flags: Flags): KmTypeVisitor =
|
override fun visitReturnType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { returnType = it }
|
KmType(flags).also { returnType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
||||||
KmVersionRequirement().addTo(versionRequirements)
|
KmVersionRequirement().addTo(versionRequirements)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@ExperimentalContracts
|
@ExperimentalContracts
|
||||||
override fun visitContract(): KmContractVisitor =
|
override fun visitContract(): KmContractVisitor =
|
||||||
KmContract().also { contract = it }
|
KmContract().also { contract = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmFunctionExtensionVisitor =
|
override fun visitExtensions(type: KmExtensionType): KmFunctionExtensionVisitor =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -481,7 +481,7 @@ class KmFunction(
|
|||||||
* @param visitor the visitor which will visit data in this function
|
* @param visitor the visitor which will visit data in this function
|
||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalContextReceivers::class)
|
@OptIn(ExperimentalContextReceivers::class)
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmFunctionVisitor) {
|
fun accept(visitor: KmFunctionVisitor) {
|
||||||
typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) }
|
typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) }
|
||||||
receiverParameterType?.let { visitor.visitReceiverParameterType(it.flags)?.let(it::accept) }
|
receiverParameterType?.let { visitor.visitReceiverParameterType(it.flags)?.let(it::accept) }
|
||||||
@@ -546,32 +546,32 @@ class KmProperty(
|
|||||||
private val extensions: List<KmPropertyExtension> =
|
private val extensions: List<KmPropertyExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createPropertyExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createPropertyExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
||||||
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitReceiverParameterType(flags: Flags): KmTypeVisitor =
|
override fun visitReceiverParameterType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { receiverParameterType = it }
|
KmType(flags).also { receiverParameterType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@ExperimentalContextReceivers
|
@ExperimentalContextReceivers
|
||||||
override fun visitContextReceiverType(flags: Flags): KmTypeVisitor =
|
override fun visitContextReceiverType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).addTo(contextReceiverTypes)
|
KmType(flags).addTo(contextReceiverTypes)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitSetterParameter(flags: Flags, name: String): KmValueParameterVisitor =
|
override fun visitSetterParameter(flags: Flags, name: String): KmValueParameterVisitor =
|
||||||
KmValueParameter(flags, name).also { setterParameter = it }
|
KmValueParameter(flags, name).also { setterParameter = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitReturnType(flags: Flags): KmTypeVisitor =
|
override fun visitReturnType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { returnType = it }
|
KmType(flags).also { returnType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
||||||
KmVersionRequirement().addTo(versionRequirements)
|
KmVersionRequirement().addTo(versionRequirements)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmPropertyExtensionVisitor =
|
override fun visitExtensions(type: KmExtensionType): KmPropertyExtensionVisitor =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -581,7 +581,7 @@ class KmProperty(
|
|||||||
* @param visitor the visitor which will visit data in this property
|
* @param visitor the visitor which will visit data in this property
|
||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalContextReceivers::class)
|
@OptIn(ExperimentalContextReceivers::class)
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmPropertyVisitor) {
|
fun accept(visitor: KmPropertyVisitor) {
|
||||||
typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) }
|
typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) }
|
||||||
receiverParameterType?.let { visitor.visitReceiverParameterType(it.flags)?.let(it::accept) }
|
receiverParameterType?.let { visitor.visitReceiverParameterType(it.flags)?.let(it::accept) }
|
||||||
@@ -634,28 +634,28 @@ class KmTypeAlias(
|
|||||||
private val extensions: List<KmTypeAliasExtension> =
|
private val extensions: List<KmTypeAliasExtension> =
|
||||||
MetadataExtensions.INSTANCES.mapNotNull(MetadataExtensions::createTypeAliasExtension)
|
MetadataExtensions.INSTANCES.mapNotNull(MetadataExtensions::createTypeAliasExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
override fun visitTypeParameter(flags: Flags, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor =
|
||||||
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
KmTypeParameter(flags, name, id, variance).addTo(typeParameters)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitUnderlyingType(flags: Flags): KmTypeVisitor =
|
override fun visitUnderlyingType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { underlyingType = it }
|
KmType(flags).also { underlyingType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExpandedType(flags: Flags): KmTypeVisitor =
|
override fun visitExpandedType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { expandedType = it }
|
KmType(flags).also { expandedType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitAnnotation(annotation: KmAnnotation) {
|
override fun visitAnnotation(annotation: KmAnnotation) {
|
||||||
annotations.add(annotation)
|
annotations.add(annotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmTypeAliasExtensionVisitor? =
|
override fun visitExtensions(type: KmExtensionType): KmTypeAliasExtensionVisitor? =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
override fun visitVersionRequirement(): KmVersionRequirementVisitor =
|
||||||
KmVersionRequirement().addTo(versionRequirements)
|
KmVersionRequirement().addTo(versionRequirements)
|
||||||
|
|
||||||
@@ -664,7 +664,7 @@ class KmTypeAlias(
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this type alias
|
* @param visitor the visitor which will visit data in this type alias
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmTypeAliasVisitor) {
|
fun accept(visitor: KmTypeAliasVisitor) {
|
||||||
typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) }
|
typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) }
|
||||||
visitor.visitUnderlyingType(underlyingType.flags)?.let(underlyingType::accept)
|
visitor.visitUnderlyingType(underlyingType.flags)?.let(underlyingType::accept)
|
||||||
@@ -701,15 +701,15 @@ class KmValueParameter(
|
|||||||
private val extensions: List<KmValueParameterExtension> =
|
private val extensions: List<KmValueParameterExtension> =
|
||||||
MetadataExtensions.INSTANCES.mapNotNull(MetadataExtensions::createValueParameterExtension)
|
MetadataExtensions.INSTANCES.mapNotNull(MetadataExtensions::createValueParameterExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitType(flags: Flags): KmTypeVisitor =
|
override fun visitType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { type = it }
|
KmType(flags).also { type = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVarargElementType(flags: Flags): KmTypeVisitor =
|
override fun visitVarargElementType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { varargElementType = it }
|
KmType(flags).also { varargElementType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmValueParameterExtensionVisitor? =
|
override fun visitExtensions(type: KmExtensionType): KmValueParameterExtensionVisitor? =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -718,7 +718,7 @@ class KmValueParameter(
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this value parameter
|
* @param visitor the visitor which will visit data in this value parameter
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmValueParameterVisitor) {
|
fun accept(visitor: KmValueParameterVisitor) {
|
||||||
visitor.visitType(type.flags)?.let(type::accept)
|
visitor.visitType(type.flags)?.let(type::accept)
|
||||||
varargElementType?.let { visitor.visitVarargElementType(it.flags)?.let(it::accept) }
|
varargElementType?.let { visitor.visitVarargElementType(it.flags)?.let(it::accept) }
|
||||||
@@ -751,11 +751,11 @@ class KmTypeParameter(
|
|||||||
private val extensions: List<KmTypeParameterExtension> =
|
private val extensions: List<KmTypeParameterExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createTypeParameterExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createTypeParameterExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitUpperBound(flags: Flags): KmTypeVisitor =
|
override fun visitUpperBound(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).addTo(upperBounds)
|
KmType(flags).addTo(upperBounds)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmTypeParameterExtensionVisitor? =
|
override fun visitExtensions(type: KmExtensionType): KmTypeParameterExtensionVisitor? =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -764,7 +764,7 @@ class KmTypeParameter(
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this type parameter
|
* @param visitor the visitor which will visit data in this type parameter
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmTypeParameterVisitor) {
|
fun accept(visitor: KmTypeParameterVisitor) {
|
||||||
upperBounds.forEach { visitor.visitUpperBound(it.flags)?.let(it::accept) }
|
upperBounds.forEach { visitor.visitUpperBound(it.flags)?.let(it::accept) }
|
||||||
extensions.forEach { visitor.visitExtensions(it.type)?.let(it::accept) }
|
extensions.forEach { visitor.visitExtensions(it.type)?.let(it::accept) }
|
||||||
@@ -822,43 +822,43 @@ class KmType(var flags: Flags) : KmTypeVisitor() {
|
|||||||
private val extensions: List<KmTypeExtension> =
|
private val extensions: List<KmTypeExtension> =
|
||||||
MetadataExtensions.INSTANCES.map(MetadataExtensions::createTypeExtension)
|
MetadataExtensions.INSTANCES.map(MetadataExtensions::createTypeExtension)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitClass(name: ClassName) {
|
override fun visitClass(name: ClassName) {
|
||||||
classifier = KmClassifier.Class(name)
|
classifier = KmClassifier.Class(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeAlias(name: ClassName) {
|
override fun visitTypeAlias(name: ClassName) {
|
||||||
classifier = KmClassifier.TypeAlias(name)
|
classifier = KmClassifier.TypeAlias(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitTypeParameter(id: Int) {
|
override fun visitTypeParameter(id: Int) {
|
||||||
classifier = KmClassifier.TypeParameter(id)
|
classifier = KmClassifier.TypeParameter(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitArgument(flags: Flags, variance: KmVariance): KmTypeVisitor =
|
override fun visitArgument(flags: Flags, variance: KmVariance): KmTypeVisitor =
|
||||||
KmType(flags).also { arguments.add(KmTypeProjection(variance, it)) }
|
KmType(flags).also { arguments.add(KmTypeProjection(variance, it)) }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitStarProjection() {
|
override fun visitStarProjection() {
|
||||||
arguments.add(KmTypeProjection.STAR)
|
arguments.add(KmTypeProjection.STAR)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitAbbreviatedType(flags: Flags): KmTypeVisitor =
|
override fun visitAbbreviatedType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { abbreviatedType = it }
|
KmType(flags).also { abbreviatedType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitOuterType(flags: Flags): KmTypeVisitor =
|
override fun visitOuterType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { outerType = it }
|
KmType(flags).also { outerType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitFlexibleTypeUpperBound(flags: Flags, typeFlexibilityId: String?): KmTypeVisitor =
|
override fun visitFlexibleTypeUpperBound(flags: Flags, typeFlexibilityId: String?): KmTypeVisitor =
|
||||||
KmType(flags).also { flexibleTypeUpperBound = KmFlexibleTypeUpperBound(it, typeFlexibilityId) }
|
KmType(flags).also { flexibleTypeUpperBound = KmFlexibleTypeUpperBound(it, typeFlexibilityId) }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitExtensions(type: KmExtensionType): KmTypeExtension =
|
override fun visitExtensions(type: KmExtensionType): KmTypeExtension =
|
||||||
extensions.singleOfType(type)
|
extensions.singleOfType(type)
|
||||||
|
|
||||||
@@ -867,7 +867,7 @@ class KmType(var flags: Flags) : KmTypeVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this type
|
* @param visitor the visitor which will visit data in this type
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmTypeVisitor) {
|
fun accept(visitor: KmTypeVisitor) {
|
||||||
when (val classifier = classifier) {
|
when (val classifier = classifier) {
|
||||||
is KmClassifier.Class -> visitor.visitClass(classifier.name)
|
is KmClassifier.Class -> visitor.visitClass(classifier.name)
|
||||||
@@ -924,7 +924,7 @@ class KmVersionRequirement : KmVersionRequirementVisitor() {
|
|||||||
*/
|
*/
|
||||||
lateinit var version: KmVersion
|
lateinit var version: KmVersion
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visit(kind: KmVersionRequirementVersionKind, level: KmVersionRequirementLevel, errorCode: Int?, message: String?) {
|
override fun visit(kind: KmVersionRequirementVersionKind, level: KmVersionRequirementLevel, errorCode: Int?, message: String?) {
|
||||||
this.kind = kind
|
this.kind = kind
|
||||||
this.level = level
|
this.level = level
|
||||||
@@ -932,7 +932,7 @@ class KmVersionRequirement : KmVersionRequirementVisitor() {
|
|||||||
this.message = message
|
this.message = message
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitVersion(major: Int, minor: Int, patch: Int) {
|
override fun visitVersion(major: Int, minor: Int, patch: Int) {
|
||||||
this.version = KmVersion(major, minor, patch)
|
this.version = KmVersion(major, minor, patch)
|
||||||
}
|
}
|
||||||
@@ -942,7 +942,7 @@ class KmVersionRequirement : KmVersionRequirementVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this version requirement
|
* @param visitor the visitor which will visit data in this version requirement
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmVersionRequirementVisitor) {
|
fun accept(visitor: KmVersionRequirementVisitor) {
|
||||||
visitor.visit(kind, level, errorCode, message)
|
visitor.visit(kind, level, errorCode, message)
|
||||||
visitor.visitVersion(version.major, version.minor, version.patch)
|
visitor.visitVersion(version.major, version.minor, version.patch)
|
||||||
@@ -964,7 +964,7 @@ class KmContract : KmContractVisitor() {
|
|||||||
*/
|
*/
|
||||||
val effects: MutableList<KmEffect> = ArrayList(1)
|
val effects: MutableList<KmEffect> = ArrayList(1)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitEffect(type: KmEffectType, invocationKind: KmEffectInvocationKind?): KmEffectVisitor =
|
override fun visitEffect(type: KmEffectType, invocationKind: KmEffectInvocationKind?): KmEffectVisitor =
|
||||||
KmEffect(type, invocationKind).addTo(effects)
|
KmEffect(type, invocationKind).addTo(effects)
|
||||||
|
|
||||||
@@ -973,7 +973,7 @@ class KmContract : KmContractVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this contract
|
* @param visitor the visitor which will visit data in this contract
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmContractVisitor) {
|
fun accept(visitor: KmContractVisitor) {
|
||||||
effects.forEach { visitor.visitEffect(it.type, it.invocationKind)?.let(it::accept) }
|
effects.forEach { visitor.visitEffect(it.type, it.invocationKind)?.let(it::accept) }
|
||||||
visitor.visitEnd()
|
visitor.visitEnd()
|
||||||
@@ -1007,11 +1007,11 @@ class KmEffect(
|
|||||||
*/
|
*/
|
||||||
var conclusion: KmEffectExpression? = null
|
var conclusion: KmEffectExpression? = null
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitConstructorArgument(): KmEffectExpressionVisitor =
|
override fun visitConstructorArgument(): KmEffectExpressionVisitor =
|
||||||
KmEffectExpression().addTo(constructorArguments)
|
KmEffectExpression().addTo(constructorArguments)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitConclusionOfConditionalEffect(): KmEffectExpressionVisitor =
|
override fun visitConclusionOfConditionalEffect(): KmEffectExpressionVisitor =
|
||||||
KmEffectExpression().also { conclusion = it }
|
KmEffectExpression().also { conclusion = it }
|
||||||
|
|
||||||
@@ -1020,7 +1020,7 @@ class KmEffect(
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this effect
|
* @param visitor the visitor which will visit data in this effect
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmEffectVisitor) {
|
fun accept(visitor: KmEffectVisitor) {
|
||||||
constructorArguments.forEach { visitor.visitConstructorArgument()?.let(it::accept) }
|
constructorArguments.forEach { visitor.visitConstructorArgument()?.let(it::accept) }
|
||||||
conclusion?.let { visitor.visitConclusionOfConditionalEffect()?.let(it::accept) }
|
conclusion?.let { visitor.visitConclusionOfConditionalEffect()?.let(it::accept) }
|
||||||
@@ -1070,26 +1070,26 @@ class KmEffectExpression : KmEffectExpressionVisitor() {
|
|||||||
*/
|
*/
|
||||||
val orArguments: MutableList<KmEffectExpression> = ArrayList(0)
|
val orArguments: MutableList<KmEffectExpression> = ArrayList(0)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visit(flags: Flags, parameterIndex: Int?) {
|
override fun visit(flags: Flags, parameterIndex: Int?) {
|
||||||
this.flags = flags
|
this.flags = flags
|
||||||
this.parameterIndex = parameterIndex
|
this.parameterIndex = parameterIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitConstantValue(value: Any?) {
|
override fun visitConstantValue(value: Any?) {
|
||||||
constantValue = KmConstantValue(value)
|
constantValue = KmConstantValue(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitIsInstanceType(flags: Flags): KmTypeVisitor =
|
override fun visitIsInstanceType(flags: Flags): KmTypeVisitor =
|
||||||
KmType(flags).also { isInstanceType = it }
|
KmType(flags).also { isInstanceType = it }
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitAndArgument(): KmEffectExpressionVisitor =
|
override fun visitAndArgument(): KmEffectExpressionVisitor =
|
||||||
KmEffectExpression().addTo(andArguments)
|
KmEffectExpression().addTo(andArguments)
|
||||||
|
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
override fun visitOrArgument(): KmEffectExpressionVisitor =
|
override fun visitOrArgument(): KmEffectExpressionVisitor =
|
||||||
KmEffectExpression().addTo(orArguments)
|
KmEffectExpression().addTo(orArguments)
|
||||||
|
|
||||||
@@ -1098,7 +1098,7 @@ class KmEffectExpression : KmEffectExpressionVisitor() {
|
|||||||
*
|
*
|
||||||
* @param visitor the visitor which will visit data in this effect expression
|
* @param visitor the visitor which will visit data in this effect expression
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
fun accept(visitor: KmEffectExpressionVisitor) {
|
fun accept(visitor: KmEffectExpressionVisitor) {
|
||||||
visitor.visit(flags, parameterIndex)
|
visitor.visit(flags, parameterIndex)
|
||||||
constantValue?.let { visitor.visitConstantValue(it.value) }
|
constantValue?.let { visitor.visitConstantValue(it.value) }
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@file:Suppress("unused")
|
|
||||||
|
|
||||||
package kotlinx.metadata
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assigns the contents of [collection] into this list. After this function completes, the list and [collection]
|
|
||||||
* will have the same size and will consist of the same elements in the same order.
|
|
||||||
*
|
|
||||||
* Useful for rewriting contents of any repeated Km* element represented by a [MutableList], e.g.:
|
|
||||||
*
|
|
||||||
* val klass: KmClass
|
|
||||||
* klass.functions.assignFrom(...)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
internal fun <T> MutableList<T>.assignFrom(collection: Collection<T>) {
|
|
||||||
clear()
|
|
||||||
addAll(collection)
|
|
||||||
}
|
|
||||||
@@ -7,13 +7,13 @@ package kotlinx.metadata
|
|||||||
|
|
||||||
import kotlin.contracts.ExperimentalContracts
|
import kotlin.contracts.ExperimentalContracts
|
||||||
|
|
||||||
internal const val visitorApiMessage =
|
internal const val VISITOR_API_MESSAGE =
|
||||||
"Visitor API is deprecated as excessive and cumbersome. Please use nodes (such as KmClass) and their properties."
|
"Visitor API is deprecated as excessive and cumbersome. Please use nodes (such as KmClass) and their properties."
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor containing the common code to visit Kotlin declaration containers, such as classes and package fragments.
|
* A visitor containing the common code to visit Kotlin declaration containers, such as classes and package fragments.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected open val delegate: KmDeclarationContainerVisitor? = null) {
|
abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected open val delegate: KmDeclarationContainerVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +61,7 @@ abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected
|
|||||||
* When using this class, [visit] must be called first, followed by zero or more [visitTypeParameter] calls, followed by zero or more calls
|
* When using this class, [visit] must be called first, followed by zero or more [visitTypeParameter] calls, followed by zero or more calls
|
||||||
* to other visit* methods, followed by [visitEnd].
|
* to other visit* methods, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor? = null) : KmDeclarationContainerVisitor(delegate) {
|
abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor? = null) : KmDeclarationContainerVisitor(delegate) {
|
||||||
override val delegate: KmClassVisitor?
|
override val delegate: KmClassVisitor?
|
||||||
@@ -194,7 +194,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor
|
|||||||
*
|
*
|
||||||
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVisitor? = null) : KmDeclarationContainerVisitor(delegate) {
|
abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVisitor? = null) : KmDeclarationContainerVisitor(delegate) {
|
||||||
override val delegate: KmPackageVisitor?
|
override val delegate: KmPackageVisitor?
|
||||||
@@ -222,7 +222,7 @@ abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVis
|
|||||||
*
|
*
|
||||||
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val delegate: KmModuleFragmentVisitor? = null) {
|
abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val delegate: KmModuleFragmentVisitor? = null) {
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val del
|
|||||||
*
|
*
|
||||||
* When using this class, [visitFunction] must be called first, followed by [visitEnd].
|
* When using this class, [visitFunction] must be called first, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmLambdaVisitor @JvmOverloads constructor(private val delegate: KmLambdaVisitor? = null) {
|
abstract class KmLambdaVisitor @JvmOverloads constructor(private val delegate: KmLambdaVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -284,7 +284,7 @@ abstract class KmLambdaVisitor @JvmOverloads constructor(private val delegate: K
|
|||||||
*
|
*
|
||||||
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmConstructorVisitor @JvmOverloads constructor(private val delegate: KmConstructorVisitor? = null) {
|
abstract class KmConstructorVisitor @JvmOverloads constructor(private val delegate: KmConstructorVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -324,7 +324,7 @@ abstract class KmConstructorVisitor @JvmOverloads constructor(private val delega
|
|||||||
* When using this class, zero or more calls to [visitTypeParameter] must be done first, followed by zero or more calls
|
* When using this class, zero or more calls to [visitTypeParameter] must be done first, followed by zero or more calls
|
||||||
* to other visit* methods, followed by [visitEnd].
|
* to other visit* methods, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: KmFunctionVisitor? = null) {
|
abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: KmFunctionVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -408,7 +408,7 @@ abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate:
|
|||||||
* When using this class, zero or more calls to [visitTypeParameter] must be done first, followed by zero or more calls
|
* When using this class, zero or more calls to [visitTypeParameter] must be done first, followed by zero or more calls
|
||||||
* to other visit* methods, followed by [visitEnd].
|
* to other visit* methods, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: KmPropertyVisitor? = null) {
|
abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: KmPropertyVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -485,7 +485,7 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate:
|
|||||||
* When using this class, zero or more calls to [visitTypeParameter] must be done first, followed by zero or more calls
|
* When using this class, zero or more calls to [visitTypeParameter] must be done first, followed by zero or more calls
|
||||||
* to other visit* methods, followed by [visitEnd].
|
* to other visit* methods, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate: KmTypeAliasVisitor? = null) {
|
abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate: KmTypeAliasVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -554,7 +554,7 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate
|
|||||||
* When using this class, either [visitType] or [visitVarargElementType] must be called first (depending on whether the value parameter
|
* When using this class, either [visitType] or [visitVarargElementType] must be called first (depending on whether the value parameter
|
||||||
* is `vararg` or not), followed by [visitEnd].
|
* is `vararg` or not), followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmValueParameterVisitor @JvmOverloads constructor(private val delegate: KmValueParameterVisitor? = null) {
|
abstract class KmValueParameterVisitor @JvmOverloads constructor(private val delegate: KmValueParameterVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -594,7 +594,7 @@ abstract class KmValueParameterVisitor @JvmOverloads constructor(private val del
|
|||||||
*
|
*
|
||||||
* When using this class, zero or more [visitUpperBound] calls must be done first, followed by [visitEnd].
|
* When using this class, zero or more [visitUpperBound] calls must be done first, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val delegate: KmTypeParameterVisitor? = null) {
|
abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val delegate: KmTypeParameterVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -632,7 +632,7 @@ abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val dele
|
|||||||
*
|
*
|
||||||
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
* When using this class, [visitEnd] must be called exactly once and after calls to all other visit* methods.
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmTypeVisitor? = null) {
|
abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmTypeVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
@@ -745,7 +745,7 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT
|
|||||||
*
|
*
|
||||||
* When using this class, [visit] must be called first, followed by [visitVersion], followed by [visitEnd].
|
* When using this class, [visit] must be called first, followed by [visitVersion], followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress("DEPRECATION") private val delegate: KmVersionRequirementVisitor? = null) {
|
abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress("DEPRECATION") private val delegate: KmVersionRequirementVisitor? = null) {
|
||||||
/**
|
/**
|
||||||
* Visits the description of this version requirement.
|
* Visits the description of this version requirement.
|
||||||
@@ -787,7 +787,7 @@ abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress("
|
|||||||
*
|
*
|
||||||
* When using this class, zero or more calls to [visitEffect] must be done first, followed by [visitEnd].
|
* When using this class, zero or more calls to [visitEffect] must be done first, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@ExperimentalContracts
|
@ExperimentalContracts
|
||||||
abstract class KmContractVisitor @JvmOverloads constructor(private val delegate: KmContractVisitor? = null) {
|
abstract class KmContractVisitor @JvmOverloads constructor(private val delegate: KmContractVisitor? = null) {
|
||||||
@@ -818,7 +818,7 @@ abstract class KmContractVisitor @JvmOverloads constructor(private val delegate:
|
|||||||
* When using this class, zero or more calls to [visitConstructorArgument] or [visitConclusionOfConditionalEffect] must be done first,
|
* When using this class, zero or more calls to [visitConstructorArgument] or [visitConclusionOfConditionalEffect] must be done first,
|
||||||
* followed by [visitEnd].
|
* followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@ExperimentalContracts
|
@ExperimentalContracts
|
||||||
abstract class KmEffectVisitor @JvmOverloads constructor(private val delegate: KmEffectVisitor? = null) {
|
abstract class KmEffectVisitor @JvmOverloads constructor(private val delegate: KmEffectVisitor? = null) {
|
||||||
@@ -852,7 +852,7 @@ abstract class KmEffectVisitor @JvmOverloads constructor(private val delegate: K
|
|||||||
*
|
*
|
||||||
* When using this class, [visit] must be called first, followed by zero or more calls to other visit* methods, followed by [visitEnd].
|
* When using this class, [visit] must be called first, followed by zero or more calls to other visit* methods, followed by [visitEnd].
|
||||||
*/
|
*/
|
||||||
@Deprecated(visitorApiMessage)
|
@Deprecated(VISITOR_API_MESSAGE)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@ExperimentalContracts
|
@ExperimentalContracts
|
||||||
abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val delegate: KmEffectExpressionVisitor? = null) {
|
abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val delegate: KmEffectExpressionVisitor? = null) {
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ private fun transformClassFileWithNodes(classFile: KotlinClassMetadata): KotlinC
|
|||||||
else -> classFile
|
else -> classFile
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION") // We're testing that reading/writing with KmNodes is identical to direct
|
||||||
private fun transformModuleFileWithReadWriteVisitors(moduleFile: KotlinModuleMetadata): KotlinModuleMetadata =
|
private fun transformModuleFileWithReadWriteVisitors(moduleFile: KotlinModuleMetadata): KotlinModuleMetadata =
|
||||||
KotlinModuleMetadata.Writer().apply(moduleFile::accept).write()
|
KotlinModuleMetadata.Writer().apply(moduleFile::accept).write()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user