aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-04-29 15:29:16 +0200
committerDmitry Jemerov <yole@jetbrains.com>2016-04-29 15:29:16 +0200
commit3356187ba8742cb987ca2c7bd543e2890bcedf29 (patch)
treee253b56b5ac180535caf4d77160b33593f9770bf /core/src/main/kotlin
parentad8af9c7d489026bbab66c1e79e9e2c3ffb694be (diff)
downloaddokka-3356187ba8742cb987ca2c7bd543e2890bcedf29.tar.gz
dokka-3356187ba8742cb987ca2c7bd543e2890bcedf29.tar.bz2
dokka-3356187ba8742cb987ca2c7bd543e2890bcedf29.zip
don't report type parameters for array classes; don't report qualified names for stdlib types such as java.lang.String
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/Languages/JavaLanguageService.kt3
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt2
-rw-r--r--core/src/main/kotlin/javadoc/docbase.kt10
3 files changed, 10 insertions, 5 deletions
diff --git a/core/src/main/kotlin/Languages/JavaLanguageService.kt b/core/src/main/kotlin/Languages/JavaLanguageService.kt
index f3b567d3..59bedd02 100644
--- a/core/src/main/kotlin/Languages/JavaLanguageService.kt
+++ b/core/src/main/kotlin/Languages/JavaLanguageService.kt
@@ -45,7 +45,8 @@ class JavaLanguageService : LanguageService {
fun getArrayElementType(node: DocumentationNode): DocumentationNode? = when (node.qualifiedName()) {
"kotlin.Array" ->
- node.details(NodeKind.Type).singleOrNull()?.let { et -> getArrayElementType(et) ?: et } ?: DocumentationNode("Object", node.content, NodeKind.ExternalClass)
+ node.details(NodeKind.Type).singleOrNull()?.let { et -> getArrayElementType(et) ?: et } ?:
+ DocumentationNode("Object", node.content, NodeKind.ExternalClass)
"kotlin.IntArray", "kotlin.LongArray", "kotlin.ShortArray", "kotlin.ByteArray",
"kotlin.CharArray", "kotlin.DoubleArray", "kotlin.FloatArray", "kotlin.BooleanArray" ->
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index 33543aff..ebfce907 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -174,3 +174,5 @@ fun DocumentationNode.qualifiedName(): String {
}
return path.drop(1).map { it.name }.filter { it.length > 0 }.joinToString(".")
}
+
+fun DocumentationNode.simpleName() = name.substringAfterLast('.')
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<out ConstructorDoc> = classNode.members(NodeKind.Constructor).map { ConstructorAdapter(module, it) }.toTypedArray()