Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut that includes only interfaces

Hmmm....that almost sounds like a bug, but don't know if this is an
AspectJ bug, or an AJDT bug.

Given this:

package p;

public aspect Aspect {
	interface I1 {}
	declare parents : p..* extends I1;
}

package p;
public interface Interface { }

package p;
public class AClass { }


I would hve expected that the compiler looks at the "extends" of
declare parents and sees that the target is an interface.  So, the
"extends" should only apply to other interfaces.  If it were
"implements" then would only apply to classes.

However, AspectJ applies the declare parents to the class, the
interface, *and* the aspect.

And, AJDT incorrectly applies the "extends" clause to the class.  The
creates a spurious error in the editor because AJDT assumes that
AClass "extends" I1 (but should really be "implements").

Johan, until we figure out what *should* be happening here, and
potentially fix the compiler bug (if we determine that this behavior
is incorrect), then there is no way that I know of to address your
problem.

--a

On Mon, Apr 27, 2009 at 5:18 AM, Johan Haleby <haleby@xxxxxxxxx> wrote:
> Hi,
>
> I'd like to create a simple aspect that adds an interface to other
> interfaces in a specific package. Right now my pointcut looks like:
> declare parents: x.y.z..* extends MyInterface;
>
> My question is, how to I include only interfaces in the pointcut? I.e. no
> concrete (or abstract) classes.
>
> /Johan
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top