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

Bug filed.

On Wed, Sep 2, 2009 at 12:37 AM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
I didn't answer this earlier because I am not sure what the specified behavior should be.  There are many subtle differences between code style and annotation style behavior and this appears to be one of them.  In general, we want the behavior for the two syntaxes to be as close as possible, so there is a good argument that this is a bug.

I'd recommend that you raise a bug for this and we can think about whether or not it makes sense to change the behavior.

2009/9/1 João Gonçalves <jocolimonada@xxxxxxxxx>

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?


aspectj-users mailing list

aspectj-users mailing list