aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-06-30 17:09:58 +0200
committerDmitry Jemerov <yole@jetbrains.com>2016-06-30 17:09:58 +0200
commitaf27102b662439b4f7ccdeaf2195c93ba533c7be (patch)
tree315c4b3943cf88b4d42de76f617bdfe32dbbf7a9
parentd1fc5f1610e646718afc6d9dfc6c5a3650350ea4 (diff)
downloaddokka-af27102b662439b4f7ccdeaf2195c93ba533c7be.tar.gz
dokka-af27102b662439b4f7ccdeaf2195c93ba533c7be.tar.bz2
dokka-af27102b662439b4f7ccdeaf2195c93ba533c7be.zip
Generate correct signature for methods with parameters of Java primitive types. Resolves #76
-rw-r--r--core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt1
-rw-r--r--core/src/test/kotlin/javadoc/JavadocTest.kt11
-rw-r--r--core/testdata/javadoc/paramlink.kt10
3 files changed, 22 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index 39ad79a6..d2748ee3 100644
--- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
+++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
@@ -15,6 +15,7 @@ fun getSignature(element: PsiElement?) = when(element) {
private fun PsiType.typeSignature(): String = when(this) {
is PsiArrayType -> "Array((${componentType.typeSignature()}))"
+ is PsiPrimitiveType -> "kotlin." + canonicalText.capitalize()
else -> mapTypeName(this)
}
diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt
index 614a786e..48bc9f6a 100644
--- a/core/src/test/kotlin/javadoc/JavadocTest.kt
+++ b/core/src/test/kotlin/javadoc/JavadocTest.kt
@@ -76,6 +76,17 @@ class JavadocTest {
}
}
+ @Test fun testLinkWithParam() {
+ verifyJavadoc("testdata/javadoc/paramlink.kt", withKotlinRuntime = true) { doc ->
+ val classDoc = doc.classNamed("demo.Apple")!!
+ assertNotNull(classDoc.asClassDoc())
+ val tags = classDoc.inlineTags().filterIsInstance<SeeTagAdapter>()
+ assertEquals(2, tags.size)
+ val linkTag = tags[1] as SeeMethodTagAdapter
+ assertEquals("cutIntoPieces", linkTag.method.name())
+ }
+ }
+
private fun verifyJavadoc(name: String,
withJdk: Boolean = false,
withKotlinRuntime: Boolean = false,
diff --git a/core/testdata/javadoc/paramlink.kt b/core/testdata/javadoc/paramlink.kt
new file mode 100644
index 00000000..48972a22
--- /dev/null
+++ b/core/testdata/javadoc/paramlink.kt
@@ -0,0 +1,10 @@
+package demo
+
+/**
+ * You can [eat] it or cut it into slices using [cutIntoPieces]
+ */
+interface Apple {
+ fun eat()
+
+ fun cutIntoPieces(pieces: Int)
+}