Bug 135997

Summary: [AST] invalid source range with recovered node
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, philippe_mulet
Version: 3.2   
Target Milestone: 3.2 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
screenshot ASTview
none
Proposed fix none

Description Martin Aeschlimann CLA 2006-04-10 16:45:36 EDT
20060410

Look at the following code with the (recovered) AST view:

- in the AST View double click the block node of the initializer:
  > its source range does end in the middle of the second statement

Add Olivier as CC as this might be related to the latest addition of incomplete ExpressionStatement

package p1.sub1;

import java.io.File;

public class C2 {
	{
		new Thread();
		File.pathSeparator;
	}
}
Comment 1 Olivier Thomann CLA 2006-04-10 21:08:41 EDT
The latest changes for bug 129330 were not released for the build you are using.
I'll investigate.
Comment 2 Olivier Thomann CLA 2006-04-10 23:11:07 EDT
I tried your test case with 0410 and with HEAD, and I never got wrong positions for the initializer.
Can you reproduce all the time?
Comment 3 Martin Aeschlimann CLA 2006-04-11 03:58:59 EDT
Oh, I used jdt.core HEAD.
Comment 4 Martin Aeschlimann CLA 2006-04-11 04:04:04 EDT
Created attachment 38261 [details]
screenshot ASTview
Comment 5 Olivier Thomann CLA 2006-04-11 10:07:46 EDT
This has nothing to do with the latest changes in the recovered nodes. I can reproduce using 0410 where the changes are not included.

David,

The block doesn't have the same position than the initializer. The initializer's positions are ok, but the block is too short.
Comment 6 David Audel CLA 2006-04-18 09:22:19 EDT
Created attachment 38785 [details]
Proposed fix
Comment 7 David Audel CLA 2006-04-18 09:26:26 EDT
Philippe - Do you want this fix for 3.2RC2 ?
Comment 8 Philipe Mulet CLA 2006-04-18 10:10:28 EDT
+1 for 3.2RC2
Comment 9 David Audel CLA 2006-04-18 10:22:38 EDT
Fix released and test added.
  ASTConverterTestAST3_2#test0645()

Now, position of the block is the same as initializer.
Comment 10 Olivier Thomann CLA 2006-04-28 14:03:56 EDT
Verified with I20060427-1600 for 3.2RC2