New J2K: add hack for incorrect comment parsing in J2K (KT-16845)
#KT-33825 fixed
This commit is contained in:
@@ -19,7 +19,11 @@ internal class JKCommentPrinter(val printer: JKPrinter) {
|
|||||||
private fun JKComment.createText() =
|
private fun JKComment.createText() =
|
||||||
if (this !in printedTokens) {
|
if (this !in printedTokens) {
|
||||||
printedTokens += this
|
printedTokens += this
|
||||||
text
|
|
||||||
|
// hack till #KT-16845 is fixed
|
||||||
|
if (!isSingleline && text.endsWith("/*/")) {
|
||||||
|
text.replaceRange(text.length - "/*/".length, text.length, "/ */")
|
||||||
|
} else text
|
||||||
} else null
|
} else null
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
public class Foo {
|
||||||
|
/*/
|
||||||
|
/*/
|
||||||
|
public void foo(){
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class Foo {
|
||||||
|
/*/
|
||||||
|
/ */
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
+5
@@ -1045,6 +1045,11 @@ public class NewJavaToKotlinConverterSingleFileTestGenerated extends AbstractNew
|
|||||||
public void testRemoveNoInspectionComment() throws Exception {
|
public void testRemoveNoInspectionComment() throws Exception {
|
||||||
runTest("nj2k/testData/newJ2k/comments/removeNoInspectionComment.java");
|
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")
|
@TestMetadata("nj2k/testData/newJ2k/conditionalExpression")
|
||||||
|
|||||||
Reference in New Issue
Block a user