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

Raised bug 273914
https://bugs.eclipse.org/bugs/show_bug.cgi?id=273914

On Mon, Apr 27, 2009 at 10:08 AM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> OK...this means two things:
> 1. this is an AJDT bug because AJDT thinks "extends" means extends and
> "implements" means implements.
> 2. What Johan is trying to do is not currently possible.
>
> I'll raise a bug for #1.
>
> On Mon, Apr 27, 2009 at 9:00 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
>> extends/implements are interchangeable and are only syntax sugar -
>> they don't express any kind of constraint about the match.
>>
>> And.
>>
>> 2009/4/27 Andrew Eisenberg <andrew@xxxxxxxxxxxx>:
>>> 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
>>>>
>>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>


Back to the top