aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-13 17:55:18 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-13 17:55:18 +0100
commitce29c52ff50c592b724bb1ef1b06d3625679ebfa (patch)
tree4fa11e97b0752b372c262cb7c722d906ef01bd81 /src/Java
parent2527b962c394511ef90d9d76fe66a39caeea436e (diff)
downloaddokka-ce29c52ff50c592b724bb1ef1b06d3625679ebfa.tar.gz
dokka-ce29c52ff50c592b724bb1ef1b06d3625679ebfa.tar.bz2
dokka-ce29c52ff50c592b724bb1ef1b06d3625679ebfa.zip
handle Java constructors nicely
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/JavaDocumentationBuilder.kt15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 879c0b2c..fdf5c665 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -32,9 +32,11 @@ public class JavaDocumentationBuilder() {
return result
}
- fun DocumentationNode(element: PsiNamedElement, kind: Kind): DocumentationNode {
+ fun DocumentationNode(element: PsiNamedElement,
+ kind: Kind,
+ name: String = element.getName() ?: "<anonymous>"): DocumentationNode {
val docComment = if (element is PsiDocCommentOwner) parseDocumentation(element.getDocComment()) else Content.Empty
- val node = DocumentationNode(element.getName() ?: "<anonymous>", docComment, kind)
+ val node = DocumentationNode(name, docComment, kind)
if (element is PsiModifierListOwner) {
node.appendModifiers(element)
}
@@ -71,8 +73,13 @@ public class JavaDocumentationBuilder() {
}
fun PsiMethod.build(): DocumentationNode {
- val node = DocumentationNode(this, Kind.Function)
- node.appendType(getReturnType())
+ val node = DocumentationNode(this,
+ if (isConstructor()) Kind.Constructor else Kind.Function,
+ if (isConstructor()) "<init>" else getName())
+
+ if (!isConstructor()) {
+ node.appendType(getReturnType())
+ }
node.appendDetails(getParameterList().getParameters()) { build() }
node.appendDetails(getTypeParameters()) { build() }
return node