From 6051ab5051be76d6c830a9996901bfbb9e1f901e Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 31 Mar 2016 15:38:07 +0200 Subject: Fix the implementation of containingClass() in javadoc adapters. Resolves #57 --- core/src/main/kotlin/javadoc/docbase.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/javadoc/docbase.kt b/core/src/main/kotlin/javadoc/docbase.kt index db5f201e..4298316f 100644 --- a/core/src/main/kotlin/javadoc/docbase.kt +++ b/core/src/main/kotlin/javadoc/docbase.kt @@ -156,12 +156,10 @@ class ProgramElementAdapter(module: ModuleNodeAdapter, node: DocumentationNode) var owner = node.owner while (owner != null) { - when (owner.kind) { - NodeKind.Class, - NodeKind.Interface, - NodeKind.Enum -> return ClassDocumentationNodeAdapter(module, owner) - else -> owner = owner.owner + if (owner.kind in NodeKind.classLike) { + return ClassDocumentationNodeAdapter(module, owner) } + owner = owner.owner } return null @@ -346,6 +344,10 @@ open class ExecutableMemberAdapter(module: ModuleNodeAdapter, node: Documentatio class ConstructorAdapter(module: ModuleNodeAdapter, node: DocumentationNode) : ExecutableMemberAdapter(module, node), ConstructorDoc { override fun name(): String = node.owner?.name ?: throw IllegalStateException("No owner for $node") + + override fun containingClass(): ClassDoc? { + return super.containingClass() + } } class MethodAdapter(module: ModuleNodeAdapter, node: DocumentationNode) : DocumentationNodeAdapter(module, node), ExecutableMemberDoc by ExecutableMemberAdapter(module, node), MethodDoc { -- cgit