New J2K: add hack for incorrect comment parsing in J2K (KT-16845)

#KT-33825 fixed
This commit is contained in:
Ilya Kirillov
2019-10-02 13:51:03 +03:00
parent 008b916755
commit 81341e3fd3
4 changed files with 21 additions and 1 deletions
@@ -19,7 +19,11 @@ internal class JKCommentPrinter(val printer: JKPrinter) {
private fun JKComment.createText() =
if (this !in printedTokens) {
printedTokens += this
text
// hack till #KT-16845 is fixed
if (!isSingleline && text.endsWith("/*/")) {
text.replaceRange(text.length - "/*/".length, text.length, "/ */")
} else text
} else null
@@ -0,0 +1,6 @@
public class Foo {
/*/
/*/
public void foo(){
}
}
@@ -0,0 +1,5 @@
class Foo {
/*/
/ */
fun foo() {}
}
@@ -1045,6 +1045,11 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
public void testRemoveNoInspectionComment() throws Exception {
runTest("nj2k/testData/newJ2k/comments/removeNoInspectionComment.java");
}
@TestMetadata("shashBeforeEndOfMultilineComment.java")
public void testShashBeforeEndOfMultilineComment() throws Exception {
runTest("nj2k/testData/newJ2k/comments/shashBeforeEndOfMultilineComment.java");
}
}
@TestMetadata("nj2k/testData/newJ2k/conditionalExpression")