when finding usages of parameter of annotation class primary constructor, search also for light method generated from that parameter

#KT-9399 Fixed
This commit is contained in:
Dmitry Jemerov
2016-06-03 20:42:46 +02:00
parent 5161b6bfe0
commit 7e2ce2d4e0
7 changed files with 29 additions and 0 deletions
@@ -273,6 +273,7 @@ class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, ReferencesSearc
is KtParameter -> {
searchPropertyMethods(queryParameters, element)
runReadAction {
val componentFunctionDescriptor = element.dataClassComponentFunction()
if (componentFunctionDescriptor != null) {
val containingClass = element.getStrictParentOfType<KtClassOrObject>()?.toLightClass()
@@ -0,0 +1,4 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
annotation class KotlinAnnForJava(val <caret>p: String)
@@ -0,0 +1 @@
@KotlinAnnForJava(p = "a") public class JavaClassForKotlin {}
@@ -0,0 +1 @@
Unclassified usage 1 @KotlinAnnForJava(p = "a") public class JavaClassForKotlin {}
@@ -804,6 +804,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/findUsages/kotlin/findParameterUsages"), Pattern.compile("^(.+)\\.0\\.kt$"), true);
}
@TestMetadata("kotlinAnnotationConstructorParameterUsages.0.kt")
public void testKotlinAnnotationConstructorParameterUsages() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/findParameterUsages/kotlinAnnotationConstructorParameterUsages.0.kt");
doTest(fileName);
}
@TestMetadata("kotlinComponentFunctionParameterUsages.0.kt")
public void testKotlinComponentFunctionParameterUsages() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/findParameterUsages/kotlinComponentFunctionParameterUsages.0.kt");