Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] declare annotation syntax

I think package anntotation are handled through a manifest, thus
likely to be part of a build process or Ant responsabilty to inject
things in the manifest.
Any use case for declaring package annotations ?

As regards Wes concerns, that s interesting to mirror the AJ 5
annotation style syntax, which seems to address it.

@Aspect
     public class DeclareAnnotationExamples {
     
       // this example assumes that the @Secured annotation has a Target
       // annotation with value ElementType.METHOD
       @DeclareAnnotation("public * org.xyz.banking.BankAccount+.*(..)")
       @Secured(role="supervisor) void bankAccountMethod();
       
       @DeclareAnnotation("* DAO+.*")
       @Persisted Object daoFields;     
     }     

Aside as we can see here, the java compiler will ensure that an
annotation targetted to a field only will not end up to a method etc.
That s something that ajc will have to check for code style aspect to
ensure consistency with the Java Annotation "Target" spec.

Alex


On Thu, 27 Jan 2005 14:30:05 +0100, Eric Bodden <eric@xxxxxxxxx> wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Wes Isberg wrote:
> >   declare annotation : *.*Test : @Test;
> >   declare annotation : * *Test : @Test;
> >   declare annotation : (Test+) *Test : @Test;
> >   declare annotation : (Test+) *(Test) : @Test;
> >   declare annotation : @Test (Test+)* : @Robust;
> >   declare annotation : @Test * * : @Robust;
> >   declare annotation : @Test * @Critical *.*(..): @Robust;
> I agree that this is *very* confusing...
> 
> > How about this (cheating a bit on the examples):
> >
> >   declare @field : *..testing..* *: @TestOnly;
> >   declare @constructor : @Test test*.new(): @TestMethod;
> >   declare @method : @Test void test*(): @TestMethod;
> >   declare @class : (*Test && Test+) : @TestClass;
> This is indeed much clearer in my opinion.
> Something I am missing here: What about package annotations,
> actually? Are those not going to be available?
> 
> > P.S. - I considered collapsing "method" and "constructor" into
> > "code" for brevity, but preferred being direct.
> I think constructor/method is much clearer, given you don't actually
> annotate "code" (you annotate *declarations*, which could also mean
> declarations in interfaces).
> 
> Hope that helps,
> Eric
> 
> - --
> Eric Bodden
> Chair I2 for Programming Languages and Program Analysis
> RWTH Aachen University
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0.3
> 
> iQA/AwUBQfjs3cwiFCm7RlWCEQKDZgCffXQMaKkXiFFfZX9N8dca7p9IAesAniji
> WSxsrsKqRipKNBhkrXnexodW
> =Jmlx
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
>


Back to the top