Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Declare annotation question

Hi Ashley,

As you have discovered in the doc:
http://www.eclipse.org/aspectj/doc/released/adk15notebook/ataspectj-declare.html

there are no equivalent constructs for 'declare @' if you are in
annotation style syntax - that is a point in time statement as we just
haven't had the requirements or requests in to do an implementation.
You will have found the DeclareAnnotation annotation we ship but it
doesn't yet work if you use it.

I'm not aware of any hacks other than using some other bytecode mod
tool to add those annos.

Can you not build the code style aspects into a jar as a separate
activity in another project then use them with binary weaving?  So you
can keep your project as pure Java

Andy.

On 29/11/2007, Ashley Williams <ashley.williams@xxxxxx> wrote:
>
> Hi,
>
> I've started converting our various aspects to the annotation style of
> development so that we can use the ordinary java compiler and then weave at
> runtime. This way our build process doesn't need to change and since we are
> new to aspectj, very comforting for everyone.
>
> However I seem to have hit on a snag when it comes to declaring our @Tracing
> annotation, since the @DeclareAnnotaion equivalent doesn't seem to work, and
> reading the documentation confirms this. Is there some workaround that I can
> use no matter how dirty?
>
> A little more background to what I am trying to do: I would like to create a
> number of different tracing profile aspect that declare the tracing
> annotations in different combinations, so that we can choose which one gets
> woven by modifying a deployment aop.xml file, here are a couple of examples:
>
> //  I have example pojos called Pojo1.java, Pojo2.java etc for this test
> case
>
> public aspect FullPojoTracing {
>         declare @type : Pojo* : @Tracing(loggerName = "FullPojoTracing");
>
>         declare @field : * Pojo*.* : @Tracing;
>
>         declare @constructor : Pojo*.new(..) : @Tracing;
>
>         declare @method : * Pojo*.*() : @Tracing;
> }
>
> public aspect ConstructorPojoTracing {
>         declare @type : Pojo* : @Tracing(loggerName =
> "ConstructorPojoTracing");
>
>         declare @constructor : Pojo*.new(..) : @Tracing;
> }
>
> Thanks for any tips
> - Ashley
>  ---
>
>  This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>  Please refer to
> http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top