Community
Participate
Working Groups
Build Identifier: I20100608-0911 Hi guys, I'm sorry if this is already reported: I did a quick scan and couldn't find anything but I'm currently in a hurry. Anyhow, just wanted to report this problem with the refactoring functionality (see the steps below). Some clues may be that it happened to me twice on two attributes that were inside namespaces (on different classes). I'll be attaching the error log. Reproducible: Always Steps to Reproduce: 1. Create a C++ class 2. Create an attribute of the class 3. Try to generate Getters and Setters for that attribute (Right Click on the attribute name -> Source -> Generate Getters and Setters...)
Created attachment 177582 [details] Error log This is what I got after trying to refactor the attributes (see original bug report)
I can reproduce that with fields in OgreMesh.h in the Ogre source code. I'll try to create a simpler example.
Test.h: #ifndef TEST_H_ #define TEST_H_ namespace foo { class Test { int testField; void foo(); }; } #endif Test.cpp: #include "Test.h" namespace foo { void Test::foo() { } } I think Generate Getters and Setters should handle scope like Implement method, using NameHelper.createQualifiedNameFor. This is related to bug 316083.
So, what's the status on this?
The cause for this is the ContainerNode in the modifacation adding the definitions. The ContainerNode can't be casted to IASTFunctionDefinition.
Created attachment 178797 [details] Bugfix and test case
Fixed in HEAD and 7.0 > 20100914
*** cdt cvs genie on behalf of egraf *** Bug 323780: "Generate Getters and Setters..." crashes <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=323780>https://bugs.eclipse.org/bugs/show_bug.cgi?id=323780</a> FIXED [*] ASTModificationHelper.java 1.4.14.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java?root=Tools_Project&r1=1.4&r2=1.4.14.1 [*] GenerateGettersAndSettersRefactoring.java 1.11.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GenerateGettersAndSettersRefactoring.java?root=Tools_Project&r1=1.11&r2=1.11.2.1 [*] GenerateGettersAndSetters.rts 1.6.4.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts?root=Tools_Project&r1=1.6&r2=1.6.4.1 [*] GenerateGettersAndSetters.rts 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts?root=Tools_Project&r1=1.8&r2=1.9 [*] GenerateGettersAndSettersRefactoring.java 1.13 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/gettersandsetters/GenerateGettersAndSettersRefactoring.java?root=Tools_Project&r1=1.12&r2=1.13 [*] ASTModificationHelper.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java?root=Tools_Project&r1=1.4&r2=1.5