Summary: | [introduce parameter] does not replace all occurrences of expression [refactoring] | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Tobias Widmer <tobias_widmer> |
Component: | UI | Assignee: | Markus Keller <markus.kell.r> |
Status: | ASSIGNED --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P4 | CC: | akiezun, daniel_megert, david, deepakazad, eclipse, martinae, nikolaymetchev, private |
Version: | 3.0 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Whiteboard: | fix candidate |
Description
Tobias Widmer
2003-10-14 05:42:14 EDT
Introduce Parameter currently doesn't offer an option to replace all occurrences. +1 here introduce param that replaced all occurences would be a powerful tool for making methods more reusable. i could even imagine a refactoring that would introduce params until a method could be turned into a static methods and moved to a reusable util class. ha! this is a compination of extract temp + introduce param + inline temp observe: class A{ int fField; int doubleIt(){ return fField + fField; } void caller(){ int x= doubleIt(); } } now do extract temp: class A{ int fField; int doubleIt(){ int i= fField; return i + i; } void caller(){ int x= doubleIt(); } } intro param class A{ int fField; int doubleIt(int p){ int i= p; return i + i; } void caller(){ int x= doubleIt(fField); } } inline temp class A{ int fField; int doubleIt(int p){ return p + p; } void caller(){ int x= doubleIt(fField); } } now you have a reusable doubling method kinda slow but works. *** Bug 68147 has been marked as a duplicate of this bug. *** *** Bug 73659 has been marked as a duplicate of this bug. *** *** Bug 118134 has been marked as a duplicate of this bug. *** See also bug 102125, which handles this problem more generally *** Bug 194139 has been marked as a duplicate of this bug. *** |