mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[extract method] IDEA-278872: fix missed return variable
GitOrigin-RevId: 55ffed6010a531c34dfa18e22ad5b82ced9599ba
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f40371f009
commit
c3afc8b902
+1
-3
@@ -83,9 +83,7 @@ class CodeFragmentAnalyzer(val elements: List<PsiElement>) {
|
||||
}
|
||||
|
||||
fun findOutputVariables(): List<PsiVariable> {
|
||||
val exitPoints = IntArrayList()
|
||||
ControlFlowUtil.findExitPointsAndStatements(flow, flowRange.first, flowRange.last, exitPoints, *DEFAULT_EXIT_STATEMENTS_CLASSES)
|
||||
return ControlFlowUtil.getOutputVariables(flow, flowRange.first, flowRange.last, exitPoints.toIntArray()).distinct()
|
||||
return ControlFlowUtil.getOutputVariables(flow, flowRange.first, flowRange.last, findExitPoints().toIntArray()).distinct()
|
||||
}
|
||||
|
||||
fun findUndeclaredVariables(): List<PsiVariable> {
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
void test() {
|
||||
<selection>final String str = "atata";
|
||||
do {
|
||||
System.out.println();
|
||||
} while (Math.random() > 0.5);</selection>
|
||||
|
||||
System.out.println(str);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
final String str = getString();
|
||||
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getString() {
|
||||
final String str = "atata";
|
||||
do {
|
||||
System.out.println();
|
||||
} while (Math.random() > 0.5);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
+4
@@ -158,6 +158,10 @@ class ExtractMethodAndDuplicatesInplaceTest: LightJavaCodeInsightTestCase() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testIDEA278872(){
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testRefactoringListener(){
|
||||
templateTest {
|
||||
configureByFile("$BASE_PATH/${getTestName(false)}.java")
|
||||
|
||||
Reference in New Issue
Block a user