The aspect is compiled for future use against other potential join point 
targets too - I can use that aspect and other test source code without 
recompiling it and it will work just fine - so the aspect is generated for 
different eventualities. Perhaps your target joinpoint in this scenario allows 
around advice inlining. But some other target joinpoint later may not. (You 
might find different methods are used if you tried -XnoInline to avoid 
inlining.) I can also imagine in the inlining case some of the methods are 
acting as ‘donors’ that just carry the compiled advice.  If advice is inlined 
that code is copied into the destination and looks ‘unused’ in the aspect. But 
next time it needs copying into another place it is there and ready to be 
copied, if we didn’t have the donor method we wouldn’t be able to do that.

Sorry I’m not going into specifics, I don’t have the time right now to dig 
through the code which is where I’d refresh my memory on why all these things 
exist. 

cheers,
Andy

> On May 21, 2015, at 5:40 AM, 이현동 <[email protected]> wrote:
> 
> 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!!
> 
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to