Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to exclude field execution from method executions pointcut with Aspectj
    text
    copied!<p>I'd like to capture all method executions. So I defined below pointcut and tried to exclude the field access with get/set pointcut designators, but it doesn't work. </p> <p>Any suggestions? Thanks a lot.</p> <pre><code> pointcut funcExecutionPointcut():execution(* *.*(..)) &amp;&amp; !get(* *.*) &amp;&amp; !set(* *.*); before():funcExecutionPointcut() { //log some info. Signature sig = thisJoinPointStaticPart.getSignature(); String className = ""; if (thisJoinPoint.getThis() != null) className = thisJoinPoint.getThis().getClass().getName(); mylogger.log(Level.INFO,"Entering [(" + className + ")" + sig.toShortString() + "] @" + line + "@" +file); } </code></pre> <p>The problem is that the output shows that the class's fields are also hit by the pointcut, log like below.</p> <pre><code>2013-09-30 11:39:11:18 Thread-447 INFO AspectJFuncTracing - Entering [()ImageListManager.access$0(..)] @48@ImageListManager.java 2013-09-30 11:39:11:19 Thread-447 INFO AspectJFuncTracing - Entering [()ImageListManager.access$1(..)] @56@ImageListManager.java </code></pre> <p>The corresponding source code is as below.</p> <pre><code> .... public void run() { while (mThreadBeing) { try { sleep(sleeptime); } catch (Exception e) { e.printStackTrace(); } sleeptime = 200; if (!mThreadBeing) { break; } if (mScrolling) { continue; } ... </code></pre> <p>ImageListManager.access$0 points to the class field mThreadBeing, while ImageListManager.access$1 points to the class field mScrolling.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload