Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] "Help with hasmethod() and hasfield() pointcuts"

Hi, here you go:

--- A.java ----- 8< -----
public class A {
  public static void main(String[]argv) {
  }
}

aspect X {
 declare parents: hasmethod(public void main(..)) implements
java.io.Serializable;
}
-----8<------
$ ajc -1.5 -showWeaveInfo -XhasMember A.java
Extending interface set for type 'A' (A.java) to include
'java.io.Serializable' (A.java)

$ javap A
Compiled from "A.java"
public class A extends java.lang.Object implements java.io.Serializable{
    public A();
    public static void main(java.lang.String[]);
}

I'm not sure why flicking the option on in AJDT is not working for you.

Andy.

On 19/12/2007, Henrique Mostaert <henrique.mr@xxxxxxxxx> wrote:
> Hello all,
>
>   Could someone give me some instructions in order to use hasmethod() and
> hasfield() pointcuts?
>
>   I activated the option in AJDT 1.4 with AspectJ 5 to "allow hasmethod()
> and hasfield() type patterns in declare parents and declare @type".  But, it
> doesn't work. The AJDT plugin doesn't recognize these pointcuts leading to
> compile time error. So, Could someone explain me why this happens?
>
>  Moreover, If someone could also show me how to allow these pointcuts
> Through ajc compiler options. (I didn't find the this option, only through
> eclipse and it does not work ).
>
> Regards!
>
> --
> Henrique Mostaert
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top