2 Replies Latest reply on Jun 17, 2005 3:10 PM by Bill Burke

    Infinite loop when applying caller aspects

    Ben Livshits Newbie

      I have been using caller aspects successfully until it came to instrumenting calls to some Swing classes.

      In particular, the method I am instrumenting is javax.swing.JTable->addNotify. The interceptor method looks as follows:

       public Object invoke(Invocation invocation) throws Throwable {
       // log.println("Hit " + invocation);
       if(invocation instanceof CallerInvocation){
       CallerInvocation cinvocation = (CallerInvocation)invocation;
       System.err.println("Unexpected " + invocation);
       return invocation.invokeNext();

      and the problem is that the return statement invocation.invokeNext causes method invoke() to be called on the same method as before leading to an infinite loop.

      Any thoughts?