IDEA-216810 Unexpected behaviour with "Transform Method to Single Exit Point" / Inline refactoring

GitOrigin-RevId: 31a77ebb86f3da40caeda5e8ca60ccec51ebfb13
This commit is contained in:
Tagir Valeev
2019-07-16 15:01:49 +03:00
committed by intellij-monorepo-bot
parent 50ff44aebd
commit 30b914be28
5 changed files with 60 additions and 13 deletions
@@ -0,0 +1,10 @@
// "Transform body to single exit-point form" "true"
class Test {
private String nameByIndex(int colourIndex) {
String result = "Blue";
if (colourIndex == 1) {
result = "Red";
}
return result;
}
}
@@ -0,0 +1,12 @@
// "Transform body to single exit-point form" "true"
class Test {
private String nameByIndex(int colourIndex) {
String result = "Blue";
if (colourIndex == 1) {
result = "Red";
} else if (colourIndex == 2) {
result = "Green";
}
return result;
}
}
@@ -0,0 +1,9 @@
// "Transform body to single exit-point form" "true"
class Test {
private <caret>String nameByIndex(int colourIndex) {
if (colourIndex == 1) {
return "Red";
}
return "Blue";
}
}
@@ -0,0 +1,11 @@
// "Transform body to single exit-point form" "true"
class Test {
private <caret>String nameByIndex(int colourIndex) {
if (colourIndex == 1) {
return "Red";
} else if (colourIndex == 2) {
return "Green";
}
return "Blue";
}
}