Bug 10245

Summary: Cannot extract method if message send is used on lhs of assignment
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: UIAssignee: Dirk Baeumer <dirk_baeumer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 14217    
Bug Blocks:    

Description Jerome Lanneluc CLA 2002-02-26 07:21:48 EST
Build 20020214

In the following method:
public void restore() throws JavaModelException {
	if (!isDestroyed) {
		CompilationUnit original = (CompilationUnit) getOriginalElement
();
		getBuffer().setContents(original.getContents());

		long timeStamp =
			((IFile) original.getUnderlyingResource
()).getModificationStamp();
		if (timeStamp == IResource.NULL_STAMP) {
			throw new JavaModelException(
				new JavaModelStatus
(IJavaModelStatusConstants.INVALID_RESOURCE));
		}
		((CompilationUnitElementInfo) getElementInfo()).fTimestamp = 
timeStamp;
		makeConsistent(null);
	}
}

I selected the code snippet from 'long timeStamp ' to '.fTimestamp = timeStamp;'
and I chose extract method.

I got a dialog saying that the selected statements do not belong to the same 
category. Why this restriction?
Comment 1 Adam Kiezun CLA 2002-02-27 13:06:32 EST
in fact, the problem is different - modified summary

this fails:
public class A {
	A f;
	public A a() {
		/*[*/int y= 0;	
		a().f= a();/*[*/
		return null;
	}
}


as well as this:
public class A {
	A f;
	public A a() {
		/*[*/a().f= a();/*[*/
		return null;
	}
}
Comment 2 Dirk Baeumer CLA 2002-03-11 11:18:49 EST
The problem is a wrong position in the field reference (doesn't include the 
method invocation). Waiting for JCore to fix this.
Comment 3 Dirk Baeumer CLA 2002-05-03 09:10:11 EDT
Got fixed by JDT/Core.