| Summary: | Annotation processor doesn't generate impl for inner interfaces correctly | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Konstantin Komissarchik <konstantin> |
| Component: | Sapphire | Assignee: | Konstantin Komissarchik <konstantin> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ling.hao |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
> whereas it should produce ParentImpl and ParentImpl$ChildImpl classes.
Thinking about it some more, it should really produce Parent$ChildImpl as the logic that generates the default implementation class name should not making any assumptions about the class/interface containing the model element interface with @GenerateImpl annotation. It could be another model element interface or it could be an arbitrary class.
Fixed. Since the logic for deriving the impl class name has gotten to be fairly involved, I refactored it into a set of new static methods ModelElementType.getImplClassName(). These methods are called by the annotation processor and at runtime when locating the impl class to instantiate. TestModelingMisc0006 covers the new method, including the handling of inner classes. I need to back port this to 0.3.1. Re-opening. Done. Verify via TestModelingMisc0006 and that the original model element sample does generate Parent and IParent$ChildImpl classes. |
Given the following model element type declaration (notice the inner type declaration), the annotation processor produces implementation classes ParentImpl and ChildImpl whereas it should produce ParentImpl and ParentImpl$ChildImpl classes. @GenerateImpl public interface Parent extends IModelElement { ModelElementType TYPE = new ModelElementType( Parent.class ); // *** Children *** @GenerateImpl public interface Child extends IModelElement { ModelElementType TYPE = new ModelElementType( Child.class ); // *** Name *** ValueProperty PROP_NAME = new ValueProperty( TYPE, "Name" ); Value<String> getName(); void setName( String value ); } @Type( base = ServicePortNameWrapper.class ) ListProperty PROP_CHILDREN = new ListProperty( TYPE, "Children" ); ModelElementList<Child> getChildren(); }