Community
Participate
Working Groups
Build Identifier: The refactoring generates declaration in an incorrect way. There are two separate problems, one applies to string constants and one to float constants. Reproducible: Always Steps to Reproduce: 1. Create new .c file, insert the code: void foo() { const char* a = "foo"; double d = 123.0; } 2. Select the string "foo" and run Refactor -> Extract Constant 3. Select the value 123.0 and run Refactor -> Extract Constant 4. Observe the declarations Generated: static const float _123_0 = 123.0; static const wchar_t _kos = "kos"; Expected: static const double _123_0 = 123.0; static const char* _kos = "kos";
Created attachment 173408 [details] test case update
Created attachment 173409 [details] fix for 8.0 (using DeclarationGenerator) I'll probably need to also submit a patch for 7.0 without using the new API (see discussion in bug 312736).
Fixed in HEAD and 7.0 > 20100707 I modified your patch for 7.0
*** cdt cvs genie on behalf of egraf *** Bug 318874: Extract Constant generates wrong declarations <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=318874>https://bugs.eclipse.org/bugs/show_bug.cgi?id=318874</a> [*] ExtractConstantRefactoring.java 1.17 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractconstant/ExtractConstantRefactoring.java?root=Tools_Project&r1=1.16&r2=1.17 [*] ExtractConstant.rts 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts?root=Tools_Project&r1=1.6&r2=1.7 [*] ExtractConstant.rts 1.6.6.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts?root=Tools_Project&r1=1.6&r2=1.6.6.1 [*] ExtractConstantRefactoring.java 1.15.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractconstant/ExtractConstantRefactoring.java?root=Tools_Project&r1=1.15.2.1&r2=1.15.2.2