Community
Participate
Working Groups
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"
Created attachment 16303 [details] stack trace
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.
Test case is ready in ASTConverter15Test.test0090. You simply need to enable the test.
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?
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).
Verified for 3.1 M4 using build I200412142000.