aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-01-05 18:32:04 +0100
committerDmitry Jemerov <yole@jetbrains.com>2016-01-05 18:32:04 +0100
commitc59a3d8455ad45d679c47a387f854bdd81a01952 (patch)
treeb10a1db23597b4ed0b8030598bb01d7837a3e342 /core/src/main/kotlin
parentada91f40f716b20a69d8372dc5c6e250312543f7 (diff)
downloaddokka-c59a3d8455ad45d679c47a387f854bdd81a01952.tar.gz
dokka-c59a3d8455ad45d679c47a387f854bdd81a01952.tar.bz2
dokka-c59a3d8455ad45d679c47a387f854bdd81a01952.zip
don't include companion object members inherited from Any in class documentation
Diffstat (limited to 'core/src/main/kotlin')
-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 }