mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
SillyAssignmentInspection: fix finality check in quickfix creation: skip parentheses
This commit is contained in:
@@ -29,7 +29,7 @@ public class SillyAssignmentInspection extends SillyAssignmentInspectionBase {
|
||||
|
||||
@Override
|
||||
protected LocalQuickFix createRemoveAssignmentFix(PsiReferenceExpression expression) {
|
||||
final PsiElement parent = expression.getParent();
|
||||
final PsiElement parent = PsiUtil.skipParenthesizedExprUp(expression.getParent());
|
||||
if (parent instanceof PsiVariable) {
|
||||
final PsiVariable variable = (PsiVariable)parent;
|
||||
if (variable.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class X {
|
||||
private final String s = ((this).<caret>s);
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public class RemoveSillyAssignmentFixTest extends LightCodeInsightFixtureTestCas
|
||||
public void testSillyButIncomplete() { doTest(); }
|
||||
|
||||
public void testFinalField() { assertQuickfixNotAvailable(); }
|
||||
public void testFinalField2() { assertQuickfixNotAvailable(); }
|
||||
|
||||
public void doTest() {
|
||||
myFixture.enableInspections(SillyAssignmentInspection.class);
|
||||
|
||||
Reference in New Issue
Block a user