What about adding it to code inspection?

My suggestion is to support an inspection for
"Declared type can be more abstract" similar to
"Declaration access can be weaker".

IDEA would list all places where a super class or an implemented 
interface would have been possible instead of the declared type.

Of course the actual refactoring would be directly accesible from the 
code inspection results.

What do you think? (Maybe we should move this over to the features list 
instead)

/Fredrik Lindgren


Thomas Singer wrote:

> I would find it very useful to have a Change Type refactoring:
> 
> 1) Select a variable (local or member) and invoke "Change Type".
> 
> 2) Idea scans all usages of this variable and offers all possible types 
> for selection, that would not break the code.
> 
> 3) The user selects one and IDEA changes the type of the variable 
> declaration.
> 
> 
> Example:
> 
>   MyButton button = new MyButton();
>   button.setText("Hello world!"); // JButton.setText()
>   addComponent(button); // addComponent(Component)
> 
> IDEA would suggest:
> - MyButton
> - JButton
> but not "Component" or "JComponent", because they would break the code.
> After selecting "JButton", the code would look like:
> 
>   JButton button = new MyButton();
>   button.setText("Hello world!");
>   addComponent(button);
> 
> Tom
> 
> 
> _______________________________________________
> Eap-list mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-list
> 



_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

Reply via email to