[jboss-user] [JBoss AOP] - Strange behavior with execution pointcuts.

jnorris10 do-not-reply at jboss.com
Tue Jul 11 20:48:16 EDT 2006


In the jboss-aop_1.5.0.GA source distribution, In the docs/aspect-framework/examples/method-execution example, if I simply change the jboss-aop.xml descriptor to the following:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <aop>
  |    <bind pointcut="execution(public void POJO->callBar())">
  |      <interceptor class="MethodInterceptor"/>
  |    </bind>
  | </aop>
  | 

The MethodInterceptor is not invoked for the call to POJO->callBar().  This seems very strange.  Can someone please explain this behavior?

Here is the unchanged POJO.java file for reference:


  | public class POJO
  | {
  |    public void noop()
  |    {
  |       System.out.println("noop()");
  |    }
  | 
  |    public void test1(String param)
  |    {
  |       System.out.println("test1(String param): " + param);
  |    }
  | 
  |    public void test2(int param)
  |    {
  |       System.out.println("test2(int param): " + param);
  |       callBar();
  |    }
  | 
  |    public static void test2()
  |    {
  |       System.out.println("static method");
  |    }
  | 
  |    public void callBar()
  |    {
  |       new Bar().hello();
  |    }
  | 
  |    public class Bar
  |    {
  |       public void hello() { System.out.println("hello"); }
  |    }
  | }
  | 

To reproduce this, simple make the change to the jboss-aop.xml file in this example and run ant.  Thanks for your help.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957192#3957192

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957192



More information about the jboss-user mailing list