Capturing Method Signature Changes? [message #251800] |
Sun, 02 March 2008 13:37 |
Eclipse User |
|
|
|
Originally posted by: tansey.vt.edu
Hi all,
I'm writing a plug-in that needs to be able to track methods that have
had their signatures changed, by either being renamed or having the
types of one of their parameters renamed. The current way that I'm doing
this is to tap into the refactoring history as follows:
RefactoringHistory hist = ...;
// get all refactorings that occurred since the plug-in was started
RefactoringDescriptorProxy[] proxies = hist.getDescriptors();
for(int i = proxies.length - 1; i >= 0; --i)
{
RefactoringDescriptor descriptor = proxies[i].requestDescriptor(null);
// get the ID of the refactoring
String descID = descriptor.getID();
RefactoringContribution contrib =
RefactoringCore.getRefactoringContribution(descID);
// get the args map
Map<String,String> args = contrib.retrieveArgumentMap(descriptor);
// assume for now that all the refactorings are rename refactorings
updateMapping(descID, args.get("input"), args.get("name"));
}
Then I go in and parse the input string and rename it appropriately. The
problem I just ran into is that if a type is being renamed, I have to go
in and rename all of the mappings for methods that have the type as a
parameter or declaring type.
Am I missing something here? Is there a better way to maintain a mapping
between old and new method signatures?
Sincerely,
Wes
|
|
|
Powered by
FUDForum. Page generated in 0.03466 seconds