From af27102b662439b4f7ccdeaf2195c93ba533c7be Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 30 Jun 2016 17:09:58 +0200 Subject: Generate correct signature for methods with parameters of Java primitive types. Resolves #76 --- core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 1 + core/src/test/kotlin/javadoc/JavadocTest.kt | 11 +++++++++++ 2 files changed, 12 insertions(+) (limited to 'core/src') 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() + 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, -- cgit