Project: JDT
Bug 242127 [extract method] Allow method extraction from field initializer
Reported: 2008-07-25 17:48:42 | Status: verified fixed

Build ID: I20080617-2000 (3.4.0) If I select a field's initializer and try to extract a method, Eclipse complains that "Only statements from a method body can be extracted." It would be nice if this extraction were allowed.

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/fieldInitializer_in/A_test1250.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/fieldInitializer_in/A_test1251.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/fieldInitializer_in/A_test1252.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/fieldInitializer_out/A_test1250.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/fieldInitializer_out/A_test1251.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/fieldInitializer_out/A_test1252.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup.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/LocalVariableIndex.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java