aboutsummaryrefslogtreecommitdiff
path: root/javadoc/src/main
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-10-30 18:43:48 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-10-30 18:43:48 +0100
commite4b2ae90bf0e84f76ceb7c56b7c128d28adad917 (patch)
treeb1e7d86b808b41909679d44da8ac97bec1928c44 /javadoc/src/main
parent17492c5f48c459dd44eafb0e747c1164193ca7f7 (diff)
downloaddokka-e4b2ae90bf0e84f76ceb7c56b7c128d28adad917.tar.gz
dokka-e4b2ae90bf0e84f76ceb7c56b7c128d28adad917.tar.bz2
dokka-e4b2ae90bf0e84f76ceb7c56b7c128d28adad917.zip
initial support for generating javadoc from Kotlin light classes
Diffstat (limited to 'javadoc/src/main')
-rw-r--r--javadoc/src/main/kotlin/docbase.kt15
-rw-r--r--javadoc/src/main/kotlin/dokka-adapters.kt9
2 files changed, 17 insertions, 7 deletions
diff --git a/javadoc/src/main/kotlin/docbase.kt b/javadoc/src/main/kotlin/docbase.kt
index 9cb0148d..06bbaa58 100644
--- a/javadoc/src/main/kotlin/docbase.kt
+++ b/javadoc/src/main/kotlin/docbase.kt
@@ -15,7 +15,7 @@ private interface HasDocumentationNode {
}
open class DocumentationNodeBareAdapter(override val node: DocumentationNode) : Doc, HasDocumentationNode {
- private var rawCommentText_ = rawCommentText
+ private var rawCommentText_: String? = null
override fun name(): String = node.name
override fun position(): SourcePosition? = SourcePositionAdapter(node)
@@ -31,7 +31,7 @@ open class DocumentationNodeBareAdapter(override val node: DocumentationNode) :
rawCommentText_ = rawDocumentation ?: ""
}
- override fun getRawCommentText(): String = rawCommentText_
+ override fun getRawCommentText(): String = rawCommentText_ ?: ""
override fun isError(): Boolean = false
override fun isException(): Boolean = node.kind == DocumentationNode.Kind.Exception
@@ -357,7 +357,14 @@ class FieldAdapter(module: ModuleNodeAdapter, node: DocumentationNode) : Documen
override fun isVolatile(): Boolean = node.hasAnnotation(Volatile::class)
}
-open class ClassDocumentationNodeAdapter(module: ModuleNodeAdapter, val classNode: DocumentationNode) : DocumentationNodeAdapter(module, classNode), Type by TypeAdapter(module, classNode), ProgramElementDoc by ProgramElementAdapter(module, classNode), ClassDoc {
+open class ClassDocumentationNodeAdapter(module: ModuleNodeAdapter, val classNode: DocumentationNode, val name: String = classNode.name)
+ : DocumentationNodeAdapter(module, classNode),
+ Type by TypeAdapter(module, classNode),
+ ProgramElementDoc by ProgramElementAdapter(module, classNode),
+ ClassDoc {
+
+ override fun name(): String = name
+
override fun constructors(filter: Boolean): Array<out ConstructorDoc> = classNode.members(DocumentationNode.Kind.Constructor).map { ConstructorAdapter(module, it) }.toTypedArray()
override fun constructors(): Array<out ConstructorDoc> = constructors(true)
override fun importedPackages(): Array<out PackageDoc> = emptyArray()
@@ -419,7 +426,7 @@ open class ClassDocumentationNodeAdapter(module: ModuleNodeAdapter, val classNod
return false
}
- override fun innerClasses(): Array<out ClassDoc> = classNode.members(DocumentationNode.Kind.Class).map { ClassDocumentationNodeAdapter(module, it) }.toTypedArray()
+ override fun innerClasses(): Array<out ClassDoc> = classNode.members(DocumentationNode.Kind.Class).map { ClassDocumentationNodeAdapter(module, it, name + "." + it.name) }.toTypedArray()
override fun innerClasses(filter: Boolean): Array<out ClassDoc> = innerClasses()
}
diff --git a/javadoc/src/main/kotlin/dokka-adapters.kt b/javadoc/src/main/kotlin/dokka-adapters.kt
index 0f7c53d7..a863faf7 100644
--- a/javadoc/src/main/kotlin/dokka-adapters.kt
+++ b/javadoc/src/main/kotlin/dokka-adapters.kt
@@ -1,10 +1,11 @@
package org.jetbrains.dokka.javadoc
+import com.google.inject.Inject
import com.sun.tools.doclets.formats.html.HtmlDoclet
import org.jetbrains.dokka.*
import org.jetbrains.dokka.Formats.FormatDescriptor
-class JavadocGenerator(val conf: DokkaGenerator) : Generator {
+class JavadocGenerator @Inject constructor (val conf: DokkaGenerator) : Generator {
override fun buildPages(nodes: Iterable<DocumentationNode>) {
val module = nodes.single() as DocumentationModule
@@ -24,6 +25,8 @@ class JavadocFormatDescriptor : FormatDescriptor {
get() = null
override val generatorServiceClass: Class<out Generator>
- get() = javaClass<JavadocGenerator>()
-}
+ get() = JavadocGenerator::class.java
+ override val packageDocumentationBuilderServiceClass: Class<out PackageDocumentationBuilder>?
+ get() = KotlinAsJavaDocumentationBuilder::class.java
+}