@deprecated with multi-line message in Javadoc converted to @Deprecated("long ugly string") #KT-19644 Fixed (#1253)
This commit is contained in:
committed by
Dmitry Jemerov
parent
4e4bf31016
commit
0246b82833
@@ -77,7 +77,16 @@ class AnnotationConverter(private val converter: Converter) {
|
||||
private fun convertDeprecatedJavadocTag(element: PsiDocCommentOwner, target: AnnotationUseTarget?): Annotation? {
|
||||
val deprecatedTag = element.docComment?.findTagByName("deprecated") ?: return null
|
||||
val deferredExpression = converter.deferredElement<Expression> {
|
||||
LiteralExpression("\"" + StringUtil.escapeStringCharacters(deprecatedTag.content()) + "\"").assignNoPrototype()
|
||||
val text = buildString {
|
||||
val split = deprecatedTag.content().split("\n")
|
||||
val length = split.size
|
||||
split.forEachIndexed { index, s ->
|
||||
if (index > 0) append("+\n")
|
||||
val content = if (index == length - 1) s else s + "\n"
|
||||
append("\"" + StringUtil.escapeStringCharacters(content) + "\"")
|
||||
}
|
||||
}
|
||||
LiteralExpression(text).assignNoPrototype()
|
||||
}
|
||||
val identifier = Identifier("Deprecated").assignPrototype(deprecatedTag.nameElement)
|
||||
return Annotation(identifier,
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @deprecated Ph'nglui mglw'nafh
|
||||
* Cthulhu R'lyeh wgah'nagl fhtagn.
|
||||
* 'In His House at R'lyeh
|
||||
* Dead Cthulhu waits dreaming,
|
||||
* yet He shall rise and His kingdom
|
||||
* shall cover the Earth.'
|
||||
*/
|
||||
public class TestDeprecatedInJavadocWithMultilineMessage {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
@Deprecated("Ph'nglui mglw'nafh\n" +
|
||||
" Cthulhu R'lyeh wgah'nagl fhtagn.\n" +
|
||||
" 'In His House at R'lyeh\n" +
|
||||
" Dead Cthulhu waits dreaming,\n" +
|
||||
" yet He shall rise and His kingdom\n" +
|
||||
" shall cover the Earth.'")
|
||||
class TestDeprecatedInJavadocWithMultilineMessage
|
||||
@@ -1796,6 +1796,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedDocTagWithMultiLineMessage.java")
|
||||
public void testDeprecatedDocTagWithMultiLineMessage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/docComments/deprecatedDocTagWithMultiLineMessage.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("docCommentWithParamTag.java")
|
||||
public void testDocCommentWithParamTag() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/docComments/docCommentWithParamTag.java");
|
||||
|
||||
@@ -1796,6 +1796,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("deprecatedDocTagWithMultiLineMessage.java")
|
||||
public void testDeprecatedDocTagWithMultiLineMessage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/docComments/deprecatedDocTagWithMultiLineMessage.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("docCommentWithParamTag.java")
|
||||
public void testDocCommentWithParamTag() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/docComments/docCommentWithParamTag.java");
|
||||
|
||||
Reference in New Issue
Block a user