diff --git a/java/java-impl/src/com/intellij/codeInspection/intermediaryVariable/ReturnSeparatedFromComputationInspection.java b/java/java-impl/src/com/intellij/codeInspection/intermediaryVariable/ReturnSeparatedFromComputationInspection.java index ce98af30385d..02d6fb790508 100644 --- a/java/java-impl/src/com/intellij/codeInspection/intermediaryVariable/ReturnSeparatedFromComputationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/intermediaryVariable/ReturnSeparatedFromComputationInspection.java @@ -112,10 +112,10 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal * return result; * */ - private static boolean hasChainedAssignmentsInScope(@NotNull ControlFlow flow, @NotNull PsiVariable variable, - @NotNull PsiReturnStatement returnStatement, - @NotNull PsiCodeBlock variableScope) { - for (PsiStatement statement = getPrevNonEmptyStatement(returnStatement, null); + private static boolean hasChainedAssignmentsInScope(@NotNull ControlFlow flow, + @NotNull PsiVariable variable, + @NotNull PsiStatement lastStatementInScope) { + for (PsiStatement statement = getPrevNonEmptyStatement(lastStatementInScope, null); statement != null; statement = getPrevNonEmptyStatement(statement, null)) { if (statement instanceof PsiExpressionStatement) { @@ -166,7 +166,7 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal final int returnEndOffset = flow.getEndOffset(context.returnStatement); if (returnStartOffset < 0 || returnEndOffset < 0) return false; - if (hasChainedAssignmentsInScope(flow, context.returnedVariable, context.returnStatement, context.variableScope)) { + if (hasChainedAssignmentsInScope(flow, context.returnedVariable, context.returnStatement)) { return false; } @@ -325,7 +325,7 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal return moveToForeach((PsiForeachStatement)targetStatement); } if (targetStatement instanceof PsiSwitchStatement) { - return moveToSwitch((PsiSwitchStatement)targetStatement, returnAtTheEnd); + return moveToSwitch((PsiSwitchStatement)targetStatement); } if (targetStatement instanceof PsiTryStatement) { return moveToTry((PsiTryStatement)targetStatement, returnAtTheEnd); @@ -353,7 +353,7 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal PsiJavaToken rBrace = codeBlock.getRBrace(); if (rBrace != null) { PsiStatement lastNonEmptyStatement = getPrevNonEmptyStatement(rBrace, removeCompletely); - if (lastNonEmptyStatement == null) { + if (lastNonEmptyStatement == null || hasChainedAssignmentsInScope(flow, resultVariable, lastNonEmptyStatement)) { return false; } if (moveTo(lastNonEmptyStatement, returnAtTheEnd)) { @@ -396,10 +396,10 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal return false; } - private boolean moveToSwitch(PsiSwitchStatement targetStatement, boolean returnAtTheEnd) { + private boolean moveToSwitch(@NotNull PsiSwitchStatement targetStatement) { moveToBreaks(targetStatement, false); PsiCodeBlock body = targetStatement.getBody(); - return body != null && moveToBlockBody(body, returnAtTheEnd); + return body != null && moveToBlockBody(body, false) && hasDefaultSwitchLabel(body); } private boolean moveToTry(@NotNull PsiTryStatement targetStatement, boolean returnAtTheEnd) { @@ -457,6 +457,15 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal } } + private static boolean hasDefaultSwitchLabel(@NotNull PsiCodeBlock switchBody) { + for (PsiStatement statement : switchBody.getStatements()) { + if (statement instanceof PsiSwitchLabelStatement && ((PsiSwitchLabelStatement)statement).isDefaultCase()) { + return true; + } + } + return false; + } + private static boolean isAlwaysTrue(@Nullable PsiExpression condition, boolean nullIsTrue) { if(condition == null) return nullIsTrue; return ExpressionUtils.computeConstantExpression(condition) == Boolean.TRUE; @@ -492,8 +501,9 @@ public class ReturnSeparatedFromComputationInspection extends BaseJavaBatchLocal } } - private static PsiStatement getPrevNonEmptyStatement(@NotNull PsiElement psiElement, @Nullable Set skippedEmptyStatements) { - if (!(psiElement.getParent() instanceof PsiCodeBlock)) { + @Nullable + private static PsiStatement getPrevNonEmptyStatement(@Nullable PsiElement psiElement, @Nullable Set skippedEmptyStatements) { + if (psiElement == null || !(psiElement.getParent() instanceof PsiCodeBlock)) { return null; } PsiStatement prevStatement = PsiTreeUtil.getPrevSiblingOfType(psiElement, PsiStatement.class); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterBreakFromLoopInTryWithResources.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterBreakFromLoopInTryWithResources.java index 0281d2efdc95..f0e3b703a155 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterBreakFromLoopInTryWithResources.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterBreakFromLoopInTryWithResources.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 's'" "true" +// "Move 'return' closer to computation of the value of 's'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterDoWhileTrue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterDoWhileTrue.java index 5dda4432661f..88ff45206762 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterDoWhileTrue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterDoWhileTrue.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f() { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForBreakComment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForBreakComment.java index 5c9602050626..cb2bb8f2d7fe 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForBreakComment.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForBreakComment.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a[]) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForWithoutCondition.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForWithoutCondition.java index c1068e6085bc..3de096028497 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForWithoutCondition.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterForWithoutCondition.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f() { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfComment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfComment.java index ce1aa7216759..668baee11030 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfComment.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfComment.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 's'" "true" +// "Move 'return' closer to computation of the value of 's'" "true" class T { int f(String a) { String s = a; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseThrow.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseThrow.java index fcb5925a9fa9..33d11882b489 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseThrow.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseThrow.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInBoth.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInBoth.java index 819d619d4e41..e195cb41e4ba 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInBoth.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInBoth.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInElse.java index 6b39f5efb41c..fd000cb5dbcb 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInIf.java index 5cd0516f9de5..ccfb27604e48 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfElseWriteInIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfThrowElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfThrowElse.java index 2aa4d9932d84..a0088e2af6b7 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfThrowElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfThrowElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfTryCatch.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfTryCatch.java index 8232b4078605..869375c5bb07 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfTryCatch.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterIfTryCatch.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b, boolean c) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledBlock.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledBlock.java index c59b5c149e20..90e5d1bd973a 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledBlock.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledBlock.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor.java index 37e2e90549b5..c1fb348ebc9b 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int[] a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor2.java index 861fb83eb003..be2d2d181a49 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledFor2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int[] a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledIf.java index 7674e011b245..f5c56a41fbfe 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterLabeledIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlock.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlock.java index 31b709aa2647..3284973c296d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlock.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlock.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f() { int n; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlockSideEffect.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlockSideEffect.java index 7e5867826d10..97fd09edaec4 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlockSideEffect.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedBlockSideEffect.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f() { int n; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIf.java index 78abbd78e05b..e5b51a0d65d9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean a, boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfInnerElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfInnerElse.java index ae6127c6881c..4363c7f96e01 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfInnerElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfInnerElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean a, boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfOuterElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfOuterElse.java index 866b42c74562..a6608d0d284e 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfOuterElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterNestedIfOuterElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean a, boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterReturnOutsideTryWithResources.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterReturnOutsideTryWithResources.java index 962a80e516d4..bc901c8f4d3f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterReturnOutsideTryWithResources.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterReturnOutsideTryWithResources.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 's'" "true" +// "Move 'return' closer to computation of the value of 's'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleDoWhile.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleDoWhile.java index 82b7f13511d6..50b1a447b3d8 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleDoWhile.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleDoWhile.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String a) { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleFor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleFor.java index 4c29428d52a2..e83828c53d25 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleFor.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleFor.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int[] a, int b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleForeach.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleForeach.java index fb1d378f6f1e..b377c503ea92 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleForeach.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleForeach.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String[] a) { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIf.java index 3724c25dca0e..2e91a94cfe9a 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueComputed.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueComputed.java index b26cdd5c41b7..043fdba56aa7 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueComputed.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueComputed.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = g(); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueParameter.java index 74e9bae4deae..3781bc15017c 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueParameter.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleIfDefaultValueParameter.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b, int d) { int n = d; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleWhile.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleWhile.java index fd178727c871..bebbffc5f9db 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleWhile.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSimpleWhile.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f() { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch1.java new file mode 100644 index 000000000000..41e2a08b16d0 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch1.java @@ -0,0 +1,13 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + return 2; + case 2: + return 4; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch2.java new file mode 100644 index 000000000000..41e2a08b16d0 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch2.java @@ -0,0 +1,13 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + return 2; + case 2: + return 4; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch3.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch3.java new file mode 100644 index 000000000000..f12a1758a78a --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch3.java @@ -0,0 +1,14 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + return 2; + case 2: + return 4; + default: + return 0; + } + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch4.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch4.java new file mode 100644 index 000000000000..38ec798848fa --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch4.java @@ -0,0 +1,16 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + return 2; + case 2: + return 4; + default: + return 0; + case 0: + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch5.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch5.java new file mode 100644 index 000000000000..f25426d4e5f7 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterSwitch5.java @@ -0,0 +1,14 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + return 2; + default: + return 0; + case 2: + return 4; + } + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchAssign.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchAssign.java index 4b14996fafa4..4a53bd6919ce 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchAssign.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchAssign.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally1.java index ebf6bcd8031e..4041f5208c2d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally2.java index ebf6bcd8031e..4041f5208c2d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally5.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally5.java index 792ef28315de..2cfa6ead98fe 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally5.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally5.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally6.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally6.java index bcc9d240a015..c9d65831ff04 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally6.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchFinally6.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchRethrow.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchRethrow.java index 429ce2db43da..85840658f3eb 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchRethrow.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchRethrow.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchReturn.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchReturn.java index 4b14996fafa4..4a53bd6919ce 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchReturn.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryCatchReturn.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile1.java index a8020c7ceee3..d09334e3b926 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String p) { String r = null; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile2.java index 1a6dcc6e112d..872297ef431f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterTryWhile2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String p) { String r = null; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak1.java index 8e5297bf158b..195ec1f1fb2d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak2.java index ff2d070643d8..6d6d017cbfac 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileBreak2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue.java index 5fa37e40d37b..278cb69045a3 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue1.java index 066998da0071..370113ebee9e 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue2.java index e9a3acf8c9a7..878304ecd5bb 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileContinue2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileTrue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileTrue.java index 63a01fb335cb..a86ab1ee881a 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileTrue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/afterWhileTrue.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { long f() { long r; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssert.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssert.java index a51b9bf71b1a..d96e6d617ebe 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssert.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssert.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "false" +// "Move 'return' closer to computation of the value of 'n'" "false" class T { int f(int a) { int n = a; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssignmentChainUnderIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssignmentChainUnderIf.java new file mode 100644 index 000000000000..c0ccfdbfa1c0 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeAssignmentChainUnderIf.java @@ -0,0 +1,15 @@ +// "Move 'return' closer to computation of the value of 'n'" "false" +class T { + int x; + int y; + + int f(int a) { + int n = -1; + if (a != 0) { + n = a; + n = 31 * x + n; + n = 31 * y + n; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeBreakFromLoopInTryWithResources.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeBreakFromLoopInTryWithResources.java index 48230a643e28..8283da4acc8d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeBreakFromLoopInTryWithResources.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeBreakFromLoopInTryWithResources.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 's'" "true" +// "Move 'return' closer to computation of the value of 's'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeDoWhileTrue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeDoWhileTrue.java index 1cdde2ffdde8..1f1df5a6ea9b 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeDoWhileTrue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeDoWhileTrue.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f() { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForBreakComment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForBreakComment.java index 8ee9c838a6c7..c0a26870bf70 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForBreakComment.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForBreakComment.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a[]) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForWithoutCondition.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForWithoutCondition.java index 49caccf5f1cd..e18802660a39 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForWithoutCondition.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeForWithoutCondition.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f() { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeHashCode.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeHashCode.java index a0fbf4709a2d..4a03e3f523a9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeHashCode.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeHashCode.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'result'" "false" +// "Move 'return' closer to computation of the value of 'result'" "false" class T { int size; int width; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfComment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfComment.java index ac6cb9259988..9edae3e9e1f6 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfComment.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfComment.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 's'" "true" +// "Move 'return' closer to computation of the value of 's'" "true" class T { int f(String a) { String s = a; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseNoWrite.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseNoWrite.java index e8893863450d..b15e87127162 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseNoWrite.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseNoWrite.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "false" +// "Move 'return' closer to computation of the value of 'n'" "false" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseThrow.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseThrow.java index e4a6eb5634f1..b52f70f47393 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseThrow.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseThrow.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInBoth.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInBoth.java index 9cc257d8d008..3d59be1dcb1f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInBoth.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInBoth.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInElse.java index 8a12ce8558f0..6fac1681f9b6 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInIf.java index 0786f31ef2d5..f6ac5fcf1c8f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfElseWriteInIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrow.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrow.java index 63f476304fb7..b61d4c9ceb5f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrow.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrow.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "false" +// "Move 'return' closer to computation of the value of 'n'" "false" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrowElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrowElse.java index 1d991b685844..8af38d8ed250 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrowElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfThrowElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfTryCatch.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfTryCatch.java index f45e7dbe0f00..8f9ff66f0d42 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfTryCatch.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeIfTryCatch.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b, boolean c) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledBlock.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledBlock.java index db850a43d4f7..5a4f8666ea64 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledBlock.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledBlock.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor.java index 1e8878cd6e85..aec9c9057798 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int[] a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor2.java index 8dda8c86eb6f..52546d93cbf4 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledFor2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int[] a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledIf.java index 798d26283373..37bcbbf9c323 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeLabeledIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlock.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlock.java index fa5faaffd48a..92947d444c3c 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlock.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlock.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f() { int n; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlockSideEffect.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlockSideEffect.java index 6b0d43a15d31..71b485fd1ca0 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlockSideEffect.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedBlockSideEffect.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f() { int n; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIf.java index a28f57fc90df..0f9b1ceb4ad1 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean a, boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfInnerElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfInnerElse.java index 25cd63fb4012..7d9012f5649d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfInnerElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfInnerElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean a, boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfOuterElse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfOuterElse.java index 4cdbfe1c05ef..40f114602f16 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfOuterElse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeNestedIfOuterElse.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean a, boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeReturnOutsideTryWithResources.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeReturnOutsideTryWithResources.java index 49737e9aeb3a..225a1fa24b2d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeReturnOutsideTryWithResources.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeReturnOutsideTryWithResources.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 's'" "true" +// "Move 'return' closer to computation of the value of 's'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleDoWhile.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleDoWhile.java index 9d65a5ad57d2..a1421a97bd5d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleDoWhile.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleDoWhile.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String a) { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleFor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleFor.java index a2283fdb1652..ff5b9f6850e5 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleFor.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleFor.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int[] a, int b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleForeach.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleForeach.java index b27e8485f32c..32ec0e36ef5b 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleForeach.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleForeach.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String[] a) { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIf.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIf.java index 4a98ee9c6302..b20bad5e9de0 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIf.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIf.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueComputed.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueComputed.java index 7dc95fac9da5..0b5627edfc7f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueComputed.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueComputed.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = g(); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueParameter.java index c1e967c6339d..38e1385e9390 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueParameter.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleIfDefaultValueParameter.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b, int d) { int n = d; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleWhile.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleWhile.java index 45f28d655eb4..6da10796e6c4 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleWhile.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSimpleWhile.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f() { String r = ""; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch1.java new file mode 100644 index 000000000000..d734fc78af1c --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch1.java @@ -0,0 +1,15 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + n = 2; + break; + case 2: + n = 4; + break; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch2.java new file mode 100644 index 000000000000..d7006368c986 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch2.java @@ -0,0 +1,14 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + n = 2; + break; + case 2: + n = 4; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch3.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch3.java new file mode 100644 index 000000000000..8ddd40d1daf9 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch3.java @@ -0,0 +1,17 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + n = 2; + break; + case 2: + n = 4; + break; + default: + n = 0; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch4.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch4.java new file mode 100644 index 000000000000..952c7a50e1c7 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch4.java @@ -0,0 +1,19 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + n = 2; + break; + case 2: + n = 4; + break; + default: + n = 0; + break; + case 0: + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch5.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch5.java new file mode 100644 index 000000000000..08b85481bae0 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeSwitch5.java @@ -0,0 +1,17 @@ +// "Move 'return' closer to computation of the value of 'n'" "true" +class T { + int f(int a) { + int n = -1; + switch (a) { + case 1: + n = 2; + break; + default: + n = 0; + break; + case 2: + n = 4; + } + return n; + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchAssign.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchAssign.java index e18ab16df1e5..4e9b6b59efb9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchAssign.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchAssign.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally1.java index 0a2ef23dd784..c8cfdf3674ec 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally2.java index 2612ceed3baa..10417468603a 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally3.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally3.java index d0bc3e8c952b..d9bf203f8240 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally3.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally3.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "false" +// "Move 'return' closer to computation of the value of 'n'" "false" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally4.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally4.java index a6aeb25ee7de..0743bfde3c9b 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally4.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally4.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "false" +// "Move 'return' closer to computation of the value of 'n'" "false" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally5.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally5.java index 3d6a0c2a64a8..e4c962b6a590 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally5.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally5.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally6.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally6.java index 8e35e8772497..4a80fff4e04f 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally6.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchFinally6.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" import java.io.*; class T { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchRethrow.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchRethrow.java index 09233f876879..4c107fdac1a7 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchRethrow.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchRethrow.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchReturn.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchReturn.java index a40364b9a877..f857cf7115b8 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchReturn.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryCatchReturn.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(boolean b) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile1.java index 49301036ff7f..5526aa751633 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String p) { String r = null; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile2.java index 83e2c777c230..e6f2d0371773 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeTryWhile2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { String f(String p) { String r = null; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak1.java index f82890d1ee86..3ab160a1ddbf 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak2.java index 225b4b1bb27f..cd5ab3147603 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileBreak2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue.java index 84857d271bbe..cf766ca9a7a9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue1.java index 54826e895fd9..4b9908c2e93a 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue1.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue2.java index fdd557ae55d4..d7dd3a0f89b9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue2.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "true" +// "Move 'return' closer to computation of the value of 'n'" "true" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue3.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue3.java index 04685b6f58e6..e4cc8cd1634d 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue3.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileContinue3.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'n'" "false" +// "Move 'return' closer to computation of the value of 'n'" "false" class T { int f(int a) { int n = -1; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileTrue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileTrue.java index 93af902ecd88..f470dd85da91 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileTrue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/returnSeparatedFromComputation/beforeWhileTrue.java @@ -1,4 +1,4 @@ -// "Move 'return' to computation of the value of 'r'" "true" +// "Move 'return' closer to computation of the value of 'r'" "true" class T { long f() { long r; diff --git a/java/java-tests/testData/inspection/returnSeparatedFromComputation/AssignmentChainUnderIf.java b/java/java-tests/testData/inspection/returnSeparatedFromComputation/AssignmentChainUnderIf.java new file mode 100644 index 000000000000..cde65b63d675 --- /dev/null +++ b/java/java-tests/testData/inspection/returnSeparatedFromComputation/AssignmentChainUnderIf.java @@ -0,0 +1,14 @@ +class T { + int x; + int y; + + int f(int a) { + int n = -1; + if (a != 0) { + n = a; + n = 31 * x + n; + n = 31 * y + n; + } + return n; + } +} \ No newline at end of file diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties index 0849225885b6..8f682aeeb0b0 100644 --- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties +++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties @@ -138,8 +138,8 @@ inspection.can.be.local.variable.problem.descriptor=Variable #ref c inspection.return.separated.from.computation.name=Return separated from computation of result inspection.return.separated.from.computation.descriptor=Return separated from computation of value of ''{0}'' -inspection.return.separated.from.computation.quickfix=Move ''return'' to computation of the value of ''{0}'' -inspection.return.separated.from.computation.family.quickfix=Move 'return' to computation of the result +inspection.return.separated.from.computation.quickfix=Move ''return'' closer to computation of the value of ''{0}'' +inspection.return.separated.from.computation.family.quickfix=Move 'return' closer to computation of the result inspection.nullable.problems.display.name=@NotNull/@Nullable problems #check box options