Hello Jon,
I believe, both, an option in Inspect Code and a separate Refactoring
would be very useful. What do you think?
Tom
On Wed, 14 Aug 2002 11:38:21 -0400, Jon Steelman
<[EMAIL PROTECTED]> wrote:
> Hi Tom,
>
> Just because something is reported by code inspection doesn't mean you
> should implement the observation. The edge case you are talking about
> can't be anticipated by code inspection. One must always use judgement.
> However, code inspection can report that the declaration type of a
> member can be narrowed or widened, and that information can be useful
> for those with proper judgement. I do think that these advanced code
> inspection options should be off by default. I think that the widening
> can encompass both interface and subclass. I agree that given the
> importance of interfaces, an option to show interface-only declaration
> type alternatives is useful.
>
> Jon
>
> Thomas Singer wrote:
> > Hello Jon,
> >
> > please read my comments in a previous post on this thread, why I
> > believe, this isn't very useful.
> >
> > Tom
> >
> >
> > On Wed, 14 Aug 2002 10:54:59 -0400, Jon Steelman
> > <[EMAIL PROTECTED]> wrote:
> >
> >
> >>I would like this to be part of code inspection.
> >>
> >>Jon
> >>
> >>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