Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338507 - @extends treated as @implements for classes
Summary: @extends treated as @implements for classes
Status: RESOLVED WONTFIX
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: 2.7.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-01 02:07 EST by Ed Willink CLA
Modified: 2011-03-01 12:27 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2011-03-01 02:07:28 EST
The following fragment of an auto-generated validator is manually edited to include an @extends and a manual change to the extended class.
----------
import org.eclipse.emf.ecore.util.EObjectValidator;
import org.eclipse.ocl.examples.xtext.oclinecore.validation.OCLinEcoreEObjectValidator;

/**
 * <!-- begin-user-doc -->
 * The <b>Validator</b> for the model.
 * @extends OCLinEcoreEObjectValidator
 * <!-- end-user-doc -->
 * @see company.CompanyPackage
 * @generated
 */
public class CompanyValidator extends OCLinEcoreEObjectValidator {
-----------
after regeneration the final line is not preserved. It becomes:
-----------
public class CompanyValidator extends EObjectValidator implements OCLinEcoreEObjectValidator {
-----------
suggesting that @extends is only supported properly for interfaces.

[Perhaps this is an enhancement since at the end of ch 10 of the EMF book, @implements is described as an additional facility for classes without indicating that @extends changes behaviour for classes.]
Comment 1 Ed Merks CLA 2011-03-01 10:14:51 EST
It's working as designed.  You can imagine that changing that design can break existing usage.  Use @generate not to have control over both the extends and the implements of a class.
Comment 2 Ed Willink CLA 2011-03-01 11:45:08 EST
I tried @generate NOT on the class, but that disables regeneration of internal class fields too.
Comment 3 Ed Merks CLA 2011-03-01 11:54:52 EST
That's why I said use "@generated not" rather than "@generated NOT" because for class/interfaces, the later disables all merging, including for nested content while anything other than "NOT" disables merging only for the "header" itself.
Comment 4 Ed Willink CLA 2011-03-01 12:27:57 EST
Thanks; should have read more thoroughly.