KaSymbol
Last modified: 01 August 2024A base interface of the symbol hierarchy.
Members
Relation utilities
val KaSymbol.containingSymbol: KaSymbol?
A containing symbol:
For top-level declarations, a
KaFileSymbol
, or aKaScriptSymbol
if the file is a script file;For scripts, a
KaFileSymbol
;For class members, a containing class;
For local declarations, a declaration it was declared in.
val KaSymbol.containingDeclaration: KaDeclarationSymbol?
A containing declaration:
For top-level declarations, a containing
KaScriptSymbol
ornull
for non-script declarations;For class members, a containing class;
For local declarations, a declaration it was declared in.
Other utilities
KaSymbolLocation
The location
property indicates the relation between the declaration represented by a symbol and its container (a file, a class, etc.).
Member | Description |
---|---|
| A declaration placed directly in a file, or in a script. |
| A member of some class, object, or interface. |
| A part of some property declaration (e.g., an accessor or a backing field). |
| A declaration inside some callable declaration body. |
KaSymbolOrigin
The origin
property indicates the origin of the symbol. Below you can find a comprehensive list of possible KaSymbolOrigin
values and their descriptions.
Member | Description |
---|---|
| A declaration directly written in Kotlin source code. Examples: Classes, functions, properties, and other declarations defined in Kotlin source files. |
| A declaration automatically generated by the Kotlin compiler as a member of another declaration. Examples:
|
| A declaration from a compiled Kotlin library ( Examples: Classes, functions, properties, and other declarations defined in Kotlin source files. |
| A declaration from Java source code. Examples: Classes, methods, and fields defined in Java source files. |
| A declaration from a compiled Java library. Examples: Classes, methods, and fields from Java libraries, or from the JDK. |
| A synthetic function generated by the SAM (Single Abstract Method) conversion. This occurs when a lambda expression is passed as an argument where a functional interface is expected. Example:
In this case, the lambda expression is converted to a synthetic function that implements the |
| A synthetic declaration automatically created by the Kotlin compiler for callable intersections. Example:
In |
| A synthetic declaration automatically created by the Kotlin compiler for callable type substitutions. Example:
Interface |
| A member generated by the compiler for interface delegation. This occurs when a class delegates the implementation of an interface to another object. Example:
The compiler generates a member function |
| A synthetic property generated by the compiler for a Java field with a getter or setter. This allows Java fields to be accessed like Kotlin properties. Example:
The compiler generates a synthetic property |
| A backing field of a property declaration (a field that stores the value of the property). Example:
The |
| A declaration generated by a compiler plugin. |
| A declaration from a dynamic Kotlin/JS scope. |
| A Kotlin/Native forward declaration. See the forward declarations section in the Kotlin documentation. |