condition to insert final tweaks
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 12 May 2011 09:29:00 +0000 (13:29 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 12 May 2011 09:29:00 +0000 (13:29 +0400)
java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java

index 6605d527652c326476622595d284f7a1e4b08036..8bbcae485a237857c007798e9c26b1e8010eaa79 100644 (file)
@@ -771,9 +771,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
     final String variableName = suggestedName.names[0];
     final boolean replaceAll =
       replaceChoice == OccurrencesChooser.ReplaceChoice.ALL || replaceChoice == OccurrencesChooser.ReplaceChoice.NO_WRITE;
-    final boolean declareFinal =
-      !anyAssignmentLHS && (replaceAll &&
-                            declareFinalIfAll || createFinals(project));
+    final boolean declareFinal = replaceAll && (declareFinalIfAll || !anyAssignmentLHS) || createFinals(project);
     final boolean replaceWrite = anyAssignmentLHS && replaceChoice == OccurrencesChooser.ReplaceChoice.ALL;
     return new IntroduceVariableSettings() {
       @Override