Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut declaration in interfaces

sshhhh, don't tell anyone ;)

Looks like an unintended consequence of a lack of checking. It still
works in AJ5 M-very-very-nearly-3.  There was a big discussion on
pointcuts in interfaces a couple of years back (I was advocating such
a thing at the time), but with the model being that the pointcut
declaration would be implicitly abstract (like an operation in an
interface) and any concrete implementor of the the interface would be
required to provide a definition. There were issues with that proposal
though and we never carried it through (I'd have to go digging in the
archives to remind myself of the pros and cons that were discussed).

I can see why its kind of useful in the form that it accidently now
has, but proper support would depend on us doing the language design
to ensure all the consequences are well thought out. Please don't
depend on this feature in its current form!

On 23/08/05, Vincenz Braun <vb@xxxxxxxxx> wrote:
> Hello,
> 
> I am currently reading Eclipse AspectJ and found
> that pointcut declarations are only allowed in classes and
> aspects and not in interfaces. The Aspectj documentation also
> states this. I was a little bit surprised, because I had something
> different in my mind and started to write a little test case. With success.
> 
> With AJDT 1.2 and AspectJ 1.2 I could declare a pointcut in an interface.
> Is this a bug? Or in which version was this feature introduced? Does anybody
> know the background why this was(?) prohibited and now(?) is allowed?
> 
> Thanks a lot,
> Vincenz
> 
> // litte test:
> public interface TestIF {
> 
>     pointcut test(): call(String toString());
> }
> 
> public aspect TestAspect {
> 
>     after(): TestInterface.test() {
>         System.out.println("toString called");
>     }
> }
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


-- 
-- Adrian
adrian.colyer@xxxxxxxxx


Back to the top