From 3356187ba8742cb987ca2c7bd543e2890bcedf29 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 29 Apr 2016 15:29:16 +0200 Subject: don't report type parameters for array classes; don't report qualified names for stdlib types such as java.lang.String --- core/src/main/kotlin/javadoc/docbase.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'core/src/main/kotlin/javadoc') diff --git a/core/src/main/kotlin/javadoc/docbase.kt b/core/src/main/kotlin/javadoc/docbase.kt index 795ba84a..20d74088 100644 --- a/core/src/main/kotlin/javadoc/docbase.kt +++ b/core/src/main/kotlin/javadoc/docbase.kt @@ -173,7 +173,7 @@ open class TypeAdapter(override val module: ModuleNodeAdapter, override val node private val javaLanguageService = JavaLanguageService() override fun qualifiedTypeName(): String = javaLanguageService.getArrayElementType(node)?.qualifiedNameFromType() ?: node.qualifiedNameFromType() - override fun typeName(): String = javaLanguageService.getArrayElementType(node)?.name ?: node.name + override fun typeName(): String = javaLanguageService.getArrayElementType(node)?.simpleName() ?: node.simpleName() override fun simpleTypeName(): String = typeName() // TODO difference typeName() vs simpleTypeName() override fun dimension(): String = Collections.nCopies(javaLanguageService.getArrayDimension(node), "[]").joinToString("") @@ -194,8 +194,10 @@ open class TypeAdapter(override val module: ModuleNodeAdapter, override val node override fun asTypeVariable(): TypeVariable? = if (node.kind == NodeKind.TypeParameter) TypeVariableAdapter(module, node) else null override fun asParameterizedType(): ParameterizedType? = - if (node.details(NodeKind.Type).isNotEmpty()) ParameterizedTypeAdapter(module, node) - else null // TODO it should ignore dimensions + if (node.details(NodeKind.Type).isNotEmpty() && javaLanguageService.getArrayElementType(node) == null) + ParameterizedTypeAdapter(module, node) + else + null override fun asAnnotationTypeDoc(): AnnotationTypeDoc? = if (node.kind == NodeKind.AnnotationClass) AnnotationTypeDocAdapter(module, node) else null override fun asAnnotatedType(): AnnotatedType? = if (node.annotations.isNotEmpty()) AnnotatedTypeAdapter(module, node) else null @@ -389,7 +391,7 @@ open class ClassDocumentationNodeAdapter(module: ModuleNodeAdapter, val classNod if (parent?.kind in NodeKind.classLike) { return parent!!.name + "." + classNode.name } - return classNode.name + return classNode.simpleName() } override fun constructors(filter: Boolean): Array = classNode.members(NodeKind.Constructor).map { ConstructorAdapter(module, it) }.toTypedArray() -- cgit