[ULC] Fix invalid annotation resolve for KtUltraLightParameterForSetterParameter
This commit is contained in:
+12
-6
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.psi.KtParameter
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil.LABELED_THIS_PARAMETER
|
import org.jetbrains.kotlin.codegen.AsmUtil.LABELED_THIS_PARAMETER
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil.RECEIVER_PARAMETER_NAME
|
import org.jetbrains.kotlin.codegen.AsmUtil.RECEIVER_PARAMETER_NAME
|
||||||
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||||
|
|
||||||
internal class KtUltraLightSuspendContinuationParameter(
|
internal class KtUltraLightSuspendContinuationParameter(
|
||||||
private val ktFunction: KtFunction,
|
private val ktFunction: KtFunction,
|
||||||
@@ -144,7 +145,7 @@ internal abstract class KtAbstractUltraLightParameterForDeclaration(
|
|||||||
) : KtUltraLightParameter(name, kotlinOrigin, support, method) {
|
) : KtUltraLightParameter(name, kotlinOrigin, support, method) {
|
||||||
|
|
||||||
protected fun tryGetContainingDescriptor(): CallableDescriptor? =
|
protected fun tryGetContainingDescriptor(): CallableDescriptor? =
|
||||||
containingDeclaration.resolve() as? CallableMemberDescriptor
|
containingDeclaration.resolve() as? CallableDescriptor
|
||||||
|
|
||||||
protected abstract fun tryGetKotlinType(): KotlinType?
|
protected abstract fun tryGetKotlinType(): KotlinType?
|
||||||
|
|
||||||
@@ -189,11 +190,16 @@ internal class KtUltraLightParameterForSetterParameter(
|
|||||||
override fun tryGetKotlinType(): KotlinType? = property.getKotlinType()
|
override fun tryGetKotlinType(): KotlinType? = property.getKotlinType()
|
||||||
|
|
||||||
override val givenAnnotations: List<KtLightAbstractAnnotation>?
|
override val givenAnnotations: List<KtLightAbstractAnnotation>?
|
||||||
get() = (property.resolve() as? PropertyDescriptor)
|
get() = property.annotationEntries.filter {
|
||||||
?.setter
|
it.useSiteTarget?.getAnnotationUseSiteTarget() == AnnotationUseSiteTarget.SETTER_PARAMETER
|
||||||
?.valueParameters
|
}.map { entry ->
|
||||||
?.firstOrNull()
|
KtLightAnnotationForSourceEntry(
|
||||||
?.obtainLightAnnotations(support, this)
|
lazyQualifiedName = { entry.analyzeAnnotation()?.fqName?.asString() },
|
||||||
|
kotlinOrigin = entry,
|
||||||
|
parent = this,
|
||||||
|
lazyClsDelegate = null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
override fun isVarArgs(): Boolean = false
|
override fun isVarArgs(): Boolean = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
public final class Test /* Test*/ {
|
||||||
|
@MyAnnotation5()
|
||||||
|
private java.lang.String bar;
|
||||||
|
|
||||||
|
@MyAnnotation()
|
||||||
|
@org.jetbrains.annotations.NotNull()
|
||||||
|
public final java.lang.String getBar();// getBar()
|
||||||
|
|
||||||
|
@MyAnnotation2()
|
||||||
|
public final void setBar(@MyAnnotation3() @org.jetbrains.annotations.NotNull() java.lang.String);// setBar(java.lang.String)
|
||||||
|
|
||||||
|
public Test(@MyAnnotation6() @org.jetbrains.annotations.NotNull() java.lang.String);// .ctor(java.lang.String)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// Test
|
||||||
|
annotation class MyAnnotation
|
||||||
|
annotation class MyAnnotation2
|
||||||
|
annotation class MyAnnotation3
|
||||||
|
annotation class MyAnnotation4
|
||||||
|
annotation class MyAnnotation5
|
||||||
|
annotation class MyAnnotation6
|
||||||
|
|
||||||
|
class Test(@get:MyAnnotation @set:MyAnnotation2 @setparam:MyAnnotation3 @property:MyAnnotation4 @field:MyAnnotation5 @param:MyAnnotation6 var bar: String)
|
||||||
+5
@@ -38,6 +38,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
|||||||
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotatedPropertyWithSites.kt")
|
||||||
|
public void testAnnotatedPropertyWithSites() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedPropertyWithSites.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AnnotationClass.kt")
|
@TestMetadata("AnnotationClass.kt")
|
||||||
public void testAnnotationClass() throws Exception {
|
public void testAnnotationClass() throws Exception {
|
||||||
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
||||||
|
|||||||
+5
@@ -38,6 +38,11 @@ public class UltraLightClassSanityTestGenerated extends AbstractUltraLightClassS
|
|||||||
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotatedPropertyWithSites.kt")
|
||||||
|
public void testAnnotatedPropertyWithSites() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedPropertyWithSites.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AnnotationClass.kt")
|
@TestMetadata("AnnotationClass.kt")
|
||||||
public void testAnnotationClass() throws Exception {
|
public void testAnnotationClass() throws Exception {
|
||||||
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
||||||
|
|||||||
Generated
+5
@@ -38,6 +38,11 @@ public class IdeCompiledLightClassTestGenerated extends AbstractIdeCompiledLight
|
|||||||
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotatedPropertyWithSites.kt")
|
||||||
|
public void testAnnotatedPropertyWithSites() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedPropertyWithSites.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AnnotationClass.kt")
|
@TestMetadata("AnnotationClass.kt")
|
||||||
public void testAnnotationClass() throws Exception {
|
public void testAnnotationClass() throws Exception {
|
||||||
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
||||||
|
|||||||
+5
@@ -38,6 +38,11 @@ public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest {
|
|||||||
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedParameterInInnerClassConstructor.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotatedPropertyWithSites.kt")
|
||||||
|
public void testAnnotatedPropertyWithSites() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/AnnotatedPropertyWithSites.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AnnotationClass.kt")
|
@TestMetadata("AnnotationClass.kt")
|
||||||
public void testAnnotationClass() throws Exception {
|
public void testAnnotationClass() throws Exception {
|
||||||
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user