Community
Participate
Working Groups
Build Identifier: Version: Juno Release Build id: 20120614-1722 When I use Refactor > Rename on a local variable, and the method calls a method declared via Inter-Type Declarations (ITDs), the preview dialog finds compilation errors because it doesn't understand that. Reproducible: Always Steps to Reproduce: 1. Open attached sample project 2. Open the Bean class 3. Rename the local variable "i" to "x" 4. The preview dialog shows a "The method doSomething() is undefined for the type Bean" compilation error.
Created attachment 218306 [details] Example project for reproducing the bug
Finally getting around to this. Bumping up the priority since this problem is could be quite confusing for developers who are unaware of how ITDs are acting on their code.
I've made some progress on this. I am now weaving into the Refactoring parser so that ITDs are pushed in before analyzing the code. This will ensure that there are no compile problems during the checking of final conditions. However, this is only part of the solution, I also need to alter source locations based on the pushed-in code or else we get all sorts of exceptions since the source location of the refactoring doesn't match with the source locations in the analysis. There's more work to do, but there is progress. And the fix for this bug may fix other related problems when analyzing code with ITDs during a refactoring.
This turned out to be a bit more involved than I had originally hoped, but I now have this working with enough regression tests to make me feel that it is safely not affecting other features. I had to add a new pointcut so that the correct AST is provided when analyzing the results of a rename local refactoring. I also had to ensure that source locations are updated appropriately in the analyzed AST. Fix will be available in next dev build in e42 branch.
That's great news, thanks for the hard work.