Bug 108784

Summary: SourceMapper doesn't find name range of inner class constructors
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: frederic_fusier, Olivier_Thomann, srikanth_sankaran
Version: 3.1   
Target Milestone: 3.6 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Proposed fix + regression test none

Description David Audel CLA 2005-09-05 06:29:10 EDT
build I20050823-0800 + jdtcore head

1) create class files X.class and X$Inner.class with the following source
public class X {
  public class Inner {
    public Inner() {}
  }
}

2) Find the IType corresponding to X.Inner.
3) Get methods of X.Inner with IType#getMethods().
there is one IMethod with one parameter: Inner(X)

4) Get the name range of this method with IMethod#getNameRange().
the result isn't correct and is a range of [offset=-1, length=0].

IType t = getType(...);
IMethod[] ms = t.getMethods();
ISourceRange sr = ms[0].getNameRange();

If you look inside the SourceMapper, you will find a name range for the Inner()
method but not for Inner(X).
Comment 1 Olivier Thomann CLA 2009-12-09 11:35:34 EST
Created attachment 154126 [details]
Proposed fix + regression test

Fix is trivial.
A constructor with a parameter was properly handled, but not a constructor without any parameter.
Comment 2 Olivier Thomann CLA 2009-12-10 10:55:16 EST
Released for 3.6M5.
Regression test added in:
org.eclipse.jdt.core.tests.model.AttachSourceTests#testGetNameRange04
Comment 3 Srikanth Sankaran CLA 2010-01-25 04:56:19 EST
Verified for 3.6M5 using build I20100122-0800