Do not build light classes for decompiled enum entries

This commit is contained in:
Pavel V. Talanov
2015-07-21 18:25:14 +03:00
parent 4e0d2bc23c
commit edc3755b91
5 changed files with 26 additions and 1 deletions
@@ -223,6 +223,9 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
@Nullable
private static PsiClass getLightClassForDecompiledClassOrObject(@NotNull JetClassOrObject decompiledClassOrObject) {
if (decompiledClassOrObject instanceof JetEnumEntry) {
return null;
}
JetFile containingJetFile = decompiledClassOrObject.getContainingJetFile();
if (!containingJetFile.isCompiled()) {
return null;
@@ -248,7 +251,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
while (iterator.hasNext()) {
Name name = iterator.next();
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();
current = innerClass;
}
@@ -69,4 +69,9 @@ fun test() {
}
LocalClass(localClassProperty = 1).localClassProperty
}
enum class E {
ONE,
TWO
}
@@ -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
}
@@ -0,0 +1 @@
Value read (9: 7) E.ONE
@@ -100,6 +100,12 @@ public class KotlinFindUsagesWithLibraryTestGenerated extends AbstractKotlinFind
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")
public void testLibraryFunctionUsages() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/libraryUsages/kotlinLibrary/LibraryFunctionUsages.0.kt");