Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 486440

Summary: [extract method] extract method from enum constant declaration
Product: [Eclipse Project] JDT Reporter: leokom leokom <lrozenblyum>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta, stephan.herrmann
Version: 4.5.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description leokom leokom CLA 2016-01-25 03:31:43 EST
SCENARIO:
public enum SomeEnum {
	FIRST( "hello" );
	
	SomeEnum( String param ) {
		
	};
}

Select "hello", Call Refactor -> Extract Method

EXPECTED:
a) private method created:
private static String getSmth() {
    return "hello";
}
b) enum declaration changed to
FIRST( getSmth() );

ACTUALLY:
Error "Cannot extract new method since the selection is not valid"
Comment 1 Noopur Gupta CLA 2016-01-27 07:30:30 EST

*** This bug has been marked as a duplicate of bug 431300 ***