Skip to content

KaSymbolInformationProvider

@SubclassOptInRequired(markerClass = [KaSessionComponentImplementationDetail::class])
interface KaSymbolInformationProvider : KaSessionComponent

Inheritors

Properties

applicableAnnotationTargets

A set of applicable targets for an annotation class symbol, or null if the symbol is not an annotation class.

canBeOperator

Whether the function symbol meets all the requirements to be declared as an operator function.

In Kotlin, the set of functions which can be declared as an operator is predefined. canBeOperator not only checks the name of a potential operator function, but also its signature, depending on the operator.

canBeOperator does not determine whether the function symbol is declared as an operator. For this purpose, use KaNamedFunctionSymbol.isOperator instead.

Example

class A

fun A.plus(that: A): A = A() // canBeOperator = true, as it meets all requirements for `plus`.

operator fun A.contains(that: A): Boolean = true // canBeOperator = true, as it's already an operator.

fun A.something(that: A): A = A() // canBeOperator = false, as there is no operator with such a name.

fun A.minus(): A = A() // canBeOperator = false, as `minus` is a binary operator and should have one parameter.

containingFileAnnotations

File-level annotations (@file:SomeAnnotation) of the source file this top-level KaDeclarationSymbol was defined in, or null for a nested declaration.

This API is only intended to be used by the TypeScript export utility.

defaultAnnotationTargets

A set of annotation targets matching for the given symbol, or null if the symbol cannot be annotated. Annotations with one of targets from the returned set can be placed on the KaSymbol without an explicit use-site target.

Such as, annotations with KaAnnotationTarget.PROPERTY or KaAnnotationTarget.VALUE_PARAMETER can be directly placed on a 'val' value parameter, while annotations for KaAnnotationTarget.PROPERTY_GETTER and KaAnnotationTarget.PROPERTY_SETTER can only be applied using the @set:AnnotationName syntax.

Check the Annotation use-site targets documentation for additional information.

deprecation

The deprecation status of the given symbol, or null if the symbol is not deprecated.

This considers deprecation annotations applied to the symbol itself and, for property-related symbols, deprecation annotations with appropriate use-site targets.

importableFqName

abstract val KaSymbol.importableFqName: FqName?

A FqName which can be used to import the given symbol, or null if the symbol cannot be imported.

isDeprecated

abstract val KaSymbol.isDeprecated: Boolean

Whether the symbol is deprecated at any level.

This is a convenience property equivalent to deprecation != null.

isInline

Whether the property is an inline property. A property is considered inline when both of its accessors are inline or when it has the inline keyword. The inline keyword on a property is syntactic sugar for marking both accessors as inline.

returnValueStatus

The return value status of the function (should it be used, or can it be ignored). See the KEEP for details.

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

assertIsValidAndAccessible

isValid

Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.

withValidityAssertion

inline fun <R> KaLifetimeOwner.withValidityAssertion(action: () -> R): R

Executes action only if the KaLifetimeOwner is still valid and accessible. Otherwise, throws a validity exception based on the concrete violation.