diff --git a/libraries/kotlinx-metadata/build.gradle.kts b/libraries/kotlinx-metadata/build.gradle.kts index 26a2c3dcde0..e3f3dfa5b38 100644 --- a/libraries/kotlinx-metadata/build.gradle.kts +++ b/libraries/kotlinx-metadata/build.gradle.kts @@ -15,3 +15,7 @@ dependencies { compileOnly(project(":core:metadata")) compileOnly(protobufLite()) } + +kotlin { + explicitApi() +} diff --git a/libraries/kotlinx-metadata/jvm/build.gradle.kts b/libraries/kotlinx-metadata/jvm/build.gradle.kts index 31516a4f1df..97ec7da176d 100644 --- a/libraries/kotlinx-metadata/jvm/build.gradle.kts +++ b/libraries/kotlinx-metadata/jvm/build.gradle.kts @@ -50,6 +50,10 @@ dependencies { testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false } } +kotlin { + explicitApi() +} + if (deployVersion != null) { publish() } diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmAttributes.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmAttributes.kt index 300bfa4b33e..fb294b5aff8 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmAttributes.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmAttributes.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmFlags as JF * * Returns `false` if the property is not declared in a companion object of some interface. */ -var KmProperty.isMovedFromInterfaceCompanion by BooleanFlagDelegate(KmProperty::jvmFlags, booleanFlag(JF.IS_MOVED_FROM_INTERFACE_COMPANION)) +public var KmProperty.isMovedFromInterfaceCompanion: Boolean by BooleanFlagDelegate(KmProperty::jvmFlags, booleanFlag(JF.IS_MOVED_FROM_INTERFACE_COMPANION)) /** * Applicable to an interface compiled with -Xjvm-default=all or all-compatibility. @@ -37,7 +37,7 @@ var KmProperty.isMovedFromInterfaceCompanion by BooleanFlagDelegate(KmProperty:: * @see JvmDefaultWithCompatibility * @see JvmDefaultWithoutCompatibility */ -var KmClass.hasMethodBodiesInInterface by BooleanFlagDelegate(KmClass::jvmFlags, booleanFlag(JF.IS_COMPILED_IN_JVM_DEFAULT_MODE)) +public var KmClass.hasMethodBodiesInInterface: Boolean by BooleanFlagDelegate(KmClass::jvmFlags, booleanFlag(JF.IS_COMPILED_IN_JVM_DEFAULT_MODE)) /** * Indicates if an interface was compiled with -Xjvm-default=all-compatibility. @@ -53,7 +53,7 @@ var KmClass.hasMethodBodiesInInterface by BooleanFlagDelegate(KmClass::jvmFlags, * @see JvmDefaultWithCompatibility * @see JvmDefaultWithoutCompatibility */ -var KmClass.isCompiledInCompatibilityMode by BooleanFlagDelegate(KmClass::jvmFlags, booleanFlag(JF.IS_COMPILED_IN_COMPATIBILITY_MODE)) +public var KmClass.isCompiledInCompatibilityMode: Boolean by BooleanFlagDelegate(KmClass::jvmFlags, booleanFlag(JF.IS_COMPILED_IN_COMPATIBILITY_MODE)) private fun booleanFlag(f: Flags.BooleanFlagField): FlagImpl = FlagImpl(f.offset, f.bitWidth, 1) diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensionVisitors.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensionVisitors.kt index d62dbdae7e1..89ff3a9e63c 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensionVisitors.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensionVisitors.kt @@ -13,7 +13,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. */ @Deprecated(VISITOR_API_MESSAGE) -abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor( +public abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor( protected open val delegate: JvmDeclarationContainerExtensionVisitor? = null ) : KmDeclarationContainerExtensionVisitor { /** @@ -32,13 +32,13 @@ abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor * @param setterFlags property accessor flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag, modality flag * and [Flag.PropertyAccessor] flags */ - open fun visitLocalDelegatedProperty(flags: Int, name: String, getterFlags: Int, setterFlags: Int): KmPropertyVisitor? = + public open fun visitLocalDelegatedProperty(flags: Int, name: String, getterFlags: Int, setterFlags: Int): KmPropertyVisitor? = delegate?.visitLocalDelegatedProperty(flags, name, getterFlags, setterFlags) /** * Visits the name of the module where this container is declared. */ - open fun visitModuleName(name: String) { + public open fun visitModuleName(name: String) { delegate?.visitModuleName(name) } } @@ -47,7 +47,7 @@ abstract class JvmDeclarationContainerExtensionVisitor @JvmOverloads constructor * A visitor to visit JVM extensions for a class. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmClassExtensionVisitor @JvmOverloads constructor( +public open class JvmClassExtensionVisitor @JvmOverloads constructor( delegate: JvmClassExtensionVisitor? = null ) : KmClassExtensionVisitor, JvmDeclarationContainerExtensionVisitor(delegate) { override val delegate: JvmClassExtensionVisitor? @@ -60,32 +60,32 @@ open class JvmClassExtensionVisitor @JvmOverloads constructor( * Visits the JVM internal name of the original class this anonymous object is copied from. This method is called for * anonymous objects copied from bodies of inline functions to the use site by the Kotlin compiler. */ - open fun visitAnonymousObjectOriginName(internalName: String) { + public open fun visitAnonymousObjectOriginName(internalName: String) { delegate?.visitAnonymousObjectOriginName(internalName) } /** * Visits the JVM-specific flags of the class, consisting of [JvmFlag.Class] flags. */ - open fun visitJvmFlags(flags: Int) { + public open fun visitJvmFlags(flags: Int) { delegate?.visitJvmFlags(flags) } /** * Visits the end of JVM extensions for the class. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmClassExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmClassExtensionVisitor::class) } } @@ -93,7 +93,7 @@ open class JvmClassExtensionVisitor @JvmOverloads constructor( * A visitor to visit JVM extensions for a package fragment. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmPackageExtensionVisitor @JvmOverloads constructor( +public open class JvmPackageExtensionVisitor @JvmOverloads constructor( delegate: JvmPackageExtensionVisitor? = null ) : KmPackageExtensionVisitor, JvmDeclarationContainerExtensionVisitor(delegate) { override val delegate: JvmPackageExtensionVisitor? @@ -105,18 +105,18 @@ open class JvmPackageExtensionVisitor @JvmOverloads constructor( /** * Visits the end of JVM extensions for the package fragment. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmPackageExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmPackageExtensionVisitor::class) } } @@ -124,7 +124,7 @@ open class JvmPackageExtensionVisitor @JvmOverloads constructor( * A visitor to visit JVM extensions for a function. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmFunctionExtensionVisitor @JvmOverloads constructor( +public open class JvmFunctionExtensionVisitor @JvmOverloads constructor( private val delegate: JvmFunctionExtensionVisitor? = null ) : KmFunctionExtensionVisitor { final override val type: KmExtensionType @@ -137,7 +137,7 @@ open class JvmFunctionExtensionVisitor @JvmOverloads constructor( * * @param signature the signature of the function */ - open fun visit(signature: JvmMethodSignature?) { + public open fun visit(signature: JvmMethodSignature?) { delegate?.visit(signature) } @@ -145,25 +145,25 @@ open class JvmFunctionExtensionVisitor @JvmOverloads constructor( * Visits the JVM internal name of the original class the lambda class for this function is copied from. * This information is present for lambdas copied from bodies of inline functions to the use site by the Kotlin compiler. */ - open fun visitLambdaClassOriginName(internalName: String) { + public open fun visitLambdaClassOriginName(internalName: String) { delegate?.visitLambdaClassOriginName(internalName) } /** * Visits the end of JVM extensions for the function. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmFunctionExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmFunctionExtensionVisitor::class) } } @@ -171,7 +171,7 @@ open class JvmFunctionExtensionVisitor @JvmOverloads constructor( * A visitor to visit JVM extensions for a property. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmPropertyExtensionVisitor @JvmOverloads constructor( +public open class JvmPropertyExtensionVisitor @JvmOverloads constructor( private val delegate: JvmPropertyExtensionVisitor? = null ) : KmPropertyExtensionVisitor { final override val type: KmExtensionType @@ -188,7 +188,7 @@ open class JvmPropertyExtensionVisitor @JvmOverloads constructor( * @param setterSignature the signature of the property setter, or `null` if this property has no setter or its signature is unknown. * Example: `JvmMethodSignature("setX", "(Ljava/lang/Object;)V")` */ - open fun visit( + public open fun visit( jvmFlags: Int, fieldSignature: JvmFieldSignature?, getterSignature: JvmMethodSignature?, @@ -205,7 +205,7 @@ open class JvmPropertyExtensionVisitor @JvmOverloads constructor( level = DeprecationLevel.ERROR, replaceWith = ReplaceWith("visit(flagsOf(), fieldSignature, getterSignature, setterSignature)", "kotlinx.metadata.flagsOf") ) - open fun visit( + public open fun visit( fieldSignature: JvmFieldSignature?, getterSignature: JvmMethodSignature?, setterSignature: JvmMethodSignature? @@ -221,7 +221,7 @@ open class JvmPropertyExtensionVisitor @JvmOverloads constructor( * * @param signature the signature of the synthetic method */ - open fun visitSyntheticMethodForAnnotations(signature: JvmMethodSignature?) { + public open fun visitSyntheticMethodForAnnotations(signature: JvmMethodSignature?) { delegate?.visitSyntheticMethodForAnnotations(signature) } @@ -234,25 +234,25 @@ open class JvmPropertyExtensionVisitor @JvmOverloads constructor( * * @param signature the signature of the synthetic method */ - open fun visitSyntheticMethodForDelegate(signature: JvmMethodSignature?) { + public open fun visitSyntheticMethodForDelegate(signature: JvmMethodSignature?) { delegate?.visitSyntheticMethodForDelegate(signature) } /** * Visits the end of JVM extensions for the property. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmPropertyExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmPropertyExtensionVisitor::class) } } @@ -260,7 +260,7 @@ open class JvmPropertyExtensionVisitor @JvmOverloads constructor( * A visitor to visit JVM extensions for a constructor. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmConstructorExtensionVisitor @JvmOverloads constructor( +public open class JvmConstructorExtensionVisitor @JvmOverloads constructor( private val delegate: JvmConstructorExtensionVisitor? = null ) : KmConstructorExtensionVisitor { final override val type: KmExtensionType @@ -273,18 +273,18 @@ open class JvmConstructorExtensionVisitor @JvmOverloads constructor( * * @param signature the signature of the constructor */ - open fun visit(signature: JvmMethodSignature?) { + public open fun visit(signature: JvmMethodSignature?) { delegate?.visit(signature) } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmConstructorExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmConstructorExtensionVisitor::class) } } @@ -292,7 +292,7 @@ open class JvmConstructorExtensionVisitor @JvmOverloads constructor( * A visitor to visit JVM extensions for a type parameter. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor( +public open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor( private val delegate: JvmTypeParameterExtensionVisitor? = null ) : KmTypeParameterExtensionVisitor { final override val type: KmExtensionType @@ -303,25 +303,25 @@ open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor( * * @param annotation the annotation on the type parameter */ - open fun visitAnnotation(annotation: KmAnnotation) { + public open fun visitAnnotation(annotation: KmAnnotation) { delegate?.visitAnnotation(annotation) } /** * Visits the end of JVM extensions for the type parameter. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmTypeParameterExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmTypeParameterExtensionVisitor::class) } } @@ -329,7 +329,7 @@ open class JvmTypeParameterExtensionVisitor @JvmOverloads constructor( * A visitor to visit JVM extensions for a type. */ @Deprecated(VISITOR_API_MESSAGE) -open class JvmTypeExtensionVisitor @JvmOverloads constructor( +public open class JvmTypeExtensionVisitor @JvmOverloads constructor( private val delegate: JvmTypeExtensionVisitor? = null ) : KmTypeExtensionVisitor { final override val type: KmExtensionType @@ -340,7 +340,7 @@ open class JvmTypeExtensionVisitor @JvmOverloads constructor( * * @param isRaw whether the type is seen as a raw type in Java */ - open fun visit(isRaw: Boolean) { + public open fun visit(isRaw: Boolean) { delegate?.visit(isRaw) } @@ -349,31 +349,31 @@ open class JvmTypeExtensionVisitor @JvmOverloads constructor( * * @param annotation the annotation on the type */ - open fun visitAnnotation(annotation: KmAnnotation) { + public open fun visitAnnotation(annotation: KmAnnotation) { delegate?.visitAnnotation(annotation) } /** * Visits the end of JVM extensions for the type parameter. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } - companion object { + public companion object { /** * The type of this extension visitor. * * @see KmExtensionType */ @JvmField - val TYPE: KmExtensionType = KmExtensionType(JvmTypeExtensionVisitor::class) + public val TYPE: KmExtensionType = KmExtensionType(JvmTypeExtensionVisitor::class) /** * The type flexibility id, signifying that the visited type is a JVM platform type. * * @see KmTypeVisitor.visitFlexibleTypeUpperBound */ - const val PLATFORM_TYPE_ID = JvmProtoBufUtil.PLATFORM_TYPE_ID // TODO: move out of deprecated visitor + public const val PLATFORM_TYPE_ID: String = JvmProtoBufUtil.PLATFORM_TYPE_ID // TODO: move out of deprecated visitor } } diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensions.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensions.kt index 82dcab68e8f..f54cfa9c256 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensions.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmExtensions.kt @@ -20,13 +20,13 @@ import kotlinx.metadata.jvm.internal.jvm * If an incorrect index is used, either the `KProperty<*>` object passed to delegate methods will point to the wrong property * at runtime, or an exception will be thrown. */ -val KmClass.localDelegatedProperties: MutableList +public val KmClass.localDelegatedProperties: MutableList get() = jvm.localDelegatedProperties /** * Name of the module where this class is declared. */ -var KmClass.moduleName: String? +public var KmClass.moduleName: String? get() = jvm.moduleName set(value) { jvm.moduleName = value @@ -36,7 +36,7 @@ var KmClass.moduleName: String? * JVM internal name of the original class this anonymous object is copied from. This value is set for anonymous objects * copied from bodies of inline functions to the use site by the Kotlin compiler. */ -var KmClass.anonymousObjectOriginName: String? +public var KmClass.anonymousObjectOriginName: String? get() = jvm.anonymousObjectOriginName set(value) { jvm.anonymousObjectOriginName = value @@ -46,7 +46,7 @@ var KmClass.anonymousObjectOriginName: String? * JVM-specific flags of the class, consisting of [JvmFlag.Class] flags. */ @Deprecated("Flag API is deprecated. Please use corresponding member extensions on KmClass, such as KmClass.hasMethodBodiesInInterface") -var KmClass.jvmFlags: Int +public var KmClass.jvmFlags: Int get() = jvm.jvmFlags set(value) { jvm.jvmFlags = value @@ -61,13 +61,13 @@ var KmClass.jvmFlags: Int * If an incorrect index is used, either the `KProperty<*>` object passed to delegate methods will point to the wrong property * at runtime, or an exception will be thrown. */ -val KmPackage.localDelegatedProperties: MutableList +public val KmPackage.localDelegatedProperties: MutableList get() = jvm.localDelegatedProperties /** * Name of the module where this package fragment is declared. */ -var KmPackage.moduleName: String? +public var KmPackage.moduleName: String? get() = jvm.moduleName set(value) { jvm.moduleName = value @@ -78,7 +78,7 @@ var KmPackage.moduleName: String? * * Example: `JvmMethodSignature("equals", "(Ljava/lang/Object;)Z")`. */ -var KmFunction.signature: JvmMethodSignature? +public var KmFunction.signature: JvmMethodSignature? get() = jvm.signature set(value) { jvm.signature = value @@ -88,7 +88,7 @@ var KmFunction.signature: JvmMethodSignature? * JVM internal name of the original class the lambda class for this function is copied from. This value is set for lambdas * copied from bodies of inline functions to the use site by the Kotlin compiler. */ -var KmFunction.lambdaClassOriginName: String? +public var KmFunction.lambdaClassOriginName: String? get() = jvm.lambdaClassOriginName set(value) { jvm.lambdaClassOriginName = value @@ -98,7 +98,7 @@ var KmFunction.lambdaClassOriginName: String? * JVM-specific flags of the property, consisting of [JvmFlag.Property] flags. */ @Deprecated("Flag API is deprecated. Please use corresponding member extensions on KmProperty, such as KmProperty.isMovedFromInterfaceCompanion") -var KmProperty.jvmFlags: Int +public var KmProperty.jvmFlags: Int get() = jvm.jvmFlags set(value) { jvm.jvmFlags = value @@ -109,7 +109,7 @@ var KmProperty.jvmFlags: Int * * Example: `JvmFieldSignature("X", "Ljava/lang/Object;")`. */ -var KmProperty.fieldSignature: JvmFieldSignature? +public var KmProperty.fieldSignature: JvmFieldSignature? get() = jvm.fieldSignature set(value) { jvm.fieldSignature = value @@ -120,7 +120,7 @@ var KmProperty.fieldSignature: JvmFieldSignature? * * Example: `JvmMethodSignature("getX", "()Ljava/lang/Object;")`. */ -var KmProperty.getterSignature: JvmMethodSignature? +public var KmProperty.getterSignature: JvmMethodSignature? get() = jvm.getterSignature set(value) { jvm.getterSignature = value @@ -131,7 +131,7 @@ var KmProperty.getterSignature: JvmMethodSignature? * * Example: `JvmMethodSignature("setX", "(Ljava/lang/Object;)V")`. */ -var KmProperty.setterSignature: JvmMethodSignature? +public var KmProperty.setterSignature: JvmMethodSignature? get() = jvm.setterSignature set(value) { jvm.setterSignature = value @@ -142,7 +142,7 @@ var KmProperty.setterSignature: JvmMethodSignature? * * Example: `JvmMethodSignature("getX$annotations", "()V")`. */ -var KmProperty.syntheticMethodForAnnotations: JvmMethodSignature? +public var KmProperty.syntheticMethodForAnnotations: JvmMethodSignature? get() = jvm.syntheticMethodForAnnotations set(value) { jvm.syntheticMethodForAnnotations = value @@ -155,7 +155,7 @@ var KmProperty.syntheticMethodForAnnotations: JvmMethodSignature? * * Example: `JvmMethodSignature("getX$delegate", "()Ljava/lang/Object;")`. */ -var KmProperty.syntheticMethodForDelegate: JvmMethodSignature? +public var KmProperty.syntheticMethodForDelegate: JvmMethodSignature? get() = jvm.syntheticMethodForDelegate set(value) { jvm.syntheticMethodForDelegate = value @@ -166,7 +166,7 @@ var KmProperty.syntheticMethodForDelegate: JvmMethodSignature? * * Example: `JvmMethodSignature("", "(Ljava/lang/Object;)V")`. */ -var KmConstructor.signature: JvmMethodSignature? +public var KmConstructor.signature: JvmMethodSignature? get() = jvm.signature set(value) { jvm.signature = value @@ -175,13 +175,13 @@ var KmConstructor.signature: JvmMethodSignature? /** * Annotations on the type parameter. */ -val KmTypeParameter.annotations: MutableList +public val KmTypeParameter.annotations: MutableList get() = jvm.annotations /** * `true` if the type is seen as a raw type in Java. */ -var KmType.isRaw: Boolean +public var KmType.isRaw: Boolean get() = jvm.isRaw set(value) { jvm.isRaw = value @@ -190,5 +190,5 @@ var KmType.isRaw: Boolean /** * Annotations on the type. */ -val KmType.annotations: MutableList +public val KmType.annotations: MutableList get() = jvm.annotations diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmFlag.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmFlag.kt index 6556f4a53ab..5e6bf1f13cb 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmFlag.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmFlag.kt @@ -21,12 +21,12 @@ private const val prefix = "Flag API is deprecated. Please use" * @see Flags */ @Deprecated("$prefix corresponding extensions on Km nodes, such as KmClass.hasMethodBodiesInInterface") -object JvmFlag { +public object JvmFlag { /** * JVM-specific property flags in addition to common property flags declared in [Flag.Property]. */ @Deprecated("$prefix corresponding extension on KmProperty: KmProperty.isMovedFromInterfaceCompanion") - object Property { + public object Property { /** * Applied to a property declared in an interface's companion object, signifies that its backing field is declared as a static * field in the interface. In Kotlin code, this usually happens if the property is annotated with [JvmField]. @@ -35,14 +35,14 @@ object JvmFlag { */ @JvmField @Deprecated("$prefix KmProperty.isMovedFromInterfaceCompanion") - val IS_MOVED_FROM_INTERFACE_COMPANION = booleanFlag(JF.IS_MOVED_FROM_INTERFACE_COMPANION) + public val IS_MOVED_FROM_INTERFACE_COMPANION: Flag = booleanFlag(JF.IS_MOVED_FROM_INTERFACE_COMPANION) } /** * JVM-specific class flags in addition to common class flags declared in [Flag.Class]. */ @Deprecated("$prefix corresponding extensions on KmClass") - object Class { + public object Class { /** * Applied to an interface compiled with -Xjvm-default=all or all-compatibility. * @@ -52,7 +52,7 @@ object JvmFlag { */ @JvmField @Deprecated("$prefix KmClass.hasMethodBodiesInInterface") - val HAS_METHOD_BODIES_IN_INTERFACE = booleanFlag(JF.IS_COMPILED_IN_JVM_DEFAULT_MODE) + public val HAS_METHOD_BODIES_IN_INTERFACE: Flag = booleanFlag(JF.IS_COMPILED_IN_JVM_DEFAULT_MODE) /** * Applied to an interface compiled with -Xjvm-default=all-compatibility. @@ -63,7 +63,7 @@ object JvmFlag { */ @JvmField @Deprecated("$prefix KmClass.isCompiledInCompatibilityMode") - val IS_COMPILED_IN_COMPATIBILITY_MODE = booleanFlag(JF.IS_COMPILED_IN_COMPATIBILITY_MODE) + public val IS_COMPILED_IN_COMPATIBILITY_MODE: Flag = booleanFlag(JF.IS_COMPILED_IN_COMPATIBILITY_MODE) } internal fun booleanFlag(f: F.BooleanFlagField): Flag = diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMemberSignature.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMemberSignature.kt index d059e96fdb6..f0d70f15112 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMemberSignature.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMemberSignature.kt @@ -13,10 +13,10 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMemberSignature as J * @property name name of method or field * @property descriptor JVM descriptor of a method, e.g. `(Ljava/lang/Object;)Z`, or a field type, e.g. `Ljava/lang/String;` */ -sealed class JvmMemberSignature { +public sealed class JvmMemberSignature { - abstract val name: String - abstract val descriptor: String + public abstract val name: String + public abstract val descriptor: String /** * Returns a string representation of the signature. @@ -30,14 +30,14 @@ sealed class JvmMemberSignature { // Two following declarations are deprecated since 0.6.1, should be error in 0.7.0+ @Deprecated("Deprecated for removal. Use descriptor instead", ReplaceWith("descriptor"), level = DeprecationLevel.WARNING) - val desc: String get() = descriptor + public val desc: String get() = descriptor @Deprecated( "asString() is deprecated as redundant. Use toString() instead", ReplaceWith("toString()"), level = DeprecationLevel.WARNING ) - fun asString(): String = toString() + public fun asString(): String = toString() } /** @@ -47,8 +47,8 @@ sealed class JvmMemberSignature { * * @see JvmMemberSignature */ -data class JvmMethodSignature(override val name: String, override val descriptor: String) : JvmMemberSignature() { - override fun toString() = name + descriptor +public data class JvmMethodSignature(override val name: String, override val descriptor: String) : JvmMemberSignature() { + override fun toString(): String = name + descriptor } /** @@ -58,8 +58,8 @@ data class JvmMethodSignature(override val name: String, override val descriptor * * @see JvmMemberSignature */ -data class JvmFieldSignature(override val name: String, override val descriptor: String) : JvmMemberSignature() { - override fun toString() = "$name:$descriptor" +public data class JvmFieldSignature(override val name: String, override val descriptor: String) : JvmMemberSignature() { + override fun toString(): String = "$name:$descriptor" } diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMetadataUtil.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMetadataUtil.kt index 0d5f193d0e9..6c032e35f58 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMetadataUtil.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/JvmMetadataUtil.kt @@ -14,7 +14,7 @@ import kotlinx.metadata.isLocalClassName * Converts [this] to a JVM internal name of the class, where package names are separated by '/', and class names are separated by '$', * for example: `"org/foo/bar/Baz.Nested"` -> `"org/foo/bar/Baz$Nested"` */ -fun ClassName.toJvmInternalName(): String = +public fun ClassName.toJvmInternalName(): String = if (this.isLocalClassName()) substring(1) else replace('.', '$') @@ -24,14 +24,14 @@ fun ClassName.toJvmInternalName(): String = ReplaceWith("toJvmInternalName()"), level = DeprecationLevel.WARNING ) -val ClassName.jvmInternalName: String get() = toJvmInternalName() +public val ClassName.jvmInternalName: String get() = toJvmInternalName() /** * Helper function to instantiate [Metadata]. * Contrary to a direct constructor call, this one accepts nullable parameters to substitute nulls with default values. * Also, this one does not accept [Metadata.bytecodeVersion] as it is deprecated. */ -fun Metadata( +public fun Metadata( kind: Int? = null, metadataVersion: IntArray? = null, data1: Array? = null, diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinClassMetadata.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinClassMetadata.kt index d0efd54ae11..628dd354a01 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinClassMetadata.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinClassMetadata.kt @@ -13,7 +13,6 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil import org.jetbrains.kotlin.metadata.jvm.serialization.JvmStringTable import java.util.* -import kotlin.LazyThreadSafetyMode.PUBLICATION /** * Represents the parsed metadata of a Kotlin JVM class file. Entry point for parsing metadata on JVM. @@ -44,7 +43,7 @@ import kotlin.LazyThreadSafetyMode.PUBLICATION * } * ``` */ -sealed class KotlinClassMetadata(internal val annotationData: Metadata) { +public sealed class KotlinClassMetadata(internal val annotationData: Metadata) { /** * Represents metadata of a class file containing a declaration of a Kotlin class. @@ -52,7 +51,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * Anything that does not belong to a Kotlin class (top-level declarations) is not present in * [Class] metadata, even if such declaration was in the same source file. See [FileFacade] for details. */ - class Class internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { + public class Class internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { /** * Returns the [KmClass] representation of this metadata. @@ -72,7 +71,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { ReplaceWith("kmClass"), DeprecationLevel.WARNING ) - fun toKmClass(): KmClass = KmClass().also { newKm -> kmClass.accept(newKm) } // defensive copy + public fun toKmClass(): KmClass = KmClass().also { newKm -> kmClass.accept(newKm) } // defensive copy /** * Makes the given visitor visit the metadata of this class. @@ -80,7 +79,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @param v the visitor that must visit this class */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(v: KmClassVisitor) = kmClass.accept(v) + public fun accept(v: KmClassVisitor): Unit = kmClass.accept(v) /** * A [KmClassVisitor] that generates the metadata of a Kotlin class. @@ -88,7 +87,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { @Deprecated( "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeClass(kmClass, metadataVersion, extraInt)", ) - class Writer : ClassWriter(JvmStringTable()) { + public class Writer : ClassWriter(JvmStringTable()) { /** * Returns the metadata of the class that was written with this writer. * @@ -101,7 +100,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { @Deprecated( "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeClass(kmClass, metadataVersion, extraInt)", ) - fun write( + public fun write( metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0 ): Class { @@ -121,7 +120,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * If Kotlin source file contains both classes and top-level declarations, only top-level declarations would be available in the corresponding file facade. * Classes would have their own JVM classfiles and their own metadata of [Class] kind. */ - class FileFacade internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { + public class FileFacade internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { /** * Returns the [KmPackage] representation of this metadata. @@ -141,7 +140,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { ReplaceWith("kmPackage"), DeprecationLevel.WARNING ) - fun toKmPackage(): KmPackage = KmPackage().also { newPkg -> kmPackage.accept(newPkg) } + public fun toKmPackage(): KmPackage = KmPackage().also { newPkg -> kmPackage.accept(newPkg) } /** * Makes the given visitor visit metadata of this file facade. @@ -149,7 +148,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @param v the visitor that must visit this file facade */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(v: KmPackageVisitor) = kmPackage.accept(v) + public fun accept(v: KmPackageVisitor): Unit = kmPackage.accept(v) /** * A [KmPackageVisitor] that generates the metadata of a Kotlin file facade. @@ -157,7 +156,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { @Deprecated( "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeFileFacade(kmPackage, metadataVersion, extraInt)", ) - class Writer : PackageWriter(JvmStringTable()) { + public class Writer : PackageWriter(JvmStringTable()) { /** * Returns the metadata of the file facade that was written with this writer. * @@ -170,7 +169,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { @Deprecated( "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeFileFacade(kmPackage, metadataVersion, extraInt)", ) - fun write( + public fun write( metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0 ): FileFacade { @@ -186,7 +185,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * Represents metadata of a class file containing a synthetic class, e.g. a class for lambda, `$DefaultImpls` class for interface * method implementations, `$WhenMappings` class for optimized `when` over enums, etc. */ - class SyntheticClass internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { + public class SyntheticClass internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { private val functionData = annotationData.data1.takeIf(Array<*>::isNotEmpty)?.let { data1 -> JvmProtoBufUtil.readFunctionDataFrom(data1, annotationData.data2) @@ -195,7 +194,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { /** * Returns `true` if this synthetic class is a class file compiled for a Kotlin lambda. */ - val isLambda: Boolean + public val isLambda: Boolean get() = annotationData.data1.isNotEmpty() @@ -218,7 +217,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { ReplaceWith("kmLambda"), DeprecationLevel.WARNING ) - fun toKmLambda(): KmLambda? = if (isLambda) KmLambda().apply(this::accept) else null + public fun toKmLambda(): KmLambda? = if (isLambda) KmLambda().apply(this::accept) else null /** * Makes the given visitor visit metadata of this file facade if this synthetic class represents a Kotlin lambda @@ -229,7 +228,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @param v the visitor that must visit this lambda */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(v: KmLambdaVisitor) { + public fun accept(v: KmLambdaVisitor) { if (!isLambda) throw IllegalArgumentException( "accept(KmLambdaVisitor) is only possible for synthetic classes which are lambdas (isLambda = true)" ) @@ -246,7 +245,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { WRITER_API_MESSAGE + ": KotlinClassMetadata.writeLambda(kmLambda, metadataVersion, extraInt) " + "or KotlinClassMetadata.writeSyntheticClass(metadataVersion, extraInt) for a non-lambda synthetic class", ) - class Writer : LambdaWriter(JvmStringTable()) { + public class Writer : LambdaWriter(JvmStringTable()) { /** * Returns the metadata of the synthetic class that was written with this writer. * @@ -260,7 +259,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { "or KotlinClassMetadata.writeSyntheticClass(metadataVersion, extraInt) for a non-lambda synthetic class", ) @JvmOverloads - fun write( + public fun write( metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0 ): SyntheticClass { @@ -306,11 +305,11 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @see MultiFileClassPart * @see JvmMultifileClass */ - class MultiFileClassFacade internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { + public class MultiFileClassFacade internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { /** * JVM internal names of the part classes which this multi-file class combines. */ - val partClassNames: List = annotationData.data1.asList() + public val partClassNames: List = annotationData.data1.asList() /** * A writer that generates the metadata of a multi-file class facade. @@ -318,7 +317,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { @Deprecated( "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassFacade(partClassNames, metadataVersion, extraInt)", ) - class Writer { + public class Writer { /** * Returns the metadata of the multi-file class facade that was written with this writer. * @@ -332,7 +331,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassFacade(partClassNames, metadataVersion, extraInt)", ) @JvmOverloads - fun write( + public fun write( partClassNames: List, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0 @@ -358,7 +357,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @see MultiFileClassFacade * @see JvmMultifileClass */ - class MultiFileClassPart internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { + public class MultiFileClassPart internal constructor(annotationData: Metadata) : KotlinClassMetadata(annotationData) { /** * Returns the [KmPackage] representation of this metadata. * @@ -372,7 +371,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { /** * JVM internal name of the corresponding multi-file class facade. */ - val facadeClassName: String + public val facadeClassName: String get() = annotationData.extraString /** @@ -383,7 +382,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { ReplaceWith("kmPackage"), DeprecationLevel.WARNING ) - fun toKmPackage(): KmPackage = KmPackage().also { newKmp -> kmPackage.accept(newKmp) } + public fun toKmPackage(): KmPackage = KmPackage().also { newKmp -> kmPackage.accept(newKmp) } /** * Makes the given visitor visit metadata of this multi-file class part. @@ -391,7 +390,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @param v the visitor that must visit this multi-file class part */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(v: KmPackageVisitor) { + public fun accept(v: KmPackageVisitor) { kmPackage.accept(v) } @@ -401,7 +400,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { @Deprecated( "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassPart(kmPackage, facadeClassName, metadataVersion, extraInt)" ) - class Writer : PackageWriter(JvmStringTable()) { + public class Writer : PackageWriter(JvmStringTable()) { /** * Returns the metadata of the multi-file class part that was written with this writer. * @@ -415,7 +414,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { "$WRITER_API_MESSAGE, such as KotlinClassMetadata.writeMultiFileClassPart(kmPackage, facadeClassName, metadataVersion, extraInt)" ) @JvmOverloads - fun write( + public fun write( facadeClassName: String, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0 @@ -434,13 +433,13 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * Represents metadata of an unknown class file. This class is used if an old version of this library is used against a new kind * of class files generated by the Kotlin compiler, unsupported by this library. */ - data object Unknown : KotlinClassMetadata(Metadata()) + public data object Unknown : KotlinClassMetadata(Metadata()) /** * Collection of methods for reading and writing [KotlinClassMetadata], * as well as metadata kind constants and [COMPATIBLE_METADATA_VERSION] constant. */ - companion object { + public companion object { /** * Writes contents of [kmClass] as the class metadata. * @@ -453,7 +452,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { */ @JvmStatic @JvmOverloads - fun writeClass( + public fun writeClass( kmClass: KmClass, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0, @@ -473,7 +472,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { */ @JvmStatic @JvmOverloads - fun writeFileFacade( + public fun writeFileFacade( kmPackage: KmPackage, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0, @@ -493,7 +492,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { */ @JvmStatic @JvmOverloads - fun writeLambda( + public fun writeLambda( kmLambda: KmLambda, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0, @@ -513,7 +512,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { */ @JvmStatic @JvmOverloads - fun writeSyntheticClass( + public fun writeSyntheticClass( metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0, ): Metadata = SyntheticClass.Writer().write(metadataVersion, extraInt).annotationData @@ -531,7 +530,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { */ @JvmStatic @JvmOverloads - fun writeMultiFileClassFacade( + public fun writeMultiFileClassFacade( partClassNames: List, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0, ): Metadata = MultiFileClassFacade.Writer().write(partClassNames, metadataVersion, extraInt).annotationData @@ -549,7 +548,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { */ @JvmStatic @JvmOverloads - fun writeMultiFileClassPart( + public fun writeMultiFileClassPart( kmPackage: KmPackage, facadeClassName: String, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, @@ -575,7 +574,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * @see COMPATIBLE_METADATA_VERSION */ @JvmStatic - fun read(annotationData: Metadata): KotlinClassMetadata { + public fun read(annotationData: Metadata): KotlinClassMetadata { checkMetadataVersionForRead(annotationData) return wrapIntoMetadataExceptionWhenNeeded { @@ -622,14 +621,14 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * * @see Metadata.kind */ - const val CLASS_KIND = 1 + public const val CLASS_KIND: Int = 1 /** * A class file kind signifying that the corresponding class file is a compiled Kotlin file facade. * * @see Metadata.kind */ - const val FILE_FACADE_KIND = 2 + public const val FILE_FACADE_KIND: Int = 2 /** * A class file kind signifying that the corresponding class file is synthetic, e.g. it is a class for lambda, `$DefaultImpls` class @@ -637,7 +636,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * * @see Metadata.kind */ - const val SYNTHETIC_CLASS_KIND = 3 + public const val SYNTHETIC_CLASS_KIND: Int = 3 /** * A class file kind signifying that the corresponding class file is a compiled multi-file class facade. @@ -646,7 +645,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * * @see JvmMultifileClass */ - const val MULTI_FILE_CLASS_FACADE_KIND = 4 + public const val MULTI_FILE_CLASS_FACADE_KIND: Int = 4 /** * A class file kind signifying that the corresponding class file is a compiled multi-file class part, i.e. an internal class @@ -656,7 +655,7 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * * @see JvmMultifileClass */ - const val MULTI_FILE_CLASS_PART_KIND = 5 + public const val MULTI_FILE_CLASS_PART_KIND: Int = 5 /** * The latest stable metadata version supported by this version of the library. @@ -667,8 +666,8 @@ sealed class KotlinClassMetadata(internal val annotationData: Metadata) { * * @see Metadata.metadataVersion */ - @JvmField // TODO: move it somewhere since it is also used in KotlinModuleMetadata? - val COMPATIBLE_METADATA_VERSION = JvmMetadataVersion.INSTANCE.toArray().copyOf() + @JvmField // TODO: move it somewhere since it is also used in KotlinModuleMetadata? + public val COMPATIBLE_METADATA_VERSION: IntArray = JvmMetadataVersion.INSTANCE.toArray().copyOf() } } diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinModuleMetadata.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinModuleMetadata.kt index f1dfd2d50f8..ccb6aca8e11 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinModuleMetadata.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/KotlinModuleMetadata.kt @@ -37,7 +37,7 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.serializeToByteArray * @property bytes the byte array representing the contents of a `.kotlin_module` file */ @UnstableMetadataApi -class KotlinModuleMetadata private constructor( +public class KotlinModuleMetadata private constructor( private val bytes: ByteArray, private val data: ModuleMapping, ) { @@ -57,14 +57,14 @@ class KotlinModuleMetadata private constructor( ReplaceWith("kmModule"), DeprecationLevel.WARNING ) - fun toKmModule(): KmModule = KmModule().apply(kmModule::accept) + public fun toKmModule(): KmModule = KmModule().apply(kmModule::accept) /** * A [KmModuleVisitor] that generates the metadata of a Kotlin JVM module file. */ @Deprecated("Writer API is deprecated as excessive and cumbersome. Please use KotlinModuleMetadata.write(kmModule, metadataVersion)") - class Writer : KmModuleVisitor() { + public class Writer : KmModuleVisitor() { private val b = JvmModuleProtoBuf.Module.newBuilder() override fun visitPackageParts(fqName: String, fileFacades: List, multiFileClassParts: Map) { @@ -107,7 +107,7 @@ class KotlinModuleMetadata private constructor( * [KotlinClassMetadata.COMPATIBLE_METADATA_VERSION] by default */ @Deprecated("Writer API is deprecated as excessive and cumbersome. Please use KotlinModuleMetadata.write(kmModule, metadataVersion)") - fun write(metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION): ByteArray { + public fun write(metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION): ByteArray { return b.build().serializeToByteArray(JvmMetadataVersion(*metadataVersion), 0) } } @@ -118,7 +118,7 @@ class KotlinModuleMetadata private constructor( * @param v the visitor that must visit this module file */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(v: KmModuleVisitor) { + public fun accept(v: KmModuleVisitor) { for ((fqName, parts) in data.packageFqName2Parts) { val (fileFacades, multiFileClassParts) = parts.parts.partition { parts.getMultifileFacadeName(it) == null } v.visitPackageParts(fqName, fileFacades, multiFileClassParts.associateWith { parts.getMultifileFacadeName(it)!! }) @@ -140,7 +140,7 @@ class KotlinModuleMetadata private constructor( /** * Collection of methods for reading and writing [KotlinModuleMetadata]. */ - companion object { + public companion object { /** * Parses the given byte array with the .kotlin_module file content and returns the [KotlinModuleMetadata] instance, * or `null` if this byte array encodes a module with an unsupported metadata version. @@ -150,7 +150,7 @@ class KotlinModuleMetadata private constructor( */ @JvmStatic @UnstableMetadataApi - fun read(bytes: ByteArray): KotlinModuleMetadata { + public fun read(bytes: ByteArray): KotlinModuleMetadata { return wrapIntoMetadataExceptionWhenNeeded { val result = dataFromBytes(bytes) when (result) { @@ -172,7 +172,7 @@ class KotlinModuleMetadata private constructor( @UnstableMetadataApi @JvmStatic @JvmOverloads - fun write(kmModule: KmModule, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION): ByteArray = wrapWriteIntoIAE { + public fun write(kmModule: KmModule, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION): ByteArray = wrapWriteIntoIAE { Writer().also { kmModule.accept(it) }.write(metadataVersion) } @@ -192,7 +192,7 @@ class KotlinModuleMetadata private constructor( */ @Deprecated(VISITOR_API_MESSAGE) @UnstableMetadataApi -abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) { +public 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. * @@ -203,7 +203,7 @@ abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) { * @param multiFileClassParts the map of multi-file classes where keys are names of multi-file class parts, * and values are names of the corresponding multi-file facades */ - open fun visitPackageParts(fqName: String, fileFacades: List, multiFileClassParts: Map) { + public open fun visitPackageParts(fqName: String, fileFacades: List, multiFileClassParts: Map) { delegate?.visitPackageParts(fqName, fileFacades, multiFileClassParts) } @@ -212,7 +212,7 @@ abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) { * * @param annotation annotation on the module */ - open fun visitAnnotation(annotation: KmAnnotation) { + public open fun visitAnnotation(annotation: KmAnnotation) { delegate?.visitAnnotation(annotation) } @@ -224,13 +224,13 @@ abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) { * Multiplatform projects are an experimental feature of Kotlin, and their behavior and/or binary format * may change in a subsequent release. */ - open fun visitOptionalAnnotationClass(): KmClassVisitor? = + public open fun visitOptionalAnnotationClass(): KmClassVisitor? = delegate?.visitOptionalAnnotationClass() /** * Visits the end of the module. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } @@ -241,11 +241,11 @@ abstract class KmModuleVisitor(private val delegate: KmModuleVisitor? = null) { * Represents a Kotlin JVM module file (`.kotlin_module` extension). */ @UnstableMetadataApi -class KmModule : KmModuleVisitor() { +public class KmModule : KmModuleVisitor() { /** * Table of all single- and multi-file facades declared in some package of this module, where keys are '.'-separated package names. */ - val packageParts: MutableMap = LinkedHashMap() + public val packageParts: MutableMap = LinkedHashMap() /** * Annotations on the module. @@ -253,7 +253,7 @@ class KmModule : KmModuleVisitor() { * Currently, Kotlin does not provide functionality to specify annotations on modules. */ @Deprecated("This list is always empty and will be removed", level = DeprecationLevel.WARNING) - val annotations: MutableList = ArrayList(0) + public val annotations: MutableList = ArrayList(0) /** * `@OptionalExpectation`-annotated annotation classes declared in this module. @@ -263,7 +263,7 @@ class KmModule : KmModuleVisitor() { * Multiplatform projects are an experimental feature of Kotlin, and their behavior and/or binary format * may change in a subsequent release. */ - val optionalAnnotationClasses: MutableList = ArrayList(0) + public val optionalAnnotationClasses: MutableList = ArrayList(0) @Deprecated(VISITOR_API_MESSAGE) override fun visitPackageParts(fqName: String, fileFacades: List, multiFileClassParts: Map) { @@ -285,7 +285,7 @@ class KmModule : KmModuleVisitor() { * @param visitor the visitor which will visit data in this module. */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmModuleVisitor) { + public fun accept(visitor: KmModuleVisitor) { for ((fqName, parts) in packageParts) { visitor.visitPackageParts(fqName, parts.fileFacades, parts.multiFileClassParts) } @@ -304,7 +304,7 @@ class KmModule : KmModuleVisitor() { * and values are names of the corresponding multi-file facades */ @UnstableMetadataApi -class KmPackageParts( - val fileFacades: MutableList, - val multiFileClassParts: MutableMap +public class KmPackageParts( + public val fileFacades: MutableList, + public val multiFileClassParts: MutableMap ) diff --git a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/UnstableMetadataApi.kt b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/UnstableMetadataApi.kt index 5165fb5bf0d..f13b8cb78e2 100644 --- a/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/UnstableMetadataApi.kt +++ b/libraries/kotlinx-metadata/jvm/src/kotlinx/metadata/jvm/UnstableMetadataApi.kt @@ -15,4 +15,4 @@ package kotlinx.metadata.jvm level = RequiresOptIn.Level.WARNING ) @MustBeDocumented -annotation class UnstableMetadataApi +public annotation class UnstableMetadataApi diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Annotations.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Annotations.kt index 4ff6d52396b..08ac4deb6ec 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Annotations.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Annotations.kt @@ -16,7 +16,7 @@ package kotlinx.metadata * @property arguments Explicitly specified arguments to the annotation; does not include default values for annotation parameters * (specified in the annotation class declaration) */ -class KmAnnotation(val className: ClassName, val arguments: Map) { +public class KmAnnotation(public val className: ClassName, public val arguments: Map) { /** * Checks if this KmAnnotation is equal to the [other]. @@ -45,7 +45,7 @@ class KmAnnotation(val className: ClassName, val arguments: Map : KmAnnotationArgument() { + public sealed class LiteralValue : KmAnnotationArgument() { /** * The value of this argument. */ - abstract val value: T + public abstract val value: T - // final modifier prevents generation of data class-like .toString() in inheritors + // the final modifier prevents generation of data class-like .toString() in inheritors // Java reflection instead of Kotlin reflection to avoid (probably small) overhead of mapping Kotlin/Java names final override fun toString(): String = "${this::class.java.simpleName}(${if (this is StringValue) "\"$value\"" else value.toString()})" @@ -75,33 +75,33 @@ sealed class KmAnnotationArgument { // to the overridden one. However, it does not do this with classes, and we do not have `@inheritdoc` :( /** An annotation argument with a [Byte] type. */ - data class ByteValue(override val value: Byte) : LiteralValue() + public data class ByteValue(override val value: Byte) : LiteralValue() /** An annotation argument with a [Char] type. */ - data class CharValue(override val value: Char) : LiteralValue() + public data class CharValue(override val value: Char) : LiteralValue() /** An annotation argument with a [Short] type. */ - data class ShortValue(override val value: Short) : LiteralValue() + public data class ShortValue(override val value: Short) : LiteralValue() /** An annotation argument with a [Int] type. */ - data class IntValue(override val value: Int) : LiteralValue() + public data class IntValue(override val value: Int) : LiteralValue() /** An annotation argument with a [Long] type. */ - data class LongValue(override val value: Long) : LiteralValue() + public data class LongValue(override val value: Long) : LiteralValue() /** An annotation argument with a [Float] type. */ - data class FloatValue(override val value: Float) : LiteralValue() + public data class FloatValue(override val value: Float) : LiteralValue() /** An annotation argument with a [Double] type. */ - data class DoubleValue(override val value: Double) : LiteralValue() + public data class DoubleValue(override val value: Double) : LiteralValue() /** An annotation argument with a [Boolean] type. */ - data class BooleanValue(override val value: Boolean) : LiteralValue() + public data class BooleanValue(override val value: Boolean) : LiteralValue() /** An annotation argument with a [UByte] type. */ - data class UByteValue(override val value: UByte) : LiteralValue() + public data class UByteValue(override val value: UByte) : LiteralValue() /** An annotation argument with a [UShort] type. */ - data class UShortValue(override val value: UShort) : LiteralValue() + public data class UShortValue(override val value: UShort) : LiteralValue() /** An annotation argument with a [UInt] type. */ - data class UIntValue(override val value: UInt) : LiteralValue() + public data class UIntValue(override val value: UInt) : LiteralValue() /** An annotation argument with a [ULong] type. */ - data class ULongValue(override val value: ULong) : LiteralValue() + public data class ULongValue(override val value: ULong) : LiteralValue() /** An annotation argument with a [String] type. */ - data class StringValue(override val value: String) : LiteralValue() + public data class StringValue(override val value: String) : LiteralValue() /** * An annotation argument with an enumeration type. @@ -112,7 +112,7 @@ sealed class KmAnnotationArgument { * @property enumClassName FQ name of the enum class * @property enumEntryName Name of the enum entry */ - data class EnumValue(val enumClassName: ClassName, val enumEntryName: String) : KmAnnotationArgument() { + public data class EnumValue(val enumClassName: ClassName, val enumEntryName: String) : KmAnnotationArgument() { override fun toString(): String = "EnumValue($enumClassName.$enumEntryName)" } @@ -131,7 +131,7 @@ sealed class KmAnnotationArgument { * * @property annotation Annotation instance with all its arguments. */ - data class AnnotationValue(val annotation: KmAnnotation) : KmAnnotationArgument() { + public data class AnnotationValue(val annotation: KmAnnotation) : KmAnnotationArgument() { override fun toString(): String = "AnnotationValue($annotation)" } @@ -145,7 +145,7 @@ sealed class KmAnnotationArgument { * * @property elements Values of elements in the array. */ - data class ArrayValue(val elements: List) : KmAnnotationArgument() { + public data class ArrayValue(val elements: List) : KmAnnotationArgument() { override fun toString(): String = "ArrayValue($elements)" } @@ -160,7 +160,7 @@ sealed class KmAnnotationArgument { * @property className FQ name of the referenced class. */ @Suppress("DEPRECATION_ERROR") - data class KClassValue @Deprecated( + public data class KClassValue @Deprecated( "Use single-argument constructor instead or ArrayKClassValue", level = DeprecationLevel.ERROR ) constructor( @@ -170,7 +170,7 @@ sealed class KmAnnotationArgument { level = DeprecationLevel.ERROR ) val arrayDimensionCount: Int ) : KmAnnotationArgument() { - constructor(className: ClassName) : this(className, 0) + public constructor(className: ClassName) : this(className, 0) init { require(arrayDimensionCount == 0) { "KClassValue must not have array dimensions. For Array::class, use ArrayKClassValue." } @@ -199,7 +199,7 @@ sealed class KmAnnotationArgument { * @property className FQ name of the referenced array element type. * @property arrayDimensionCount Referenced array dimension. */ - data class ArrayKClassValue(val className: ClassName, val arrayDimensionCount: Int) : KmAnnotationArgument() { + public data class ArrayKClassValue(val className: ClassName, val arrayDimensionCount: Int) : KmAnnotationArgument() { init { require(arrayDimensionCount > 0) { "ArrayKClassValue must have at least one dimension. For regular X::class argument, use KClassValue." } } diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Attributes.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Attributes.kt index 792208cc15f..4575c42b3ad 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Attributes.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Attributes.kt @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.metadata.deserialization.Flags as ProtoFlags * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files. */ -var KmClass.hasAnnotations by annotationsOn(KmClass::flags) +public var KmClass.hasAnnotations: Boolean by annotationsOn(KmClass::flags) /** * Indicates that the corresponding constructor has at least one annotation. @@ -38,7 +38,7 @@ var KmClass.hasAnnotations by annotationsOn(KmClass::flags) * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files. */ -var KmConstructor.hasAnnotations by annotationsOn(KmConstructor::flags) +public var KmConstructor.hasAnnotations: Boolean by annotationsOn(KmConstructor::flags) /** * Indicates that the corresponding function has at least one annotation. @@ -49,7 +49,7 @@ var KmConstructor.hasAnnotations by annotationsOn(KmConstructor::flags) * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files. */ -var KmFunction.hasAnnotations by annotationsOn(KmFunction::flags) +public var KmFunction.hasAnnotations: Boolean by annotationsOn(KmFunction::flags) /** * Indicates that the corresponding property has at least one annotation. @@ -60,7 +60,7 @@ var KmFunction.hasAnnotations by annotationsOn(KmFunction::flags) * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files. */ -var KmProperty.hasAnnotations by annotationsOn(KmProperty::flags) +public var KmProperty.hasAnnotations: Boolean by annotationsOn(KmProperty::flags) /** * Indicates that the corresponding property accessor has at least one annotation. @@ -71,7 +71,7 @@ var KmProperty.hasAnnotations by annotationsOn(KmProperty::flags) * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files. */ -var KmPropertyAccessorAttributes.hasAnnotations by annotationsOn(KmPropertyAccessorAttributes::flags) +public var KmPropertyAccessorAttributes.hasAnnotations: Boolean by annotationsOn(KmPropertyAccessorAttributes::flags) /** * Indicates that the corresponding value parameter has at least one annotation. @@ -82,7 +82,7 @@ var KmPropertyAccessorAttributes.hasAnnotations by annotationsOn(KmPropertyAcces * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files. */ -var KmValueParameter.hasAnnotations by annotationsOn(KmValueParameter::flags) +public var KmValueParameter.hasAnnotations: Boolean by annotationsOn(KmValueParameter::flags) /** * Indicates that the corresponding type alias has at least one annotation. @@ -93,7 +93,7 @@ var KmValueParameter.hasAnnotations by annotationsOn(KmValueParameter::flags) * * Only annotations with [AnnotationRetention.BINARY] and [AnnotationRetention.RUNTIME] are written to the class files and metadata. */ -var KmTypeAlias.hasAnnotations by annotationsOn(KmTypeAlias::flags) +public var KmTypeAlias.hasAnnotations: Boolean by annotationsOn(KmTypeAlias::flags) // KmType and KmTypeParameter have annotations in it, and this flag for them is not written @@ -104,7 +104,7 @@ var KmTypeAlias.hasAnnotations by annotationsOn(KmTypeAlias::flags) * * Modality determines when and where it is possible to extend/implement a class/interface. */ -var KmClass.modality: Modality by modalityDelegate(KmClass::flags) +public var KmClass.modality: Modality by modalityDelegate(KmClass::flags) /** * Represents visibility of the corresponding class. @@ -112,12 +112,12 @@ var KmClass.modality: Modality by modalityDelegate(KmClass::flags) * Note that Kotlin metadata has an extended list of visibilities; some of them are non-denotable. * For additional details, see [Visibility]. */ -var KmClass.visibility: Visibility by visibilityDelegate(KmClass::flags) +public var KmClass.visibility: Visibility by visibilityDelegate(KmClass::flags) /** * Represents kind of the corresponding class — whether it is a regular class or an interface, companion object, et cetera. */ -var KmClass.kind: ClassKind by EnumFlagDelegate( +public var KmClass.kind: ClassKind by EnumFlagDelegate( KmClass::flags, ProtoFlags.CLASS_KIND, ClassKind.entries, @@ -127,23 +127,23 @@ var KmClass.kind: ClassKind by EnumFlagDelegate( /** * Indicates that the corresponding class is `inner`. */ -var KmClass.isInner: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_INNER)) +public var KmClass.isInner: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_INNER)) /** * Indicates that the corresponding `class` or `object` is `data`. * Always false for other kinds. */ -var KmClass.isData: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_DATA)) +public var KmClass.isData: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_DATA)) /** * Indicates that the corresponding class is `external`. */ -var KmClass.isExternal: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_CLASS)) +public var KmClass.isExternal: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_CLASS)) /** * Indicates that the corresponding class is `expect`. */ -var KmClass.isExpect: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_EXPECT_CLASS)) +public var KmClass.isExpect: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_EXPECT_CLASS)) /** * Indicates that the corresponding class is either a pre-Kotlin-1.5 `inline` class, or a 1.5+ `value` class. @@ -151,14 +151,14 @@ var KmClass.isExpect: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_EXPECT_CLAS * Note that it does not imply that the class has [JvmInline] annotation and will be inlined. * Currently, it is impossible to declare a value class without this annotation, but this can be changed in the future. */ -var KmClass.isValue: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_VALUE_CLASS)) +public var KmClass.isValue: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_VALUE_CLASS)) /** * Indicates that the corresponding class is a functional interface, i.e., marked with the keyword `fun`. * * Always `false` if [KmClass.kind] is not an interface. */ -var KmClass.isFunInterface: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_FUN_INTERFACE)) +public var KmClass.isFunInterface: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_FUN_INTERFACE)) /** * Indicates that the corresponding enum class has synthetic ".entries" property in bytecode. @@ -166,7 +166,7 @@ var KmClass.isFunInterface: Boolean by classBooleanFlag(Flag(ProtoFlags.IS_FUN_I * Always `false` if [KmClass.kind] is not an enum. * Enum classes always have enum entries property starting from Kotlin 1.9.0. */ -var KmClass.hasEnumEntries: Boolean by classBooleanFlag(Flag(ProtoFlags.HAS_ENUM_ENTRIES)) +public var KmClass.hasEnumEntries: Boolean by classBooleanFlag(Flag(ProtoFlags.HAS_ENUM_ENTRIES)) // --- CONSTRUCTOR --- @@ -176,12 +176,12 @@ var KmClass.hasEnumEntries: Boolean by classBooleanFlag(Flag(ProtoFlags.HAS_ENUM * Note that Kotlin metadata has an extended list of visibilities; some of them are non-denotable. * For additional details, see [Visibility]. */ -var KmConstructor.visibility: Visibility by visibilityDelegate(KmConstructor::flags) +public var KmConstructor.visibility: Visibility by visibilityDelegate(KmConstructor::flags) /** * Indicates that the corresponding constructor is secondary, i.e., declared not in the class header, but in the class body. */ -var KmConstructor.isSecondary: Boolean by constructorBooleanFlag(Flag(ProtoFlags.IS_SECONDARY)) +public var KmConstructor.isSecondary: Boolean by constructorBooleanFlag(Flag(ProtoFlags.IS_SECONDARY)) /** * Indicates that the corresponding constructor has non-stable parameter names, i.e., cannot be called with named arguments. @@ -189,7 +189,7 @@ var KmConstructor.isSecondary: Boolean by constructorBooleanFlag(Flag(ProtoFlags * Currently, this attribute is Kotlin/Native-specific and is never set by Kotlin/JVM compiler. * This may be changed in the future. */ -var KmConstructor.hasNonStableParameterNames: Boolean by constructorBooleanFlag(Flag(ProtoFlags.IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES)) +public var KmConstructor.hasNonStableParameterNames: Boolean by constructorBooleanFlag(Flag(ProtoFlags.IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES)) // --- FUNCTION --- @@ -198,7 +198,7 @@ var KmConstructor.hasNonStableParameterNames: Boolean by constructorBooleanFlag( * * Kind indicates the origin of a declaration within a containing class. For details, see [MemberKind]. */ -var KmFunction.kind: MemberKind by memberKindDelegate(KmFunction::flags) +public var KmFunction.kind: MemberKind by memberKindDelegate(KmFunction::flags) /** * Represents visibility of the corresponding function. @@ -206,7 +206,7 @@ var KmFunction.kind: MemberKind by memberKindDelegate(KmFunction::flags) * Note that Kotlin metadata has an extended list of visibilities; some of them are non-denotable. * For additional details, see [Visibility]. */ -var KmFunction.visibility: Visibility by visibilityDelegate(KmFunction::flags) +public var KmFunction.visibility: Visibility by visibilityDelegate(KmFunction::flags) /** * Represents modality of the corresponding function. @@ -216,42 +216,42 @@ var KmFunction.visibility: Visibility by visibilityDelegate(KmFunction::flags) * * [Modality.SEALED] is not applicable for [KmFunction] and setting it as a value results in undefined behavior. */ -var KmFunction.modality: Modality by modalityDelegate(KmFunction::flags) +public var KmFunction.modality: Modality by modalityDelegate(KmFunction::flags) /** * Indicates that the corresponding function is `operator`. */ -var KmFunction.isOperator: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_OPERATOR)) +public var KmFunction.isOperator: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_OPERATOR)) /** * Indicates that the corresponding function is `infix`. */ -var KmFunction.isInfix: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_INFIX)) +public var KmFunction.isInfix: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_INFIX)) /** * Indicates that the corresponding function is `inline`. */ -var KmFunction.isInline: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_INLINE)) +public var KmFunction.isInline: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_INLINE)) /** * Indicates that the corresponding function is `tailrec`. */ -var KmFunction.isTailrec: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_TAILREC)) +public var KmFunction.isTailrec: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_TAILREC)) /** * Indicates that the corresponding function is `external`. */ -var KmFunction.isExternal: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_FUNCTION)) +public var KmFunction.isExternal: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_FUNCTION)) /** * Indicates that the corresponding function is `suspend`. */ -var KmFunction.isSuspend: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_SUSPEND)) +public var KmFunction.isSuspend: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_SUSPEND)) /** * Indicates that the corresponding function is `expect`. */ -var KmFunction.isExpect: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_EXPECT_FUNCTION)) +public var KmFunction.isExpect: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_EXPECT_FUNCTION)) /** * Indicates that the corresponding function has non-stable parameter names, i.e., cannot be called with named arguments. @@ -259,7 +259,7 @@ var KmFunction.isExpect: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_EXPEC * Currently, this attribute is Kotlin/Native-specific and is never set by Kotlin/JVM compiler. * This may be changed in the future. */ -var KmFunction.hasNonStableParameterNames: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES)) +public var KmFunction.hasNonStableParameterNames: Boolean by functionBooleanFlag(Flag(ProtoFlags.IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES)) // --- PROPERTY --- @@ -269,7 +269,7 @@ var KmFunction.hasNonStableParameterNames: Boolean by functionBooleanFlag(Flag(P * Note that Kotlin metadata has an extended list of visibilities; some of them are non-denotable. * For additional details, see [Visibility]. */ -var KmProperty.visibility: Visibility by visibilityDelegate(KmProperty::flags) +public var KmProperty.visibility: Visibility by visibilityDelegate(KmProperty::flags) /** * Represents modality of the corresponding property. @@ -279,39 +279,39 @@ var KmProperty.visibility: Visibility by visibilityDelegate(KmProperty::flags) * * [Modality.SEALED] is not applicable for [KmProperty] and setting it as a value results in undefined behavior. */ -var KmProperty.modality: Modality by modalityDelegate(KmProperty::flags) +public var KmProperty.modality: Modality by modalityDelegate(KmProperty::flags) /** * Represents kind of the corresponding property. * * Kind indicates the origin of a declaration within a containing class. For details, see [MemberKind]. */ -var KmProperty.kind: MemberKind by memberKindDelegate(KmProperty::flags) +public var KmProperty.kind: MemberKind by memberKindDelegate(KmProperty::flags) /** * Indicates that the corresponding property is `var`. */ -var KmProperty.isVar: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_VAR)) +public var KmProperty.isVar: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_VAR)) /** * Indicates that the corresponding property has a getter. */ -var KmProperty.hasGetter: Boolean by propertyBooleanFlag(Flag(ProtoFlags.HAS_GETTER)) +public var KmProperty.hasGetter: Boolean by propertyBooleanFlag(Flag(ProtoFlags.HAS_GETTER)) /** * Indicates that the corresponding property has a setter. */ -var KmProperty.hasSetter: Boolean by propertyBooleanFlag(Flag(ProtoFlags.HAS_SETTER)) +public var KmProperty.hasSetter: Boolean by propertyBooleanFlag(Flag(ProtoFlags.HAS_SETTER)) /** * Indicates that the corresponding property is `const`. */ -var KmProperty.isConst: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_CONST)) +public var KmProperty.isConst: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_CONST)) /** * Indicates that the corresponding property is `lateinit`. */ -var KmProperty.isLateinit: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_LATEINIT)) +public var KmProperty.isLateinit: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_LATEINIT)) /** * Indicates that the corresponding property has a constant value. On JVM, this flag allows an optimization similarly to @@ -334,12 +334,12 @@ var KmProperty.isLateinit: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_LAT * } * ``` */ -var KmProperty.hasConstant: Boolean by propertyBooleanFlag(Flag(ProtoFlags.HAS_CONSTANT)) +public var KmProperty.hasConstant: Boolean by propertyBooleanFlag(Flag(ProtoFlags.HAS_CONSTANT)) /** * Indicates that the corresponding property is `external`. */ -var KmProperty.isExternal: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_PROPERTY)) +public var KmProperty.isExternal: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_PROPERTY)) /** * Indicates that the corresponding property is a delegated property. @@ -347,12 +347,12 @@ var KmProperty.isExternal: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_EXT * Not to be confused with interface delegation. * If a property was produced by interface delegation, it would have the corresponding [KmProperty.kind]. */ -var KmProperty.isDelegated: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_DELEGATED)) +public var KmProperty.isDelegated: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_DELEGATED)) /** * Indicates that the corresponding property is `expect`. */ -var KmProperty.isExpect: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_EXPECT_PROPERTY)) +public var KmProperty.isExpect: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_EXPECT_PROPERTY)) // --- PROPERTY ACCESSOR --- @@ -362,7 +362,7 @@ var KmProperty.isExpect: Boolean by propertyBooleanFlag(Flag(ProtoFlags.IS_EXPEC * Note that Kotlin metadata has an extended list of visibilities; some of them are non-denotable. * For additional details, see [Visibility]. */ -var KmPropertyAccessorAttributes.visibility: Visibility by visibilityDelegate(KmPropertyAccessorAttributes::flags) +public var KmPropertyAccessorAttributes.visibility: Visibility by visibilityDelegate(KmPropertyAccessorAttributes::flags) /** * Represents modality of the corresponding property accessor. @@ -372,40 +372,40 @@ var KmPropertyAccessorAttributes.visibility: Visibility by visibilityDelegate(Km * * [Modality.SEALED] is not applicable for [KmPropertyAccessorAttributes] and setting it as a value results in undefined behavior. */ -var KmPropertyAccessorAttributes.modality: Modality by modalityDelegate(KmPropertyAccessorAttributes::flags) +public var KmPropertyAccessorAttributes.modality: Modality by modalityDelegate(KmPropertyAccessorAttributes::flags) /** * Indicates that the corresponding property accessor is not default, i.e. it has a body and/or annotations in the source code, * or the property is delegated. */ -var KmPropertyAccessorAttributes.isNotDefault: Boolean by propertyAccessorBooleanFlag(Flag(ProtoFlags.IS_NOT_DEFAULT)) +public var KmPropertyAccessorAttributes.isNotDefault: Boolean by propertyAccessorBooleanFlag(Flag(ProtoFlags.IS_NOT_DEFAULT)) /** * Indicates that the corresponding property accessor is `external`. */ -var KmPropertyAccessorAttributes.isExternal: Boolean by propertyAccessorBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_ACCESSOR)) +public var KmPropertyAccessorAttributes.isExternal: Boolean by propertyAccessorBooleanFlag(Flag(ProtoFlags.IS_EXTERNAL_ACCESSOR)) /** * Indicates that the corresponding property accessor is `inline`. */ -var KmPropertyAccessorAttributes.isInline: Boolean by propertyAccessorBooleanFlag(Flag(ProtoFlags.IS_INLINE_ACCESSOR)) +public var KmPropertyAccessorAttributes.isInline: Boolean by propertyAccessorBooleanFlag(Flag(ProtoFlags.IS_INLINE_ACCESSOR)) // --- TYPE & TYPE_PARAM /** * Indicates that the corresponding type is marked as nullable, i.e. has a question mark at the end of its notation. */ -var KmType.isNullable: Boolean by typeBooleanFlag(FlagImpl(0, 1, 1)) +public var KmType.isNullable: Boolean by typeBooleanFlag(FlagImpl(0, 1, 1)) /** * Indicates that the corresponding type is `suspend`. */ -var KmType.isSuspend: Boolean by typeBooleanFlag(FlagImpl(ProtoFlags.SUSPEND_TYPE.offset + 1, ProtoFlags.SUSPEND_TYPE.bitWidth, 1)) +public var KmType.isSuspend: Boolean by typeBooleanFlag(FlagImpl(ProtoFlags.SUSPEND_TYPE.offset + 1, ProtoFlags.SUSPEND_TYPE.bitWidth, 1)) /** * Indicates that the corresponding type is [definitely non-null](https://kotlinlang.org/docs/whatsnew17.html#stable-definitely-non-nullable-types). */ -var KmType.isDefinitelyNonNull: Boolean by typeBooleanFlag( +public var KmType.isDefinitelyNonNull: Boolean by typeBooleanFlag( FlagImpl( ProtoFlags.DEFINITELY_NOT_NULL_TYPE.offset + 1, ProtoFlags.DEFINITELY_NOT_NULL_TYPE.bitWidth, @@ -417,7 +417,7 @@ var KmType.isDefinitelyNonNull: Boolean by typeBooleanFlag( /** * Indicates that the corresponding type parameter is `reified`. */ -var KmTypeParameter.isReified: Boolean by BooleanFlagDelegate(KmTypeParameter::flags, FlagImpl(0, 1, 1)) +public var KmTypeParameter.isReified: Boolean by BooleanFlagDelegate(KmTypeParameter::flags, FlagImpl(0, 1, 1)) // --- TYPE ALIAS --- @@ -427,7 +427,7 @@ var KmTypeParameter.isReified: Boolean by BooleanFlagDelegate(KmTypeParameter::f * Note that Kotlin metadata has an extended list of visibilities; some of them are non-denotable. * For additional details, see [Visibility]. */ -var KmTypeAlias.visibility: Visibility by visibilityDelegate(KmTypeAlias::flags) +public var KmTypeAlias.visibility: Visibility by visibilityDelegate(KmTypeAlias::flags) // --- VALUE PARAMETER --- @@ -439,17 +439,17 @@ var KmTypeAlias.visibility: Visibility by visibilityDelegate(KmTypeAlias::flags) * parameter in the derived method does _not_ declare the default value, but the parameter is * still optional at the call site because the default value from the base method is used. */ -var KmValueParameter.declaresDefaultValue: Boolean by valueParameterBooleanFlag(Flag(ProtoFlags.DECLARES_DEFAULT_VALUE)) +public var KmValueParameter.declaresDefaultValue: Boolean by valueParameterBooleanFlag(Flag(ProtoFlags.DECLARES_DEFAULT_VALUE)) /** * Indicates that the corresponding value parameter is `crossinline`. */ -var KmValueParameter.isCrossinline: Boolean by valueParameterBooleanFlag(Flag(ProtoFlags.IS_CROSSINLINE)) +public var KmValueParameter.isCrossinline: Boolean by valueParameterBooleanFlag(Flag(ProtoFlags.IS_CROSSINLINE)) /** * Indicates that the corresponding value parameter is `noinline`. */ -var KmValueParameter.isNoinline: Boolean by valueParameterBooleanFlag(Flag(ProtoFlags.IS_NOINLINE)) +public var KmValueParameter.isNoinline: Boolean by valueParameterBooleanFlag(Flag(ProtoFlags.IS_NOINLINE)) // --- EFFECT EXPRESSION --- @@ -460,7 +460,7 @@ var KmValueParameter.isNoinline: Boolean by valueParameterBooleanFlag(Flag(Proto * may change in a subsequent release. */ @ExperimentalContracts -var KmEffectExpression.isNegated: Boolean by BooleanFlagDelegate(KmEffectExpression::flags, Flag(ProtoFlags.IS_NEGATED)) +public var KmEffectExpression.isNegated: Boolean by BooleanFlagDelegate(KmEffectExpression::flags, Flag(ProtoFlags.IS_NEGATED)) /** * Indicates that the corresponding effect expression checks whether a value of some variable is `null`. @@ -469,4 +469,4 @@ var KmEffectExpression.isNegated: Boolean by BooleanFlagDelegate(KmEffectExpress * may change in a subsequent release. */ @ExperimentalContracts -var KmEffectExpression.isNullCheckPredicate: Boolean by BooleanFlagDelegate(KmEffectExpression::flags, Flag(ProtoFlags.IS_NULL_CHECK_PREDICATE)) +public var KmEffectExpression.isNullCheckPredicate: Boolean by BooleanFlagDelegate(KmEffectExpression::flags, Flag(ProtoFlags.IS_NULL_CHECK_PREDICATE)) diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/ClassName.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/ClassName.kt index 01a1c6ab8aa..e017b113a54 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/ClassName.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/ClassName.kt @@ -16,14 +16,14 @@ package kotlinx.metadata * If this name starts with '.', it represents a local class or an anonymous object. This is used by the Kotlin compiler * to prevent lookup of this name in the resolution. */ -typealias ClassName = String // Not a value class because of Java usages +public typealias ClassName = String // Not a value class because of Java usages /** * Checks whether a class name [this] represents a local class or an anonymous object. * * A class name represents a local class or an anonymous object if it starts with '.' (dot). */ -fun ClassName.isLocalClassName(): Boolean = this.startsWith(".") +public fun ClassName.isLocalClassName(): Boolean = this.startsWith(".") // Deprecated since 0.6.1, should be error in 0.7.0+ @Deprecated( @@ -31,4 +31,4 @@ fun ClassName.isLocalClassName(): Boolean = this.startsWith(".") ReplaceWith("isLocalClassName()"), level = DeprecationLevel.WARNING ) -val ClassName.isLocal: Boolean get() = isLocalClassName() +public val ClassName.isLocal: Boolean get() = isLocalClassName() diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Extensions.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Extensions.kt index d3e9f062398..89920d77f09 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Extensions.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Extensions.kt @@ -30,7 +30,7 @@ import kotlin.reflect.KClass * In case an extension visitor of an unrelated type is returned, the code using the visitor API must ignore that visitor. */ @Deprecated(VISITOR_API_MESSAGE) -class KmExtensionType(private val klass: KClass) { +public class KmExtensionType(private val klass: KClass) { override fun equals(other: Any?): Boolean = other is KmExtensionType && klass == other.klass @@ -45,69 +45,69 @@ class KmExtensionType(private val klass: KClass) { * A base interface for all extension visitors. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmExtensionVisitor { +public interface KmExtensionVisitor { /** * Type of this extension visitor. */ - val type: KmExtensionType + public val type: KmExtensionType } /** * A visitor to visit platform-specific extensions for a declaration container, such as a class or a package fragment. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmDeclarationContainerExtensionVisitor : KmExtensionVisitor +public interface KmDeclarationContainerExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a class. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmClassExtensionVisitor : KmDeclarationContainerExtensionVisitor +public interface KmClassExtensionVisitor : KmDeclarationContainerExtensionVisitor /** * A visitor to visit platform-specific extensions for a package fragment. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmPackageExtensionVisitor : KmDeclarationContainerExtensionVisitor +public interface KmPackageExtensionVisitor : KmDeclarationContainerExtensionVisitor /** * A visitor to visit platform-specific extensions for a function. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmFunctionExtensionVisitor : KmExtensionVisitor +public interface KmFunctionExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a property. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmPropertyExtensionVisitor : KmExtensionVisitor +public interface KmPropertyExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a constructor. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmConstructorExtensionVisitor : KmExtensionVisitor +public interface KmConstructorExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a type parameter. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmTypeParameterExtensionVisitor : KmExtensionVisitor +public interface KmTypeParameterExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a type. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmTypeExtensionVisitor : KmExtensionVisitor +public interface KmTypeExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a type alias. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmTypeAliasExtensionVisitor : KmExtensionVisitor +public interface KmTypeAliasExtensionVisitor : KmExtensionVisitor /** * A visitor to visit platform-specific extensions for a value parameter. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmValueParameterExtensionVisitor : KmExtensionVisitor +public interface KmValueParameterExtensionVisitor : KmExtensionVisitor diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Flag.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Flag.kt index d46b1770630..1b493f111ac 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Flag.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Flag.kt @@ -30,8 +30,8 @@ private const val prefix = "Flag API is deprecated. Please use" * * v.visitFunction(flagsOf(Flag.Function.IS_DECLARATION, Flag.Function.IS_INLINE), "foo") * - * Flag common to multiple kinds of Kotlin declarations ("common flags") are declared in [Flag.Common]. - * Flag applicable to specific kinds of declarations ("declaration-specific flags") are declared in nested objects of the [Flag] object. + * Flags common to multiple kinds of Kotlin declarations ("common flags") are declared in [Flag.Common]. + * Flags applicable to specific kinds of declarations ("declaration-specific flags") are declared in nested objects of the [Flag] object. * * Some flags are mutually exclusive, i.e. there are "flag groups" such that no more than one flag from each group can be present * in the same bitmask. Among common flags, there are the following flag groups: @@ -45,16 +45,16 @@ private const val prefix = "Flag API is deprecated. Please use" */ @Deprecated("$prefix corresponding extensions on Km nodes, such as KmClass.visibility") @Suppress("DEPRECATION") -abstract class Flag internal constructor() { +public abstract class Flag internal constructor() { /** * Checks whether the flag is present in the given bitmask. */ - abstract operator fun invoke(flags: Int): Boolean + public abstract operator fun invoke(flags: Int): Boolean /** @suppress deprecated */ @Deprecated("$prefix corresponding extensions on Km nodes, such as KmClass.visibility") - companion object Common { + public companion object Common { /** * Signifies that the corresponding declaration has at least one annotation. * @@ -64,7 +64,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix corresponding extension on a node, e.g. KmClass.hasAnnotations") - val HAS_ANNOTATIONS: Flag = FlagImpl(F.HAS_ANNOTATIONS) + public val HAS_ANNOTATIONS: Flag = FlagImpl(F.HAS_ANNOTATIONS) /** @@ -72,28 +72,28 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix visibility extension on a node, e.g. KmClass.visibility") - val IS_INTERNAL: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.INTERNAL_VALUE) + public val IS_INTERNAL: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.INTERNAL_VALUE) /** * A visibility flag, signifying that the corresponding declaration is `private`. */ @JvmField @Deprecated("$prefix visibility extension on a node, e.g. KmClass.visibility") - val IS_PRIVATE: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PRIVATE_VALUE) + public val IS_PRIVATE: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PRIVATE_VALUE) /** * A visibility flag, signifying that the corresponding declaration is `protected`. */ @JvmField @Deprecated("$prefix visibility extension on a node, e.g. KmClass.visibility") - val IS_PROTECTED: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PROTECTED_VALUE) + public val IS_PROTECTED: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PROTECTED_VALUE) /** * A visibility flag, signifying that the corresponding declaration is `public`. */ @JvmField @Deprecated("$prefix visibility extension on a node, e.g. KmClass.visibility") - val IS_PUBLIC: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PUBLIC_VALUE) + public val IS_PUBLIC: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PUBLIC_VALUE) /** * A visibility flag, signifying that the corresponding declaration is "private-to-this", which is a non-denotable visibility of @@ -101,7 +101,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix visibility extension on a node, e.g. KmClass.visibility") - val IS_PRIVATE_TO_THIS: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PRIVATE_TO_THIS_VALUE) + public val IS_PRIVATE_TO_THIS: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.PRIVATE_TO_THIS_VALUE) /** * A visibility flag, signifying that the corresponding declaration is local, i.e. declared inside a code block @@ -109,7 +109,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix visibility extension on a node, e.g. KmClass.visibility") - val IS_LOCAL: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.LOCAL_VALUE) + public val IS_LOCAL: Flag = FlagImpl(F.VISIBILITY, ProtoVisibility.LOCAL_VALUE) /** @@ -117,28 +117,28 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix modality extension on a node, e.g. KmClass.modality or KmFunction.modality") - val IS_FINAL: Flag = FlagImpl(F.MODALITY, ProtoModality.FINAL_VALUE) + public val IS_FINAL: Flag = FlagImpl(F.MODALITY, ProtoModality.FINAL_VALUE) /** * A modality flag, signifying that the corresponding declaration is `open`. */ @JvmField @Deprecated("$prefix modality extension on a node, e.g. KmClass.modality or KmFunction.modality") - val IS_OPEN: Flag = FlagImpl(F.MODALITY, ProtoModality.OPEN_VALUE) + public val IS_OPEN: Flag = FlagImpl(F.MODALITY, ProtoModality.OPEN_VALUE) /** * A modality flag, signifying that the corresponding declaration is `abstract`. */ @JvmField @Deprecated("$prefix modality extension on a node, e.g. KmClass.modality or KmFunction.modality") - val IS_ABSTRACT: Flag = FlagImpl(F.MODALITY, ProtoModality.ABSTRACT_VALUE) + public val IS_ABSTRACT: Flag = FlagImpl(F.MODALITY, ProtoModality.ABSTRACT_VALUE) /** * A modality flag, signifying that the corresponding declaration is `sealed`. */ @JvmField @Deprecated("$prefix modality extension on a node, e.g. KmClass.modality") - val IS_SEALED: Flag = FlagImpl(F.MODALITY, ProtoModality.SEALED_VALUE) + public val IS_SEALED: Flag = FlagImpl(F.MODALITY, ProtoModality.SEALED_VALUE) } /** @@ -149,55 +149,55 @@ abstract class Flag internal constructor() { * [IS_COMPANION_OBJECT] */ @Deprecated("$prefix corresponding extension on a KmClass") - object Class { + public object Class { /** * A class kind flag, signifying that the corresponding class is a usual `class`. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_CLASS: Flag = FlagImpl(F.CLASS_KIND, ClassKind.CLASS_VALUE) + public val IS_CLASS: Flag = FlagImpl(F.CLASS_KIND, ClassKind.CLASS_VALUE) /** * A class kind flag, signifying that the corresponding class is an `interface`. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_INTERFACE: Flag = FlagImpl(F.CLASS_KIND, ClassKind.INTERFACE_VALUE) + public val IS_INTERFACE: Flag = FlagImpl(F.CLASS_KIND, ClassKind.INTERFACE_VALUE) /** * A class kind flag, signifying that the corresponding class is an `enum class`. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_ENUM_CLASS: Flag = FlagImpl(F.CLASS_KIND, ClassKind.ENUM_CLASS_VALUE) + public val IS_ENUM_CLASS: Flag = FlagImpl(F.CLASS_KIND, ClassKind.ENUM_CLASS_VALUE) /** * A class kind flag, signifying that the corresponding class is an enum entry. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_ENUM_ENTRY: Flag = FlagImpl(F.CLASS_KIND, ClassKind.ENUM_ENTRY_VALUE) + public val IS_ENUM_ENTRY: Flag = FlagImpl(F.CLASS_KIND, ClassKind.ENUM_ENTRY_VALUE) /** * A class kind flag, signifying that the corresponding class is an `annotation class`. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_ANNOTATION_CLASS: Flag = FlagImpl(F.CLASS_KIND, ClassKind.ANNOTATION_CLASS_VALUE) + public val IS_ANNOTATION_CLASS: Flag = FlagImpl(F.CLASS_KIND, ClassKind.ANNOTATION_CLASS_VALUE) /** * A class kind flag, signifying that the corresponding class is a non-companion `object`. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_OBJECT: Flag = FlagImpl(F.CLASS_KIND, ClassKind.OBJECT_VALUE) + public val IS_OBJECT: Flag = FlagImpl(F.CLASS_KIND, ClassKind.OBJECT_VALUE) /** * A class kind flag, signifying that the corresponding class is a `companion object`. */ @JvmField @Deprecated("$prefix KmClass.kind") - val IS_COMPANION_OBJECT: Flag = FlagImpl(F.CLASS_KIND, ClassKind.COMPANION_OBJECT_VALUE) + public val IS_COMPANION_OBJECT: Flag = FlagImpl(F.CLASS_KIND, ClassKind.COMPANION_OBJECT_VALUE) /** @@ -205,28 +205,28 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmClass.isInner") - val IS_INNER: Flag = FlagImpl(F.IS_INNER) + public val IS_INNER: Flag = FlagImpl(F.IS_INNER) /** * Signifies that the corresponding class is `data`. */ @JvmField @Deprecated("$prefix KmClass.isData") - val IS_DATA: Flag = FlagImpl(F.IS_DATA) + public val IS_DATA: Flag = FlagImpl(F.IS_DATA) /** * Signifies that the corresponding class is `external`. */ @JvmField @Deprecated("$prefix KmClass.isExternal") - val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_CLASS) + public val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_CLASS) /** * Signifies that the corresponding class is `expect`. */ @JvmField @Deprecated("$prefix KmClass.isExpect") - val IS_EXPECT: Flag = FlagImpl(F.IS_EXPECT_CLASS) + public val IS_EXPECT: Flag = FlagImpl(F.IS_EXPECT_CLASS) @JvmField @Deprecated( @@ -234,21 +234,21 @@ abstract class Flag internal constructor() { level = DeprecationLevel.ERROR ) @Suppress("unused") - val IS_INLINE: Flag = FlagImpl(F.IS_VALUE_CLASS) + public val IS_INLINE: Flag = FlagImpl(F.IS_VALUE_CLASS) /** * Signifies that the corresponding class is either a pre-Kotlin-1.5 `inline` class, or a 1.5+ `value` class. */ @JvmField @Deprecated("$prefix KmClass.isValue") - val IS_VALUE: Flag = FlagImpl(F.IS_VALUE_CLASS) + public val IS_VALUE: Flag = FlagImpl(F.IS_VALUE_CLASS) /** * Signifies that the corresponding class is a functional interface, i.e. marked with the keyword `fun`. */ @JvmField @Deprecated("$prefix KmClass.isFun") - val IS_FUN: Flag = FlagImpl(F.IS_FUN_INTERFACE) + public val IS_FUN: Flag = FlagImpl(F.IS_FUN_INTERFACE) /** * Signifies that the corresponding enum class has ".entries" property in bytecode. @@ -256,31 +256,31 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmClass.hasEnumEntries") - val HAS_ENUM_ENTRIES: Flag = FlagImpl(F.HAS_ENUM_ENTRIES) + public val HAS_ENUM_ENTRIES: Flag = FlagImpl(F.HAS_ENUM_ENTRIES) } /** * A container of flags applicable to Kotlin constructors. */ - object Constructor { + public object Constructor { @JvmField @Deprecated("Use IS_SECONDARY which holds inverted value instead.", level = DeprecationLevel.ERROR) @Suppress("unused") - val IS_PRIMARY: Flag = FlagImpl(F.IS_SECONDARY, 0) + public val IS_PRIMARY: Flag = FlagImpl(F.IS_SECONDARY, 0) /** * Signifies that the corresponding constructor is secondary, i.e. declared not in the class header, but in the class body. */ @JvmField @Deprecated("$prefix KmConstructor.isSecondary") - val IS_SECONDARY: Flag = FlagImpl(F.IS_SECONDARY) + public val IS_SECONDARY: Flag = FlagImpl(F.IS_SECONDARY) /** * Signifies that the corresponding constructor has non-stable parameter names, i.e. cannot be called with named arguments. */ @JvmField @Deprecated("$prefix KmConstructor.hasNonStableParameterNames") - val HAS_NON_STABLE_PARAMETER_NAMES: Flag = FlagImpl(F.IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES) + public val HAS_NON_STABLE_PARAMETER_NAMES: Flag = FlagImpl(F.IS_CONSTRUCTOR_WITH_NON_STABLE_PARAMETER_NAMES) } /** @@ -289,13 +289,13 @@ abstract class Flag internal constructor() { * In addition to the common flag groups, the following flag groups exist for function flags: * * member kind flags: [IS_DECLARATION], [IS_FAKE_OVERRIDE], [IS_DELEGATION], [IS_SYNTHESIZED] */ - object Function { + public object Function { /** * A member kind flag, signifying that the corresponding function is explicitly declared in the containing class. */ @JvmField @Deprecated("$prefix KmFunction.kind") - val IS_DECLARATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DECLARATION_VALUE) + public val IS_DECLARATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DECLARATION_VALUE) /** * A member kind flag, signifying that the corresponding function exists in the containing class because a function with a suitable @@ -303,7 +303,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmFunction.kind") - val IS_FAKE_OVERRIDE: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.FAKE_OVERRIDE_VALUE) + public val IS_FAKE_OVERRIDE: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.FAKE_OVERRIDE_VALUE) /** * A member kind flag, signifying that the corresponding function exists in the containing class because it has been produced @@ -311,7 +311,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmFunction.kind") - val IS_DELEGATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DELEGATION_VALUE) + public val IS_DELEGATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DELEGATION_VALUE) /** * A member kind flag, signifying that the corresponding function exists in the containing class because it has been synthesized @@ -319,63 +319,63 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmFunction.kind") - val IS_SYNTHESIZED: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.SYNTHESIZED_VALUE) + public val IS_SYNTHESIZED: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.SYNTHESIZED_VALUE) /** * Signifies that the corresponding function is `operator`. */ @JvmField @Deprecated("$prefix KmFunction.isOperator") - val IS_OPERATOR: Flag = FlagImpl(F.IS_OPERATOR) + public val IS_OPERATOR: Flag = FlagImpl(F.IS_OPERATOR) /** * Signifies that the corresponding function is `infix`. */ @JvmField @Deprecated("$prefix KmFunction.isInfix") - val IS_INFIX: Flag = FlagImpl(F.IS_INFIX) + public val IS_INFIX: Flag = FlagImpl(F.IS_INFIX) /** * Signifies that the corresponding function is `inline`. */ @JvmField @Deprecated("$prefix KmFunction.isInline") - val IS_INLINE: Flag = FlagImpl(F.IS_INLINE) + public val IS_INLINE: Flag = FlagImpl(F.IS_INLINE) /** * Signifies that the corresponding function is `tailrec`. */ @JvmField @Deprecated("$prefix KmFunction.isTailrec") - val IS_TAILREC: Flag = FlagImpl(F.IS_TAILREC) + public val IS_TAILREC: Flag = FlagImpl(F.IS_TAILREC) /** * Signifies that the corresponding function is `external`. */ @JvmField @Deprecated("$prefix KmFunction.isExternalFunction") - val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_FUNCTION) + public val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_FUNCTION) /** * Signifies that the corresponding function is `suspend`. */ @JvmField @Deprecated("$prefix KmFunction.isSuspend") - val IS_SUSPEND: Flag = FlagImpl(F.IS_SUSPEND) + public val IS_SUSPEND: Flag = FlagImpl(F.IS_SUSPEND) /** * Signifies that the corresponding function is `expect`. */ @JvmField @Deprecated("$prefix KmFunction.isExpectFunction") - val IS_EXPECT: Flag = FlagImpl(F.IS_EXPECT_FUNCTION) + public val IS_EXPECT: Flag = FlagImpl(F.IS_EXPECT_FUNCTION) /** * Signifies that the corresponding function has non-stable parameter names, i.e. cannot be called with named arguments. */ @JvmField @Deprecated("$prefix KmFunction.isFunctionWithNonStableParameterNames") - val HAS_NON_STABLE_PARAMETER_NAMES: Flag = FlagImpl(F.IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES) + public val HAS_NON_STABLE_PARAMETER_NAMES: Flag = FlagImpl(F.IS_FUNCTION_WITH_NON_STABLE_PARAMETER_NAMES) } /** @@ -384,13 +384,13 @@ abstract class Flag internal constructor() { * In addition to the common flag groups, the following flag groups exist for property flags: * * member kind flags: [IS_DECLARATION], [IS_FAKE_OVERRIDE], [IS_DELEGATION], [IS_SYNTHESIZED] */ - object Property { + public object Property { /** * A member kind flag, signifying that the corresponding property is explicitly declared in the containing class. */ @JvmField @Deprecated("$prefix KmProperty.kind") - val IS_DECLARATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DECLARATION_VALUE) + public val IS_DECLARATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DECLARATION_VALUE) /** * A member kind flag, signifying that the corresponding property exists in the containing class because a property with a suitable @@ -398,7 +398,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmProperty.kind") - val IS_FAKE_OVERRIDE: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.FAKE_OVERRIDE_VALUE) + public val IS_FAKE_OVERRIDE: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.FAKE_OVERRIDE_VALUE) /** * A member kind flag, signifying that the corresponding property exists in the containing class because it has been produced @@ -406,7 +406,7 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmProperty.kind") - val IS_DELEGATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DELEGATION_VALUE) + public val IS_DELEGATION: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.DELEGATION_VALUE) /** * A member kind flag, signifying that the corresponding property exists in the containing class because it has been synthesized @@ -414,42 +414,42 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmProperty.kind") - val IS_SYNTHESIZED: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.SYNTHESIZED_VALUE) + public val IS_SYNTHESIZED: Flag = FlagImpl(F.MEMBER_KIND, ProtoMemberKind.SYNTHESIZED_VALUE) /** * Signifies that the corresponding property is `var`. */ @JvmField @Deprecated("$prefix KmProperty.isVar") - val IS_VAR: Flag = FlagImpl(F.IS_VAR) + public val IS_VAR: Flag = FlagImpl(F.IS_VAR) /** * Signifies that the corresponding property has a getter. */ @JvmField @Deprecated("$prefix KmProperty.hasGetter") - val HAS_GETTER: Flag = FlagImpl(F.HAS_GETTER) + public val HAS_GETTER: Flag = FlagImpl(F.HAS_GETTER) /** * Signifies that the corresponding property has a setter. */ @JvmField @Deprecated("$prefix KmProperty.hasSetter") - val HAS_SETTER: Flag = FlagImpl(F.HAS_SETTER) + public val HAS_SETTER: Flag = FlagImpl(F.HAS_SETTER) /** * Signifies that the corresponding property is `const`. */ @JvmField @Deprecated("$prefix KmProperty.isConst") - val IS_CONST: Flag = FlagImpl(F.IS_CONST) + public val IS_CONST: Flag = FlagImpl(F.IS_CONST) /** * Signifies that the corresponding property is `lateinit`. */ @JvmField @Deprecated("$prefix KmProperty.isLateinit") - val IS_LATEINIT: Flag = FlagImpl(F.IS_LATEINIT) + public val IS_LATEINIT: Flag = FlagImpl(F.IS_LATEINIT) /** * Signifies that the corresponding property has a constant value. On JVM, this flag allows an optimization similarly to @@ -458,74 +458,74 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmProperty.hasConstant") - val HAS_CONSTANT: Flag = FlagImpl(F.HAS_CONSTANT) + public val HAS_CONSTANT: Flag = FlagImpl(F.HAS_CONSTANT) /** * Signifies that the corresponding property is `external`. */ @JvmField @Deprecated("$prefix KmProperty.isExternal") - val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_PROPERTY) + public val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_PROPERTY) /** * Signifies that the corresponding property is a delegated property. */ @JvmField @Deprecated("$prefix KmProperty.isDelegated") - val IS_DELEGATED: Flag = FlagImpl(F.IS_DELEGATED) + public val IS_DELEGATED: Flag = FlagImpl(F.IS_DELEGATED) /** * Signifies that the corresponding property is `expect`. */ @JvmField @Deprecated("$prefix KmProperty.isExpect") - val IS_EXPECT: Flag = FlagImpl(F.IS_EXPECT_PROPERTY) + public val IS_EXPECT: Flag = FlagImpl(F.IS_EXPECT_PROPERTY) } /** * A container of flags applicable to Kotlin property getters and setters. */ - object PropertyAccessor { + public object PropertyAccessor { /** * Signifies that the corresponding property accessor is not default, i.e. it has a body and/or annotations in the source code. */ @JvmField @Deprecated("$prefix KmPropertyAccessorAttributes.isNotDefault") - val IS_NOT_DEFAULT: Flag = FlagImpl(F.IS_NOT_DEFAULT) + public val IS_NOT_DEFAULT: Flag = FlagImpl(F.IS_NOT_DEFAULT) /** * Signifies that the corresponding property accessor is `external`. */ @JvmField @Deprecated("$prefix KmPropertyAccessorAttributes.isExternal") - val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_ACCESSOR) + public val IS_EXTERNAL: Flag = FlagImpl(F.IS_EXTERNAL_ACCESSOR) /** * Signifies that the corresponding property accessor is `inline`. */ @JvmField @Deprecated("$prefix KmPropertyAccessorAttributes.isInline") - val IS_INLINE: Flag = FlagImpl(F.IS_INLINE_ACCESSOR) + public val IS_INLINE: Flag = FlagImpl(F.IS_INLINE_ACCESSOR) } /** * A container of flags applicable to Kotlin types. */ - object Type { + public object Type { /** * Signifies that the corresponding type is marked as nullable, i.e. has a question mark at the end of its notation. */ @JvmField @Deprecated("$prefix KmType.isNullable") - val IS_NULLABLE: Flag = FlagImpl(0, 1, 1) + public val IS_NULLABLE: Flag = FlagImpl(0, 1, 1) /** * Signifies that the corresponding type is `suspend`. */ @JvmField @Deprecated("$prefix KmType.isSuspend") - val IS_SUSPEND: Flag = FlagImpl(F.SUSPEND_TYPE.offset + 1, F.SUSPEND_TYPE.bitWidth, 1) + public val IS_SUSPEND: Flag = FlagImpl(F.SUSPEND_TYPE.offset + 1, F.SUSPEND_TYPE.bitWidth, 1) /** * Signifies that the corresponding type is @@ -533,25 +533,25 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmType.isDefinitelyNonNull") - val IS_DEFINITELY_NON_NULL: Flag = FlagImpl(F.DEFINITELY_NOT_NULL_TYPE.offset + 1, F.DEFINITELY_NOT_NULL_TYPE.bitWidth, 1) + public val IS_DEFINITELY_NON_NULL: Flag = FlagImpl(F.DEFINITELY_NOT_NULL_TYPE.offset + 1, F.DEFINITELY_NOT_NULL_TYPE.bitWidth, 1) } /** * A container of flags applicable to Kotlin type parameters. */ - object TypeParameter { + public object TypeParameter { /** * Signifies that the corresponding type parameter is `reified`. */ @JvmField @Deprecated("$prefix KmTypeParameter.isReified") - val IS_REIFIED: Flag = FlagImpl(0, 1, 1) + public val IS_REIFIED: Flag = FlagImpl(0, 1, 1) } /** * A container of flags applicable to Kotlin value parameters. */ - object ValueParameter { + public object ValueParameter { /** * Signifies that the corresponding value parameter declares a default value. Note that the default value itself can be a complex * expression and is not available via metadata. Also note that in case of an override of a parameter with default value, the @@ -560,21 +560,21 @@ abstract class Flag internal constructor() { */ @JvmField @Deprecated("$prefix KmValueParameter.declaresDefaultValue") - val DECLARES_DEFAULT_VALUE: Flag = FlagImpl(F.DECLARES_DEFAULT_VALUE) + public val DECLARES_DEFAULT_VALUE: Flag = FlagImpl(F.DECLARES_DEFAULT_VALUE) /** * Signifies that the corresponding value parameter is `crossinline`. */ @JvmField @Deprecated("$prefix KmValueParameter.isCrossinline") - val IS_CROSSINLINE: Flag = FlagImpl(F.IS_CROSSINLINE) + public val IS_CROSSINLINE: Flag = FlagImpl(F.IS_CROSSINLINE) /** * Signifies that the corresponding value parameter is `noinline`. */ @JvmField @Deprecated("$prefix KmValueParameter.isNoinline") - val IS_NOINLINE: Flag = FlagImpl(F.IS_NOINLINE) + public val IS_NOINLINE: Flag = FlagImpl(F.IS_NOINLINE) } /** @@ -583,19 +583,19 @@ abstract class Flag internal constructor() { * Contracts are an internal feature of the standard Kotlin library, and their behavior and/or binary format * may change in a subsequent release. */ - object EffectExpression { + public object EffectExpression { /** * Signifies that the corresponding effect expression should be negated to compute the proposition or the conclusion of an effect. */ @JvmField @Deprecated("$prefix KmEffectExpression.isNegated") - val IS_NEGATED: Flag = FlagImpl(F.IS_NEGATED) + public val IS_NEGATED: Flag = FlagImpl(F.IS_NEGATED) /** * Signifies that the corresponding effect expression checks whether a value of some variable is `null`. */ @JvmField @Deprecated("$prefix KmEffectExpression.isNullCheckPredicate") - val IS_NULL_CHECK_PREDICATE: Flag = FlagImpl(F.IS_NULL_CHECK_PREDICATE) + public val IS_NULL_CHECK_PREDICATE: Flag = FlagImpl(F.IS_NULL_CHECK_PREDICATE) } } diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Flags.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Flags.kt index 5bc24970023..d7af9f6ded4 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Flags.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Flags.kt @@ -18,7 +18,7 @@ import kotlinx.metadata.internal.FlagImpl "Flags API is deprecated and this typealias will be removed. Use Int directly and then migrate to corresponding Km nodes extensions, e.g. KmClass.visibility", ReplaceWith("Int") ) -typealias Flags = Int +public typealias Flags = Int /** * Combines several flags into an integer bitmask. @@ -31,5 +31,5 @@ typealias Flags = Int @Deprecated( "Flags API is deprecated and this function will be removed. Create Km nodes directly and then use corresponding Km nodes extensions, e.g. KmClass.visibility", ) -fun flagsOf(vararg flags: Flag): Int = +public fun flagsOf(vararg flags: Flag): Int = flags.fold(0) { acc, flag -> (flag as FlagImpl) + acc } diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Modifiers.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Modifiers.kt index 0afa0c1a392..602f5d5f65d 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Modifiers.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Modifiers.kt @@ -21,7 +21,7 @@ import org.jetbrains.kotlin.metadata.ProtoBuf.MemberKind as ProtoMemberKind * Represents visibility level (also known as access level) of the corresponding declaration. * Some of these visibilities may be non-denotable in Kotlin. */ -enum class Visibility(kind: Int) { +public enum class Visibility(kind: Int) { /** * Signifies that the corresponding declaration is `internal`. */ @@ -65,7 +65,7 @@ enum class Visibility(kind: Int) { PRIVATE_TO_THIS(ProtoVisibility.PRIVATE_TO_THIS_VALUE), /** - * Signifies that the corresponding declaration is local, i.e. declared inside a code block + * Signifies that the corresponding declaration is local, i.e., declared inside a code block, * and not visible from the outside. */ LOCAL(ProtoVisibility.LOCAL_VALUE) @@ -79,7 +79,7 @@ enum class Visibility(kind: Int) { * * Modality determines when and where it is possible to extend/override a class/member. */ -enum class Modality(kind: Int) { +public enum class Modality(kind: Int) { /** * Signifies that the corresponding declaration is `final`. */ @@ -110,7 +110,7 @@ enum class Modality(kind: Int) { /** * Represents the kind of the corresponding class, i.e., the way it is declared in the source code. */ -enum class ClassKind(kind: Int) { +public enum class ClassKind(kind: Int) { /** * Signifies that the corresponding class is a usual or anonymous class. */ @@ -156,7 +156,7 @@ enum class ClassKind(kind: Int) { * Kind indicates the origin of a declaration within a containing class. * It provides information about whether a function or property was defined, generated, or something else. */ -enum class MemberKind(kind: Int) { +public enum class MemberKind(kind: Int) { /** * Signifies that the corresponding function or property is explicitly declared in the containing class. */ diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Nodes.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Nodes.kt index 8e8c94aefd2..3db8b41a87f 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Nodes.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Nodes.kt @@ -14,21 +14,21 @@ import kotlin.contracts.ExperimentalContracts /** * Represents a Kotlin declaration container, such as a class or a package fragment. */ -interface KmDeclarationContainer { +public interface KmDeclarationContainer { /** * Functions in the container. */ - val functions: MutableList + public val functions: MutableList /** * Properties in the container. */ - val properties: MutableList + public val properties: MutableList /** * Type aliases in the container. */ - val typeAliases: MutableList + public val typeAliases: MutableList } /** @@ -39,27 +39,27 @@ interface KmDeclarationContainer { * Various class attributes can be read and manipulated via extension properties, such as [KmClass.visibility] or [KmClass.isData]. */ @Suppress("DEPRECATION") -class KmClass : KmClassVisitor(), KmDeclarationContainer { +public class KmClass : KmClassVisitor(), KmDeclarationContainer { /** * Class flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag, modality flag and [Flag.Class] flags. */ @Deprecated("$flagAccessPrefix KmClass, such as KmClass.visibility") - var flags: Int = 0 + public var flags: Int = 0 /** * Name of the class. */ - lateinit var name: ClassName + public lateinit var name: ClassName /** * Type parameters of the class. */ - val typeParameters: MutableList = ArrayList(0) + public val typeParameters: MutableList = ArrayList(0) /** * Supertypes of the class. */ - val supertypes: MutableList = ArrayList(1) + public val supertypes: MutableList = ArrayList(1) /** * Functions in the class. @@ -79,48 +79,48 @@ class KmClass : KmClassVisitor(), KmDeclarationContainer { /** * Constructors of the class. */ - val constructors: MutableList = ArrayList(1) + public val constructors: MutableList = ArrayList(1) /** * Name of the companion object of this class, if it has one. */ - var companionObject: String? = null + public var companionObject: String? = null /** * Names of nested classes of this class. */ - val nestedClasses: MutableList = ArrayList(0) + public val nestedClasses: MutableList = ArrayList(0) /** * Names of enum entries, if this class is an enum class. */ - val enumEntries: MutableList = ArrayList(0) + public val enumEntries: MutableList = ArrayList(0) /** * Names of direct subclasses of this class, if this class is `sealed`. */ - val sealedSubclasses: MutableList = ArrayList(0) + public val sealedSubclasses: MutableList = ArrayList(0) /** * Name of the underlying property, if this class is `inline`. */ - var inlineClassUnderlyingPropertyName: String? = null + public var inlineClassUnderlyingPropertyName: String? = null /** * Type of the underlying property, if this class is `inline`. */ - var inlineClassUnderlyingType: KmType? = null + public var inlineClassUnderlyingType: KmType? = null /** * Types of context receivers of the class. */ @ExperimentalContextReceivers - val contextReceiverTypes: MutableList = ArrayList(0) + public val contextReceiverTypes: MutableList = ArrayList(0) /** * Version requirements on this class. */ - val versionRequirements: MutableList = ArrayList(0) + public val versionRequirements: MutableList = ArrayList(0) private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createClassExtension) @@ -204,7 +204,7 @@ class KmClass : KmClassVisitor(), KmDeclarationContainer { */ @Deprecated(VISITOR_API_MESSAGE) @OptIn(ExperimentalContextReceivers::class) - fun accept(visitor: KmClassVisitor) { + public fun accept(visitor: KmClassVisitor) { visitor.visit(flags, name) typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) } supertypes.forEach { visitor.visitSupertype(it.flags)?.let(it::accept) } @@ -231,7 +231,7 @@ class KmClass : KmClassVisitor(), KmDeclarationContainer { * Note that a package fragment does not contain any classes, as classes are not a part of file facades and have their own metadata. */ @Suppress("DEPRECATION") -class KmPackage : KmPackageVisitor(), KmDeclarationContainer { +public class KmPackage : KmPackageVisitor(), KmDeclarationContainer { /** * Functions in the package fragment. */ @@ -272,7 +272,7 @@ class KmPackage : KmPackageVisitor(), KmDeclarationContainer { * @param visitor the visitor which will visit data in this package fragment */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmPackageVisitor) { + public fun accept(visitor: KmPackageVisitor) { functions.forEach { visitor.visitFunction(it.flags, it.name)?.let(it::accept) } properties.forEach { visitor.visitProperty(it.flags, it.name, it.getter.flags, it.setterFlags)?.let(it::accept) } typeAliases.forEach { visitor.visitTypeAlias(it.flags, it.name)?.let(it::accept) } @@ -285,11 +285,11 @@ class KmPackage : KmPackageVisitor(), KmDeclarationContainer { * Represents a synthetic class generated for a Kotlin lambda. */ @Suppress("DEPRECATION") -class KmLambda : KmLambdaVisitor() { +public class KmLambda : KmLambdaVisitor() { /** * Signature of the synthetic anonymous function, representing the lambda. */ - lateinit var function: KmFunction + public lateinit var function: KmFunction @Deprecated(VISITOR_API_MESSAGE) override fun visitFunction(flags: Int, name: String): KmFunctionVisitor = @@ -301,7 +301,7 @@ class KmLambda : KmLambdaVisitor() { * @param visitor the visitor which will visit data in this lambda */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmLambdaVisitor) { + public fun accept(visitor: KmLambdaVisitor) { visitor.visitFunction(function.flags, function.name)?.let(function::accept) visitor.visitEnd() } @@ -314,21 +314,21 @@ class KmLambda : KmLambdaVisitor() { * such as [KmConstructor.visibility] or [KmConstructor.isSecondary]. */ @Suppress("DEPRECATION") -class KmConstructor @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmConstructor, such as KmConstructor.visibility") var flags: Int, +public class KmConstructor @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmConstructor, such as KmConstructor.visibility") public var flags: Int, ) : KmConstructorVisitor() { - constructor() : this(0) + public constructor() : this(0) /** * Value parameters of the constructor. */ - val valueParameters: MutableList = ArrayList() + public val valueParameters: MutableList = ArrayList() /** * Version requirements on the constructor. */ - val versionRequirements: MutableList = ArrayList(0) + public val versionRequirements: MutableList = ArrayList(0) private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createConstructorExtension) @@ -351,7 +351,7 @@ class KmConstructor @Deprecated(flagsCtorDeprecated) constructor( * @param visitor the visitor which will visit data in this class */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmConstructorVisitor) { + public fun accept(visitor: KmConstructorVisitor) { valueParameters.forEach { visitor.visitValueParameter(it.flags, it.name)?.let(it::accept) } versionRequirements.forEach { visitor.visitVersionRequirement()?.let(it::accept) } extensions.forEach { visitor.visitExtensions(it.type)?.let(it::accept) } @@ -368,49 +368,49 @@ class KmConstructor @Deprecated(flagsCtorDeprecated) constructor( * @property name the name of the function */ @Suppress("DEPRECATION") -class KmFunction @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmFunction, such as KmFunction.visibility") var flags: Int, - var name: String, +public class KmFunction @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmFunction, such as KmFunction.visibility") public var flags: Int, + public var name: String, ) : KmFunctionVisitor() { - constructor(name: String) : this(0, name) + public constructor(name: String) : this(0, name) /** * Type parameters of the function. */ - val typeParameters: MutableList = ArrayList(0) + public val typeParameters: MutableList = ArrayList(0) /** * Type of the receiver of the function, if this is an extension function. */ - var receiverParameterType: KmType? = null + public var receiverParameterType: KmType? = null /** * Types of context receivers of the function. */ @ExperimentalContextReceivers - val contextReceiverTypes: MutableList = ArrayList(0) + public val contextReceiverTypes: MutableList = ArrayList(0) /** * Value parameters of the function. */ - val valueParameters: MutableList = ArrayList() + public val valueParameters: MutableList = ArrayList() /** * Return type of the function. */ - lateinit var returnType: KmType + public lateinit var returnType: KmType /** * Version requirements on the function. */ - val versionRequirements: MutableList = ArrayList(0) + public val versionRequirements: MutableList = ArrayList(0) /** * Contract of the function. */ @ExperimentalContracts - var contract: KmContract? = null + public var contract: KmContract? = null private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createFunctionExtension) @@ -456,7 +456,7 @@ class KmFunction @Deprecated(flagsCtorDeprecated) constructor( */ @OptIn(ExperimentalContextReceivers::class) @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmFunctionVisitor) { + public fun accept(visitor: KmFunctionVisitor) { typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) } receiverParameterType?.let { visitor.visitReceiverParameterType(it.flags)?.let(it::accept) } contextReceiverTypes.forEach { visitor.visitContextReceiverType(it.flags)?.let(it::accept) } @@ -490,14 +490,14 @@ public class KmPropertyAccessorAttributes internal constructor(internal var flag * @property name the name of the property */ @Suppress("DEPRECATION") -class KmProperty @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmProperty, such as KmProperty.visibility") var flags: Int, - var name: String, +public class KmProperty @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmProperty, such as KmProperty.visibility") public var flags: Int, + public var name: String, getterFlags: Int, setterFlags: Int, ) : KmPropertyVisitor() { - constructor(name: String) : this(0, name, 0, 0) + public constructor(name: String) : this(0, name, 0, 0) /** * Attributes of the getter of this property. @@ -505,7 +505,7 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( * * Getter for property is always present, hence return type of this function is non-nullable. */ - val getter: KmPropertyAccessorAttributes = KmPropertyAccessorAttributes(getterFlags) + public val getter: KmPropertyAccessorAttributes = KmPropertyAccessorAttributes(getterFlags) /** * Attributes of the setter of this property. @@ -513,7 +513,7 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( * * Returns null if setter is absent, i.e. [KmProperty.isVar] is false. */ - var setter: KmPropertyAccessorAttributes? = if (this.hasSetter) KmPropertyAccessorAttributes(setterFlags) else null + public var setter: KmPropertyAccessorAttributes? = if (this.hasSetter) KmPropertyAccessorAttributes(setterFlags) else null set(new) { this.hasSetter = new != null field = new @@ -526,7 +526,7 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( * and [Flag.PropertyAccessor] flags. */ @Deprecated("$flagAccessPrefix KmProperty.getter, such as KmProperty.getter.isNotDefault") - var getterFlags: Int + public var getterFlags: Int get() = getter.flags set(value) { getter.flags = value @@ -547,7 +547,7 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( * This behavior is for compatibility only and will be removed in future versions. */ @Deprecated("$flagAccessPrefix KmProperty.setter, such as KmProperty.setter.isNotDefault") - var setterFlags: Int = getDefaultPropertyAccessorFlags(flags) + public var setterFlags: Int = getDefaultPropertyAccessorFlags(flags) get() = setter?.flags ?: field set(value) { setter?.flags = value @@ -557,18 +557,18 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( /** * Type parameters of the property. */ - val typeParameters: MutableList = ArrayList(0) + public val typeParameters: MutableList = ArrayList(0) /** * Type of the receiver of the property, if this is an extension property. */ - var receiverParameterType: KmType? = null + public var receiverParameterType: KmType? = null /** * Types of context receivers of the property. */ @ExperimentalContextReceivers - val contextReceiverTypes: MutableList = ArrayList(0) + public val contextReceiverTypes: MutableList = ArrayList(0) /** * Value parameter of the setter of this property, if this is a `var` property and parameter is present. @@ -581,17 +581,17 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( * } * ``` */ - var setterParameter: KmValueParameter? = null + public var setterParameter: KmValueParameter? = null /** * Type of the property. */ - lateinit var returnType: KmType + public lateinit var returnType: KmType /** * Version requirements on the property. */ - val versionRequirements: MutableList = ArrayList(0) + public val versionRequirements: MutableList = ArrayList(0) private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createPropertyExtension) @@ -632,7 +632,7 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( */ @OptIn(ExperimentalContextReceivers::class) @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmPropertyVisitor) { + public fun accept(visitor: KmPropertyVisitor) { typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) } receiverParameterType?.let { visitor.visitReceiverParameterType(it.flags)?.let(it::accept) } contextReceiverTypes.forEach { visitor.visitContextReceiverType(it.flags)?.let(it::accept) } @@ -653,38 +653,38 @@ class KmProperty @Deprecated(flagsCtorDeprecated) constructor( * @property name the name of the type alias */ @Suppress("DEPRECATION") -class KmTypeAlias @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmTypeAlias, such as KmTypeAlias.visibility") var flags: Int, - var name: String, +public class KmTypeAlias @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmTypeAlias, such as KmTypeAlias.visibility") public var flags: Int, + public var name: String, ) : KmTypeAliasVisitor() { - constructor(name: String) : this(0, name) + public constructor(name: String) : this(0, name) /** * Type parameters of the type alias. */ - val typeParameters: MutableList = ArrayList(0) + public val typeParameters: MutableList = ArrayList(0) /** * Underlying type of the type alias, i.e. the type in the right-hand side of the type alias declaration. */ - lateinit var underlyingType: KmType + public lateinit var underlyingType: KmType /** * Expanded type of the type alias, i.e. the full expansion of the underlying type, where all type aliases are substituted * with their expanded types. If no type aliases are used in the underlying type, the expanded type is equal to the underlying type. */ - lateinit var expandedType: KmType + public lateinit var expandedType: KmType /** * Annotations on the type alias. */ - val annotations: MutableList = ArrayList(0) + public val annotations: MutableList = ArrayList(0) /** * Version requirements on the type alias. */ - val versionRequirements: MutableList = ArrayList(0) + public val versionRequirements: MutableList = ArrayList(0) private val extensions: List = MetadataExtensions.INSTANCES.mapNotNull(MetadataExtensions::createTypeAliasExtension) @@ -720,7 +720,7 @@ class KmTypeAlias @Deprecated(flagsCtorDeprecated) constructor( * @param visitor the visitor which will visit data in this type alias */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmTypeAliasVisitor) { + public fun accept(visitor: KmTypeAliasVisitor) { typeParameters.forEach { visitor.visitTypeParameter(it.flags, it.name, it.id, it.variance)?.let(it::accept) } visitor.visitUnderlyingType(underlyingType.flags)?.let(underlyingType::accept) visitor.visitExpandedType(expandedType.flags)?.let(expandedType::accept) @@ -740,23 +740,23 @@ class KmTypeAlias @Deprecated(flagsCtorDeprecated) constructor( * @property name the name of the value parameter */ @Suppress("DEPRECATION") -class KmValueParameter @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmValueParameter, such as KmValueParameter.declaresDefaultValue") var flags: Int, - var name: String, +public class KmValueParameter @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmValueParameter, such as KmValueParameter.declaresDefaultValue") public var flags: Int, + public var name: String, ) : KmValueParameterVisitor() { - constructor(name: String) : this(0, name) + public constructor(name: String) : this(0, name) /** * Type of the value parameter. * If this is a `vararg` parameter of type `X`, returns the type `Array`. */ - lateinit var type: KmType + public lateinit var type: KmType /** * Type of the `vararg` value parameter, or `null` if this is not a `vararg` parameter. */ - var varargElementType: KmType? = null + public var varargElementType: KmType? = null private val extensions: List = MetadataExtensions.INSTANCES.mapNotNull(MetadataExtensions::createValueParameterExtension) @@ -779,7 +779,7 @@ class KmValueParameter @Deprecated(flagsCtorDeprecated) constructor( * @param visitor the visitor which will visit data in this value parameter */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmValueParameterVisitor) { + public fun accept(visitor: KmValueParameterVisitor) { visitor.visitType(type.flags)?.let(type::accept) varargElementType?.let { visitor.visitVarargElementType(it.flags)?.let(it::accept) } extensions.forEach { visitor.visitExtensions(it.type)?.let(it::accept) } @@ -799,19 +799,19 @@ class KmValueParameter @Deprecated(flagsCtorDeprecated) constructor( * @property variance the declaration-site variance of the type parameter */ @Suppress("DEPRECATION") -class KmTypeParameter @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmTypeParameter, such as KmTypeParameter.isReified") var flags: Int, - var name: String, - var id: Int, - var variance: KmVariance, +public class KmTypeParameter @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmTypeParameter, such as KmTypeParameter.isReified") public var flags: Int, + public var name: String, + public var id: Int, + public var variance: KmVariance, ) : KmTypeParameterVisitor() { - constructor(name: String, id: Int, variance: KmVariance) : this(0, name, id, variance) + public constructor(name: String, id: Int, variance: KmVariance) : this(0, name, id, variance) /** * Upper bounds of the type parameter. */ - val upperBounds: MutableList = ArrayList(1) + public val upperBounds: MutableList = ArrayList(1) private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createTypeParameterExtension) @@ -830,7 +830,7 @@ class KmTypeParameter @Deprecated(flagsCtorDeprecated) constructor( * @param visitor the visitor which will visit data in this type parameter */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmTypeParameterVisitor) { + public fun accept(visitor: KmTypeParameterVisitor) { upperBounds.forEach { visitor.visitUpperBound(it.flags)?.let(it::accept) } extensions.forEach { visitor.visitExtensions(it.type)?.let(it::accept) } visitor.visitEnd() @@ -844,21 +844,21 @@ class KmTypeParameter @Deprecated(flagsCtorDeprecated) constructor( * such as [KmType.isNullable]. */ @Suppress("DEPRECATION") -class KmType @Deprecated(flagsCtorDeprecated) constructor( - @Deprecated("$flagAccessPrefix KmType, such as KmType.isNullable") var flags: Int +public class KmType @Deprecated(flagsCtorDeprecated) constructor( + @Deprecated("$flagAccessPrefix KmType, such as KmType.isNullable") public var flags: Int ) : KmTypeVisitor() { - constructor() : this(0) + public constructor() : this(0) /** * Classifier of the type. */ - lateinit var classifier: KmClassifier + public lateinit var classifier: KmClassifier /** * Arguments of the type, if the type's classifier is a class or a type alias. */ - val arguments: MutableList = ArrayList(0) + public val arguments: MutableList = ArrayList(0) /** * Abbreviation of this type. Note that all types are expanded for metadata produced by the Kotlin compiler. For example: @@ -869,7 +869,7 @@ class KmType @Deprecated(flagsCtorDeprecated) constructor( * * The type of the `foo`'s parameter in the metadata is actually `MutableList`, and its abbreviation is `A`. */ - var abbreviatedType: KmType? = null + public var abbreviatedType: KmType? = null /** * Outer type of this type, if this type's classifier is an inner class. For example: @@ -881,14 +881,14 @@ class KmType @Deprecated(flagsCtorDeprecated) constructor( * The type of the `foo`'s parameter in the metadata is `B` (a type whose classifier is class `B`, and it has one type argument, * type `Byte?`), and its outer type is `A<*>` (a type whose classifier is class `A`, and it has one type argument, star projection). */ - var outerType: KmType? = null + public var outerType: KmType? = null /** * Upper bound of this type, if this type is flexible. In that case, all other data refers to the lower bound of the type. * * Flexible types in Kotlin include platform types in Kotlin/JVM and `dynamic` type in Kotlin/JS. */ - var flexibleTypeUpperBound: KmFlexibleTypeUpperBound? = null + public var flexibleTypeUpperBound: KmFlexibleTypeUpperBound? = null private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createTypeExtension) @@ -940,7 +940,7 @@ class KmType @Deprecated(flagsCtorDeprecated) constructor( * @throws IllegalArgumentException if type metadata is inconsistent */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmTypeVisitor) { + public fun accept(visitor: KmTypeVisitor) { when (val classifier = classifier) { is KmClassifier.Class -> visitor.visitClass(classifier.name) is KmClassifier.TypeParameter -> visitor.visitTypeParameter(classifier.id) @@ -970,31 +970,31 @@ class KmType @Deprecated(flagsCtorDeprecated) constructor( * enabled, for example, with the internal [kotlin.internal.RequireKotlin] annotation. */ @Suppress("DEPRECATION") -class KmVersionRequirement : KmVersionRequirementVisitor() { +public class KmVersionRequirement : KmVersionRequirementVisitor() { /** * Kind of the version that this declaration requires. */ - lateinit var kind: KmVersionRequirementVersionKind + public lateinit var kind: KmVersionRequirementVersionKind /** * Level of the diagnostic that must be reported on the usages of the declaration in case the version requirement is not satisfied. */ - lateinit var level: KmVersionRequirementLevel + public lateinit var level: KmVersionRequirementLevel /** * Optional error code to be displayed in the diagnostic. */ - var errorCode: Int? = null + public var errorCode: Int? = null /** * Optional message to be displayed in the diagnostic. */ - var message: String? = null + public var message: String? = null /** * Version required by this requirement. */ - lateinit var version: KmVersion + public lateinit var version: KmVersion @Deprecated(VISITOR_API_MESSAGE) override fun visit(kind: KmVersionRequirementVersionKind, level: KmVersionRequirementLevel, errorCode: Int?, message: String?) { @@ -1015,7 +1015,7 @@ class KmVersionRequirement : KmVersionRequirementVisitor() { * @param visitor the visitor which will visit data in this version requirement */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmVersionRequirementVisitor) { + public fun accept(visitor: KmVersionRequirementVisitor) { visitor.visit(kind, level, errorCode, message) visitor.visitVersion(version.major, version.minor, version.patch) visitor.visitEnd() @@ -1030,11 +1030,11 @@ class KmVersionRequirement : KmVersionRequirementVisitor() { */ @ExperimentalContracts @Suppress("DEPRECATION") -class KmContract : KmContractVisitor() { +public class KmContract : KmContractVisitor() { /** * Effects of this contract. */ - val effects: MutableList = ArrayList(1) + public val effects: MutableList = ArrayList(1) @Deprecated(VISITOR_API_MESSAGE) override fun visitEffect(type: KmEffectType, invocationKind: KmEffectInvocationKind?): KmEffectVisitor = @@ -1046,7 +1046,7 @@ class KmContract : KmContractVisitor() { * @param visitor the visitor which will visit data in this contract */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmContractVisitor) { + public fun accept(visitor: KmContractVisitor) { effects.forEach { visitor.visitEffect(it.type, it.invocationKind)?.let(it::accept) } visitor.visitEnd() } @@ -1064,20 +1064,20 @@ class KmContract : KmContractVisitor() { */ @ExperimentalContracts @Suppress("DEPRECATION") -class KmEffect( - var type: KmEffectType, - var invocationKind: KmEffectInvocationKind? +public class KmEffect( + public var type: KmEffectType, + public var invocationKind: KmEffectInvocationKind? ) : KmEffectVisitor() { /** * Arguments of the effect constructor, i.e. the constant value for the [KmEffectType.RETURNS_CONSTANT] effect, * or the parameter reference for the [KmEffectType.CALLS] effect. */ - val constructorArguments: MutableList = ArrayList(1) + public val constructorArguments: MutableList = ArrayList(1) /** * Conclusion of the effect. If this value is set, the effect represents an implication with this value as the right-hand side. */ - var conclusion: KmEffectExpression? = null + public var conclusion: KmEffectExpression? = null @Deprecated(VISITOR_API_MESSAGE) override fun visitConstructorArgument(): KmEffectExpressionVisitor = @@ -1093,7 +1093,7 @@ class KmEffect( * @param visitor the visitor which will visit data in this effect */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmEffectVisitor) { + public fun accept(visitor: KmEffectVisitor) { constructorArguments.forEach { visitor.visitConstructorArgument()?.let(it::accept) } conclusion?.let { visitor.visitConclusionOfConditionalEffect()?.let(it::accept) } visitor.visitEnd() @@ -1111,40 +1111,40 @@ class KmEffect( */ @ExperimentalContracts @Suppress("DEPRECATION") -class KmEffectExpression : KmEffectExpressionVisitor() { +public class KmEffectExpression : KmEffectExpressionVisitor() { /** * Effect expression flags, consisting of [Flag.EffectExpression] flags. */ @Deprecated("$flagAccessPrefix KmEffectExpression, such as KmEffectExpression.isNegated") - var flags: Int = flagsOf() + public var flags: Int = flagsOf() /** * Optional 1-based index of the value parameter of the function, for effects which assert something about * the function parameters. Index 0 means the extension receiver parameter. */ - var parameterIndex: Int? = null + public var parameterIndex: Int? = null /** * Constant value used in the effect expression. */ - var constantValue: KmConstantValue? = null + public var constantValue: KmConstantValue? = null /** * Type used as the target of an `is`-expression in the effect expression. */ - var isInstanceType: KmType? = null + public var isInstanceType: KmType? = null /** * Arguments of an `&&`-expression. If this list is non-empty, the resulting effect expression is a conjunction of this expression * and elements of the list. */ - val andArguments: MutableList = ArrayList(0) + public val andArguments: MutableList = ArrayList(0) /** * Arguments of an `||`-expression. If this list is non-empty, the resulting effect expression is a disjunction of this expression * and elements of the list. */ - val orArguments: MutableList = ArrayList(0) + public val orArguments: MutableList = ArrayList(0) @Deprecated(VISITOR_API_MESSAGE) override fun visit(flags: Int, parameterIndex: Int?) { @@ -1175,7 +1175,7 @@ class KmEffectExpression : KmEffectExpressionVisitor() { * @param visitor the visitor which will visit data in this effect expression */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmEffectExpressionVisitor) { + public fun accept(visitor: KmEffectExpressionVisitor) { visitor.visit(flags, parameterIndex) constantValue?.let { visitor.visitConstantValue(it.value) } isInstanceType?.let { visitor.visitIsInstanceType(it.flags)?.let(it::accept) } @@ -1189,20 +1189,20 @@ class KmEffectExpression : KmEffectExpressionVisitor() { * Represents a classifier of a Kotlin type. A classifier is a class, type parameter, or type alias. * For example, in `MutableMap`, `MutableMap` is the classifier. */ -sealed class KmClassifier { +public sealed class KmClassifier { /** * Represents a class used as a classifier in a type. * * @property name the name of the class */ - data class Class(val name: ClassName) : KmClassifier() + public data class Class(val name: ClassName) : KmClassifier() /** * Represents a type parameter used as a classifier in a type. * * @property id id of the type parameter */ - data class TypeParameter(val id: Int) : KmClassifier() + public data class TypeParameter(val id: Int) : KmClassifier() /** * Represents a type alias used as a classifier in a type. Note that all types are expanded for metadata produced @@ -1210,7 +1210,7 @@ sealed class KmClassifier { * * @property name the name of the type alias */ - data class TypeAlias(val name: ClassName) : KmClassifier() + public data class TypeAlias(val name: ClassName) : KmClassifier() } /** @@ -1220,17 +1220,17 @@ sealed class KmClassifier { * @property variance the variance of the type projection, or `null` if this is a star projection * @property type the projected type, or `null` if this is a star projection */ -data class KmTypeProjection(var variance: KmVariance?, var type: KmType?) { +public data class KmTypeProjection(var variance: KmVariance?, var type: KmType?) { /** * Contains default instance for star projection: [KmTypeProjection.STAR]. */ - companion object { + public companion object { /** * Star projection (`*`). * For example, in `MutableMap`, `*` is the star projection which is the second type argument of the type. */ @JvmField - val STAR = KmTypeProjection(null, null) + public val STAR: KmTypeProjection = KmTypeProjection(null, null) } } @@ -1241,7 +1241,7 @@ data class KmTypeProjection(var variance: KmVariance?, var type: KmType?) { * @property typeFlexibilityId id of the kind of flexibility this type has. For example, "kotlin.jvm.PlatformType" for JVM platform types, * or "kotlin.DynamicType" for JS dynamic type */ -data class KmFlexibleTypeUpperBound(var type: KmType, var typeFlexibilityId: String?) +public data class KmFlexibleTypeUpperBound(var type: KmType, var typeFlexibilityId: String?) /** * Represents a version used in a version requirement. @@ -1250,7 +1250,7 @@ data class KmFlexibleTypeUpperBound(var type: KmType, var typeFlexibilityId: Str * @property minor the minor component of the version (e.g. "2" in "1.2.3") * @property patch the patch component of the version (e.g. "3" in "1.2.3") */ -data class KmVersion(val major: Int, val minor: Int, val patch: Int) { +public data class KmVersion(val major: Int, val minor: Int, val patch: Int) { /** * Returns a string representation of this version in "$major.$minor.$patch" form. @@ -1267,7 +1267,7 @@ data class KmVersion(val major: Int, val minor: Int, val patch: Int) { * @property value the constant value. May be `true`, `false` or `null` */ @ExperimentalContracts -data class KmConstantValue(val value: Any?) +public data class KmConstantValue(val value: Any?) internal fun T.addTo(collection: MutableCollection): T { collection.add(this) diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/OptInMarkers.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/OptInMarkers.kt index 539baa074db..9575b400b41 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/OptInMarkers.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/OptInMarkers.kt @@ -16,4 +16,4 @@ package kotlinx.metadata RequiresOptIn.Level.ERROR ) @MustBeDocumented -annotation class ExperimentalContextReceivers +public annotation class ExperimentalContextReceivers diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/Visitors.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/Visitors.kt index 2977a0af26e..289f77ba417 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/Visitors.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/Visitors.kt @@ -15,14 +15,14 @@ internal const val VISITOR_API_MESSAGE = */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected open val delegate: KmDeclarationContainerVisitor? = null) { +public abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected open val delegate: KmDeclarationContainerVisitor? = null) { /** * Visits a function in the container. * * @param flags function flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag, modality flag and [Flag.Function] flags * @param name the name of the function */ - open fun visitFunction(flags: Int, name: String): KmFunctionVisitor? = + public open fun visitFunction(flags: Int, name: String): KmFunctionVisitor? = delegate?.visitFunction(flags, name) /** @@ -35,7 +35,7 @@ abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected * @param setterFlags property accessor flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag, modality flag * and [Flag.PropertyAccessor] flags */ - open fun visitProperty(flags: Int, name: String, getterFlags: Int, setterFlags: Int): KmPropertyVisitor? = + public open fun visitProperty(flags: Int, name: String, getterFlags: Int, setterFlags: Int): KmPropertyVisitor? = delegate?.visitProperty(flags, name, getterFlags, setterFlags) /** @@ -44,7 +44,7 @@ abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected * @param flags type alias flags, consisting of [Flag.HAS_ANNOTATIONS] and visibility flag * @param name the name of the type alias */ - open fun visitTypeAlias(flags: Int, name: String): KmTypeAliasVisitor? = + public open fun visitTypeAlias(flags: Int, name: String): KmTypeAliasVisitor? = delegate?.visitTypeAlias(flags, name) /** @@ -52,7 +52,7 @@ abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected * * @param type the type of extension visitor to be returned */ - abstract fun visitExtensions(type: KmExtensionType): KmDeclarationContainerExtensionVisitor? + public abstract fun visitExtensions(type: KmExtensionType): KmDeclarationContainerExtensionVisitor? } /** @@ -63,7 +63,7 @@ abstract class KmDeclarationContainerVisitor @JvmOverloads constructor(protected */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor? = null) : KmDeclarationContainerVisitor(delegate) { +public abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor? = null) : KmDeclarationContainerVisitor(delegate) { override val delegate: KmClassVisitor? get() = super.delegate as KmClassVisitor? @@ -73,7 +73,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * @param flags class flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag, modality flag and [Flag.Class] flags * @param name the name of the class */ - open fun visit(flags: Int, name: ClassName) { + public open fun visit(flags: Int, name: ClassName) { delegate?.visit(flags, name) } @@ -86,7 +86,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * the name isn't enough (e.g. `class A { fun foo(t: T) }`) * @param variance the declaration-site variance of the type parameter */ - open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = + public open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = delegate?.visitTypeParameter(flags, name, id, variance) /** @@ -94,7 +94,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitSupertype(flags: Int): KmTypeVisitor? = + public open fun visitSupertype(flags: Int): KmTypeVisitor? = delegate?.visitSupertype(flags) /** @@ -102,7 +102,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param flags constructor flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag and [Flag.Constructor] flags */ - open fun visitConstructor(flags: Int): KmConstructorVisitor? = + public open fun visitConstructor(flags: Int): KmConstructorVisitor? = delegate?.visitConstructor(flags) /** @@ -110,7 +110,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param name the name of the companion object */ - open fun visitCompanionObject(name: String) { + public open fun visitCompanionObject(name: String) { delegate?.visitCompanionObject(name) } @@ -119,7 +119,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param name the name of a nested class */ - open fun visitNestedClass(name: String) { + public open fun visitNestedClass(name: String) { delegate?.visitNestedClass(name) } @@ -128,7 +128,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param name the name of an enum entry */ - open fun visitEnumEntry(name: String) { + public open fun visitEnumEntry(name: String) { delegate?.visitEnumEntry(name) } @@ -137,7 +137,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param name the name of a direct subclass */ - open fun visitSealedSubclass(name: ClassName) { + public open fun visitSealedSubclass(name: ClassName) { delegate?.visitSealedSubclass(name) } @@ -146,7 +146,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param name the name of the underlying property. */ - open fun visitInlineClassUnderlyingPropertyName(name: String) { + public open fun visitInlineClassUnderlyingPropertyName(name: String) { delegate?.visitInlineClassUnderlyingPropertyName(name) } @@ -155,7 +155,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitInlineClassUnderlyingType(flags: Int): KmTypeVisitor? = + public open fun visitInlineClassUnderlyingType(flags: Int): KmTypeVisitor? = delegate?.visitInlineClassUnderlyingType(flags) /** @@ -164,13 +164,13 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor * @param flags type flags, consisting of [Flag.Type] flags */ @ExperimentalContextReceivers - open fun visitContextReceiverType(flags: Int): KmTypeVisitor? = + public open fun visitContextReceiverType(flags: Int): KmTypeVisitor? = delegate?.visitContextReceiverType(flags) /** * Visits the version requirement on this class. */ - open fun visitVersionRequirement(): KmVersionRequirementVisitor? = + public open fun visitVersionRequirement(): KmVersionRequirementVisitor? = delegate?.visitVersionRequirement() /** @@ -184,7 +184,7 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor /** * Visits the end of the class. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -196,7 +196,8 @@ abstract class KmClassVisitor @JvmOverloads constructor(delegate: KmClassVisitor */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVisitor? = null) : KmDeclarationContainerVisitor(delegate) { +public abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVisitor? = null) : + KmDeclarationContainerVisitor(delegate) { override val delegate: KmPackageVisitor? get() = super.delegate as KmPackageVisitor? @@ -211,7 +212,7 @@ abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVis /** * Visits the end of the package fragment. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -223,20 +224,20 @@ abstract class KmPackageVisitor @JvmOverloads constructor(delegate: KmPackageVis */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmLambdaVisitor @JvmOverloads constructor(private val delegate: KmLambdaVisitor? = null) { +public abstract class KmLambdaVisitor @JvmOverloads constructor(private val delegate: KmLambdaVisitor? = null) { /** * Visits the signature of a synthetic anonymous function, representing the lambda. * * @param flags function flags, consisting of [Flag.HAS_ANNOTATIONS], visibility flag, modality flag and [Flag.Function] flags * @param name the name of the function (usually `""` or `""` for lambdas emitted by the Kotlin compiler) */ - open fun visitFunction(flags: Int, name: String): KmFunctionVisitor? = + public open fun visitFunction(flags: Int, name: String): KmFunctionVisitor? = delegate?.visitFunction(flags, name) /** * Visits the end of the lambda. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -248,20 +249,20 @@ abstract class KmLambdaVisitor @JvmOverloads constructor(private val delegate: K */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmConstructorVisitor @JvmOverloads constructor(private val delegate: KmConstructorVisitor? = null) { +public abstract class KmConstructorVisitor @JvmOverloads constructor(private val delegate: KmConstructorVisitor? = null) { /** * Visits a value parameter of the constructor. * * @param flags value parameter flags, consisting of [Flag.ValueParameter] flags * @param name the name of the value parameter */ - open fun visitValueParameter(flags: Int, name: String): KmValueParameterVisitor? = + public open fun visitValueParameter(flags: Int, name: String): KmValueParameterVisitor? = delegate?.visitValueParameter(flags, name) /** * Visits the version requirement on this constructor. */ - open fun visitVersionRequirement(): KmVersionRequirementVisitor? = + public open fun visitVersionRequirement(): KmVersionRequirementVisitor? = delegate?.visitVersionRequirement() /** @@ -269,13 +270,13 @@ abstract class KmConstructorVisitor @JvmOverloads constructor(private val delega * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmConstructorExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmConstructorExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the constructor. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -288,7 +289,7 @@ abstract class KmConstructorVisitor @JvmOverloads constructor(private val delega */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: KmFunctionVisitor? = null) { +public abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: KmFunctionVisitor? = null) { /** * Visits a type parameter of the function. * @@ -298,24 +299,24 @@ abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: * the name isn't enough (e.g. `class A { fun foo(t: T) }`) * @param variance the declaration-site variance of the type parameter */ - open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = + public open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = delegate?.visitTypeParameter(flags, name, id, variance) /** - * Visits the type of the receiver of the function, if this is an extension function. + * Visits the type of the receiver of the function if this is an extension function. * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitReceiverParameterType(flags: Int): KmTypeVisitor? = + public open fun visitReceiverParameterType(flags: Int): KmTypeVisitor? = delegate?.visitReceiverParameterType(flags) /** - * Visits the type of a context receiver of the function. + * Visits the type of the context receiver of the function. * * @param flags type flags, consisting of [Flag.Type] flags */ @ExperimentalContextReceivers - open fun visitContextReceiverType(flags: Int): KmTypeVisitor? = + public open fun visitContextReceiverType(flags: Int): KmTypeVisitor? = delegate?.visitContextReceiverType(flags) /** @@ -324,7 +325,7 @@ abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: * @param flags value parameter flags, consisting of [Flag.ValueParameter] flags * @param name the name of the value parameter */ - open fun visitValueParameter(flags: Int, name: String): KmValueParameterVisitor? = + public open fun visitValueParameter(flags: Int, name: String): KmValueParameterVisitor? = delegate?.visitValueParameter(flags, name) /** @@ -332,20 +333,20 @@ abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitReturnType(flags: Int): KmTypeVisitor? = + public open fun visitReturnType(flags: Int): KmTypeVisitor? = delegate?.visitReturnType(flags) /** * Visits the version requirement on this function. */ - open fun visitVersionRequirement(): KmVersionRequirementVisitor? = + public open fun visitVersionRequirement(): KmVersionRequirementVisitor? = delegate?.visitVersionRequirement() /** * Visits the contract of the function. */ @ExperimentalContracts - open fun visitContract(): KmContractVisitor? = + public open fun visitContract(): KmContractVisitor? = delegate?.visitContract() /** @@ -353,13 +354,13 @@ abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmFunctionExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmFunctionExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the function. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -372,7 +373,7 @@ abstract class KmFunctionVisitor @JvmOverloads constructor(private val delegate: */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: KmPropertyVisitor? = null) { +public abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: KmPropertyVisitor? = null) { /** * Visits a type parameter of the property. * @@ -382,15 +383,15 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: * the name isn't enough (e.g. `class A { fun foo(t: T) }`) * @param variance the declaration-site variance of the type parameter */ - open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = + public open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = delegate?.visitTypeParameter(flags, name, id, variance) /** - * Visits the type of the receiver of the property, if this is an extension property. + * Visits the type of the receiver of the property if this is an extension property. * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitReceiverParameterType(flags: Int): KmTypeVisitor? = + public open fun visitReceiverParameterType(flags: Int): KmTypeVisitor? = delegate?.visitReceiverParameterType(flags) /** @@ -399,7 +400,7 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: * @param flags type flags, consisting of [Flag.Type] flags */ @ExperimentalContextReceivers - open fun visitContextReceiverType(flags: Int): KmTypeVisitor? = + public open fun visitContextReceiverType(flags: Int): KmTypeVisitor? = delegate?.visitContextReceiverType(flags) /** @@ -408,7 +409,7 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: * @param flags value parameter flags, consisting of [Flag.ValueParameter] flags * @param name the name of the value parameter (`""` for properties emitted by the Kotlin compiler) */ - open fun visitSetterParameter(flags: Int, name: String): KmValueParameterVisitor? = + public open fun visitSetterParameter(flags: Int, name: String): KmValueParameterVisitor? = delegate?.visitSetterParameter(flags, name) /** @@ -416,13 +417,13 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitReturnType(flags: Int): KmTypeVisitor? = + public open fun visitReturnType(flags: Int): KmTypeVisitor? = delegate?.visitReturnType(flags) /** * Visits the version requirement on this property. */ - open fun visitVersionRequirement(): KmVersionRequirementVisitor? = + public open fun visitVersionRequirement(): KmVersionRequirementVisitor? = delegate?.visitVersionRequirement() /** @@ -430,13 +431,13 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmPropertyExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmPropertyExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the property. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -449,7 +450,7 @@ abstract class KmPropertyVisitor @JvmOverloads constructor(private val delegate: */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate: KmTypeAliasVisitor? = null) { +public abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate: KmTypeAliasVisitor? = null) { /** * Visits a type parameter of the type alias. * @@ -459,7 +460,7 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate * the name isn't enough (e.g. `class A { fun foo(t: T) }`) * @param variance the declaration-site variance of the type parameter */ - open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = + public open fun visitTypeParameter(flags: Int, name: String, id: Int, variance: KmVariance): KmTypeParameterVisitor? = delegate?.visitTypeParameter(flags, name, id, variance) /** @@ -467,7 +468,7 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitUnderlyingType(flags: Int): KmTypeVisitor? = + public open fun visitUnderlyingType(flags: Int): KmTypeVisitor? = delegate?.visitUnderlyingType(flags) /** @@ -476,7 +477,7 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitExpandedType(flags: Int): KmTypeVisitor? = + public open fun visitExpandedType(flags: Int): KmTypeVisitor? = delegate?.visitExpandedType(flags) /** @@ -484,14 +485,14 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate * * @param annotation annotation on the type alias */ - open fun visitAnnotation(annotation: KmAnnotation) { + public open fun visitAnnotation(annotation: KmAnnotation) { delegate?.visitAnnotation(annotation) } /** * Visits the version requirement on this type alias. */ - open fun visitVersionRequirement(): KmVersionRequirementVisitor? = + public open fun visitVersionRequirement(): KmVersionRequirementVisitor? = delegate?.visitVersionRequirement() /** @@ -499,13 +500,13 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmTypeAliasExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmTypeAliasExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the type alias. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -518,13 +519,13 @@ abstract class KmTypeAliasVisitor @JvmOverloads constructor(private val delegate */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmValueParameterVisitor @JvmOverloads constructor(private val delegate: KmValueParameterVisitor? = null) { +public abstract class KmValueParameterVisitor @JvmOverloads constructor(private val delegate: KmValueParameterVisitor? = null) { /** * Visits the type of the value parameter, if this is **not** a `vararg` parameter. * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitType(flags: Int): KmTypeVisitor? = + public open fun visitType(flags: Int): KmTypeVisitor? = delegate?.visitType(flags) /** @@ -532,7 +533,7 @@ abstract class KmValueParameterVisitor @JvmOverloads constructor(private val del * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitVarargElementType(flags: Int): KmTypeVisitor? = + public open fun visitVarargElementType(flags: Int): KmTypeVisitor? = delegate?.visitVarargElementType(flags) /** @@ -540,13 +541,13 @@ abstract class KmValueParameterVisitor @JvmOverloads constructor(private val del * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmValueParameterExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmValueParameterExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the value parameter. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -558,13 +559,13 @@ abstract class KmValueParameterVisitor @JvmOverloads constructor(private val del */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val delegate: KmTypeParameterVisitor? = null) { +public abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val delegate: KmTypeParameterVisitor? = null) { /** * Visits the upper bound of the type parameter. * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitUpperBound(flags: Int): KmTypeVisitor? = + public open fun visitUpperBound(flags: Int): KmTypeVisitor? = delegate?.visitUpperBound(flags) /** @@ -572,13 +573,13 @@ abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val dele * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmTypeParameterExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmTypeParameterExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the type parameter. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -596,13 +597,13 @@ abstract class KmTypeParameterVisitor @JvmOverloads constructor(private val dele */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmTypeVisitor? = null) { +public abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmTypeVisitor? = null) { /** * Visits the name of the class, if this type's classifier is a class. * * @param name the name of the class */ - open fun visitClass(name: ClassName) { + public open fun visitClass(name: ClassName) { delegate?.visitClass(name) } @@ -612,7 +613,7 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * * @param name the name of the type alias */ - open fun visitTypeAlias(name: ClassName) { + public open fun visitTypeAlias(name: ClassName) { delegate?.visitTypeAlias(name) } @@ -621,7 +622,7 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * * @param id id of the type parameter */ - open fun visitTypeParameter(id: Int) { + public open fun visitTypeParameter(id: Int) { delegate?.visitTypeParameter(id) } @@ -632,14 +633,14 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * @param flags type flags, consisting of [Flag.Type] flags * @param variance the variance of the type projection */ - open fun visitArgument(flags: Int, variance: KmVariance): KmTypeVisitor? = + public open fun visitArgument(flags: Int, variance: KmVariance): KmTypeVisitor? = delegate?.visitArgument(flags, variance) /** * Visits the star (`*`) projection used in a type argument of the type based on a class or on a type alias. * For example, in `MutableMap`, `*` is the star projection which is the second type argument of the type. */ - open fun visitStarProjection() { + public open fun visitStarProjection() { delegate?.visitStarProjection() } @@ -654,7 +655,7 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitAbbreviatedType(flags: Int): KmTypeVisitor? = + public open fun visitAbbreviatedType(flags: Int): KmTypeVisitor? = delegate?.visitAbbreviatedType(flags) /** @@ -669,7 +670,7 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitOuterType(flags: Int): KmTypeVisitor? = + public open fun visitOuterType(flags: Int): KmTypeVisitor? = delegate?.visitOuterType(flags) /** @@ -680,7 +681,7 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * @param typeFlexibilityId id of the kind of flexibility this type has. For example, "kotlin.jvm.PlatformType" for JVM platform types, * or "kotlin.DynamicType" for JS dynamic type */ - open fun visitFlexibleTypeUpperBound(flags: Int, typeFlexibilityId: String?): KmTypeVisitor? = + public open fun visitFlexibleTypeUpperBound(flags: Int, typeFlexibilityId: String?): KmTypeVisitor? = delegate?.visitFlexibleTypeUpperBound(flags, typeFlexibilityId) /** @@ -688,13 +689,13 @@ abstract class KmTypeVisitor @JvmOverloads constructor(private val delegate: KmT * * @param type the type of extension visitor to be returned */ - open fun visitExtensions(type: KmExtensionType): KmTypeExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmTypeExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the type. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -708,7 +709,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]. */ @Deprecated(VISITOR_API_MESSAGE) -abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress("DEPRECATION") private val delegate: KmVersionRequirementVisitor? = null) { +public abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress("DEPRECATION") private val delegate: KmVersionRequirementVisitor? = null) { /** * Visits the description of this version requirement. * @@ -718,7 +719,7 @@ abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress(" * @param errorCode optional error code to be displayed in the diagnostic * @param message optional message to be displayed in the diagnostic */ - open fun visit(kind: KmVersionRequirementVersionKind, level: KmVersionRequirementLevel, errorCode: Int?, message: String?) { + public open fun visit(kind: KmVersionRequirementVersionKind, level: KmVersionRequirementLevel, errorCode: Int?, message: String?) { delegate?.visit(kind, level, errorCode, message) } @@ -729,14 +730,14 @@ abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress(" * @param minor the minor component of the version (e.g. "2" in "1.2.3") * @param patch the patch component of the version (e.g. "3" in "1.2.3") */ - open fun visitVersion(major: Int, minor: Int, patch: Int) { + public open fun visitVersion(major: Int, minor: Int, patch: Int) { delegate?.visitVersion(major, minor, patch) } /** * Visits the end of the version requirement. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -752,7 +753,7 @@ abstract class KmVersionRequirementVisitor @JvmOverloads constructor(@Suppress(" @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") @ExperimentalContracts -abstract class KmContractVisitor @JvmOverloads constructor(private val delegate: KmContractVisitor? = null) { +public abstract class KmContractVisitor @JvmOverloads constructor(private val delegate: KmContractVisitor? = null) { /** * Visits an effect of this contract. * @@ -760,13 +761,13 @@ abstract class KmContractVisitor @JvmOverloads constructor(private val delegate: * @param invocationKind optional number of invocations of the lambda parameter of this function, * specified further in the effect expression */ - open fun visitEffect(type: KmEffectType, invocationKind: KmEffectInvocationKind?): KmEffectVisitor? = + public open fun visitEffect(type: KmEffectType, invocationKind: KmEffectInvocationKind?): KmEffectVisitor? = delegate?.visitEffect(type, invocationKind) /** * Visits the end of the contract. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -783,25 +784,25 @@ abstract class KmContractVisitor @JvmOverloads constructor(private val delegate: @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") @ExperimentalContracts -abstract class KmEffectVisitor @JvmOverloads constructor(private val delegate: KmEffectVisitor? = null) { +public abstract class KmEffectVisitor @JvmOverloads constructor(private val delegate: KmEffectVisitor? = null) { /** * Visits the optional argument of the effect constructor, i.e. the constant value for the [KmEffectType.RETURNS_CONSTANT] effect, * or the parameter reference for the [KmEffectType.CALLS] effect. */ - open fun visitConstructorArgument(): KmEffectExpressionVisitor? = + public open fun visitConstructorArgument(): KmEffectExpressionVisitor? = delegate?.visitConstructorArgument() /** * Visits the optional conclusion of the effect. If this method is called, the effect represents an implication with the * right-hand side handled by the returned visitor. */ - open fun visitConclusionOfConditionalEffect(): KmEffectExpressionVisitor? = + public open fun visitConclusionOfConditionalEffect(): KmEffectExpressionVisitor? = delegate?.visitConclusionOfConditionalEffect() /** * Visits the end of the effect. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -817,7 +818,7 @@ abstract class KmEffectVisitor @JvmOverloads constructor(private val delegate: K @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") @ExperimentalContracts -abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val delegate: KmEffectExpressionVisitor? = null) { +public abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val delegate: KmEffectExpressionVisitor? = null) { /** * Visits the basic information of the effect expression. * @@ -825,7 +826,7 @@ abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val d * @param parameterIndex optional 1-based index of the value parameter of the function, for effects which assert something about * the function parameters. The index 0 means the extension receiver parameter */ - open fun visit(flags: Int, parameterIndex: Int?) { + public open fun visit(flags: Int, parameterIndex: Int?) { delegate?.visit(flags, parameterIndex) } @@ -834,7 +835,7 @@ abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val d * * @param value the constant value */ - open fun visitConstantValue(value: Any?) { + public open fun visitConstantValue(value: Any?) { delegate?.visitConstantValue(value) } @@ -843,27 +844,27 @@ abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val d * * @param flags type flags, consisting of [Flag.Type] flags */ - open fun visitIsInstanceType(flags: Int): KmTypeVisitor? = + public open fun visitIsInstanceType(flags: Int): KmTypeVisitor? = delegate?.visitIsInstanceType(flags) /** * Visits the argument of an `&&`-expression. If this method is called, the expression represents the left-hand side and * the returned visitor handles the right-hand side. */ - open fun visitAndArgument(): KmEffectExpressionVisitor? = + public open fun visitAndArgument(): KmEffectExpressionVisitor? = delegate?.visitAndArgument() /** * Visits the argument of an `||`-expression. If this method is called, the expression represents the left-hand side and * the returned visitor handles the right-hand side. */ - open fun visitOrArgument(): KmEffectExpressionVisitor? = + public open fun visitOrArgument(): KmEffectExpressionVisitor? = delegate?.visitOrArgument() /** * Visits the end of the effect expression. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -872,7 +873,7 @@ abstract class KmEffectExpressionVisitor @JvmOverloads constructor(private val d * Variance applied to a type parameter on the declaration site (*declaration-site variance*), * or to a type in a projection (*use-site variance*). */ -enum class KmVariance { +public enum class KmVariance { /** * The affected type parameter or type is *invariant*, which means it has no variance applied to it. */ @@ -896,7 +897,7 @@ enum class KmVariance { * may change in a subsequent release. */ @ExperimentalContracts -enum class KmEffectType { +public enum class KmEffectType { /** * Represents `returns(value)` contract effect: * a situation when a function returns normally with the specified return value. @@ -927,7 +928,7 @@ enum class KmEffectType { * may change in a subsequent release. */ @ExperimentalContracts -enum class KmEffectInvocationKind { +public enum class KmEffectInvocationKind { /** * A function parameter will be invoked one time or not invoked at all. */ @@ -947,7 +948,7 @@ enum class KmEffectInvocationKind { /** * Severity of the diagnostic reported by the compiler when a version requirement is not satisfied. */ -enum class KmVersionRequirementLevel { +public enum class KmVersionRequirementLevel { /** * Represents a diagnostic with 'WARNING' severity. */ @@ -967,7 +968,7 @@ enum class KmVersionRequirementLevel { /** * The kind of the version that is required by a version requirement. */ -enum class KmVersionRequirementVersionKind { +public enum class KmVersionRequirementVersionKind { /** * Indicates that certain language version is required. */ diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagDelegatesImpl.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagDelegatesImpl.kt index 7c53b11cd03..8e59e930436 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagDelegatesImpl.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagDelegatesImpl.kt @@ -39,9 +39,9 @@ public class BooleanFlagDelegate(private val flags: KMutableProperty1): Boolean = flag(flags.get(thisRef)) + public operator fun getValue(thisRef: Node, property: KProperty<*>): Boolean = flag(flags.get(thisRef)) - operator fun setValue(thisRef: Node, property: KProperty<*>, value: Boolean) { + public operator fun setValue(thisRef: Node, property: KProperty<*>, value: Boolean) { val newValue = if (value) flags.get(thisRef) or mask else flags.get(thisRef) and mask.inv() flags.set(thisRef, newValue) } diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagImpl.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagImpl.kt index 43eab079871..0e4084565e3 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagImpl.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/FlagImpl.kt @@ -7,7 +7,7 @@ package kotlinx.metadata.internal import org.jetbrains.kotlin.metadata.deserialization.Flags as F -class FlagImpl(internal val offset: Int, internal val bitWidth: Int, internal val value: Int) : @Suppress("DEPRECATION") kotlinx.metadata.Flag() { +public class FlagImpl(internal val offset: Int, internal val bitWidth: Int, internal val value: Int) : @Suppress("DEPRECATION") kotlinx.metadata.Flag() { @IgnoreInApiDump internal constructor(field: F.FlagField<*>, value: Int) : this(field.offset, field.bitWidth, value) diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/ReadUtils.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/ReadUtils.kt index fb3a0050f29..d5964822980 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/ReadUtils.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/ReadUtils.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.Argument.Value.Type.* import org.jetbrains.kotlin.metadata.deserialization.Flags import org.jetbrains.kotlin.metadata.deserialization.NameResolver -fun ProtoBuf.Annotation.readAnnotation(strings: NameResolver): KmAnnotation = +public fun ProtoBuf.Annotation.readAnnotation(strings: NameResolver): KmAnnotation = KmAnnotation( strings.getClassName(id), argumentList.mapNotNull { argument -> @@ -23,7 +23,7 @@ fun ProtoBuf.Annotation.readAnnotation(strings: NameResolver): KmAnnotation = }.toMap() ) -fun ProtoBuf.Annotation.Argument.Value.readAnnotationArgument(strings: NameResolver): KmAnnotationArgument? { +public fun ProtoBuf.Annotation.Argument.Value.readAnnotationArgument(strings: NameResolver): KmAnnotationArgument? { if (Flags.IS_UNSIGNED[flags]) { return when (type) { BYTE -> KmAnnotationArgument.UByteValue(intValue.toByte().toUByte()) diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Readers.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Readers.kt index 26ea8e7977b..7feccde1cd6 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Readers.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Readers.kt @@ -18,29 +18,29 @@ import org.jetbrains.kotlin.metadata.deserialization.Flags as F * Allows to populate [ReadContext] with additional data * that can be used when reading metadata in [MetadataExtensions]. */ -interface ReadContextExtension +public interface ReadContextExtension -class ReadContext( - val strings: NameResolver, - val types: TypeTable, +public class ReadContext( + public val strings: NameResolver, + public val types: TypeTable, @get:IgnoreInApiDump internal val versionRequirements: VersionRequirementTable, private val parent: ReadContext? = null, - val contextExtensions: List = emptyList() + internal val contextExtensions: List = emptyList() ) { private val typeParameterNameToId = mutableMapOf() internal val extensions = MetadataExtensions.INSTANCES - operator fun get(index: Int): String = + public operator fun get(index: Int): String = strings.getString(index) - fun className(index: Int): ClassName = + internal fun className(index: Int): ClassName = strings.getClassName(index) - fun getTypeParameterId(name: Int): Int? = + internal fun getTypeParameterId(name: Int): Int? = typeParameterNameToId[name] ?: parent?.getTypeParameterId(name) - fun withTypeParameters(typeParameters: List): ReadContext = + internal fun withTypeParameters(typeParameters: List): ReadContext = ReadContext(strings, types, versionRequirements, this, contextExtensions).apply { for (typeParameter in typeParameters) { typeParameterNameToId[typeParameter.name] = typeParameter.id @@ -49,7 +49,7 @@ class ReadContext( } @OptIn(ExperimentalContextReceivers::class) -fun ProtoBuf.Class.accept( +public fun ProtoBuf.Class.accept( v: KmClassVisitor, strings: NameResolver, contextExtensions: List = emptyList() @@ -130,7 +130,7 @@ private fun ProtoBuf.Class.loadInlineClassUnderlyingType(c: ReadContext): ProtoB ?.returnType(c.types) } -fun ProtoBuf.Package.accept( +public fun ProtoBuf.Package.accept( v: KmPackageVisitor, strings: NameResolver, contextExtensions: List = emptyList() @@ -151,7 +151,7 @@ fun ProtoBuf.Package.accept( v.visitEnd() } -fun ProtoBuf.PackageFragment.accept( +public fun ProtoBuf.PackageFragment.accept( v: KmModuleFragmentVisitor, strings: NameResolver, contextExtensions: List = emptyList() @@ -197,7 +197,7 @@ private fun KmDeclarationContainerVisitor.visitDeclarations( } } -fun ProtoBuf.Function.accept(v: KmLambdaVisitor, strings: NameResolver) { +public fun ProtoBuf.Function.accept(v: KmLambdaVisitor, strings: NameResolver) { val c = ReadContext(strings, TypeTable(typeTable), VersionRequirementTable.EMPTY) v.visitFunction(flags, c[name])?.let { accept(it, c) } @@ -261,7 +261,7 @@ private fun ProtoBuf.Function.accept(v: KmFunctionVisitor, outer: ReadContext) { } @OptIn(ExperimentalContextReceivers::class) -fun ProtoBuf.Property.accept(v: KmPropertyVisitor, outer: ReadContext) { +public fun ProtoBuf.Property.accept(v: KmPropertyVisitor, outer: ReadContext) { val c = outer.withTypeParameters(typeParameterList) for (typeParameter in typeParameterList) { @@ -520,10 +520,10 @@ private val ProtoBuf.Type.typeFlags: Int private val ProtoBuf.TypeParameter.typeParameterFlags: Int get() = if (reified) 1 else 0 -fun ProtoBuf.Property.getPropertyGetterFlags(): Int = +public fun ProtoBuf.Property.getPropertyGetterFlags(): Int = if (hasGetterFlags()) getterFlags else getDefaultPropertyAccessorFlags(flags) -fun ProtoBuf.Property.getPropertySetterFlags(): Int = +public fun ProtoBuf.Property.getPropertySetterFlags(): Int = if (hasSetterFlags()) setterFlags else getDefaultPropertyAccessorFlags(flags) internal fun getDefaultPropertyAccessorFlags(flags: Int): Int = diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/WriteUtils.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/WriteUtils.kt index 985f59c2d8e..aaad129206b 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/WriteUtils.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/WriteUtils.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.metadata.ProtoBuf import org.jetbrains.kotlin.metadata.deserialization.Flags import org.jetbrains.kotlin.metadata.serialization.StringTable -fun KmAnnotation.writeAnnotation(strings: StringTable): ProtoBuf.Annotation.Builder = +public fun KmAnnotation.writeAnnotation(strings: StringTable): ProtoBuf.Annotation.Builder = ProtoBuf.Annotation.newBuilder().apply { id = strings.getClassNameIndex(className) for ((name, argument) in arguments) { @@ -24,7 +24,7 @@ fun KmAnnotation.writeAnnotation(strings: StringTable): ProtoBuf.Annotation.Buil } } -fun KmAnnotationArgument.writeAnnotationArgument(strings: StringTable): ProtoBuf.Annotation.Argument.Value.Builder = +public fun KmAnnotationArgument.writeAnnotationArgument(strings: StringTable): ProtoBuf.Annotation.Argument.Value.Builder = ProtoBuf.Annotation.Argument.Value.newBuilder().apply { when (this@writeAnnotationArgument) { is KmAnnotationArgument.ByteValue -> { diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Writers.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Writers.kt index 6c47b880572..fca22ece5fa 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Writers.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/Writers.kt @@ -19,15 +19,15 @@ import kotlin.contracts.ExperimentalContracts * Allows to populate [WriteContext] with additional data * that can be used when writing metadata in [MetadataExtensions]. */ -interface WriteContextExtension +public interface WriteContextExtension -open class WriteContext(val strings: StringTable, val contextExtensions: List = emptyList()) { - val versionRequirements: MutableVersionRequirementTable = MutableVersionRequirementTable() +public open class WriteContext(public val strings: StringTable, public val contextExtensions: List = emptyList()) { + internal val versionRequirements: MutableVersionRequirementTable = MutableVersionRequirementTable() - operator fun get(string: String): Int = + public operator fun get(string: String): Int = strings.getStringIndex(string) - fun getClassName(name: ClassName): Int = + internal fun getClassName(name: ClassName): Int = strings.getClassNameIndex(name) } @@ -191,7 +191,7 @@ private fun writeFunction(c: WriteContext, flags: Int, name: String, output: (Pr } } -fun writeProperty( +public fun writeProperty( c: WriteContext, flags: Int, name: String, getterFlags: Int, setterFlags: Int, output: (ProtoBuf.Property.Builder) -> Unit ): KmPropertyVisitor = object : KmPropertyVisitor() { val t = ProtoBuf.Property.newBuilder() @@ -424,8 +424,8 @@ private fun writeEffectExpression(c: WriteContext, output: (ProtoBuf.Expression. } } -open class ClassWriter(stringTable: StringTable, contextExtensions: List = emptyList()) : KmClassVisitor() { - protected val t = ProtoBuf.Class.newBuilder()!! +public open class ClassWriter(stringTable: StringTable, contextExtensions: List = emptyList()) : KmClassVisitor() { + protected val t: ProtoBuf.Class.Builder = ProtoBuf.Class.newBuilder()!! protected val c: WriteContext = WriteContext(stringTable, contextExtensions) override fun visit(flags: Int, name: ClassName) { @@ -497,8 +497,8 @@ open class ClassWriter(stringTable: StringTable, contextExtensions: List = emptyList()) : KmPackageVisitor() { - protected val t = ProtoBuf.Package.newBuilder()!! +public open class PackageWriter(stringTable: StringTable, contextExtensions: List = emptyList()) : KmPackageVisitor() { + protected val t: ProtoBuf.Package.Builder = ProtoBuf.Package.newBuilder()!! protected val c: WriteContext = WriteContext(stringTable, contextExtensions) override fun visitFunction(flags: Int, name: String): KmFunctionVisitor? = @@ -522,9 +522,9 @@ open class PackageWriter(stringTable: StringTable, contextExtensions: List = emptyList()) : +public open class ModuleFragmentWriter(stringTable: StringTable, contextExtensions: List = emptyList()) : KmModuleFragmentVisitor() { - protected val t = ProtoBuf.PackageFragment.newBuilder()!! + protected val t: ProtoBuf.PackageFragment.Builder = ProtoBuf.PackageFragment.newBuilder()!! protected val c: WriteContext = WriteContext(stringTable, contextExtensions) override fun visitPackage(): KmPackageVisitor? = object : PackageWriter(c.strings, c.contextExtensions) { @@ -547,9 +547,9 @@ open class ModuleFragmentWriter(stringTable: StringTable, contextExtensions: Lis } } -open class LambdaWriter(stringTable: StringTable) : KmLambdaVisitor() { +public open class LambdaWriter(stringTable: StringTable) : KmLambdaVisitor() { protected var t: ProtoBuf.Function.Builder? = null - protected val c = WriteContext(stringTable) + protected val c: WriteContext = WriteContext(stringTable) override fun visitFunction(flags: Int, name: String): KmFunctionVisitor? = writeFunction(c, flags, name) { t = it } diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/common/KotlinCommonMetadata.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/common/KotlinCommonMetadata.kt index 46e795cce25..291fd2f677e 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/common/KotlinCommonMetadata.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/common/KotlinCommonMetadata.kt @@ -22,15 +22,16 @@ import java.io.ByteArrayInputStream * Usually such metadata comes from serialized klibs. However, special `kotlin_builtins` file from standard library * distribution can also be read with this reader. */ -class KotlinCommonMetadata private constructor(private val proto: ProtoBuf.PackageFragment) { - fun toKmModuleFragment(): KmModuleFragment = +public class KotlinCommonMetadata private constructor(private val proto: ProtoBuf.PackageFragment) { + public fun toKmModuleFragment(): KmModuleFragment = KmModuleFragment().apply(this::accept) - class Writer : KmModuleFragmentVisitor() { + // private because there are no use-cases and it is not finished + private class Writer : KmModuleFragmentVisitor() { // TODO } - fun accept(v: KmModuleFragmentVisitor) { + public fun accept(v: KmModuleFragmentVisitor) { val strings = NameResolverImpl(proto.strings, proto.qualifiedNames) if (proto.hasPackage()) { v.visitPackage()?.let { proto.`package`.accept(it, strings) } @@ -41,9 +42,9 @@ class KotlinCommonMetadata private constructor(private val proto: ProtoBuf.Packa v.visitEnd() } - companion object { + public companion object { @JvmStatic - fun read(bytes: ByteArray): KotlinCommonMetadata? { + public fun read(bytes: ByteArray): KotlinCommonMetadata? { val (proto, _) = ByteArrayInputStream(bytes).readBuiltinsPackageFragment() if (proto == null) return null @@ -62,17 +63,17 @@ class KotlinCommonMetadata private constructor(private val proto: ProtoBuf.Packa * Can be read with [KotlinCommonMetadata.read]. */ @Suppress("DEPRECATION") -class KmModuleFragment : KmModuleFragmentVisitor() { +public class KmModuleFragment : KmModuleFragmentVisitor() { /** * Top-level functions, type aliases and properties in the module fragment. */ - var pkg: KmPackage? = null + public var pkg: KmPackage? = null /** * Classes in the module fragment. */ - val classes: MutableList = ArrayList() + public val classes: MutableList = ArrayList() private val extensions: List = MetadataExtensions.INSTANCES.map(MetadataExtensions::createModuleFragmentExtensions) @@ -95,7 +96,7 @@ class KmModuleFragment : KmModuleFragmentVisitor() { * @param visitor the visitor which will visit data in the module fragment. */ @Deprecated(VISITOR_API_MESSAGE) - fun accept(visitor: KmModuleFragmentVisitor) { + public fun accept(visitor: KmModuleFragmentVisitor) { pkg?.let { visitor.visitPackage()?.let(it::accept) } classes.forEach { visitor.visitClass()?.let(it::accept) } extensions.forEach { visitor.visitExtensions(it.type)?.let(it::accept) } @@ -111,18 +112,18 @@ class KmModuleFragment : KmModuleFragmentVisitor() { */ @Deprecated(VISITOR_API_MESSAGE) @Suppress("DEPRECATION") -abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val delegate: KmModuleFragmentVisitor? = null) { +public abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val delegate: KmModuleFragmentVisitor? = null) { /** * Visits a package within the module fragment. */ - open fun visitPackage(): KmPackageVisitor? = + public open fun visitPackage(): KmPackageVisitor? = delegate?.visitPackage() /** * Visits a class within the module fragment. */ - open fun visitClass(): KmClassVisitor? = + public open fun visitClass(): KmClassVisitor? = delegate?.visitClass() /** @@ -130,13 +131,13 @@ abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val del * * @param type the type of extension visitor to be returned. */ - open fun visitExtensions(type: KmExtensionType): KmModuleFragmentExtensionVisitor? = + public open fun visitExtensions(type: KmExtensionType): KmModuleFragmentExtensionVisitor? = delegate?.visitExtensions(type) /** * Visits the end of the module fragment. */ - open fun visitEnd() { + public open fun visitEnd() { delegate?.visitEnd() } } @@ -145,4 +146,4 @@ abstract class KmModuleFragmentVisitor @JvmOverloads constructor(private val del * A visitor to visit platform-specific extensions for a module fragment. */ @Deprecated(VISITOR_API_MESSAGE) -interface KmModuleFragmentExtensionVisitor : KmExtensionVisitor +public interface KmModuleFragmentExtensionVisitor : KmExtensionVisitor diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/ExtensionNodes.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/ExtensionNodes.kt index ded13b1b739..7ba40334022 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/ExtensionNodes.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/ExtensionNodes.kt @@ -9,26 +9,26 @@ package kotlinx.metadata.internal.extensions import kotlinx.metadata.* import kotlinx.metadata.internal.common.KmModuleFragmentExtensionVisitor -interface KmExtension : KmExtensionVisitor { - fun accept(visitor: V) +public interface KmExtension : KmExtensionVisitor { + public fun accept(visitor: V) } -interface KmClassExtension : KmClassExtensionVisitor, KmExtension +public interface KmClassExtension : KmClassExtensionVisitor, KmExtension -interface KmPackageExtension : KmPackageExtensionVisitor, KmExtension +public interface KmPackageExtension : KmPackageExtensionVisitor, KmExtension -interface KmModuleFragmentExtension : KmModuleFragmentExtensionVisitor, KmExtension +public interface KmModuleFragmentExtension : KmModuleFragmentExtensionVisitor, KmExtension -interface KmFunctionExtension : KmFunctionExtensionVisitor, KmExtension +public interface KmFunctionExtension : KmFunctionExtensionVisitor, KmExtension -interface KmPropertyExtension : KmPropertyExtensionVisitor, KmExtension +public interface KmPropertyExtension : KmPropertyExtensionVisitor, KmExtension -interface KmConstructorExtension : KmConstructorExtensionVisitor, KmExtension +public interface KmConstructorExtension : KmConstructorExtensionVisitor, KmExtension -interface KmTypeParameterExtension : KmTypeParameterExtensionVisitor, KmExtension +public interface KmTypeParameterExtension : KmTypeParameterExtensionVisitor, KmExtension -interface KmTypeExtension : KmTypeExtensionVisitor, KmExtension +public interface KmTypeExtension : KmTypeExtensionVisitor, KmExtension -interface KmTypeAliasExtension : KmTypeAliasExtensionVisitor, KmExtension +public interface KmTypeAliasExtension : KmTypeAliasExtensionVisitor, KmExtension -interface KmValueParameterExtension : KmValueParameterExtensionVisitor, KmExtension +public interface KmValueParameterExtension : KmValueParameterExtensionVisitor, KmExtension diff --git a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/MetadataExtensions.kt b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/MetadataExtensions.kt index cf1b52ecc60..c867e278d90 100644 --- a/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/MetadataExtensions.kt +++ b/libraries/kotlinx-metadata/src/kotlinx/metadata/internal/extensions/MetadataExtensions.kt @@ -12,77 +12,78 @@ import org.jetbrains.kotlin.metadata.ProtoBuf import java.util.* @Suppress("DEPRECATION") -interface MetadataExtensions { - fun readClassExtensions(v: KmClassVisitor, proto: ProtoBuf.Class, c: ReadContext) +public interface MetadataExtensions { + public fun readClassExtensions(v: KmClassVisitor, proto: ProtoBuf.Class, c: ReadContext) - fun readPackageExtensions(v: KmPackageVisitor, proto: ProtoBuf.Package, c: ReadContext) + public fun readPackageExtensions(v: KmPackageVisitor, proto: ProtoBuf.Package, c: ReadContext) - fun readModuleFragmentExtensions(v: KmModuleFragmentVisitor, proto: ProtoBuf.PackageFragment, c: ReadContext) + public fun readModuleFragmentExtensions(v: KmModuleFragmentVisitor, proto: ProtoBuf.PackageFragment, c: ReadContext) - fun readFunctionExtensions(v: KmFunctionVisitor, proto: ProtoBuf.Function, c: ReadContext) + public fun readFunctionExtensions(v: KmFunctionVisitor, proto: ProtoBuf.Function, c: ReadContext) - fun readPropertyExtensions(v: KmPropertyVisitor, proto: ProtoBuf.Property, c: ReadContext) + public fun readPropertyExtensions(v: KmPropertyVisitor, proto: ProtoBuf.Property, c: ReadContext) - fun readConstructorExtensions(v: KmConstructorVisitor, proto: ProtoBuf.Constructor, c: ReadContext) + public fun readConstructorExtensions(v: KmConstructorVisitor, proto: ProtoBuf.Constructor, c: ReadContext) - fun readTypeParameterExtensions(v: KmTypeParameterVisitor, proto: ProtoBuf.TypeParameter, c: ReadContext) + public fun readTypeParameterExtensions(v: KmTypeParameterVisitor, proto: ProtoBuf.TypeParameter, c: ReadContext) - fun readTypeExtensions(v: KmTypeVisitor, proto: ProtoBuf.Type, c: ReadContext) + public fun readTypeExtensions(v: KmTypeVisitor, proto: ProtoBuf.Type, c: ReadContext) - fun readTypeAliasExtensions(v: KmTypeAliasVisitor, proto: ProtoBuf.TypeAlias, c: ReadContext) + public fun readTypeAliasExtensions(v: KmTypeAliasVisitor, proto: ProtoBuf.TypeAlias, c: ReadContext) - fun readValueParameterExtensions(v: KmValueParameterVisitor, proto: ProtoBuf.ValueParameter, c: ReadContext) + public fun readValueParameterExtensions(v: KmValueParameterVisitor, proto: ProtoBuf.ValueParameter, c: ReadContext) - fun writeClassExtensions(type: KmExtensionType, proto: ProtoBuf.Class.Builder, c: WriteContext): KmClassExtensionVisitor? + public fun writeClassExtensions(type: KmExtensionType, proto: ProtoBuf.Class.Builder, c: WriteContext): KmClassExtensionVisitor? - fun writePackageExtensions(type: KmExtensionType, proto: ProtoBuf.Package.Builder, c: WriteContext): KmPackageExtensionVisitor? + public fun writePackageExtensions(type: KmExtensionType, proto: ProtoBuf.Package.Builder, c: WriteContext): KmPackageExtensionVisitor? - fun writeModuleFragmentExtensions( + public fun writeModuleFragmentExtensions( type: KmExtensionType, proto: ProtoBuf.PackageFragment.Builder, c: WriteContext ): KmModuleFragmentExtensionVisitor? - fun writeFunctionExtensions(type: KmExtensionType, proto: ProtoBuf.Function.Builder, c: WriteContext): KmFunctionExtensionVisitor? + public fun writeFunctionExtensions(type: KmExtensionType, proto: ProtoBuf.Function.Builder, c: WriteContext): KmFunctionExtensionVisitor? - fun writePropertyExtensions(type: KmExtensionType, proto: ProtoBuf.Property.Builder, c: WriteContext): KmPropertyExtensionVisitor? + public fun writePropertyExtensions(type: KmExtensionType, proto: ProtoBuf.Property.Builder, c: WriteContext): KmPropertyExtensionVisitor? - fun writeConstructorExtensions( + public fun writeConstructorExtensions( type: KmExtensionType, proto: ProtoBuf.Constructor.Builder, c: WriteContext ): KmConstructorExtensionVisitor? - fun writeTypeParameterExtensions( + public fun writeTypeParameterExtensions( type: KmExtensionType, proto: ProtoBuf.TypeParameter.Builder, c: WriteContext ): KmTypeParameterExtensionVisitor? - fun writeTypeExtensions(type: KmExtensionType, proto: ProtoBuf.Type.Builder, c: WriteContext): KmTypeExtensionVisitor? + public fun writeTypeExtensions(type: KmExtensionType, proto: ProtoBuf.Type.Builder, c: WriteContext): KmTypeExtensionVisitor? - fun writeTypeAliasExtensions(type: KmExtensionType, proto: ProtoBuf.TypeAlias.Builder, c: WriteContext): KmTypeAliasExtensionVisitor? + public fun writeTypeAliasExtensions(type: KmExtensionType, proto: ProtoBuf.TypeAlias.Builder, c: WriteContext): KmTypeAliasExtensionVisitor? - fun writeValueParameterExtensions( + public fun writeValueParameterExtensions( type: KmExtensionType, proto: ProtoBuf.ValueParameter.Builder, c: WriteContext ): KmValueParameterExtensionVisitor? - fun createClassExtension(): KmClassExtension + public fun createClassExtension(): KmClassExtension - fun createPackageExtension(): KmPackageExtension + public fun createPackageExtension(): KmPackageExtension - fun createModuleFragmentExtensions(): KmModuleFragmentExtension + public fun createModuleFragmentExtensions(): KmModuleFragmentExtension - fun createFunctionExtension(): KmFunctionExtension + public fun createFunctionExtension(): KmFunctionExtension - fun createPropertyExtension(): KmPropertyExtension + public fun createPropertyExtension(): KmPropertyExtension - fun createConstructorExtension(): KmConstructorExtension + public fun createConstructorExtension(): KmConstructorExtension - fun createTypeParameterExtension(): KmTypeParameterExtension + public fun createTypeParameterExtension(): KmTypeParameterExtension - fun createTypeExtension(): KmTypeExtension + public fun createTypeExtension(): KmTypeExtension - fun createTypeAliasExtension(): KmTypeAliasExtension? + public fun createTypeAliasExtension(): KmTypeAliasExtension? - fun createValueParameterExtension(): KmValueParameterExtension? + public fun createValueParameterExtension(): KmValueParameterExtension? - companion object { - val INSTANCES: List by lazy { + // 'internal' is not applicable inside an interface: KT-59796 + public companion object { + internal val INSTANCES: List by lazy { ServiceLoader.load(MetadataExtensions::class.java, MetadataExtensions::class.java.classLoader).toList().also { if (it.isEmpty()) error( "No MetadataExtensions instances found in the classpath. Please ensure that the META-INF/services/ " +