[JSR308] Block Annotations Suggestion

Eduardo Born nosachamos at gmail.com
Wed Oct 3 14:40:27 EDT 2007


Hi All!
My name is Eduardo Born, I'm new to the list, and I'm VERY interested on
discussing the future of Java Annotations.

I have been working very close and deep with Java reflection and
annotations, and there are some things I miss in the current Java
Annotations implementation that are being currently proposed, and some that
are not, so I joined the list to make suggestion and help on the current
proposal discussions whenever possible.

My first suggestion is to have a block annotation syntax, so a single
annotation can be applied to a group of elements. For example, let's suppose
we have a marker annotation that informs that a given field is to be
remotely accessible through a given framework, for example
@RemotelyAccessible.

Currently, to make several fields marked as remotely accessible, we would
have to do the following:
...
@RemotelyAcessible
private String field1;

@RemotelyAcessible
private String field2;

@RemotelyAcessible
private String field3;
...

and so on.

Why not have a syntax like the following:

@RemotelyAccessible {
     private String field1;
     private String field2;
     private String field3;
}

So the given annotation is replicated to all declarations/elements inside
the block.

As a senior Java developer, I frequently write my own annotations, and that
syntax would make my life easier. I hope that helps more folks too.

What do you think?

Cheers!

Eduardo Born
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20071003/afb7efee/attachment.html


More information about the JSR308 mailing list