[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
re: [Fwd: Re: [aspectj-users] (no subject)]
|
> Objet : [Fwd: Re: [aspectj-users] (no subject)]
>
> Looks like a bug to me, if you raise it in bugzilla I will look into it.
>
> Andy
>
> On 06/11/2007, Jean-Louis PASTUREL wrote:
> > 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 :
> >
> > > > extends="iep.perf.AbstractDurationMethod">
> > > > expression="within(jlp.exemple1.*) && call (public *
> > jlp..*(..))" />
> >
> >
> > 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 :
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> ---------------------------------------------------------------------------------------
> Orange vous informe que cet e-mail a ete controle par l'anti-virus mail.
> Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
>
Using concrete-aspect tag with the schema below it works !
<aspectj>
<aspects>
<concrete-aspect name="iep.perf.DurationMethod"
extends="iep.perf.AbstractDurationMethod">
<pointcut name="methods"
expression="call (public * jlp..*(..))" />
</concrete-aspect>
</aspects>
<weaver>
<include within="jlp.exemple1.*"/>
</weaver>
</aspectj>
It seems that the expession attribute of concrete-aspect tag doesn't support a composite expession like "within(jlp.exemple1.*) && call (public * jlp..*(..))"
Putting the include element inside weaver tag solves the problem.
Is-it a limitation or an AspectJ bug ?
If it is, i will write a bug...
Best Regards