aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index f92d15f9..3a35b764 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.resolve.constants.TypedCompileTimeConstant
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.isDocumentedAnnotation
+import org.jetbrains.kotlin.resolve.findTopMostOverriddenDescriptors
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
@@ -311,7 +312,9 @@ class DocumentationBuilder
}
val companionObjectDescriptor = companionObjectDescriptor
if (companionObjectDescriptor != null) {
- node.appendMembers(companionObjectDescriptor.defaultType.memberScope.getContributedDescriptors())
+ val descriptors = companionObjectDescriptor.defaultType.memberScope.getContributedDescriptors()
+ val descriptorsToDocument = descriptors.filter { it !is CallableDescriptor || !it.isInheritedFromAny() }
+ node.appendMembers(descriptorsToDocument)
}
node.appendAnnotations(this)
node.appendModifiers(this)
@@ -320,6 +323,12 @@ class DocumentationBuilder
return node
}
+ fun CallableDescriptor.isInheritedFromAny(): Boolean {
+ return findTopMostOverriddenDescriptors().any {
+ DescriptorUtils.getFqNameSafe(it.containingDeclaration).asString() == "kotlin.Any"
+ }
+ }
+
fun ClassDescriptor.isSubclassOfThrowable(): Boolean =
defaultType.supertypes().any { it.constructor.declarationDescriptor == builtIns.throwable }