mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
IDEA-270441 IJ-CR-12027 convert switch to if: fix "null" class name for local Enums
GitOrigin-RevId: bd6d592522e497f7897c92799333630d611dc6e1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0bf2802f19
commit
8496dd3b7f
@@ -375,7 +375,9 @@ public class ConvertSwitchToIfIntention implements IntentionActionWithFixAllOpti
|
||||
if (aClass == null) {
|
||||
return commentTracker.text(value);
|
||||
}
|
||||
return aClass.getQualifiedName() + '.' + commentTracker.text(referenceExpression);
|
||||
String qualifiedName = aClass.getQualifiedName();
|
||||
String className = qualifiedName != null ? qualifiedName : aClass.getName();
|
||||
return className + '.' + commentTracker.text(referenceExpression);
|
||||
}
|
||||
|
||||
private static void dumpBody(SwitchStatementBranch branch, @NonNls StringBuilder out, CommentTracker commentTracker) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class Test {
|
||||
void test() {
|
||||
enum P {
|
||||
s;
|
||||
}
|
||||
P p = null;
|
||||
if (p == P.s) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Replace 'switch' with 'if'" "true"
|
||||
class Test {
|
||||
void test() {
|
||||
enum P {
|
||||
s;
|
||||
}
|
||||
P p = null;
|
||||
<caret>switch (p) {
|
||||
case s -> {}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user