[java] annotations in generated module javadoc (IDEA-177945)

This commit is contained in:
Roman Shevchenko
2017-08-24 16:29:03 +03:00
parent 2dc6164e4b
commit 5290f9fdf6
2 changed files with 8 additions and 2 deletions
@@ -730,6 +730,8 @@ public class JavaDocInfoGenerator {
private void generateModuleJavaDoc(StringBuilder buffer, PsiJavaModule module, boolean generatePrologueAndEpilogue) {
if (generatePrologueAndEpilogue) generatePrologue(buffer);
generateAnnotations(buffer, module, SignaturePlace.Javadoc, true);
buffer.append("<pre>module <b>").append(module.getName()).append("</b></pre>");
PsiDocComment comment = module.getDocComment();
@@ -33,8 +33,12 @@ class LightJavadocGeneratorTest : LightCodeInsightFixtureTestCase() {
</pre>
</body>""".trimIndent())
fun testDocumentedModule() = doTestModule("/** One humble module. */\nmodule M.N { }", """
fun testDocumentedModule() = doTestModule("/** One humble module. */\n@Deprecated\nmodule M.N { }", """
<body>
@
<a href="psi_element://java.lang.Deprecated">
<code>Deprecated</code>
</a>
<pre>
module
<b>M.N</b>
@@ -45,7 +49,7 @@ class LightJavadocGeneratorTest : LightCodeInsightFixtureTestCase() {
private fun doTestModule(text: String, expected: String) {
val file = myFixture.configureByText("module-info.java", text)
val module = (file as PsiJavaFile).moduleDeclaration!!
val docInfo = JavaDocInfoGeneratorFactory.create(project, module).generateDocInfo(null)!!
val docInfo = JavaDocInfoGeneratorFactory.create(project, module).generateDocInfo(null)!!.replace("&nbsp;", " ")
val body = loadElement(docInfo).getChild("body")
assertThat(body).isEqualTo(expected)
}