[Jsr308-statements] Re: statement ranges

Eugene Kuleshov eu at javatx.org
Wed Apr 18 16:07:43 EDT 2007


Trevor Harmon wrote:
>> There is actually one thing to worry about. We need to specify how 
>> those blocks will be mapped to the bytecode. For example, consider 
>> the following method:
>>
>> 35  private void boo1() {
>> 36    int a = 1;
>> 37    @Ann1 for (int i = 0;
>> 38          i < 100;
>> 39          i++) @Ann2 {
>> 40      int b = 1;
>> 41      boo();
>> 42    }
>> 43  }
>>
>>  Now, question is how ranges should look like for annotations Ann1 
>> and Ann2?
> Is a bytecode range strictly necessary in that example? 
  We need to standardize how those ranges should be calculated for the 
bytecode, perhaps extend section 7 of the JVM Specification. 
http://docs.oracle.com/javase/specs/jvms/se5.0/html/Compiling.doc.html
> How about giving both the same bytecode location, but marking Ann1 
> "pre-expression" and Ann2 "post-expression"?
  Those actually serve different purpose. To recall Doug Lea example, 
the block body would be the thing to extract and wrap into the closure, 
while all bytecode from the for(...) itself may go somewhere else. I 
even wonder if ranges for the @Ann1 for(...) { ... } should exclude its 
body, but include code for i++ and i<100 in above example.

  regards,
  Eugene





More information about the JSR308-statements mailing list