Ok, cool. I'll enter an enhancement request for "!" notation. It seems like that would apply universally.
As for "+" notation, that would be a special case for when the type of the annotation's property is java.lang.Class. What do you think of supporting "+" in those cases where this is true? I would expect either a vanilla non-match if the annotation property were not of type java.lang.Class. You could, however, go so far as to fail to compile, since these things are all known at compile time. -matthew On Tue, Sep 6, 2011 at 3:40 PM, Andy Clement <[email protected]> wrote: > Hi Matthew, > >> Can type patterns match on values of properties of annotations? > > Yes, *but* there is a bug (uncovered in the other thread in the > mailing list today) where '.class' is tripping up the pattern parser > in AspectJ. So this is fine: > > @interface Foo { > int x(); > } > > declare @field: @Foo(x=3) * *: @Bar; > > But you can't use 'Class x()' and then '@Foo(x=String.class)' in your > type pattern. I'm just debugging it now, think I see what it is - I > guess no-one has ever > tried it for class type values. > >> declare parents: >> (@Foo(clazz=Number+) *) >> implements Fooable<Integer>; > > Don't think this is going to work, even after I fix the above. > > So: >> Can I write a type pattern that matches for Thingy but not Stringy >> based only on the value of the "@Foo" annotation's "clazz" property? > > Yes, > > declare @type: @Foo(clazz=Long.class) *: @Bar; > > We could support, I imagine: > > declare @type: @Foo(clazz!=Long.class) *: @Bar; > > but we don't right now. > > cheers > Andy > > On 6 September 2011 12:47, Matthew Adams <[email protected]> wrote: >> >> For example, given this ITD & classes: >> >> declare parents: >> (@Foo(clazz=Number+) *) >> implements Fooable<Integer>; >> >> @Foo(clazz=Long.class) >> public class Thingy {} >> >> @Foo(clazz=String.class) >> public class Stringy {} >> >> Can I write a type pattern that matches for Thingy but not Stringy >> based only on the value of the "@Foo" annotation's "clazz" property? >> >> -matthew >> >> -- >> @matthewadams12 >> mailto:[email protected] >> skype:matthewadams12 >> yahoo:matthewadams >> aol:matthewadams12 >> google-talk:[email protected] >> msn:[email protected] >> http://matthewadams.me >> http://www.linkedin.com/in/matthewadams >> _______________________________________________ >> aspectj-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > -- @matthewadams12 mailto:[email protected] skype:matthewadams12 yahoo:matthewadams aol:matthewadams12 google-talk:[email protected] msn:[email protected] http://matthewadams.me http://www.linkedin.com/in/matthewadams _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
