mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[java-intentions] EA-465575 - AE: JavaParserUtil.parseFragment
GitOrigin-RevId: 51d05798ab9a127508bcf531a3aa1a13cdda5aae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b5c5a86f77
commit
46c6cb94ad
@@ -310,7 +310,7 @@ public class ConvertSwitchToIfIntention implements IntentionActionWithFixAllOpti
|
||||
if (caseElement instanceof PsiExpression) {
|
||||
PsiExpression caseExpression = PsiUtil.skipParenthesizedExprDown((PsiExpression)caseElement);
|
||||
String caseValue = getCaseValueText(caseExpression, commentTracker);
|
||||
if (useEquals && !ExpressionUtils.isNullLiteral(caseExpression)) {
|
||||
if (useEquals && caseExpression != null && !(caseExpression.getType() instanceof PsiPrimitiveType)) {
|
||||
if (PsiPrecedenceUtil.getPrecedence(caseExpression) > PsiPrecedenceUtil.METHOD_CALL_PRECEDENCE) {
|
||||
caseValue = "(" + caseValue + ")";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Replace 'switch' with 'if'" "true-preview"
|
||||
class Test {
|
||||
void test(Object obj) {
|
||||
if (obj == 1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// "Replace 'switch' with 'if'" "true-preview"
|
||||
class Test {
|
||||
void test(Object obj) {
|
||||
if ((obj instanceof String s).equals(obj)) {
|
||||
if (obj == obj instanceof String s) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Replace 'switch' with 'if'" "true-preview"
|
||||
class Test {
|
||||
void test(Object obj) {
|
||||
if (obj == obj instanceof String) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace 'switch' with 'if'" "true-preview"
|
||||
class Test {
|
||||
void test(Object obj) {
|
||||
<caret>switch (obj) {
|
||||
case 1 -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace 'switch' with 'if'" "true-preview"
|
||||
class Test {
|
||||
void test(Object obj) {
|
||||
<caret>switch (obj) {
|
||||
case obj instanceof String -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user