Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] New feature of Aspectj 1.6.11

 
Andy,
Your analysis is deeper than my first idea and more correct.

<Andy>
@interface Foo {
   String value() default "abc";
   int i() default 4;
}

and this annotated target

@Foo(value="hello")
int aField;

declare @field: int aField: +@Foo(value,i=5)

To 'preserve any value it might already have'
</Andy>

Ok with this proposal and :

 if aField has @Bar annotation, @Bar is removed and replaced by @Foo,  with
the statement above, the default value is set for value ( "abc") or it can
be overrided like :
	declare @field: int aField: +@Foo(value="hello",i=5)


Do we have the same understanding of the behavior?

Cordialement / Best regards

Jean-Louis Pasturel


-----Message d'origine-----
De : aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Andy Clement
Envoyé : lundi 13 décembre 2010 18:57
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] New feature of Aspectj 1.6.11

Hi,

I actually have a whiteboard covered in syntax proposals around this topic
:)

Yes, for compatibility reasons we have to maintain the existing defined
behaviour without inclusion of any special characters.  It will annotate the
target or report an error if the target is already annotated.

- removes them

+ could be used for replace.

But then what would you use for augment?

Suppose I have this annotation:

@interface Foo {
   String value() default "abc";
   int i() default 4;
}

and this annotated target

@Foo(value="hello")
int aField;

What is the syntax for adding a value for 'i' to that annotation, whilst
keeping 'value="hello"'

declare @field: int aField: +@Foo(i=5)

according to your rules, that would replace the existing annotation with
yours, losing the 'value' of hello.  It almost feels like '+'
should stand for augment (plus meaning 'additive'), but then what else could
we use for replace?

Perhaps augment could be this? (not providing a new value for 'value'
- but specifying it to say 'preserve any value it might already have')

declare @field: int aField: +@Foo(value,i=5)

Andy

On 11 December 2010 09:47, Pasturel <jean-louis.pasturel@xxxxxxxxx> wrote:
> I open a new thread to discuss the new feature of 1.6.11 about declare 
> annotation
>
> The M1 comes with the removal of an annotation of field like specified 
> in the readme :
>
> declare @field: int Foo.i: -@Anno;
>
> It gives me an idea with the + sign as this :
> declare @field: int Foo.i: +@Anno(param=<newValue>);
>
> that means a force replace : if @Anno exists remove it and replaces 
> with the new parametrized @Anno.If not already exists creates it with 
> the parametrized Anno.
>
> Without the - sign and without  the + sign, it creates the Annotation 
> on field or if already exists throws an exception ( that is certainly 
> the current behavior =>  Andy?).
>
> What do you think about that ?
>
> JL PASTUREL
>
> <Andy_Post>
>
> Hi,
>
> I didn't write about using it in that way as we don't 100% yet define 
> the rules there - well I might define it as undefined right now:)   It 
> might work right now but I'd need to confirm I want that ordering to 
> remain reliable and stable.  Any values you specify for the removal 
> are actually not used right now, the removal is done based solely on 
> the name - this means you'll get what you want if the removal runs 
> first.  I might add value matching enforcement later.  Yes, at some 
> point it will be added across all the declare annotation forms for 
> consistency.
>
> Andy
> </Andy_Post>
>
>
> On 9 December 2010 23:14,<jeanlouis.pasturel@xxxxxxxxxxxxxxxxxx>  wrote:
>
>>  I see that 1.6.11M1 includes removal Annotation for field.
>>  Just a question :
>>  Is this kind of declare annotation below, supported in the same aspect :
>> ?
>>
>>  @Aspect
>>  public class MyAspect
>>  {
>>  declare @field: int Foo.i: -@Anno(init=0);
>>  declare @field: int Foo.i: @Anno(init=5);
>>  ...
>>
>>  }
>>
>
> _______________________________________________
> 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



*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************



Back to the top