Project: JDT
Bug 324237 [extract method] Extract Method refactoring fails if trailing ';' is also part of selection
Reported: 2010-09-01 15:18:03 | Status: resolved fixed

I20100831-1001 ok, I have faced this too many times now... Steps: - Use this snippet and select "122;" package p; class A { int i; void foo() { this.i = 122; } } - Alt + Shift + M (Extract Method) => The end of selection contains characters that do not belong to a statement. -- bad!! Selecting the trailing ';' is very easy - I generally place the cursor right after '=' and then press Shift + End (to select till end of the line). Extract Method refactoring should simply ignore the trailing ';' instead of complaining about it.

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_in/A_test623.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_in/A_test624.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_out/A_test623.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_out/A_test624.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/SelectionAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/StatementAnalyzer.java