Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316083

Summary: Generate getters and setters does not handle nested classes in cpp definition
Product: [Tools] CDT Reporter: Marc-André Laperle <malaperle>
Component: cdt-refactoringAssignee: Marc-André Laperle <malaperle>
Status: RESOLVED FIXED QA Contact: Sergey Prigogin <eclipse.sprigogin>
Severity: normal    
Priority: P3 CC: Jesse.Weinstein, kosashi, yevshif
Version: 7.0   
Target Milestone: 8.3.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Handle nested classes patch
none
Minimal project to verify the problem none

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.