Bug 198786 - [Extract Class] NPE when array.length access is assigned
Summary: [Extract Class] NPE when array.length access is assigned
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Karsten Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-08-03 05:10 EDT by Karsten Becker CLA
Modified: 2007-08-03 06:16 EDT (History)
1 user (show)

See Also:


Attachments
Patch (4.18 KB, patch)
2007-08-03 05:49 EDT, Karsten Becker CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Becker CLA 2007-08-03 05:10:20 EDT
package p;

public class ArrayLenghthAccess {
	private int test=new int[8].length;
}
Use Extract Class on ArrayLenghthAccess leads to a NPE
Comment 1 Karsten Becker CLA 2007-08-03 05:11:30 EDT
This is because the org.eclipse.jdt.internal.corext.refactoring.structure.ExtractClassRefactoring.FieldReferenceFinder.checkVariableBinding(IVariableBinding) does not check if the declaringClass is null, which is the case for the length field.
Comment 2 Benno Baumgartner CLA 2007-08-03 05:49:00 EDT
Can you fix it?
Comment 3 Karsten Becker CLA 2007-08-03 05:49:45 EDT
Created attachment 75314 [details]
Patch
Comment 4 Benno Baumgartner CLA 2007-08-03 06:16:49 EDT
fixed > I20070731-0800

interesting.