mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-27 05:20:54 +07:00
Java didn't use to have switch expressions and the insert handler for switch statements simply inserted ":" at the end of a case label. In the presence of switch expressions such an automatic completion is not correct anymore. The SwitchUtils#isRuleFormatSwitch method checks if the passed switch block is actually a switch expression, this fix allows TailTypes.forSwitchLabel return the correct tail type. Type references in case labels are most likely used as a pattern matching variables, so JavaPsiClassReferenceElement overrides the handleInsert method which checks if it's appropriate to add a pattern variable to the declaration. Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com> GitOrigin-RevId: 7b6d381d528136dbedc181ae756cef374938983a
8 lines
93 B
Java
8 lines
93 B
Java
|
|
class Main {
|
|
int f(Object o) {
|
|
return switch(o) {
|
|
case Intege<caret>
|
|
}
|
|
}
|
|
} |