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 it makes sense to do it, but as to *when* I’m not sure. Definitely worth getting a bugzilla enhancement logged in the system.

Feels something that could be done by a separate contributor actually - it isn’t *too* complicated, that I could probably guide. But I’m not sure I have time to implement it myself right now.

cheers,
Andy

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

So, What you think Andy? Is there a chance to implement this feature?

On Wed, Jun 17, 2015 at 12:57 PM, Henrique Rebêlo <hemr@xxxxxxxxxxx> wrote:
Hi Andy,

Thanks for answering! That's good see the support for the classical syntax... but the @annotation style need to be updated... I'm not talking about if pointcuts. See bellow:

public interface I {
@Pointcut("execution( * *(..))")
public static void pc(){}

}

We both know that interfaces now support static methods and we also know that the above pointcut (which does not include an if pointcut) is valid if declared within a class, but it's forbidden within an interface... the compiler says the following:

                  "pointcuts can only be declared in a class or an aspect"

cheers

On Mon, Jun 15, 2015 at 5:07 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
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


_______________________________________________
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



--
...............................................................................................................................
Henrique Rebelo
http://www.cin.ufpe.br/~hemr
Informatics Center, UFPE, Brazil



--
...............................................................................................................................
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