Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to define an abstract pointcut with args in aop.xml?

I'm afraid, as the docs say (
http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html
) and that error message suggests, you can't concretize a pointcut
taking arguments.  I don't think it cannot technically be done, we
just haven't done it yet.

In this case, can you not just split the pointcut up?

keep the part that exposes args in your aspect and make the scope the
abstract pointcut:

pointcut publicTest(int i): args(i) && scope();
abstract pointcut scope();

aop.xml:
"scope" expression="execution(* com.test.main.Main.fact(..))"/>

Not a very flexible solution, I'll admit...  Feel free to raise an
enhancement request for what you want.

Andy

2009/6/4 Nilay Singh <maran001.nilay@xxxxxxxxx>:
> Hi,
>
> I am trying to use the abstract pointcut having args in aop.xml.
>
> Sample :
>
> AspectTest.java
>
> public
>
> abstract aspect AspectTest {
>
>         abstract
>
> protected pointcut publicTest(int i);
>
>         before(int i): publicTest(i) {
>
>            System.
>
> out.println("Current arg is " + i);
>
>         }
>
> }
>
>
>
> aop.xml
>
> <?
>
> xml version="1.0" encoding="UTF-8"?>
>
> <aspectj>
>
> <aspects>
>
> <concrete-aspect name="com.test.aspect.Test1"
> extends="com.test.aspect.AspectTest">
>
> <pointcut name="publicTest(int i)" expression="execution(*
> com.test.main.Main.fact(..)) AND args(i)"/>
>
> </concrete-aspect>
>
> </aspects>
>
> <weaver options="-verbose -showWeaveInfo, -debug">
>
> <include within="com.test.main.*"/>
>
> </weaver>
>
> </
>
> aspectj>
>
>
>
> but while running the Main.java, getting an error that:
>
> [WeavingURLClassLoader] error Abstract method 'void
> com.test.aspect.AspectTest.ajc$pointcut$$publicTest$528(int)' cannot be
> concretized as a pointcut (illegal signature, must have no arguments, must
> return void): <concrete-aspect name='com.test.aspect.Test1'
> extends='com.test.aspect.AspectTest' perclause='null'/> in aop.xml
>
> [WeavingURLClassLoader] error Concrete-aspect 'com.test.aspect.Test1' could
> not be registered
>
>
> need help ASAP......
>
>
> Regards
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top