Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] [BUG?] @DeclareParents - Am I defining an implementation for the interface or the classes that implement the interface?

Greetings,

I'm having problems with the "translation" of the following inter-type declaration to the new @AspectJ notation:

private String FigureElement.enclosingGroup = null;


I'm working with the following hierarchy:

interface FigureElement
class Group implements FigureElement


I've declared the following interface:

public interface FigureEnclosingGroup {
    String getFigureEnclosingGroup();
    void setFigureEnclosingGroup(String enclosingGroup);
}


I've also defined a simple implementation class FigureEnclosingGroupImpl.

The @DeclareParents code I'm using is:

@DeclareParents(value="FigureElement", defaultImpl=FigureEnclosingGroupImpl.class)
private FigureEnclosingGroup figureEnclosingGroup;


However, when I cast a Group element to FigureElement and try to access the getFigureEnclosingGroup() method, I get the following exception:

java.lang.AbstractMethodError: Group.getFigureEnclosingGroup()Lfigures/Group

That is, the method is not found.

HOWEVER, if in the @DeclareParents' value attribute I use "FigureElement+" (notice the plus sign), everything runs without errors (and well)...


Is this the normal behaviour? In the first @DeclareParents was I just stating that the implementation would affect only the interface and not the classes that implement it!? Must I use the plus sign with @DeclareMixin as well?


Thanks.

Back to the top