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

Bug 352446

Summary: [extract constant] 'Extract to constant' refactoring does not replace the string with the constant
Product: [Eclipse Project] JDT Reporter: Ankur Sharma <ankur_sharma>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ankur Sharma CLA 2011-07-19 07:57:28 EDT
Snippet

		switch (string) {
		case "one":
			System.out.println("Accept");
			return true;
		case "two":
			System.out.println("Unsure");
			return true;
		default:
			System.out.println("Fail");
			return false;
		}


1. Select the string "two" in second case statement
2. Press Ctrl + 1 and invoke extract to constant

The result is creation of a constant 

private static final String TWO = "two";

however, the string "two" is not replaced by the constant TWO in second case statement.
Comment 1 Deepak Azad CLA 2011-07-19 09:32:20 EDT
Not a new bug.

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