Bug 11025

Summary: extract method: incorrectly disallowed on some boolean expressions
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer
Version: 2.0   
Target Milestone: 2.0 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2002-03-08 09:57:57 EST
public class A{
	boolean m(){
		return /*[*/a().length != 3/*]*/;
	}
	int[] a(){
		return null;
	}
}
Comment 1 Dirk Baeumer CLA 2002-03-08 13:34:26 EST
The problem is that the reported positions for the expression a().length != 3 
is incorrect. The expression doesn't include the message send. It starts with l 
from length.

Moving to JDT Core
Comment 2 Olivier Thomann CLA 2002-03-08 13:44:39 EST
Reproduced. I am working on it.
Comment 3 Olivier Thomann CLA 2002-03-08 14:11:53 EST
The bug comes from the wrong position returned by the parser. I used them to 
set the source range of the InfixExpression I created for the expression:
a().length != 3. Sometimes the positions provided by the Parser are confusing 
<g>.
Now I set the start position of the infix expression to the starting positions 
of its left expression.
Fixed and released in HEAD.