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

Bug 338507

Summary: @extends treated as @implements for classes
Product: [Modeling] EMF Reporter: Ed Willink <ed>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

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.