Partially format api/.../symbols Related to #2990
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSReferenceElement.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSReferenceElement.kt index 425036d..ba0673f 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSReferenceElement.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSReferenceElement.kt
@@ -22,8 +22,6 @@ * KSReferenceElement can specify, for example, a class, interface, or function, etc. */ interface KSReferenceElement : KSNode { - /** - * Type arguments in the type reference. - */ + /** Type arguments in the type reference. */ val typeArguments: List<KSTypeArgument> }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSType.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSType.kt index c8cd5d4..b5b95d8 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSType.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSType.kt
@@ -19,29 +19,22 @@ /** * Represents a type in Kotlin's type system. * - * Generally, a type is comprised of a declaration (e.g., class), corresponding type arguments, and other details like nullability. - * KSType is useful when doing type checking, finding the declaration, and so on. Some of the information, - * such as type annotations and type arguments, are often available in the corresponding type reference without resolution. + * Generally, a type is comprised of a declaration (e.g., class), corresponding type arguments, and + * other details like nullability. KSType is useful when doing type checking, finding the + * declaration, and so on. Some of the information, such as type annotations and type arguments, are + * often available in the corresponding type reference without resolution. */ interface KSType { - /** - * The declaration that generates this type. - */ + /** The declaration that generates this type. */ val declaration: KSDeclaration - /** - * A type can be nullable, not nullable, or context-specific in the case of platform types. - */ + /** A type can be nullable, not nullable, or context-specific in the case of platform types. */ val nullability: Nullability - /** - * Type arguments to the type. - */ + /** Type arguments to the type. */ val arguments: List<KSTypeArgument> - /** - * Type annotations to the type. - */ + /** Type annotations to the type. */ val annotations: Sequence<KSAnnotation> /** @@ -52,13 +45,12 @@ fun isAssignableFrom(that: KSType): Boolean /** - * True if the type is a collection and can be both mutable and immutable, depending on the context. + * True if the type is a collection and can be both mutable and immutable, depending on the + * context. */ fun isMutabilityFlexible(): Boolean - /** - * True if the type can be both invariant and covariant, depending on the context. - */ + /** True if the type can be both invariant and covariant, depending on the context. */ fun isCovarianceFlexible(): Boolean /** @@ -69,38 +61,27 @@ */ fun replace(arguments: List<KSTypeArgument>): KSType - /** - * Returns the star projection of the type. - */ + /** Returns the star projection of the type. */ fun starProjection(): KSType - /** - * Make the type nullable - */ + /** Make the type nullable */ fun makeNullable(): KSType - /** - * Make the type not nullable - */ + /** Make the type not nullable */ fun makeNotNullable(): KSType /** - * True if the type is explicitly marked as nullable type, i.e. has question mark in type declaration. + * True if the type is explicitly marked as nullable type, i.e. has question mark in type + * declaration. */ val isMarkedNullable: Boolean - /** - * True if the type is an error type, which means the type can't be resolved by compiler. - */ + /** True if the type is an error type, which means the type can't be resolved by compiler. */ val isError: Boolean - /** - * True if the type is a function type. Note that a suspend function will return false here. - */ + /** True if the type is a function type. Note that a suspend function will return false here. */ val isFunctionType: Boolean - /** - * True if the type is a suspend function - */ + /** True if the type is a suspend function */ val isSuspendFunctionType: Boolean }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeAlias.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeAlias.kt index 6631024..0ae5bb4 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeAlias.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeAlias.kt
@@ -16,17 +16,11 @@ */ package com.google.devtools.ksp.symbol -/** - * A type alias - */ +/** A type alias */ interface KSTypeAlias : KSDeclaration { - /** - * The name of the type alias - */ + /** The name of the type alias */ val name: KSName - /** - * The reference to the aliased type. - */ + /** The reference to the aliased type. */ val type: KSTypeReference }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeArgument.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeArgument.kt index b0dd978..ff182ca 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeArgument.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeArgument.kt
@@ -16,17 +16,11 @@ */ package com.google.devtools.ksp.symbol -/** - * A type argument - */ +/** A type argument */ interface KSTypeArgument : KSAnnotated { - /** - * The use-site variance, or namely type projection - */ + /** The use-site variance, or namely type projection */ val variance: Variance - /** - * The reference to the type - */ + /** The reference to the type */ val type: KSTypeReference? }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeParameter.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeParameter.kt index 26970d6..2d7b2b5 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeParameter.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeParameter.kt
@@ -16,9 +16,7 @@ */ package com.google.devtools.ksp.symbol -/** - * A type parameter - */ +/** A type parameter */ interface KSTypeParameter : KSDeclaration { /** * Name of the type parameter @@ -27,18 +25,12 @@ */ val name: KSName - /** - * Declaration-site variance - */ + /** Declaration-site variance */ val variance: Variance - /** - * True if it is reified, i.e., has the reified modifier. - */ + /** True if it is reified, i.e., has the reified modifier. */ val isReified: Boolean - /** - * Upper bounds of the type parameter. - */ + /** Upper bounds of the type parameter. */ val bounds: Sequence<KSTypeReference> }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeReference.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeReference.kt index f7d2864..cda9208 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeReference.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeReference.kt
@@ -16,20 +16,17 @@ */ package com.google.devtools.ksp.symbol -/** - * A [KSTypeReference] combines a [KSReferenceElement] with annotations and modifiers. - */ +/** A [KSTypeReference] combines a [KSReferenceElement] with annotations and modifiers. */ interface KSTypeReference : KSAnnotated, KSModifierListOwner { - /** - * Underlying element of this type reference, without annotations and modifiers. - */ + /** Underlying element of this type reference, without annotations and modifiers. */ val element: KSReferenceElement? /** * Resolves to the original declaration site. - * @return A type resolved from this type reference. - * Calling [resolve] is expensive and should be avoided if possible. + * + * @return A type resolved from this type reference. Calling [resolve] is expensive and should + * be avoided if possible. */ fun resolve(): KSType }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueArgument.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueArgument.kt index df941ec..f3a2c78 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueArgument.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueArgument.kt
@@ -29,9 +29,7 @@ */ val name: KSName? - /** - * True if it is a spread argument (i.e., has a "*" in front of the argument). - */ + /** True if it is a spread argument (i.e., has a "*" in front of the argument). */ val isSpread: Boolean /** @@ -49,8 +47,8 @@ * * [Double]; * * [String]; * * [KSType] for annotation arguments of type [kotlin.reflect.KClass]; - * * [KSClassDeclaration] for annotation arguments of type [Enum] (in this case[KSClassDeclaration.classKind] - * equals to [ClassKind.ENUM_CLASS]); + * * [KSClassDeclaration] for annotation arguments of type [Enum] (in this + * case[KSClassDeclaration.classKind] equals to [ClassKind.ENUM_CLASS]); * * [KSAnnotation] for embedded annotation arguments; * * [Array] of a possible type listed above. */
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueParameter.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueParameter.kt index f6e5a23..ed56507 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueParameter.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSValueParameter.kt
@@ -16,47 +16,29 @@ */ package com.google.devtools.ksp.symbol -/** - * A value parameter - */ +/** A value parameter */ interface KSValueParameter : KSAnnotated { - /** - * Name of the parameter - */ + /** Name of the parameter */ val name: KSName? - /** - * The reference to the type of the parameter. - */ + /** The reference to the type of the parameter. */ val type: KSTypeReference - /** - * True if it is a vararg. - */ + /** True if it is a vararg. */ val isVararg: Boolean - /** - * True if it has the `noinline` modifier - */ + /** True if it has the `noinline` modifier */ val isNoInline: Boolean - /** - * True if it has the `crossinline` modifier - */ + /** True if it has the `crossinline` modifier */ val isCrossInline: Boolean - /** - * True if it is a value - */ + /** True if it is a value */ val isVal: Boolean - /** - * True if it is a variable - */ + /** True if it is a variable */ val isVar: Boolean - /** - * True if it has a default value - */ + /** True if it has a default value */ val hasDefault: Boolean }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitor.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitor.kt index 6ec4ca1..50fb197 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitor.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitor.kt
@@ -16,9 +16,7 @@ */ package com.google.devtools.ksp.symbol -/** - * A visitor for program elements - */ +/** A visitor for program elements */ interface KSVisitor<D, R> { fun visitNode(node: KSNode, data: D): R
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitorVoid.kt b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitorVoid.kt index 1e729d9..09602df 100644 --- a/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitorVoid.kt +++ b/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSVisitorVoid.kt
@@ -16,82 +16,58 @@ */ package com.google.devtools.ksp.symbol -/** - * A visitor that doesn't pass or return anything. - */ +/** A visitor that doesn't pass or return anything. */ open class KSVisitorVoid : KSVisitor<Unit, Unit> { - override fun visitNode(node: KSNode, data: Unit) { - } + override fun visitNode(node: KSNode, data: Unit) {} - override fun visitAnnotated(annotated: KSAnnotated, data: Unit) { - } + override fun visitAnnotated(annotated: KSAnnotated, data: Unit) {} - override fun visitAnnotation(annotation: KSAnnotation, data: Unit) { - } + override fun visitAnnotation(annotation: KSAnnotation, data: Unit) {} - override fun visitModifierListOwner(modifierListOwner: KSModifierListOwner, data: Unit) { - } + override fun visitModifierListOwner(modifierListOwner: KSModifierListOwner, data: Unit) {} - override fun visitDeclaration(declaration: KSDeclaration, data: Unit) { - } + override fun visitDeclaration(declaration: KSDeclaration, data: Unit) {} - override fun visitDeclarationContainer(declarationContainer: KSDeclarationContainer, data: Unit) { - } + override fun visitDeclarationContainer( + declarationContainer: KSDeclarationContainer, + data: Unit, + ) {} - override fun visitDynamicReference(reference: KSDynamicReference, data: Unit) { - } + override fun visitDynamicReference(reference: KSDynamicReference, data: Unit) {} - override fun visitFile(file: KSFile, data: Unit) { - } + override fun visitFile(file: KSFile, data: Unit) {} - override fun visitFunctionDeclaration(function: KSFunctionDeclaration, data: Unit) { - } + override fun visitFunctionDeclaration(function: KSFunctionDeclaration, data: Unit) {} - override fun visitCallableReference(reference: KSCallableReference, data: Unit) { - } + override fun visitCallableReference(reference: KSCallableReference, data: Unit) {} - override fun visitParenthesizedReference(reference: KSParenthesizedReference, data: Unit) { - } + override fun visitParenthesizedReference(reference: KSParenthesizedReference, data: Unit) {} - override fun visitPropertyDeclaration(property: KSPropertyDeclaration, data: Unit) { - } + override fun visitPropertyDeclaration(property: KSPropertyDeclaration, data: Unit) {} - override fun visitPropertyAccessor(accessor: KSPropertyAccessor, data: Unit) { - } + override fun visitPropertyAccessor(accessor: KSPropertyAccessor, data: Unit) {} - override fun visitPropertyGetter(getter: KSPropertyGetter, data: Unit) { - } + override fun visitPropertyGetter(getter: KSPropertyGetter, data: Unit) {} - override fun visitPropertySetter(setter: KSPropertySetter, data: Unit) { - } + override fun visitPropertySetter(setter: KSPropertySetter, data: Unit) {} - override fun visitClassifierReference(reference: KSClassifierReference, data: Unit) { - } + override fun visitClassifierReference(reference: KSClassifierReference, data: Unit) {} - override fun visitReferenceElement(element: KSReferenceElement, data: Unit) { - } + override fun visitReferenceElement(element: KSReferenceElement, data: Unit) {} - override fun visitTypeAlias(typeAlias: KSTypeAlias, data: Unit) { - } + override fun visitTypeAlias(typeAlias: KSTypeAlias, data: Unit) {} - override fun visitTypeArgument(typeArgument: KSTypeArgument, data: Unit) { - } + override fun visitTypeArgument(typeArgument: KSTypeArgument, data: Unit) {} - override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) { - } + override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) {} - override fun visitTypeParameter(typeParameter: KSTypeParameter, data: Unit) { - } + override fun visitTypeParameter(typeParameter: KSTypeParameter, data: Unit) {} - override fun visitTypeReference(typeReference: KSTypeReference, data: Unit) { - } + override fun visitTypeReference(typeReference: KSTypeReference, data: Unit) {} - override fun visitValueParameter(valueParameter: KSValueParameter, data: Unit) { - } + override fun visitValueParameter(valueParameter: KSValueParameter, data: Unit) {} - override fun visitValueArgument(valueArgument: KSValueArgument, data: Unit) { - } + override fun visitValueArgument(valueArgument: KSValueArgument, data: Unit) {} - override fun visitDefNonNullReference(reference: KSDefNonNullReference, data: Unit) { - } + override fun visitDefNonNullReference(reference: KSDefNonNullReference, data: Unit) {} }