xref: /aosp_15_r20/external/ksp/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSDeclaration.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2020 Google LLC
3  * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package com.google.devtools.ksp.symbol
18 
19 /**
20  * A declaration, can be function declaration, clsss declaration and property declaration, or a type alias.
21  */
22 interface KSDeclaration : KSModifierListOwner, KSAnnotated, KSExpectActual {
23     /**
24      * Simple name of this declaration, usually the name identifier at the declaration site.
25      */
26     val simpleName: KSName
27 
28     /**
29      * Fully qualified name of this declaration, might not exist for some declarations like local declarations.
30      */
31     val qualifiedName: KSName?
32 
33     /**
34      * List of [type parameters][KSTypeParameter] of the declaration.
35      */
36     val typeParameters: List<KSTypeParameter>
37 
38     /**
39      * The name of the package at which this declaration is declared.
40      */
41     val packageName: KSName
42 
43     /**
44      * Parent declaration of this declaration, i.e. the declaration that directly contains this declaration.
45      * File is not a declaration, so this property will be null for top level declarations.
46      */
47     val parentDeclaration: KSDeclaration?
48 
49     /**
50      * 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.
51      */
52     val containingFile: KSFile?
53 
54     /**
55      * The doc string enclosed by \/\*\* and \*\/
56      */
57     val docString: String?
58 }
59