Community
Participate
Working Groups
Build Identifier: 201002161416 Consider a class having a friend function which is implemented in an independent file (i.e. it is not implemented in the header or .cpp file for that class). If you create a new method declaration in the header of the class, and then select "Source->Implement Method..." for that method, the refactoring programm creates the method stub in the same file containing the friend functions definition. I can't point to the exact circumstances to reproduce the bug, but the example below should hopefully be a good starting point. Reproducible: Sometimes Steps to Reproduce: 1. Create a new empty C++ executable project. 2. Add the three appended files to the project (all to the root directory). 3. Build the project. 4. Add a method declaration void FooBar() to the definition of class CFoo. 5. Select "Source->Implement Method..." for that method and let the refactoring engine implement the stub. 6. The generated method stub can be found in the file Printers.h, which should be considered an error.
Created attachment 165217 [details] Header for the class
Created attachment 165218 [details] Implementation for the class
Created attachment 165219 [details] Independent file
Created attachment 230046 [details] Minimal project to verify the problem Verified on eclipse-SDK-4.3M5a-win32-x86_64. Here's a minimal project, simplified from the example provided by the reporter (there's no need for including iostreams, etc.). This could be considered an enhancement, rather than a bug, as the code generated is not *wrong*, merely not what the reporter expected. Nevertheless, it would be good to look into how Implement Method decides where to put code, and possibly add some configuration options.