J2K: Do not convert string literal with escaped symbols automaticaly during java to kotlin conversion
#KT-9942 Fixed
This commit is contained in:
@@ -52,7 +52,9 @@ public class ConvertToStringTemplateIntention : SelfTargetingOffsetIndependentIn
|
|||||||
|
|
||||||
public fun shouldSuggestToConvert(expression: KtBinaryExpression): Boolean {
|
public fun shouldSuggestToConvert(expression: KtBinaryExpression): Boolean {
|
||||||
val entries = buildReplacement(expression).entries
|
val entries = buildReplacement(expression).entries
|
||||||
return entries.none { it is KtBlockStringTemplateEntry } && entries.count { it is KtLiteralStringTemplateEntry } > 1
|
return entries.none { it is KtBlockStringTemplateEntry } &&
|
||||||
|
!entries.all { it is KtLiteralStringTemplateEntry || it is KtEscapeStringTemplateEntry }
|
||||||
|
&& entries.count { it is KtLiteralStringTemplateEntry } > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isApplicableToNoParentCheck(expression: KtBinaryExpression): Boolean {
|
private fun isApplicableToNoParentCheck(expression: KtBinaryExpression): Boolean {
|
||||||
|
|||||||
@@ -7,13 +7,4 @@
|
|||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert string concatenation to string template</problem_class>
|
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert string concatenation to string template</problem_class>
|
||||||
<description>Convert concatenation to template</description>
|
<description>Convert concatenation to template</description>
|
||||||
</problem>
|
</problem>
|
||||||
|
|
||||||
<problem>
|
|
||||||
<file>backslashNMultilineString.kt</file>
|
|
||||||
<line>2</line>
|
|
||||||
<module>light_idea_test_case</module>
|
|
||||||
<entry_point TYPE="file" FQNAME="backslashNMultilineString.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert string concatenation to string template</problem_class>
|
|
||||||
<description>Convert concatenation to template</description>
|
|
||||||
</problem>
|
|
||||||
</problems>
|
</problems>
|
||||||
Reference in New Issue
Block a user