[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] (no subject)

 Hi,
Sorry for the lengh of this post !
I create an abstract Aspect like this :

package iep.perf;

import java.util.Calendar;
import java.io.File;

public abstract aspect AbstractDurationMethod {
   private static String rootTrace = "";

   private static Trace outDurationMethods;
   static {
       rootTrace = System.getProperty("rootTrace");

       outDurationMethods = new Trace(rootTrace + File.separator
               + "outDurationMethods.log");
   }

   public abstract pointcut methods();

   Object around(): methods() {
       long deb = Calendar.getInstance().getTimeInMillis();
           
       Object retour= proceed();
       long fin = Calendar.getInstance().getTimeInMillis();
       outDurationMethods.append(outDurationMethods.getSdf().format(
               Calendar.getInstance().getTime())
               + ";JointPoint ="
               + thisJoinPoint.getSignature().getDeclaringTypeName()
               + "."
               + thisJoinPoint.getSignature().getName()
               + ";duration="
               + (fin - deb) + " ms\n");
       outDurationMethods.flush();
       return retour;
         }

}

I use classes Square and Circle found in eclipse documentation to test my aspects

When i try this aspect with concrete-aspect tag in aop.xml :

<concrete-aspect name="iep.perf.DurationMethod"
           extends="iep.perf.AbstractDurationMethod">
           <pointcut name="methods"
               _expression_="within(jlp.exemple1.*) &amp;&amp;  call (public * jlp..*(..))" />
       </concrete-aspect>

I get this error :
Exception in thread "main" java.lang.IllegalAccessError: tried to access method
iep.perf.AbstractDurationMethod.ajc$around$iep_perf_AbstractDurationMethod$1$cd1
02c33proceed(Lorg/aspectj/runtime/internal/AroundClosure;)Ljava/lang/Object; fro
m class jlp.exemple1.Main
       at jlp.exemple1.Main.perimeter_aroundBody1$advice(Main.java:124)
       at jlp.exemple1.Main.perimeter_aroundBody2(Main.java:1)
       at jlp.exemple1.Main$AjcClosure3.run(Main.java:1)
       at iep.perf.AbstractDurationMethod.ajc$around$iep_perf_AbstractDurationMethod$1$cd102c33proceed(AbstractDurationMethod.aj:1)
       at iep.perf.AbstractDurationMethod.ajc$around$iep_perf_AbstractDurationMethod$1$cd102c33(AbstractDurationMethod.aj:24)
       at jlp.exemple1.Main.main(Main.java:8)

When I extend my Abstract Aspect like this :
package iep.perf;

public aspect ConcreteDurationMethod extends AbstractDurationMethod {

   public pointcut methods():within(jlp.exemple1.*) &&  call (public * jlp..*(..));

}

and modify my aop.xml like below :
<aspect name="iep.perf.ConcreteCounterInstances"/>
it runs fine !
But that i want is to use concrete-aspect tag.
I use AspectJ 1.5.4 embedded in Eclipse Europa 3.3.1  Build id: M20070921-1145

Do you think that is a bug, or otherwise what did i miss ?
Thanks
JLP