Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Weaving anonymous inner class

AspectJ will always weave the anonymous inner classes.  You would have
to actively specify something in your pointcuts to stop it doing it.

public aspect X {
  before(): call(* println(..)) {}
}

class C {
	public static void main(String[] args) {
		new Runnable() {
			public void run() {
				System.out.println("hello");
			}};
	}
}

$ ajc -showWeaveInfo C.java X.aj
Join point 'method-call(void
java.io.PrintStream.println(java.lang.String))' in Type 'C$1'
(C.java:5) advised by before advice from 'X' (X.aj:3)

Andy.


On 26/10/2007, Hendrik Gani <s2116865@xxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> Does anyone know how we can weave an anonymous inner class in aspectj
> (if it is possible at all)?
>
> Is it possible to tell aspectj to weave all the methods of a class
> including those that belong to its inner classes?
>
> Thanks heaps,
>
> Hendrik
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top