Skip to content

Commit

Permalink
Kotlin#465 - fix javadoc parameters generation for java classes
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystianUjma committed May 23, 2019
1 parent fd6c34d commit 9d7f9fe
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
10 changes: 7 additions & 3 deletions core/src/main/kotlin/javadoc/docbase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
)
.distinctBy { it.parameterName }
.toTypedArray()
8 changes: 8 additions & 0 deletions core/src/test/kotlin/javadoc/JavadocTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/kotlin/model/KotlinAsJavaTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
17 changes: 17 additions & 0 deletions core/testdata/javadoc/functionParameters.java
Original file line number Diff line number Diff line change
@@ -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) {

}
}

0 comments on commit 9d7f9fe

Please sign in to comment.