Sanitize block comment endings in generated Kotlin doc comments (#1830)

This commit is contained in:
Jen Basch
2026-08-25 08:27:30 -07:00
committed by GitHub
parent 7404f7d160
commit 79af6b1676
3 changed files with 36 additions and 1 deletions
@@ -2261,6 +2261,24 @@ class JavaCodeGeneratorTest {
)
}
@Test
fun `block comment escaping in doc comments`() {
val javaCode =
generateJavaCode(
"""
module my.mod
class Person {
/// This doc coment needs */ escaping
foo: Int
}
"""
.trimIndent(),
JavaCodeGeneratorOptions(generateJavadoc = true),
)
assertThat(javaCode).compilesSuccessfully().contains("*/")
}
private fun Map<String, String>.validateContents(
@Suppress("RemoveRedundantQualifierName") vararg assertions: kotlin.Pair<String, List<String>>
) {