[SLC] support type parameter annotations
^KT-65112 Fixed
This commit is contained in:
committed by
Space Team
parent
ae8e9749c8
commit
c78d3edd24
+14
-3
@@ -28,6 +28,9 @@ import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightDeclaration
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.light.classes.symbol.*
|
||||
import org.jetbrains.kotlin.light.classes.symbol.annotations.AnnotationsBox
|
||||
import org.jetbrains.kotlin.light.classes.symbol.annotations.GranularAnnotationsBox
|
||||
import org.jetbrains.kotlin.light.classes.symbol.annotations.SymbolAnnotationsProvider
|
||||
import org.jetbrains.kotlin.name.StandardClassIds
|
||||
import org.jetbrains.kotlin.psi.KtTypeParameter
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
@@ -138,7 +141,6 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
override fun hasModifierProperty(name: String): Boolean = false
|
||||
override fun getOwner(): PsiTypeParameterListOwner = parent.owner
|
||||
override fun getParent(): PsiElement = parent
|
||||
override fun getAnnotations(): Array<PsiAnnotation> = PsiAnnotation.EMPTY_ARRAY
|
||||
override fun getContainingClass(): PsiClass? = null
|
||||
override fun getDocComment(): PsiDocComment? = null
|
||||
override fun isDeprecated(): Boolean = false
|
||||
@@ -153,7 +155,6 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
override fun isInterface(): Boolean = false
|
||||
override fun isAnnotationType(): Boolean = false
|
||||
override fun isEnum(): Boolean = false
|
||||
override fun findAnnotation(qualifiedName: String): PsiAnnotation? = null
|
||||
override fun addAnnotation(qualifiedName: String): PsiAnnotation = cannotModify()
|
||||
//End of PsiClass simple implementation
|
||||
|
||||
@@ -164,7 +165,17 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
override fun getName(): String = _name
|
||||
|
||||
override fun getIndex(): Int = index
|
||||
override fun getApplicableAnnotations(): Array<PsiAnnotation> = PsiAnnotation.EMPTY_ARRAY //TODO
|
||||
|
||||
private val annotationsBox: AnnotationsBox = GranularAnnotationsBox(
|
||||
annotationsProvider = SymbolAnnotationsProvider(ktModule, typeParameterSymbolPointer)
|
||||
)
|
||||
|
||||
override fun getAnnotations(): Array<PsiAnnotation> = annotationsBox.annotationsArray(this)
|
||||
override fun findAnnotation(qualifiedName: String): PsiAnnotation? = annotationsBox.findAnnotation(this, qualifiedName)
|
||||
override fun getAnnotation(fqn: String): PsiAnnotation? = findAnnotation(fqn)
|
||||
override fun hasAnnotation(fqn: String): Boolean = annotationsBox.hasAnnotation(this, fqn)
|
||||
override fun getApplicableAnnotations(): Array<PsiAnnotation> = annotations
|
||||
|
||||
override fun toString(): String = "SymbolLightTypeParameter:$name"
|
||||
|
||||
override fun getNavigationElement(): PsiElement = kotlinOrigin ?: parent.navigationElement
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public final class C /* one.C*/<T> {
|
||||
public C();// .ctor()
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public final class C /* one.C*/<T> {
|
||||
public final class C /* one.C*/<@one.Anno() T> {
|
||||
public C();// .ctor()
|
||||
}
|
||||
|
||||
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
public final class C /* one.C*/<@one.Anno() T> {
|
||||
public C();// .ctor()
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
public abstract interface C /* one.C*/<T> {
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
public abstract interface C /* one.C*/<T> {
|
||||
public abstract interface C /* one.C*/<@one.Anno() T> {
|
||||
}
|
||||
|
||||
Vendored
-2
@@ -1,2 +0,0 @@
|
||||
public abstract interface C /* one.C*/<@one.Anno() T> {
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public final class C /* one.C*/ {
|
||||
public C();// .ctor()
|
||||
|
||||
public final <T> void foo(T);// <T> foo(T)
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
public final class C /* one.C*/ {
|
||||
public C();// .ctor()
|
||||
|
||||
public final <T> void foo(T);// <T> foo(T)
|
||||
public final <@one.Anno() T> void foo(T);// <@one.Anno() T> foo(T)
|
||||
}
|
||||
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
public final class C /* one.C*/ {
|
||||
public C();// .ctor()
|
||||
|
||||
public final <@one.Anno() T> void foo(T);// <@one.Anno() T> foo(T)
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
public final class C /* one.C*/ {
|
||||
public C();// .ctor()
|
||||
|
||||
public final <T> int getFoo(@org.jetbrains.annotations.NotNull() T);// <T> getFoo(T)
|
||||
public final <@one.Anno() T> int getFoo(@org.jetbrains.annotations.NotNull() T);// <@one.Anno() T> getFoo(T)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public final class FunctionTypeParameterAnnotationKt /* one.FunctionTypeParameterAnnotationKt*/ {
|
||||
public static final <@one.Anno() T> void foo(T);// <@one.Anno() T> foo(T)
|
||||
public static final <T> void foo(T);// <T> foo(T)
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public final class FunctionTypeParameterAnnotationKt /* one.FunctionTypeParameterAnnotationKt*/ {
|
||||
public static final <T> void foo(T);// <T> foo(T)
|
||||
public static final <@one.Anno() T> void foo(T);// <@one.Anno() T> foo(T)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public final class PropertyTypeParameterAnnotationKt /* one.PropertyTypeParameterAnnotationKt*/ {
|
||||
public static final <T> int getFoo(@org.jetbrains.annotations.NotNull() T);// <T> getFoo(T)
|
||||
public static final <@one.Anno() T> int getFoo(@org.jetbrains.annotations.NotNull() T);// <@one.Anno() T> getFoo(T)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user