Skip printing visibility modifiers in dac-as-java summaries
This makes it match doclava, dokka `html` and dokka `dac` outputs.
The new logic matches KotlinLanguageService#renderModifier
Test: modified existing test expectations.
Bug: 146661040
Change-Id: Iba6419aacd85320d6c72e991bfec496c3ce1f85f
diff --git a/core/src/main/kotlin/Languages/NewJavaLanguageService.kt b/core/src/main/kotlin/Languages/NewJavaLanguageService.kt
index a4b3de5..793706a 100644
--- a/core/src/main/kotlin/Languages/NewJavaLanguageService.kt
+++ b/core/src/main/kotlin/Languages/NewJavaLanguageService.kt
@@ -11,6 +11,8 @@
return true
}
+ private val fullOnlyModifiers = setOf("public", "protected", "private")
+
override fun render(node: DocumentationNode, renderMode: RenderMode): ContentNode {
return content {
(when (node.kind) {
@@ -39,7 +41,11 @@
when (node.name) {
"open", "internal" -> {
}
- else -> super.renderModifier(block, node, renderMode, nowrap)
+ else -> {
+ if (node.name !in fullOnlyModifiers || renderMode == RenderMode.FULL) {
+ super.renderModifier(block, node, renderMode, nowrap)
+ }
+ }
}
}
diff --git a/core/testdata/format/dac-as-java/javaSeeTag.html b/core/testdata/format/dac-as-java/javaSeeTag.html
index 0dc5dcb..44ac168 100644
--- a/core/testdata/format/dac-as-java/javaSeeTag.html
+++ b/core/testdata/format/dac-as-java/javaSeeTag.html
@@ -41,7 +41,7 @@
</th>
</tr>
<tr>
- <td><span class="keyword">public</span> <span class="identifier">void</span></td>
+ <td><span class="identifier">void</span></td>
<td>
<div><code><a href="#bar()">bar</a>()</code></div>
<p></p>