[JSR308] Can we agree on our goals? (annotations on blocks)

Tom Ball Tom.Ball at Sun.COM
Thu Feb 1 20:11:52 EST 2007

Trevor Harmon wrote:
> On Feb 1, 2007, at 3:28 PM, Gary T. Leavens wrote:
>> The only reason I mentioned loops explicitly is becuase that is more 
>> important to us than other statements.
> I think those of us coming from the WCET camp feel exactly the same way: 
> Annotation on any statement is a nice-to-have, while loop annotation is 
> a must-have.
>> While I'm at it, Tom's suggestion of annotating only blocks would be 
>> acceptable for our purposes in JML.
> Acceptable, yes, but annotating loops by artificially surrounding them 
> with braces feels kinda icky, doesn't it? It seems like a compromise 
> that just pushes extra work onto annotation users in order to make 
> implementation easier for us. Instead, we should try to make using 
> annotations as easy and natural as possible without relying on new 
> syntactical idioms.

What new syntax?  You always could put extra blocks around any statement 
or list of statements.  If you mean being about to annotate that block, 
it's as new as the other "let's annotate statements" suggestions.  I was 
also following the style used for synchronized blocks.

Eugene Kuleshov wrote:
> I just wanted to point out that with Tom's suggestion you won't be
> able to easily say if annotated block represent a single loop or a
> sequence of statements. Also, user can add another statement to the
> block added for annotating loop without noticing it. >

So?  It's trivial for an error checker to determine which statements to 
check -- the AST nodes are clearly typed for ASTs, and the bytecodes are 
unique.  A developer could block the whole method body if they want it 
checked, and then all loops would be checked without lots of extra 
annotations.  Think of it as being similar to a synchronized block, but 
without impacting code.


More information about the JSR308 mailing list