From 3e3a4af652358214815ea28e094d6f4d2554bde8 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 16 Feb 2015 14:11:57 +0100 Subject: represent static methods as class object functions --- src/Java/JavaDocumentationBuilder.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/Java/JavaDocumentationBuilder.kt') diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt index d57ffb0c..8408d25a 100644 --- a/src/Java/JavaDocumentationBuilder.kt +++ b/src/Java/JavaDocumentationBuilder.kt @@ -110,8 +110,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions) } fun PsiMethod.build(): DocumentationNode { - val node = DocumentationNode(this, - if (isConstructor()) Kind.Constructor else Kind.Function, + val node = DocumentationNode(this, nodeKind(), if (isConstructor()) "" else getName()) if (!isConstructor()) { @@ -122,6 +121,12 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions) return node } + private fun PsiMethod.nodeKind(): Kind = when { + isConstructor() -> Kind.Constructor + hasModifierProperty(PsiModifier.STATIC) -> Kind.ClassObjectFunction + else -> Kind.Function + } + fun PsiParameter.build(): DocumentationNode { val node = DocumentationNode(this, Kind.Parameter) node.appendType(getType()) @@ -144,7 +149,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions) return } PsiModifier.MODIFIERS.forEach { - if (modifierList.hasExplicitModifier(it)) { + if (it != "static" && modifierList.hasExplicitModifier(it)) { val modifierNode = DocumentationNode(it, Content.Empty, Kind.Modifier) append(modifierNode, DocumentationReference.Kind.Detail) } -- cgit