Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] declare annotations within aop.xml

Ok, implemented under https://bugs.eclipse.org/bugs/show_bug.cgi?id=375881

Dev build is on the downloads page or here:
http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/dev/aspectj-DEVELOPMENT-20120402142200.jar

It enables you to write declare-annotation segments in the
concrete-aspect section of aop.xml.  Here is one of my testcase XMLs:

<aspectj>
  <aspects>
    <concrete-aspect name="ConjuredUp">
      <declare-annotation field="* field1"
annotation="@Annot(someBoolean = false,   'abc'  )"/>
    </concrete-aspect>
  </aspects>

  <weaver options="-Xreweavable -verbose -XlazyTjp -showWeaveInfo">
    <include within="Hello6"/>
  </weaver>
</aspectj>

You can use field or method (to indicate declare @field or declare
@method), you cannot specify type yet.  All annotation value types are
supported apart from arrays and nested annotations.  Notice to avoid
the need to write double quotes as &quot;, you can use single quotes
for strings.  If you are using a class reference it must either be in
java.lang or fully qualified.

There is still more error checking code to go in but hopefully you can
use it as it is now.

cheers,
Andy

On 1 April 2012 07:51, Dominik Mengelt <dominik.mengelt@xxxxxxxxx> wrote:
> Andy,
>
> Thanks for your efforts. It is really appreciated.
>
>> I suspect markers wont be enough for you?  If so if you can tell me
>> the types of value (string,int, etc) you need to specify in the
>> annotation I'll do those first.
>
>
> Thats correct. I need the following types:
>
> - string
> - long
> - boolean
> - class
>
> It would be great to have a dev / nightly build with the ability to define
> annotations within the aop.xml
>
> thanks again,
> domi
>
>
> On Fri, Mar 30, 2012 at 8:58 PM, Andy Clement <andrew.clement@xxxxxxxxx>
> wrote:
>>
>> > So I'm curious if there are currently any plans to implement this
>> > feature or
>> > can anybody provide an alternate solution to this problem?
>>
>> I didn't have plans but as you are asking for it I've done a bit of
>> hacking this morning.  I can currently add annotations to
>> fields/methods but only simple marker annotations.
>>
>> I can do this
>>
>> <declare-annotation method="* foo(..))" annotation="@Marker"/>
>>
>> you cannot say
>>
>> annotation="@Marker(x=y,z=a)"
>>
>> I suspect markers wont be enough for you?  If so if you can tell me
>> the types of value (string,int, etc) you need to specify in the
>> annotation I'll do those first. (Obviously supporting all of them
>> would be nice, but not sure i have time to do that right now).
>>
>> Also declare @type won't work right now.
>>
>> cheers,
>> Andy
>>
>> On 30 March 2012 04:30, Dominik Mengelt <dominik.mengelt@xxxxxxxxx> wrote:
>> > Hi all,
>> >
>> > I'm interested in the possibility to declare field and method
>> > annotations
>> > directly on concrete aspects in an aop.xml. Basically I have the same
>> > "problem / feature request" as Thomas on the following post:
>> >
>> > http://aspectj.2085585.n4.nabble.com/abstract-quot-declare-method-quot-td3823887.html
>> >
>> > What I also found is the following enhancement request from Andrew:
>> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=359159
>> >
>> > On the end of comment 1 Andrew says:
>> >
>> >> "A similar model could be extended to
>> >> support any declares too (anntation/parents)".
>> >
>> >
>> > So I'm curious if there are currently any plans to implement this
>> > feature or
>> > can anybody provide an alternate solution to this problem?
>> >
>> > Thanks in advance.
>> >
>> > Domi
>> >
>> > _______________________________________________
>> > aspectj-users mailing list
>> > aspectj-users@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> >
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top