mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
LengthOneStringInConcatenationInspection: support parentheses
This commit is contained in:
+2
-1
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -118,7 +119,7 @@ public class LengthOneStringsInConcatenationInspection
|
||||
}
|
||||
|
||||
static boolean isArgumentOfStringAppend(PsiExpression expression) {
|
||||
final PsiElement parent = expression.getParent();
|
||||
final PsiElement parent = PsiUtil.skipParenthesizedExprUp(expression.getParent());
|
||||
if (parent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
@@ -23,5 +23,6 @@ public class LengthOneStringInConcatenationInspection
|
||||
System.out.println(1 + "b" + "asdf");
|
||||
System.out.println("a" + );
|
||||
System.out.println("asdf" + ("b") + 2);
|
||||
buffer2.append(("p"));
|
||||
}
|
||||
}
|
||||
+7
@@ -55,4 +55,11 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Single character string concatenation</problem_class>
|
||||
<description><code>"b"</code> can be replaced with 'b' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>LengthOneStringInConcatenationInspection.java</file>
|
||||
<line>26</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Single character string concatenation</problem_class>
|
||||
<description><code>"p"</code> can be replaced with 'p' #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Reference in New Issue
Block a user