[AA] KtAnnotationApplication: make index nullable
^KT-56046
This commit is contained in:
committed by
Space Team
parent
50711d5003
commit
379044f2c8
+5
-5
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.psi.KtCallElement
|
||||
* Some examples:
|
||||
* - For declarations: `@Deprecated("Should not be used") fun foo(){}`
|
||||
* - For types: `fun foo(x: List<@A Int>){}`
|
||||
* - Inside other annotation (`B` is annotation here): `@A(B()) fun foo(){}
|
||||
* - Inside another annotation (`B` is annotation here): `@A(B()) fun foo(){}
|
||||
*/
|
||||
public sealed interface KtAnnotationApplication {
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ public sealed interface KtAnnotationApplication {
|
||||
public val classId: ClassId?
|
||||
|
||||
/**
|
||||
* PsiElement which was used to apply annotation to declaration/type.
|
||||
* [com.intellij.psi.PsiElement] which was used to apply annotation to declaration/type.
|
||||
*
|
||||
* Present only for declarations from sources. For declarations from other places (libraries, stdlib) it's `null`
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ public sealed interface KtAnnotationApplication {
|
||||
/**
|
||||
* [AnnotationUseSiteTarget] to which annotation was applied. May be not-null only for annotation applications for declarations.
|
||||
*
|
||||
* See in more details in [Kotlin Documentation](https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets) for more information about annotation targets.
|
||||
* See more details in [Kotlin Documentation](https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets) for more information about annotation targets.
|
||||
*/
|
||||
public val useSiteTarget: AnnotationUseSiteTarget?
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed interface KtAnnotationApplication {
|
||||
public val isCallWithArguments: Boolean
|
||||
|
||||
/**
|
||||
* An index of the annotation in an owner. Can be `-1` in case of annotation arguments
|
||||
* An index of the annotation in an owner. `null` for annotation arguments
|
||||
*/
|
||||
public val index: Int
|
||||
public val index: Int?
|
||||
}
|
||||
|
||||
+1
-24
@@ -10,39 +10,16 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.psi.KtCallElement
|
||||
|
||||
/**
|
||||
* Overview of annotation to some declaration or type.
|
||||
* Info of annotation to some declaration or type.
|
||||
*
|
||||
* Some examples:
|
||||
* - For declarations: `@Deprecated("Should not be used") fun foo(){}`
|
||||
* - For types: `fun foo(x: List<@A Int>){}`
|
||||
*/
|
||||
public data class KtAnnotationApplicationInfo(
|
||||
/**
|
||||
* The [ClassId] of applied annotation. [ClassId] is a fully qualified name on annotation class.
|
||||
*/
|
||||
public override val classId: ClassId?,
|
||||
|
||||
/**
|
||||
* [com.intellij.psi.PsiElement] which was used to apply annotation to declaration/type.
|
||||
*
|
||||
* Present only for declarations from sources. For declarations from other places (libraries, stdlib) it's `null`
|
||||
*/
|
||||
public override val psi: KtCallElement?,
|
||||
|
||||
/**
|
||||
* [AnnotationUseSiteTarget] to which annotation was applied. May be not-null only for annotation applications for declarations.
|
||||
*
|
||||
* See in more details in [Kotlin Documentation](https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets) for more information about annotation targets.
|
||||
*/
|
||||
public override val useSiteTarget: AnnotationUseSiteTarget?,
|
||||
|
||||
/**
|
||||
* **true** if the annotation has any arguments
|
||||
*/
|
||||
public override val isCallWithArguments: Boolean,
|
||||
|
||||
/**
|
||||
* An index of the annotation in an owner
|
||||
*/
|
||||
public override val index: Int,
|
||||
) : KtAnnotationApplication
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public data class KtAnnotationApplicationWithArgumentsInfo(
|
||||
* A list of annotation arguments which were applied when constructing annotation. Every argument is [KtAnnotationValue]
|
||||
*/
|
||||
public val arguments: List<KtNamedAnnotationValue>,
|
||||
override val index: Int,
|
||||
override val index: Int?,
|
||||
) : KtAnnotationApplication {
|
||||
override val isCallWithArguments: Boolean get() = arguments.isNotEmpty()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user