Light classes: getOwnInnerClasses() filters out inner classes with null names
#KT-13927 Fixed
This commit is contained in:
+6
-1
@@ -317,7 +317,12 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
|
|||||||
|
|
||||||
override fun getOwnInnerClasses(): List<PsiClass> {
|
override fun getOwnInnerClasses(): List<PsiClass> {
|
||||||
val result = ArrayList<PsiClass>()
|
val result = ArrayList<PsiClass>()
|
||||||
classOrObject.declarations.filterIsInstance<KtClassOrObject>().mapNotNullTo(result) { create(it) }
|
classOrObject.declarations.filterIsInstance<KtClassOrObject>()
|
||||||
|
// workaround for ClassInnerStuffCache not supporting classes with null names, see KT-13927
|
||||||
|
// inner classes with null names can't be searched for and can't be used from java anyway
|
||||||
|
// we can't prohibit creating light classes with null names either since they can contain members
|
||||||
|
.filter { it.name != null }
|
||||||
|
.mapNotNullTo(result) { create(it) }
|
||||||
|
|
||||||
if (classOrObject.hasInterfaceDefaultImpls) {
|
if (classOrObject.hasInterfaceDefaultImpls) {
|
||||||
result.add(KtLightClassForInterfaceDefaultImpls(classOrObject))
|
result.add(KtLightClassForInterfaceDefaultImpls(classOrObject))
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
public class InnerClassWithoutName {
|
||||||
|
public void uses() {
|
||||||
|
Test5 test5 = new Test5();
|
||||||
|
Test5.In1 in1 = test5.new In1();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class Test5 {
|
||||||
|
inner class In1 {}
|
||||||
|
inner class
|
||||||
|
}
|
||||||
+6
@@ -148,6 +148,12 @@ public class JavaAgainstKotlinSourceCheckerTestGenerated extends AbstractJavaAga
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/kotlinAndJavaChecker/javaWithKotlin"), Pattern.compile("^(.+)\\.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/kotlinAndJavaChecker/javaWithKotlin"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("InnerClassWithoutName.kt")
|
||||||
|
public void testInnerClassWithoutName() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/javaWithKotlin/InnerClassWithoutName.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("NoNotNullOnParameterInOverride.kt")
|
@TestMetadata("NoNotNullOnParameterInOverride.kt")
|
||||||
public void testNoNotNullOnParameterInOverride() throws Exception {
|
public void testNoNotNullOnParameterInOverride() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/javaWithKotlin/NoNotNullOnParameterInOverride.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/kotlinAndJavaChecker/javaWithKotlin/NoNotNullOnParameterInOverride.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user