+10
"Use Interface Where Possible" is something related, but not the same. I
want to have the ability to change a particular variable declaration,
not always for the class in the whole project.
Example:
I use "Collection" if a (unsorted) collection is needed, but I use a
"List", if a sorted collection is needed, even if only the iterator is
used in the code. Therefor using "Use Interface Where Possible" isn't
appropriate in this case.
Tom
Erik Hanson wrote:
> I might have the wrong terminology here, but I think it would be useful to
> have IDEA figure out how specific or generic a variable, parameter or return
> type can be and make the change.
>
> For example, if I have:
>
> public void addFooAndBar( ArrayList list )
> {
> list.add( "foo" );
> list.add( "bar" );
> }
>
> and I select "list" and choose "make variable less specific", it would
> change the type of "list" to "Collection", since only methods from
> Collection are being used.
>
> Likewise, if I have:
>
> public Collection createFooAndBar()
> {
> ArrayList list = new ArrayList();
> list.add( "foo" );
> list.add( "bar" );
> return list;
> }
>
> and I select "createFooAndBar" and choose "make return type more specific",
> it would change the return type to "ArrayList".
>
>
> Finding return types that can be more specific and finding variables and
> parameters that can be more generic would be a good addition to the code
> inspection.
>
>
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features