Go to Declaration does not work on usage of constant from class object in Java (KT-6172)
#KT-6172 Fixed
This commit is contained in:
@@ -1001,7 +1001,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
PropertyDescriptor property = info.descriptor;
|
||||
|
||||
Type type = typeMapper.mapType(property);
|
||||
FieldVisitor fv = v.newField(OtherOrigin(property), ACC_STATIC | ACC_FINAL | ACC_PUBLIC, context.getFieldName(property, false),
|
||||
FieldVisitor fv = v.newField(Synthetic(DescriptorToSourceUtils.descriptorToDeclaration(property), property),
|
||||
ACC_STATIC | ACC_FINAL | ACC_PUBLIC, context.getFieldName(property, false),
|
||||
type.getDescriptor(), typeMapper.mapFieldSignature(property.getType()),
|
||||
info.defaultValue);
|
||||
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetProperty
|
||||
// OPTIONS: usages
|
||||
package server
|
||||
|
||||
trait Some {
|
||||
class object {
|
||||
val <caret>XX = 1
|
||||
}
|
||||
}
|
||||
|
||||
val a = Some.XX
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package client;
|
||||
|
||||
import server.*;
|
||||
|
||||
class Client {
|
||||
void fooBar() {
|
||||
int i = Some.XX;
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Unclassified usage (7: 22) int i = Some.XX;
|
||||
Value read (11: 14) val a = Some.XX
|
||||
@@ -0,0 +1,9 @@
|
||||
import k.StaticFieldInClassObjectInTrait;
|
||||
|
||||
public class ClassObjectField {
|
||||
public static void foo() {
|
||||
Object object = StaticFieldInClassObjectInTrait.<caret>XX;
|
||||
}
|
||||
}
|
||||
|
||||
// REF: (k.StaticFieldInClassObjectInTrait).XX
|
||||
@@ -0,0 +1,9 @@
|
||||
import k.PlatformStaticFun;
|
||||
|
||||
public class TestPlatformStaticFun {
|
||||
public static void foo() {
|
||||
PlatformStaticFun.<caret>test();
|
||||
}
|
||||
}
|
||||
|
||||
// REF: (in k.PlatformStaticFun).test()
|
||||
@@ -1,5 +1,7 @@
|
||||
package k
|
||||
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class Class() {
|
||||
public val prop: Int = 0
|
||||
fun function() = 1
|
||||
@@ -21,4 +23,20 @@ public class ClassWithClassObject {
|
||||
|
||||
public object KotlinObject {
|
||||
fun f() = 1
|
||||
}
|
||||
|
||||
public trait StaticFieldInClassObjectInTrait {
|
||||
class object {
|
||||
public val XX: String = "xx"
|
||||
}
|
||||
}
|
||||
|
||||
object PlatformStaticFun {
|
||||
platformStatic
|
||||
fun test() {
|
||||
}
|
||||
}
|
||||
|
||||
trait TraitNoImpl {
|
||||
fun foo()
|
||||
}
|
||||
@@ -696,6 +696,12 @@ public class JetFindUsagesTestGenerated extends AbstractJetFindUsagesTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinClassObjectPropertyUsage.0.kt")
|
||||
public void testKotlinClassObjectPropertyUsage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/findPropertyUsages/kotlinClassObjectPropertyUsage.0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinLocalPropertyUsages1.0.kt")
|
||||
public void testKotlinLocalPropertyUsages1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/findPropertyUsages/kotlinLocalPropertyUsages1.0.kt");
|
||||
|
||||
@@ -48,6 +48,12 @@ public class ReferenceResolveInJavaTestGenerated extends AbstractReferenceResolv
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectStaticField.java")
|
||||
public void testClassObjectStaticField() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/referenceInJava/ClassObjectStaticField.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Constructor.java")
|
||||
public void testConstructor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/referenceInJava/Constructor.java");
|
||||
@@ -83,4 +89,10 @@ public class ReferenceResolveInJavaTestGenerated extends AbstractReferenceResolv
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/referenceInJava/PackageFacade.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformStaticFun.java")
|
||||
public void testPlatformStaticFun() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/referenceInJava/PlatformStaticFun.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user