Find Java usage of @JvmField declared in primary constructor (KT-18322)
#KT-18322 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
8b566fda76
commit
bee7736baf
+5
@@ -233,6 +233,11 @@ class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, ReferencesSearc
|
||||
|
||||
is KtParameter -> {
|
||||
searchPropertyAccessorMethods(element)
|
||||
if (element.getStrictParentOfType<KtPrimaryConstructor>() != null) {
|
||||
// Simple parameters without val and var shouldn't be processed here because of local search scope
|
||||
val methods = LightClassUtil.getLightClassPropertyMethods(element)
|
||||
methods.allDeclarations.forEach { searchNamedElement(it) }
|
||||
}
|
||||
}
|
||||
|
||||
is KtLightMethod -> {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
|
||||
// OPTIONS: usages
|
||||
class Test(@JvmField val <caret>foo: String) {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class JavaClass {
|
||||
void test() {
|
||||
System.out.println(new Test("").foo);
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Unclassified usage 3 System.out.println(new Test("").foo);
|
||||
@@ -973,6 +973,11 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
|
||||
runTest("idea/testData/findUsages/kotlin/findPropertyUsages/javaPropertyUsages2.0.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaPropertyUsages3.0.kt")
|
||||
public void testJavaPropertyUsages3() throws Exception {
|
||||
runTest("idea/testData/findUsages/kotlin/findPropertyUsages/javaPropertyUsages3.0.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaPropertyWriteUsages.0.kt")
|
||||
public void testJavaPropertyWriteUsages() throws Exception {
|
||||
runTest("idea/testData/findUsages/kotlin/findPropertyUsages/javaPropertyWriteUsages.0.kt");
|
||||
|
||||
Reference in New Issue
Block a user