Bug 108784 - SourceMapper doesn't find name range of inner class constructors
Summary: SourceMapper doesn't find name range of inner class constructors
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-05 06:29 EDT by David Audel CLA
Modified: 2010-01-25 04:56 EST (History)
3 users (show)

See Also:


Attachments
Proposed fix + regression test (4.16 KB, patch)
2009-12-09 11:35 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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