Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut for JDK runtime packages/methods

2012/11/21 Brian Toal <brian.toal@xxxxxxxxx>
    @Pointcut("execution(* *(..))")
    public void executionPointCut() {
       
    }
[...} 
The Before/After methods are entered for a method that is called within my test program so I can confirm they are working for methods outside of java.util.*.

What do I need to do to get java.* executions picked up?

The JDK classes (everything contained in rt.jar) are loaded by the JVM before the load-time weaving (which I assume you're using, even though the problem would be the same with compile-time weaving) has the opportunity to start working. Since the weaver is written in Java, it needs the JDK to work anyway.

It's possible to weave aspects on rt.jar, and then preload it using the bootclasspath of the JVM, but you need to be extra careful when doing it so you don't have an initialization order problem between the classes, so using your extra-broad pointcut would be out of the question.

In your case, I'd consider using the call(* java.util.Map.put(..)) pointcut instead, that would be much less hassle.

Frank

Back to the top