Bug 408387 - [change method signature] remove method parameter reports unnecessary error against self-call
Summary: [change method signature] remove method parameter reports unnecessary error a...
Status: CLOSED DUPLICATE of bug 268665
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-18 11:39 EDT by Stephan Herrmann CLA
Modified: 2013-05-21 08:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2013-05-18 11:39:02 EDT
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.
Comment 1 Stephan Herrmann CLA 2013-05-18 12:00:40 EDT
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 ...
Comment 2 Dani Megert CLA 2013-05-21 08:22:11 EDT

*** This bug has been marked as a duplicate of bug 268665 ***