Project: JDT
Bug 122389 [refactoring] [extract method] Two variable assignment in while loop incorrectly extracts
Reported: 2005-12-30 11:49:01 | Status: resolved fixed

The following test passes before "extract method," but fails afterward. Build id: I20051102-1600 import junit.framework.TestCase; public class A extends TestCase{ private int getGridY(int y) { int tmp = 0, res = 1; while (res < y) { //extract here tmp = res; res += 1; //to here } return tmp; } public void testCase(){ assertEquals(getGridY(7),6); } }

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test196.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestLocalReferenceLoop1.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestLocalReferenceLoop2.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestLocalReferenceLoop3.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestLocalReferenceLoop4.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestLocalReferenceLoop5.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestLocalReferenceLoop1.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestLocalReferenceLoop2.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestLocalReferenceLoop3.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestLocalReferenceLoop4.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestLocalReferenceLoop5.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/EnhancedForFlowInfo.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/FlowAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/ForFlowInfo.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/InputFlowAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/WhileFlowInfo.java