Community
Participate
Working Groups
Build Identifier: M20100909-0800 In the current refactoring infrastructure formatting does not follow ASTNodes. Therefore, when these are moved, as happens in Extract Method when code is moved from one method to another, the code is pretty-printed and code formatting does not follow the nodes. The result is that whitespaces in the code are replaced with those inserted by the pretty-printer and that macros are expanded This bug was first reported by Alex Richardson in bug 296192, but that bug has become an aggregate of many bugs, so I am splitting them. Reproducible: Always Steps to Reproduce: 1. Create some code with strange formatting and use of macros 2. Select the code and choose Refactor -> Extract method 3. The new code in the new method has now been reformatted according to the rules of the pretty-printer and the macros has been expanded.
Created attachment 189481 [details] Test case extracting macro
Created attachment 190533 [details] Fix for the expansion bug
Created attachment 190536 [details] Fix for the expansion bug The old patch contains some comment handling code that belongs to an other bug report.
Fixed the macro expansion bug in HEAD > 20110307. I'm not going to have a look at the formatting issue now. Im closing this Bug an create a new one for the formatting.
*** cdt cvs genie on behalf of egraf *** Bug 333936: When ASTNodes are moved (as in Extract Method) formatting is not preserved and macros are expanded <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=333936>https://bugs.eclipse.org/bugs/show_bug.cgi?id=333936</a> [*] ExtractExpression.rts 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts?root=Tools_Project&r1=1.8&r2=1.9 [*] MacroExpansionHandler.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/MacroExpansionHandler.java?root=Tools_Project&r1=1.6&r2=1.7 [*] NamespaceHelper.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NamespaceHelper.java?root=Tools_Project&r1=1.5&r2=1.6 [*] NameHelper.java 1.11 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/utils/NameHelper.java?root=Tools_Project&r1=1.10&r2=1.11 [*] ExtractStatement.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractStatement.java?root=Tools_Project&r1=1.2&r2=1.3 [*] ExtractedFunctionConstructionHelper.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractedFunctionConstructionHelper.java?root=Tools_Project&r1=1.5&r2=1.6 [*] ExtractFunctionRefactoring.java 1.30 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java?root=Tools_Project&r1=1.29&r2=1.30 [*] ExtractExpression.java 1.16 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java?root=Tools_Project&r1=1.15&r2=1.16 [*] ImplementMethodRefactoring.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/implementmethod/ImplementMethodRefactoring.java?root=Tools_Project&r1=1.16&r2=1.17 [*] FunctionFactory.java 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/FunctionFactory.java?root=Tools_Project&r1=1.8&r2=1.9 [*] GetterSetterInsertEditProvider.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GetterSetterInsertEditProvider.java?root=Tools_Project&r1=1.6&r2=1.7 [*] ExtractLocalVariableRefactoring.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java?root=Tools_Project&r1=1.13&r2=1.14 [*] NodeContainer.java 1.18 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/NodeContainer.java?root=Tools_Project&r1=1.17&r2=1.18