Do not build light classes for decompiled enum entries
This commit is contained in:
+4
-1
@@ -223,6 +223,9 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static PsiClass getLightClassForDecompiledClassOrObject(@NotNull JetClassOrObject decompiledClassOrObject) {
|
private static PsiClass getLightClassForDecompiledClassOrObject(@NotNull JetClassOrObject decompiledClassOrObject) {
|
||||||
|
if (decompiledClassOrObject instanceof JetEnumEntry) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
JetFile containingJetFile = decompiledClassOrObject.getContainingJetFile();
|
JetFile containingJetFile = decompiledClassOrObject.getContainingJetFile();
|
||||||
if (!containingJetFile.isCompiled()) {
|
if (!containingJetFile.isCompiled()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -248,7 +251,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Name name = iterator.next();
|
Name name = iterator.next();
|
||||||
PsiClass innerClass = current.findInnerClassByName(name.asString(), false);
|
PsiClass innerClass = current.findInnerClassByName(name.asString(), false);
|
||||||
assert innerClass != null : "Could not find corresponding inner/nested class " + relativeFqName + "in class " + decompiledClassOrObject.getName() + "\n" +
|
assert innerClass != null : "Could not find corresponding inner/nested class " + relativeFqName + " in class " + decompiledClassOrObject.getFqName() + "\n" +
|
||||||
"File: " + decompiledClassOrObject.getContainingJetFile().getVirtualFile().getName();
|
"File: " + decompiledClassOrObject.getContainingJetFile().getVirtualFile().getName();
|
||||||
current = innerClass;
|
current = innerClass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,9 @@ fun test() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LocalClass(localClassProperty = 1).localClassProperty
|
LocalClass(localClassProperty = 1).localClassProperty
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class E {
|
||||||
|
ONE,
|
||||||
|
TWO
|
||||||
}
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetEnumEntry
|
||||||
|
// FIND_BY_REF
|
||||||
|
|
||||||
|
package usages
|
||||||
|
|
||||||
|
import library.E
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
E.<caret>ONE
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
Value read (9: 7) E.ONE
|
||||||
+6
@@ -100,6 +100,12 @@ public class KotlinFindUsagesWithLibraryTestGenerated extends AbstractKotlinFind
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("LibraryEnumEntryUsages.0.kt")
|
||||||
|
public void testLibraryEnumEntryUsages() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/libraryUsages/kotlinLibrary/LibraryEnumEntryUsages.0.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("LibraryFunctionUsages.0.kt")
|
@TestMetadata("LibraryFunctionUsages.0.kt")
|
||||||
public void testLibraryFunctionUsages() throws Exception {
|
public void testLibraryFunctionUsages() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/libraryUsages/kotlinLibrary/LibraryFunctionUsages.0.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/libraryUsages/kotlinLibrary/LibraryFunctionUsages.0.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user