mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
ConstantExpressionInspection: make it working inside parentheses
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
// "Replace '"a" + "b"' with constant value '"ab"'" "true"
|
||||
class Test {
|
||||
String x = ("ab");
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// "Replace '"a" + "b"' with constant value '"ab"'" "true"
|
||||
class Test {
|
||||
String x = ("a" + <caret>"b");
|
||||
}
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class ConstantExpressionInspection extends AbstractBaseJavaLocalInspectio
|
||||
if (expression.getTextLength() > MAX_EXPRESSION_LENGTH) return;
|
||||
if (expression.getType() == null) return;
|
||||
if (!PsiUtil.isConstantExpression(expression)) return;
|
||||
final PsiElement parent = expression.getParent();
|
||||
final PsiElement parent = PsiUtil.skipParenthesizedExprUp(expression.getParent());
|
||||
if (parent instanceof PsiExpression && PsiUtil.isConstantExpression((PsiExpression)parent)) return;
|
||||
try {
|
||||
final Object value = ExpressionUtils.computeConstantExpression(expression, true);
|
||||
|
||||
Reference in New Issue
Block a user