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

Reply via email to