Summary: | Wrong location for the last 'return' bytecode command | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Luc Bourlier <eclipse> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | eclipse |
Version: | 2.0 | ||
Target Milestone: | 2.0.1 | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: |
Description
Luc Bourlier
2002-07-17 16:21:10 EDT
Olivier - I thought we had addressed this scenario using the closing '}' ... I would say the closing parenthesis position is incorrect in this case. I need to double-check. In this example, the bodyEnd of the main method is the position of the \n in the System.out line. It should be the position of the '}' following this line. So the free return problem was addressed, but it is assuming a correct position for the bodyEnd of the method. Changing this.bodyEnd = endPosition; with this.bodyEnd = endStatementPosition; fixes the problem. I need to double-check that there is no side-effect with this. endPosition is the character right before the '}'. endStatementPosition is the right position. So the bug wasn't with the handling of the free-return, but rather with the correctness of the this.bodyEnd position. The body end is supposed to be the last character before the closing '}', so I would think it is currently ok (also it has ramifications in syntax recovery, so be careful). I would say that you should rather use the declarationSourcEnd instead. Using the declarationSourceEnd fixed the problem. I will release the code today. Fixed and released in HEAD. Please also backport to R2_0_1 stream backported to 2.0.1. Verified. Verified Verfied in 2.1 M1 |