Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Interfaces and pointcuts declarations in Java 8/AspectJ

Well, we do already support pointcut declarations in interfaces:

interface I {
  pointcut p(): execution(* main(..));
}

aspect X {
  before(): I.p() {
    System.out.println(">>");
  }
}

public class Code {
  public static void main(String[] argv) {
  }
}

But I suppose if you especially mean annotation style pointcuts in interfaces (as in your example if() pointcut).  We certainly could improve the story here.

cheers,
Andy

On Jun 12, 2015, at 6:34 PM, Henrique Rebêlo <hemr@xxxxxxxxxxx> wrote:

Hi Andy and all,

I was wondering that now AspectJ should support pointcut declarations in interfaces. New features in Java 8 include static method declarations or default method declarations in an interface. Hence, I believe to make the AspectJ language more orthogonal and symmetric, we should consider to have pointcut declarations in aspects, classes and also interfaces.

I think that one design decision that is forbidding pointcuts on interfaces is that before we couldn't write methods with bodies in interfaces, thus avoiding the use of the main design (specially in @AspectJ where we need method bodies for If pointcuts)...

What you think? This is just an advice (not AspectJ advice :-) to make the AspectJ sync with Java.

--
...............................................................................................................................
Henrique Rebelo
http://www.cin.ufpe.br/~hemr
Informatics Center, UFPE, Brazil
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top