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

Eugene Kuleshov eu at javatx.org
Thu Feb 1 20:37:25 EST 2007

Tom Ball 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.
  Tom, I understand that and do think that it could be an acceptable 
middle ground if we won't be able to agree on better solution.

  However, I think it is error prone to annotate loops by wrapping them 
into blocks. For example, one could initially write something like this:

  @Loopcount(100) {
     for(...) {
        ... relatively long body that may not fit into one screen

  Then later, someone else could add to that:

  @Loopcount(100) {
     for(...) {
        ... relatively long body that may not fit into one screen

  While annotation processor could raise a warning on this (so, we would 
need an additional annotation processor for that), saying that annotated 
block don't match expectations, it would be better if user wouldn't had 
a chance to make such mistake in the first place.

  Also note that for the bytecode analyzers it will be more difficult 
(though still possible) to detect such wrong addition.


More information about the JSR308 mailing list