mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 08:51:02 +07:00
[java][switch completion] IDEA-270439 Code completion for pattern matching in switch
Reuse the SealedUtils#findSameFileInheritorsClasses method in order to eliminate the duplicating code and reduce the searching scope. Enable "return" when there is a lambda in a switch label GitOrigin-RevId: 6e6dbcb8d9b1b16828fcdd29c1e59b2f47a71bb5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c0b2f613a4
commit
5ecc0aec9c
@@ -0,0 +1,26 @@
|
||||
|
||||
class Main {
|
||||
|
||||
private static interface Empty {
|
||||
void f();
|
||||
}
|
||||
|
||||
private Empty f(Object o) {
|
||||
return switch (o) {
|
||||
default -> () -> {
|
||||
retu<caret>
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
private Empty g(Object o1, Object o2) {
|
||||
return switch (o1) {
|
||||
default -> () -> {
|
||||
switch (o2) {
|
||||
case null -> { retu<caret> }
|
||||
case default -> { retu<caret> }
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
class Main {
|
||||
|
||||
private static interface Empty {
|
||||
void f();
|
||||
}
|
||||
|
||||
private Empty f(Object o) {
|
||||
return switch (o) {
|
||||
default -> () -> {
|
||||
return;<caret>
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
private Empty g(Object o1, Object o2) {
|
||||
return switch (o1) {
|
||||
default -> () -> {
|
||||
switch (o2) {
|
||||
case null -> { return;<caret> }
|
||||
case default -> { return;<caret> }
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ class Main {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface Sealed permits Variant1, Variant2 { }
|
||||
final class Variant1 implements Sealed { }
|
||||
final class Variant2 implements Sealed { }
|
||||
private static sealed interface Sealed permits Variant1, Variant2 { }
|
||||
private static final class Variant1 implements Sealed { }
|
||||
private static final class Variant2 implements Sealed { }
|
||||
}
|
||||
@@ -5,8 +5,8 @@ class Main {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface Sealed permits Variant1, Variant2 { }
|
||||
final class Variant1 implements Sealed { }
|
||||
final class Variant2 implements Sealed { }
|
||||
private static sealed interface Sealed permits Variant1, Variant2 { }
|
||||
private static final class Variant1 implements Sealed { }
|
||||
private static final class Variant2 implements Sealed { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user