Tagir Valeev
0835bd0976
ConvertSwitchToIfIntention: fix processing of empty blocks
...
IDEA-205137 `Replace Switch with If` produce exceptions
IDEA-205122 Unwrap switch fails with exception
2019-01-10 12:40:04 +07:00
Tagir Valeev
7addf9e702
IDEA-204717 Can't convert enhanced 'switch' to 'if' if a branch's body contains an end-of-line comment
2018-12-26 21:05:24 +07:00
Tagir Valeev
92048254c1
VariableNameGenerator: fixed failing tests
2018-12-21 13:31:29 +07:00
Tagir Valeev
bb990f4f13
ConvertSwitchToIfIntention: support Java 12 switch statements (no expressions)
2018-12-07 11:56:15 +07:00
Tagir Valeev
747aec38c9
ConvertSwitchToIfIntention: better comments handling
2018-10-23 15:34:51 +07:00
Tagir Valeev
c09250da45
CommentTracker#replaceAndRestoreComments: try to keep comments after the statement (not move them to the front)
2018-10-08 14:09:24 +07:00
Tagir Valeev
763ad22de9
Support local classes
2018-10-01 16:31:37 +07:00
Tagir Valeev
625c1cc676
ConvertSwitchToIfIntention: fixes after review IDEA-CR-37311:
...
1. Do not suggest intention if `default` case is not the last one and fallthrough is possible into or out of that case
2. Generate a code-block if side-effect should be extracted to variable
2018-09-27 10:17:10 +07:00
Tagir Valeev
1b4e5c1e39
Merge SwitchStatementWithSingleDefaultInspection into SwitchStatementWithTooFewBranches
...
Fixes IDEA-199499 Improve "Replace 'switch' with 'if'" action and make it a quick-fix for "Switch has too few branches"
Now default is not counted as branch in SwitchStatementWithTooFewBranches
2018-09-26 17:06:07 +07:00
Tagir Valeev
f859a4c439
Support BreakConverter in ConvertSwitchToIfIntention
...
Fixes IDEA-141261 'Replace 'switch' with 'if'' intention produces incorrect code if some 'case' clause contains 'break' statement inside 'if'
2018-09-26 11:58:20 +07:00
Anna.Kozlova
ae3afdbaf8
switch -> if: fix comments line breaks (IDEA-195383)
2018-07-11 13:02:10 +02:00
Anna Kozlova
a6db339c7d
convert switch -> if: ignore whitespaces (IDEA-165260)
2018-06-29 20:20:36 +03:00
Anna.Kozlova
a1239e3f1f
preserve comments: replace switch with if (IDEA-113518)
2017-12-28 18:09:41 +01:00
Bas Leijdekkers
8d6551408c
fix ControlFlowUtil.canCompleteNormally() regression (IDEA-141259)
2017-07-24 19:34:17 +02:00
Bas Leijdekkers
aa515b08a1
generate "constant".equals(variable) code when converting switch to if (IDEA-157516)
2017-07-24 19:34:16 +02:00
Tagir Valeev
f2442e32fa
ConvertSwitchToIfTest: test5 rewritten as getClass() is now pure
2017-05-18 14:36:52 +07:00
Bas Leijdekkers
9d49239ff4
EA-76495 (IOE: PsiJavaParserFacadeImpl.createStatementFromText)
2015-12-01 19:11:39 +01:00
Bas Leijdekkers
d57591cd2c
IDEA-142912 (Intention: replace switch with if failed with bit operator (operator precedence))
2015-08-27 17:45:58 +02:00
anna
9c91d9374f
add convert switch to if for invalid switch types (IDEA-81580)
2012-02-23 11:50:19 +01:00