Bug 536071 - Refactoring: When renaming a class also provide support for consistent renaming of parameters
Summary: Refactoring: When renaming a class also provide support for consistent renami...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7.2   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-20 03:26 EDT by Juergen Baier CLA
Modified: 2018-06-20 03:26 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Baier CLA 2018-06-20 03:26:13 EDT
I often have a situation like

    enum MyInitialEnum {
       A, B, C;
    }

The enum might be used as method parameter:

    interface X {
        void foo(MyInitialEnum myInitialEnum, ...);
    }

    class Y implements X {
        public void foo(MyInitialEnum myInitialEnum, ...) {};
    }


Now I want to rename "MyInitialEnum" to "EnumWithBetterName". Then I would like the UI to support renaming parameter names as well. E.g. in this case I want the code to look like:


    interface X {
        void foo(EnumWithBetterName enumWithBetterName, ...);
    }

    class Y implements X {
        public void foo(EnumWithBetterName enumWithBetterName, ...) {};
    }

instead of

    interface X {
        void foo(EnumWithBetterName myInitialEnum, ...);
    }

    class Y implements X {
        public void foo(EnumWithBetterName myInitialEnum, ...) {};
    }

Of course the enum in the example could also be a regular class or interface.

I think this would be really useful when refactoring large APIs with interfaces and many different implementation classes.

Another option could be to add a new refactoring operation which allows you to refactor parameter names. E.g. when you have

    interface X {
        void foo(EnumWithBetterName myInitialEnum, ...);
    }

then you could select "myInitialEnum" and choose "Refactor->Rename parameter name".