Community
Participate
Working Groups
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
+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 ?
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 ?
+ 1 for the fix. The AST rewriter replies on the correct source ranges.
Created attachment 56578 [details] Proposed fix
Created attachment 56579 [details] Regression tests
Created attachment 56580 [details] Proposed fix for 3.2 maintenance branch
Released for 3.3M5. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0234
Released for 3.2.2. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0234
Verified for 3.2.2 using build M20070112-1200
Verified for 3.3 M5 using build I20070205-0009