Bug 425219 - Unnecessary CPP file generated for abstract class
Summary: Unnecessary CPP file generated for abstract class
Status: ASSIGNED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Designer (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ansgar Radermacher CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-09 14:09 EST by Mihai Ciobanu CLA
Modified: 2017-08-07 11:31 EDT (History)
4 users (show)

See Also:


Attachments
Model reproducing the bug (1.60 KB, application/octet-stream)
2014-01-09 14:09 EST, Mihai Ciobanu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Ciobanu CLA 2014-01-09 14:09:46 EST
Created attachment 238835 [details]
Model reproducing the bug

Steps to reproduce:

1. Add class element to model
2. Add 2 operations to class
3. Add the virtual stereotype to the both operations
4. Set both operations to be abstract (making them pure virtual)
5. Set the class to be abstract
6. Generated code for the class



A class body cpp file is generated even though it is an abstract class.
Comment 1 Ansgar Radermacher CLA 2014-01-10 10:46:26 EST
I agree that this is not very nice (although its not harmful)
Comment 2 Andrew Eidsness CLA 2014-04-02 11:20:54 EDT
Based on this I think that if:

    1. class is abstract,
    2. all operations are abstract,
    3. none of the operations have bodies,
    4. there are no static properties, *and*
    5. none of the non-static properties have default values

Then the implementation file does not need to be generated.

Have I missed any conditions?
Comment 3 Andrew Eidsness CLA 2014-04-02 12:46:21 EDT
The problem with this is that the .cpp file is needed in order to create an implementation for the abstract operation.

I recommend that this bug be closed without making any changes.

My thinking is that there is no harm in having an empty implementation file (in the rare cases that satisfy the conditions in comment 2) and the cost is considerable complexity is several parts of the generator.