mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
invert if: do not skip returns as they may contain valuable info (IDEA-61892)
This commit is contained in:
+1
-1
@@ -209,7 +209,7 @@ public class InvertIfConditionAction extends PsiElementBaseIntentionAction {
|
||||
PsiStatement[] statements = ((PsiBlockStatement) thenBranch).getCodeBlock().getStatements();
|
||||
int len = statements.length;
|
||||
if (len > 0) {
|
||||
if (statements[len - 1] instanceof PsiReturnStatement) len--;
|
||||
//if (statements[len - 1] instanceof PsiReturnStatement) len--;
|
||||
if (len > 0) {
|
||||
PsiElement firstElement = statements [0];
|
||||
while (firstElement.getPrevSibling() instanceof PsiWhiteSpace || firstElement.getPrevSibling() instanceof PsiComment) {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class a {
|
||||
ia[~i | (i+=(!b?2:i))] -= i + 3.3;
|
||||
|
||||
// Object += String
|
||||
o += o + "string";
|
||||
<error descr="Operator '+' cannot be applied to 'java.lang.Object','java.lang.String'">o += o + "string"</error>;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert If Condition" "true"
|
||||
class Test {
|
||||
public static int create() {
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
return "s";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Invert If Condition" "true"
|
||||
class Test {
|
||||
public static int create() {
|
||||
if (!tr<caret>ue) {
|
||||
return "s";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user