Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@
*/
package com.google.devtools.ksp.symbol

/**
* A symbol that can be annotated with annotations.
*/
/** A symbol that can be annotated with annotations. */
interface KSAnnotated : KSNode {

/**
* All annotations on this symbol.
*/
/** All annotations on this symbol. */
val annotations: Sequence<KSAnnotation>
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,31 @@
*/
package com.google.devtools.ksp.symbol

/**
* Instance of a constructor-call-like annotation.
*/
/** Instance of a constructor-call-like annotation. */
interface KSAnnotation : KSNode {
/**
* Reference to the type of the annotation class declaration.
*/
/** Reference to the type of the annotation class declaration. */
val annotationType: KSTypeReference

/**
* The arguments applied to the constructor call to construct this annotation.
* Must be compile time constants.
* The arguments applied to the constructor call to construct this annotation. Must be compile
* time constants.
*
* @see [KSValueArgument] for operations on its values.
*/
val arguments: List<KSValueArgument>

/**
* The default values of the annotation members
*/
/** The default values of the annotation members */
val defaultArguments: List<KSValueArgument>

/**
* Short name for this annotation, equivalent to the simple name of the declaration of the annotation class.
* Short name for this annotation, equivalent to the simple name of the declaration of the
* annotation class.
*/
val shortName: KSName

/**
* Use site target of the annotation. Could be null if no annotation use site target is specified.
* Use site target of the annotation. Could be null if no annotation use site target is
* specified.
*/
val useSiteTarget: AnnotationUseSiteTarget?
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@
*/
package com.google.devtools.ksp.symbol

/**
* A reference to a callable entity, such as a function or a property.
*/
/** A reference to a callable entity, such as a function or a property. */
interface KSCallableReference : KSReferenceElement {
/**
* A reference to the type of its receiver.
*/
/** A reference to the type of its receiver. */
val receiverType: KSTypeReference?

/**
* Parameters to this callable.
*/
/** Parameters to this callable. */
val functionParameters: List<KSValueParameter>

/**
* A reference to its return type.
*/
/** A reference to its return type. */
val returnType: KSTypeReference

override fun <D, R> accept(visitor: KSVisitor<D, R>, data: D): R {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@
*/
package com.google.devtools.ksp.symbol

/**
* Models class-like declarations, including class, interface and object.
*/
/** Models class-like declarations, including class, interface and object. */
interface KSClassDeclaration : KSDeclaration, KSDeclarationContainer {

/**
* The Kind of the class declaration.
*/
/** The Kind of the class declaration. */
val classKind: ClassKind

/**
* Primary constructor of a class, secondary constructors can be obtained by filtering [declarations].
* Primary constructor of a class, secondary constructors can be obtained by filtering
* [declarations].
*/
val primaryConstructor: KSFunctionDeclaration?

Expand All @@ -38,39 +35,48 @@ interface KSClassDeclaration : KSDeclaration, KSDeclarationContainer {

/**
* Determine whether this class declaration is a companion object.
* @see [https://kotlinlang.org/docs/tutorials/kotlin-for-py/objects-and-companion-objects.html#companion-objects]
*
* @see
* [https://kotlinlang.org/docs/tutorials/kotlin-for-py/objects-and-companion-objects.html#companion-objects]
*/
val isCompanionObject: Boolean

/**
* @return a sequence of sealed subclasses of this class, if any.
* Calling [getSealedSubclasses] requires type resolution which is expensive and should be avoided if possible.
* @return a sequence of sealed subclasses of this class, if any. Calling [getSealedSubclasses]
* requires type resolution which is expensive and should be avoided if possible.
*/
fun getSealedSubclasses(): Sequence<KSClassDeclaration>

/**
* Get all member functions of a class declaration, including declared and inherited.
* @return Sequence of function declarations from the class members.
* Calling [getAllFunctions] requires type resolution which is expensive and should be avoided if possible.
*
* @return Sequence of function declarations from the class members. Calling [getAllFunctions]
* requires type resolution which is expensive and should be avoided if possible.
*/
fun getAllFunctions(): Sequence<KSFunctionDeclaration>

/**
* Get all member properties of a class declaration, including declared and inherited.
* @return Sequence of properties declarations from the class members.
* Calling [getAllProperties] requires type resolution which is expensive and should be avoided if possible.
*
* @return Sequence of properties declarations from the class members. Calling
* [getAllProperties] requires type resolution which is expensive and should be avoided if
* possible.
*/
fun getAllProperties(): Sequence<KSPropertyDeclaration>

/**
* Create a type by applying a list of type arguments to this class' type parameters.
*
* @param typeArguments List of Type arguments to be applied.
* @return A type constructed from this class declaration with type parameters substituted with the type arguments.
* @return A type constructed from this class declaration with type parameters substituted with
* the type arguments.
*/
fun asType(typeArguments: List<KSTypeArgument>): KSType

/**
* If this is a generic class, return the type where the type argument is applied with star projection at use-site.
* If this is a generic class, return the type where the type argument is applied with star
* projection at use-site.
*
* @return A type with all type parameters applied with star projection.
*/
fun asStarProjectedType(): KSType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@
*/
package com.google.devtools.ksp.symbol

/**
* An application / reference to a user declared type such as class, interface and object.
*/
/** An application / reference to a user declared type such as class, interface and object. */
interface KSClassifierReference : KSReferenceElement {
/**
* The outer class of an inner class.
*/
/** The outer class of an inner class. */
val qualifier: KSClassifierReference?

/**
* The text which appears in the reference. For example, it is "Int" in `val temperature: Int` or
* "kotlin.Any" in `val canBeAnything: kotlin.Any`
* The text which appears in the reference. For example, it is "Int" in `val temperature: Int`
* or "kotlin.Any" in `val canBeAnything: kotlin.Any`
*/
fun referencedName(): String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,38 @@
package com.google.devtools.ksp.symbol

/**
* A declaration, can be function declaration, class declaration and property declaration, or a type alias.
* A declaration, can be function declaration, class declaration and property declaration, or a type
* alias.
*/
interface KSDeclaration : KSModifierListOwner, KSAnnotated, KSExpectActual {
/**
* Simple name of this declaration, usually the name identifier at the declaration site.
*/
/** Simple name of this declaration, usually the name identifier at the declaration site. */
val simpleName: KSName

/**
* Fully qualified name of this declaration, might not exist for some declarations like local declarations.
* Fully qualified name of this declaration, might not exist for some declarations like local
* declarations.
*/
val qualifiedName: KSName?

/**
* List of [type parameters][KSTypeParameter] of the declaration.
*/
/** List of [type parameters][KSTypeParameter] of the declaration. */
val typeParameters: List<KSTypeParameter>

/**
* The name of the package at which this declaration is declared.
*/
/** The name of the package at which this declaration is declared. */
val packageName: KSName

/**
* Parent declaration of this declaration, i.e. the declaration that directly contains this declaration.
* File is not a declaration, so this property will be null for top level declarations.
* Parent declaration of this declaration, i.e. the declaration that directly contains this
* declaration. File is not a declaration, so this property will be null for top level
* declarations.
*/
val parentDeclaration: KSDeclaration?

/**
* The containing source file of this declaration, can be null if symbol does not come from a source file, i.e. from a class file.
* The containing source file of this declaration, can be null if symbol does not come from a
* source file, i.e. from a class file.
*/
val containingFile: KSFile?

/**
* The doc string enclosed by \/\*\* and \*\/
*/
/** The doc string enclosed by \/\*\* and \*\/ */
val docString: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
*/
package com.google.devtools.ksp.symbol

/**
* A declaration container can have a list of declarations declared in it.
*/
/** A declaration container can have a list of declarations declared in it. */
interface KSDeclarationContainer : KSNode {
/**
* Declarations that are lexically declared inside the current container.
*/
/** Declarations that are lexically declared inside the current container. */
val declarations: Sequence<KSDeclaration>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.google.devtools.ksp.symbol

interface KSDefNonNullReference : KSReferenceElement {
/**
* Enclosed reference element of the Definitely non null type.
* For a reference of `T & Any`, this returns `T`.
* Enclosed reference element of the Definitely non null type. For a reference of `T & Any`,
* this returns `T`.
*/
val enclosedType: KSClassifierReference

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@
*/
package com.google.devtools.ksp.symbol

/**
* Models `dynamic` type for Kotlin/JS.
*/
/** Models `dynamic` type for Kotlin/JS. */
interface KSDynamicReference : KSReferenceElement
Loading