[Jsr308-statements] annotations on code blocks

Eugene Kuleshov eu at javatx.org
Sat Feb 3 02:09:53 EST 2007


Trevor Harmon wrote:
>> @ReadOnly for(...) { ... }
>> for(...) @ReadOnly { ... }
>> for(...) { ... } @ReadOnly
> I agree that prefix form is more readable, but there is another 
> argument for prefix: consistency. Annotations on methods, for 
> instance, are written like this:
>
> @Test void foo() { }
>
> Not like this:
>
> void foo() @Test { }
>
> Nor like this:
>
> void foo() { } @Test
  Trevor, note that current proposal is introducing annotations on the 
method receivers in section 3 [1]. Perhaps Michael can elaborate little 
more on the reasons why method receivers annotation should be 
distinguished from annotations on the method itself, but it look like this:

public int size() @Readonly { ... }

  regards,
  Eugene

[1] http://pag.csail.mit.edu/jsr308/java-annotation-design.html#htoc4





More information about the Jsr308-statements mailing list