diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-04 19:10:38 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-04 19:10:38 +0100 |
commit | 972118bcffbdf13ebd3aefd495618c4670bdc7b3 (patch) | |
tree | 1f72ad07c9e6e8b47fec518fc448fe8aaf18fd90 /src/Java | |
parent | fb2a0e82254d473216ced358c0d80f80c3738a03 (diff) | |
download | dokka-972118bcffbdf13ebd3aefd495618c4670bdc7b3.tar.gz dokka-972118bcffbdf13ebd3aefd495618c4670bdc7b3.tar.bz2 dokka-972118bcffbdf13ebd3aefd495618c4670bdc7b3.zip |
generate @deprecated tags for javadoc
Diffstat (limited to 'src/Java')
-rw-r--r-- | src/Java/JavaPsiDocumentationBuilder.kt | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Java/JavaPsiDocumentationBuilder.kt b/src/Java/JavaPsiDocumentationBuilder.kt index fc60450a..72f398ce 100644 --- a/src/Java/JavaPsiDocumentationBuilder.kt +++ b/src/Java/JavaPsiDocumentationBuilder.kt @@ -80,9 +80,9 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { } } - fun DocumentationNode(element: PsiNamedElement, - kind: Kind, - name: String = element.name ?: "<anonymous>"): DocumentationNode { + fun nodeForElement(element: PsiNamedElement, + kind: Kind, + name: String = element.name ?: "<anonymous>"): DocumentationNode { val (docComment, deprecatedContent) = docParser.parseDocumentation(element) val node = DocumentationNode(name, docComment, kind) if (element is PsiModifierListOwner) { @@ -100,6 +100,10 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { val deprecationNode = DocumentationNode("", deprecatedContent, Kind.Modifier) node.append(deprecationNode, DocumentationReference.Kind.Deprecation) } + if (element is PsiDocCommentOwner && element.isDeprecated && node.deprecation == null) { + val deprecationNode = DocumentationNode("", Content.of(ContentText("Deprecated")), Kind.Modifier) + node.append(deprecationNode, DocumentationReference.Kind.Deprecation) + } return node } @@ -140,7 +144,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { isAnnotationType -> DocumentationNode.Kind.AnnotationClass else -> DocumentationNode.Kind.Class } - val node = DocumentationNode(this, kind) + val node = nodeForElement(this, kind) superTypes.filter { !ignoreSupertype(it) }.forEach { node.appendType(it, Kind.Supertype) val superClass = it.resolve() @@ -169,7 +173,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { } fun PsiField.build(): DocumentationNode { - val node = DocumentationNode(this, nodeKind()) + val node = nodeForElement(this, nodeKind()) node.appendType(type) node.appendModifiers(this) register(this, node) @@ -182,7 +186,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { } fun PsiMethod.build(): DocumentationNode { - val node = DocumentationNode(this, nodeKind(), + val node = nodeForElement(this, nodeKind(), if (isConstructor) "<init>" else name) if (!isConstructor) { @@ -200,7 +204,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { } fun PsiParameter.build(): DocumentationNode { - val node = DocumentationNode(this, Kind.Parameter) + val node = nodeForElement(this, Kind.Parameter) node.appendType(type) if (type is PsiEllipsisType) { node.appendTextNode("vararg", Kind.Modifier, DocumentationReference.Kind.Detail) @@ -209,7 +213,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { } fun PsiTypeParameter.build(): DocumentationNode { - val node = DocumentationNode(this, Kind.TypeParameter) + val node = nodeForElement(this, Kind.TypeParameter) extendsListTypes.forEach { node.appendType(it, Kind.UpperBound) } implementsListTypes.forEach { node.appendType(it, Kind.UpperBound) } return node |