[Jsr308-statements] annotations on code blocks

Trevor Harmon trevor at vocaro.com
Sat Feb 3 04:35:33 EST 2007


On Feb 2, 2007, at 11:09 PM, Eugene Kuleshov wrote:

>  Trevor, note that current proposal is introducing annotations on  
> the method receivers in section 3 [1].

Yes, but that's because there's a semantic difference between:

@MyAnnotation int foo() { }

and:

int foo() @MyAnnotation { }

(The first one annotates the method declaration, while the second one  
annotates the return type.)

In contrast, I don't see any semantic difference between these:

@ReadOnly for(...) { ... }
for(...) @ReadOnly { ... }
for(...) { ... } @ReadOnly

Anyway, my point is that throughout Java 5 and 6, annotations have  
been exclusively prefix, so if it's only a question of syntax and not  
of semantics, we should continue the prefix tradition.

Trevor




More information about the Jsr308-statements mailing list