Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Unused methods in weaved class

Hi~

When we used simple "around()" advice, there are many anonymous methods in 
Core java class & Cross concern aj class.

I saw some of methods are not used..


Here is Sample code.
If we weaved those classes,
In TestMain.java
 - sayWorld_aroundBody0(..)
 - sayWorld_aroundBody1$advice (..)

In TestAspect.aj
 - ajc$around$com_my_test_TestAspect$1$cbb76d13(..) =>  anonymous method
 - ajc$around$com_my_test_TestAspect$1$cbb76d13proceed(..)
 - ajc$inlineAccessMethod$com_my_test_TestAspect$com_my_test_TestAspect$testMethod(..)

 - and Methods..(postinit, init, cinit, aspectof, hasAspectI ...)

And i when i debuged program, the program  are use only three methods
 - sayWorld_aroundBody1$advice
 - sayWorld_aroundBody0
 - ajc$inlineAccessMethod$com_my_test_TestAspect$co...
 
the others method are not used...
Is there reason for unused methods ?

I`m really curious....
(and sayWorld_aroundBody1$advice & ajc$around$com_my_test_TestAspect$1$cbb76d13 are very similar...hm....)

=====================================

TestMain.java

public class TestMain {

    public void sayHello() {

        System.out.println("say hello~");

        sayWorld();

    }

    public void sayWorld() {

        System.out.println("say world~");

    }

    public static void main(String[] args) {

        new TestMain().sayHello();

    }

}

=====================================

TestAspect.aj

pointcut test() :call( void com.my.test.TestMain.sayWorld());

    void around() : test() {

          System.out.println("test");

           proceed();

           testMethod();

     }


      private void testMethod(){

           System.out.println("method");

       }


=============================================

Think!!


Back to the top