From 64e9c85c143efbedd7bf8b6a39dad2cec4345591 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 27 Dec 2016 12:31:15 +0300 Subject: [PATCH] Do not build file stubs for nested classes from .kotlin_metadata files Stubs for nested classes are going to be built inside the stubs for the corresponding outer classes, building them on the top level is just going to break everything (see EA-93105) --- .../decompiler/builtIns/KotlinBuiltInDecompiler.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt index 5f06aeb77ec..7854834c6b2 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt @@ -99,14 +99,14 @@ sealed class BuiltInDefinitionFile { val packageFqName = nameResolver.getPackageFqName(proto.`package`.getExtension(BuiltInsProtoBuf.packageFqName)) val classesToDecompile = - if (!isMetadata && FILTER_OUT_CLASSES_EXISTING_AS_JVM_CLASS_FILES) proto.class_List.filter { classProto -> - shouldDecompileBuiltInClass(nameResolver.getClassId(classProto.fqName)) + proto.class_List.filterNot { proto -> nameResolver.getClassId(proto.fqName).isNestedClass }.let { classes -> + if (isMetadata || !FILTER_OUT_CLASSES_EXISTING_AS_JVM_CLASS_FILES) classes + else classes.filter { classProto -> + shouldDecompileBuiltInClass(nameResolver.getClassId(classProto.fqName)) + } } - else proto.class_List private fun shouldDecompileBuiltInClass(classId: ClassId): Boolean { - if (classId.isNestedClass) return false - val realJvmClassFileName = classId.shortClassName.asString() + "." + JavaClassFileType.INSTANCE.defaultExtension return packageDirectory.findChild(realJvmClassFileName) == null }