Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/liftThrowOutOfSwitchExpression/afterSwitchInsideCallWithoutSideEffectInsideThenClauseWithoutBlock.java
Marcin Mikosik 6c51e2f6f9 [java] IDEA-283208 Fix bugs in Lift-throw-out-of-switch
- code-block should not be added when lifting throw out of switch makes throw statement the only one inside 'then' clause
- code-block should be added when lifting throw out of switch which is nested inside multiple variable declaration which is nested as the only statement of 'then' clause that does not have braces

Merge-request: IJ-MR-173629
Merged-by: Marcin Mikosik <marcin.mikosik@jetbrains.com>

GitOrigin-RevId: 5644e3dfee807c22eae75d3536fbb9af5ece5eca
2025-09-02 12:39:42 +00:00

16 lines
354 B
Java

// "Lift 'throw' out of 'switch' expression" "true-preview"
public class Foo {
public int bar(int param) {
if (param==2)
throw <caret>switch (param) {
default -> new ArithmeticException();
};
else {
return 1;
}
}
public int call(int param) {
return 3;
}
}