Bug 169744 - [AST] character position range wrong for super method call with type arguments
Summary: [AST] character position range wrong for super method call with type arguments
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-05 20:29 EST by xcok CLA
Modified: 2007-02-06 05:05 EST (History)
1 user (show)

See Also:


Attachments
Proposed fix (1.84 KB, patch)
2007-01-08 13:51 EST, Olivier Thomann CLA
no flags Details | Diff
Regression tests (2.13 KB, patch)
2007-01-08 13:52 EST, Olivier Thomann CLA
no flags Details | Diff
Proposed fix for 3.2 maintenance branch (1.84 KB, patch)
2007-01-08 13:52 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 xcok CLA 2007-01-05 20:29:28 EST
The AST for a super method call with type arguments has incorrect start/end
positions for the SuperMethodInvocation node.  If there are no explicit
type arguments, then the SuperMethodInvocation node begins at the beginning of
the super token (as it should); if there are explict type arguments on the 
method name, then the SuperMethodInvocation node's character range begins on the
< token that starts the type arguments, rather than at the beginning of the
super token.

TREES FOR class A { int i = super.m(); }
ECLIPSE AST
0) class org.eclipse.jdt.core.dom.CompilationUnit 0 30
 1) class org.eclipse.jdt.core.dom.TypeDeclaration 0 30
      interface = false
  2) class org.eclipse.jdt.core.dom.SimpleName 6 1
       identifier = A
  3) class org.eclipse.jdt.core.dom.FieldDeclaration 10 18
   4) class org.eclipse.jdt.core.dom.PrimitiveType 10 3
        primitiveTypeCode = int
   5) class org.eclipse.jdt.core.dom.VariableDeclarationFragment 14 13
        extraDimensions = 0
    6) class org.eclipse.jdt.core.dom.SimpleName 14 1
         identifier = i
    7) class org.eclipse.jdt.core.dom.SuperMethodInvocation 18 9
     8) class org.eclipse.jdt.core.dom.SimpleName 24 1
          identifier = m

TREES FOR class A { int i = super.<T>m(); }
ECLIPSE AST
0) class org.eclipse.jdt.core.dom.CompilationUnit 0 33
 1) class org.eclipse.jdt.core.dom.TypeDeclaration 0 33
      interface = false
  2) class org.eclipse.jdt.core.dom.SimpleName 6 1
       identifier = A
  3) class org.eclipse.jdt.core.dom.FieldDeclaration 10 21
   4) class org.eclipse.jdt.core.dom.PrimitiveType 10 3
        primitiveTypeCode = int
   5) class org.eclipse.jdt.core.dom.VariableDeclarationFragment 14 16
        extraDimensions = 0
    6) class org.eclipse.jdt.core.dom.SimpleName 14 1
         identifier = i
    7) class org.eclipse.jdt.core.dom.SuperMethodInvocation 24 6
     8) class org.eclipse.jdt.core.dom.SimpleType 25 1
      9) class org.eclipse.jdt.core.dom.SimpleName 25 1
           identifier = T
     10) class org.eclipse.jdt.core.dom.SimpleName 27 1
          identifier = m
Comment 1 Philipe Mulet CLA 2007-01-08 12:30:33 EST
+1 for 3.2.2 if it has no bad effect for JDT/UI.
Olivier - is it really that important for 3.2.2 ? Is the fix trivial ?
Comment 2 Philipe Mulet CLA 2007-01-08 12:33:00 EST
To clarify, besides being wrong, why is this considered so bad it needs to go in the 3.2.2 update ? Can't it only get fixed for 3.3 ?
Comment 3 Martin Aeschlimann CLA 2007-01-08 12:34:23 EST
+ 1 for the fix. The AST rewriter replies on the correct source ranges.
Comment 4 Olivier Thomann CLA 2007-01-08 13:51:47 EST
Created attachment 56578 [details]
Proposed fix
Comment 5 Olivier Thomann CLA 2007-01-08 13:52:00 EST
Created attachment 56579 [details]
Regression tests
Comment 6 Olivier Thomann CLA 2007-01-08 13:52:42 EST
Created attachment 56580 [details]
Proposed fix for 3.2 maintenance branch
Comment 7 Olivier Thomann CLA 2007-01-09 15:06:29 EST
Released for 3.3M5.
Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0234
Comment 8 Olivier Thomann CLA 2007-01-09 21:57:43 EST
Released for 3.2.2.
Regression test added in
org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0234
Comment 9 David Audel CLA 2007-01-16 04:18:28 EST
Verified for 3.2.2 using build M20070112-1200
Comment 10 Eric Jodet CLA 2007-02-06 03:47:43 EST
Verified for 3.3 M5 using build I20070205-0009