Community
Participate
Working Groups
Consider this method: void foo(int i, int x) { foo(i-1, x); } Trying to remove parameter x using Change Method Signature yields: Removed parameter 'x' is used in method 'foo' ... This error is pointless since the call argument will be removed, too. In fact when ignoring the error the refactoring works as expected.
Looking at ChangeSignatureProcessor.createChangeManager() I see this comment: // IntroduceParameterObjectRefactoring needs to update declarations first: so my first guess was: maybe for removing a parameter we just need to reverse the order: first change the references and only then investigate the declaration. At a closer look, however, none of the changes seems to "see" the other changes (as they are only recorded in the rewrite). Is there any possibility that the refactoring could ask the rewrite whether a certain node is being removed? If not, the refactoring may have to keep a map of ast nodes to tentative error messages and manually track node deletion to also delete associated errors? Seems clumsy to me ...
*** This bug has been marked as a duplicate of bug 268665 ***