Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316083 - Generate getters and setters does not handle nested classes in cpp definition
Summary: Generate getters and setters does not handle nested classes in cpp definition
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.3.0   Edit
Assignee: Marc-André Laperle CLA
QA Contact: Sergey Prigogin CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-07 23:42 EDT by Marc-André Laperle CLA
Modified: 2013-10-20 01:34 EDT (History)
3 users (show)

See Also:


Attachments
Handle nested classes patch (1.85 KB, patch)
2010-06-07 23:44 EDT, Marc-André Laperle CLA
no flags Details | Diff
Minimal project to verify the problem (1.94 KB, application/x-zip-compressed)
2013-04-23 14:04 EDT, Jesse Weinstein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2010-06-07 23:42:55 EDT
class TestClass 
{
public:
  class TestNestedClass
  {
    int a;
  };
  TestClass();
  virtual ~TestClass();
};

Generates:

int TestNestedClass::getA() const
{
...


void TestNestedClass::setA(int a)
{
...
Comment 1 Marc-André Laperle CLA 2010-06-07 23:44:06 EDT
Created attachment 171365 [details]
Handle nested classes patch
Comment 2 Jesse Weinstein CLA 2013-04-23 14:04:37 EDT
Created attachment 230043 [details]
Minimal project to verify the problem

Verified with eclipse-SDK-4.3M5a-win32-x86_64.

The refactoring does work if the definitions are inline, obviously. You have to select the "Definition separate from declaration" checkbox to make it generate the invalid code.
Comment 3 Jesse Weinstein CLA 2013-04-23 14:08:29 EDT
I suspect that solving this will depend on bug 402878, which is enhancing the index to track the nested status of classes. Possibly the existing namespace support is sufficient, but probably not.

If a committer would add 402878 to the "Depends on" list, that'd be useful.
Comment 4 Sergey Prigogin CLA 2013-04-23 20:43:16 EDT
(In reply to comment #3)
This bug doesn't depend on bug 402878 since class nesting structure is available in the index. Bug 402878 is about visibility of nested classes, which is irrelevant for this use case.
Comment 5 Marc-André Laperle CLA 2013-06-15 21:14:30 EDT
Proposed fix:
https://git.eclipse.org/r/13843
Comment 6 Marc-André Laperle CLA 2013-10-20 01:34:33 EDT
Fix applied to master. I created bug 419919 for further improvements to handling namespaces in generated code.