diff options
-rw-r--r-- | javadoc/src/main/kotlin/docbase.kt | 10 | ||||
-rw-r--r-- | src/Java/JavaPsiDocumentationBuilder.kt | 7 |
2 files changed, 9 insertions, 8 deletions
diff --git a/javadoc/src/main/kotlin/docbase.kt b/javadoc/src/main/kotlin/docbase.kt index 8f90edfc..22db0a09 100644 --- a/javadoc/src/main/kotlin/docbase.kt +++ b/javadoc/src/main/kotlin/docbase.kt @@ -171,16 +171,14 @@ open class TypeAdapter(override val module: ModuleNodeAdapter, override val node override fun simpleTypeName(): String = typeName() // TODO difference typeName() vs simpleTypeName() override fun dimension(): String = Collections.nCopies(javaLanguageService.getArrayDimension(node), "[]").joinToString("") - override fun isPrimitive(): Boolean = node.name in setOf("Int", "Long", "Short", "Byte", "Char", "Double", "Float", "Boolean", "Unit") + override fun isPrimitive(): Boolean = simpleTypeName() in setOf("int", "long", "short", "byte", "char", "double", "float", "boolean", "void") + override fun asClassDoc(): ClassDoc? = if (isPrimitive) null else elementType?.asClassDoc() ?: when (node.kind) { - DocumentationNode.Kind.Class, + in DocumentationNode.Kind.classLike, DocumentationNode.Kind.ExternalClass, - DocumentationNode.Kind.Interface, - DocumentationNode.Kind.Object, - DocumentationNode.Kind.Exception, - DocumentationNode.Kind.Enum -> ClassDocumentationNodeAdapter(module, node) + DocumentationNode.Kind.Exception -> ClassDocumentationNodeAdapter(module, node) else -> when { node.links.isNotEmpty() -> TypeAdapter(module, node.links.first()).asClassDoc() diff --git a/src/Java/JavaPsiDocumentationBuilder.kt b/src/Java/JavaPsiDocumentationBuilder.kt index 72f398ce..3c9875cd 100644 --- a/src/Java/JavaPsiDocumentationBuilder.kt +++ b/src/Java/JavaPsiDocumentationBuilder.kt @@ -20,9 +20,9 @@ private fun PsiType.typeSignature(): String = when(this) { private fun mapTypeName(psiType: PsiType): String = when (psiType) { is PsiPrimitiveType -> psiType.canonicalText - is PsiClassType -> psiType.className + is PsiClassType -> psiType.resolve()?.qualifiedName ?: psiType.className is PsiEllipsisType -> mapTypeName(psiType.componentType) - is PsiArrayType -> mapTypeName(psiType.componentType) + "[]" + is PsiArrayType -> "Array" else -> psiType.canonicalText } @@ -243,6 +243,9 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { node.appendDetails(parameters) { build(Kind.Type) } link(node, resolve()) } + if (this is PsiArrayType && this !is PsiEllipsisType) { + node.append(componentType.build(Kind.Type), DocumentationReference.Kind.Detail) + } return node } |