mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-55962 - CCE: DefUseInspection$RemoveInitializerFix.sideEffectAwareRemove
This commit is contained in:
@@ -94,7 +94,7 @@ public class DefUseInspection extends DefUseInspectionBase {
|
||||
protected void sideEffectAwareRemove(Project project, PsiElement psiInitializer, PsiElement elementToDelete, PsiVariable variable) {
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(psiInitializer.getContainingFile())) return;
|
||||
|
||||
final PsiDeclarationStatement declaration = (PsiDeclarationStatement)variable.getParent();
|
||||
final PsiElement declaration = variable.getParent();
|
||||
final List<PsiElement> sideEffects = new ArrayList<PsiElement>();
|
||||
boolean hasSideEffects = RemoveUnusedVariableUtil.checkSideEffects(psiInitializer, variable, sideEffects);
|
||||
int res = RemoveUnusedVariableUtil.DELETE_ALL;
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Remove redundant assignment" "true"
|
||||
class A {
|
||||
void m(int i) {
|
||||
i = 0;
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove redundant assignment" "true"
|
||||
class A {
|
||||
void m(int i) {
|
||||
<caret>i = 9;
|
||||
i = 0;
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user