Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.1.2Release
-
Fix Version/s: 2.5.0Release
-
Component/s: Refactoring
-
Labels:None
-
Number of attachments :
Description
Rename this class to User2222:
class User {
String name
Date age
}
And then undo. The result should be identical before and after, but it is actually:
class UserString name Date age }
It looks like the replace range is incorrect. See CopyResourceElementsOperation.
The problem is that the TypeReferenceSearchRequestor was returning the type declaration itself as a search match. In most cases, this doesn't matter since it is appropriately filtered out, but in the case of renaming compilation units this is a problem. The renaming of CUs happens in 2 stages. First, renaming all of the type references, and then renaming of the CompilationUnit itself. So, the problem is that the extra search match is being renamed in the first stage and then a second time in the second stage. This is confusing the Undo manager.
The fix is to simply not return these matches from the search requestor.
This change will likely break some other tests, but I will commit it and see what I need to fix later.