diff options
author | KrystianUjma <kujma@virtuslab.com> | 2019-05-23 16:26:02 +0200 |
---|---|---|
committer | KrystianUjma <kujma@virtuslab.com> | 2019-05-23 16:26:02 +0200 |
commit | 9d7f9fec41d33a636b19125b582c2aeb24a8b6e5 (patch) | |
tree | d1ecf0f4f34bbf4f1015d48c81f5fa11665d30d2 /core | |
parent | fd6c34d92b7409d3aedd9416c7b06f9c48fe2631 (diff) | |
download | dokka-9d7f9fec41d33a636b19125b582c2aeb24a8b6e5.tar.gz dokka-9d7f9fec41d33a636b19125b582c2aeb24a8b6e5.tar.bz2 dokka-9d7f9fec41d33a636b19125b582c2aeb24a8b6e5.zip |
#465 - fix javadoc parameters generation for java classes
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/javadoc/docbase.kt | 10 | ||||
-rw-r--r-- | core/src/test/kotlin/javadoc/JavadocTest.kt | 8 | ||||
-rw-r--r-- | core/src/test/kotlin/model/KotlinAsJavaTest.kt | 2 | ||||
-rw-r--r-- | core/testdata/javadoc/functionParameters.java | 17 |
4 files changed, 33 insertions, 4 deletions
diff --git a/core/src/main/kotlin/javadoc/docbase.kt b/core/src/main/kotlin/javadoc/docbase.kt index ace4ae0c..62d0ee26 100644 --- a/core/src/main/kotlin/javadoc/docbase.kt +++ b/core/src/main/kotlin/javadoc/docbase.kt @@ -531,7 +531,11 @@ private fun DocumentationNodeAdapter.collectParamTags(kind: NodeKind, sectionFil + node.content.sections .filter(sectionFilter) - .map { ParamTagAdapter(module, this, it.subjectName ?: "?", true, it.children) } + .map { + ParamTagAdapter(module, this, it.subjectName ?: "?", true, + it.children.filterNot { contentNode -> contentNode is LazyContentBlock } ) - .distinctBy { it.parameterName } - .toTypedArray()
\ No newline at end of file + } + ) + .distinctBy { it.parameterName } + .toTypedArray()
\ No newline at end of file diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt index d4f82571..64ada1d5 100644 --- a/core/src/test/kotlin/javadoc/JavadocTest.kt +++ b/core/src/test/kotlin/javadoc/JavadocTest.kt @@ -304,6 +304,14 @@ class JavadocTest { } } + @Test + fun functionParameters() { + verifyJavadoc("testdata/javadoc/functionParameters.java") { doc -> + val tags = doc.classNamed("bar.Foo")!!.methods().first().paramTags() + assertEquals((tags.first() as ParamTagAdapter).content.size, 1) + assertEquals((tags[1] as ParamTagAdapter).content.size, 1) + } + } private fun verifyJavadoc(name: String, modelConfig: ModelConfig = ModelConfig(), diff --git a/core/src/test/kotlin/model/KotlinAsJavaTest.kt b/core/src/test/kotlin/model/KotlinAsJavaTest.kt index b5c15618..8249dd0f 100644 --- a/core/src/test/kotlin/model/KotlinAsJavaTest.kt +++ b/core/src/test/kotlin/model/KotlinAsJavaTest.kt @@ -5,8 +5,8 @@ import org.jetbrains.dokka.NodeKind import org.jetbrains.dokka.Platform import org.jetbrains.dokka.RefKind import org.junit.Assert -import org.junit.Test import org.junit.Assert.assertEquals +import org.junit.Test class KotlinAsJavaTest { @Test fun function() { diff --git a/core/testdata/javadoc/functionParameters.java b/core/testdata/javadoc/functionParameters.java new file mode 100644 index 00000000..8d5f5143 --- /dev/null +++ b/core/testdata/javadoc/functionParameters.java @@ -0,0 +1,17 @@ +package bar; + +/** + * Foo + */ + +public class Foo { + + /** perfom request + * + * @param name user name + * @param password user password + */ + public void request(String name, String password) { + + } +}
\ No newline at end of file |