Bug 80021 - [1.5] CCE in VariableBinding.getJavaElement()
Summary: [1.5] CCE in VariableBinding.getJavaElement()
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-02 10:39 EST by Tobias Widmer CLA
Modified: 2004-12-15 07:30 EST (History)
0 users

See Also:


Attachments
stack trace (3.02 KB, text/plain)
2004-12-02 10:40 EST, Tobias Widmer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Widmer CLA 2004-12-02 10:39:29 EST
200412011139:

Steps to reproduce:
- Create 1.5 project with classes:
package a;
public class A {
  public void foo(){}
}

package b;
public class B {
  public void bar(A a, int f) {
    a.foo();
  }
}

- Invoke "Move Method" on "bar"
Comment 1 Tobias Widmer CLA 2004-12-02 10:40:22 EST
Created attachment 16303 [details]
stack trace
Comment 2 Olivier Thomann CLA 2004-12-02 15:59:33 EST
The parent of a VariableDeclaration can be something else than a
VariableDeclarationStatement.
It can be a EnhancedForStatement, a CatchClause or a MethodDeclaration. So the
CCE can occur in different cases.
Jérôme, I let you fix it.
Comment 3 Olivier Thomann CLA 2004-12-02 16:12:02 EST
Test case is ready in ASTConverter15Test.test0090. You simply need to enable the
test.
Comment 4 Olivier Thomann CLA 2004-12-02 16:14:15 EST
In fact I wonder why you need the parent.
The position (declaration source start and declaration source end) are the
positions of the Variable declaration. The name positions are the position of
the inner Name node, aren't they?
Comment 5 Jerome Lanneluc CLA 2004-12-03 08:00:41 EST
Fixed VariableBinding#getJavaElement() to handle the case of a
SingleVariableDeclaration. (Olivier you can see
ASTModelBridgeTests#testLocalVariable2() for the case where the parent is a
VariableDeclarationStatement).

Moved regression test to ASTModelBridgeTests#testLocalVariable3() (and
simplified it).
Comment 6 Frederic Fusier CLA 2004-12-15 07:30:00 EST
Verified for 3.1 M4 using build I200412142000.