mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
invert boolean: ensure to invert default boolean initializer (IDEA-123510)
This commit is contained in:
@@ -271,6 +271,10 @@ public class InvertBooleanProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (myElement instanceof PsiField && ((PsiField)myElement).getInitializer() == null) {
|
||||
((PsiField)myElement).setInitializer(JavaPsiFacade.getElementFactory(myProject).createExpressionFromText("true", myElement));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
private boolean notInitial<caret>ized;
|
||||
|
||||
public void foo() {
|
||||
if (notInitialized) {
|
||||
notInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
private boolean notInitializedInverted = true;
|
||||
|
||||
public void foo() {
|
||||
if (!notInitializedInverted) {
|
||||
notInitializedInverted = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user