Bug 94267

Summary: [1.5][select] Selecting type parameter in binary answer match on line 0
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philipe Mulet CLA 2005-05-10 07:03:34 EDT
Build 20050509-2010

- Open editor on file java.lang.reflect.Constructor.class (with attached sources).
- Select 2nd or 3rd occurrence of 'T' on line 573 :
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
                              ^                     ^

- Press F3: the editor goes to line 0, where I would have expected the type
parameter T to be selected instead (#getAnnotation is a generic method).
Comment 1 David Audel CLA 2005-05-18 06:49:59 EDT
SelectionEngine return the correct JavaElement but the source range of this
element is false ([offset=0, length=1]).

I found some problems:
- getSourceRange() does not use the source mapper if the type parameter is
inside a binary type or method.
- SourceMapper does not compute source range for type parameters
Comment 2 Olivier Thomann CLA 2005-05-25 15:23:07 EDT
Fixed and released in HEAD.
I checked that the steps to reproduce are working fine, but I don't know how to
add a regression test.
Comment 3 Olivier Thomann CLA 2005-05-25 15:24:02 EDT
Changes in org.eclipse.jdt.internal.core.SourceMapper and
org.eclipse.jdt.internal.core.TypeParameter.
Comment 4 Frederic Fusier CLA 2005-05-27 06:07:21 EDT
Verified for 3.1 RC1 with build I20050527-0010.