Bug 28682 - org.eclipse.jdt.core.dom.ForStatement's body position is incorrect
Summary: org.eclipse.jdt.core.dom.ForStatement's body position is incorrect
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-19 12:31 EST by Kelvin CLA
Modified: 2003-02-07 12:09 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kelvin CLA 2002-12-19 12:31:00 EST
test case :

   for (int i = 0; i < 10; i++)  // for 1
        for (int j = 0; j < 10; j++)  // for 2
            if (true) { }
   
   for (;;) ;  // for 3

code :
   String fileContent; // get the file content here
   ForStatement forstat = (ForStatement)node; // first for loop
   System.out.println("for statement:"+ forstat.toString()); 
   Statement body = forstat.getBody();
   System.out.println("body statement:"+ body.toString());
   System.out.println("body position:" +
                      fileContent.substring(body.getStartPosition() 
                        , body.getStartPosition()+body.getLength()));


   You will see the body position is incorrect, compare with the second println 
statement.
Comment 1 Olivier Thomann CLA 2003-01-07 13:52:43 EST
I reproduced the problem. The problem is located in the Parser class.
Comment 2 Olivier Thomann CLA 2003-01-07 16:44:01 EST
Fixed and released in 2.1 stream.
Regression tests added.
Comment 3 Olivier Thomann CLA 2003-01-07 16:46:14 EST
Changed milestone.
Comment 4 David Audel CLA 2003-02-07 12:09:39 EST
Verified.