+1

I just did some refactoring and got bitten by this.  It took too much debugging
to find out that one method had not been implemented.  I would prefer an
exception be thrown to force you to finish the implementation(s).

dimiter wrote:

> I would prefer
>
> throw new UnsupportedOperationException("TODO: add implementation");
>
> this way you are visually notified in the IDE and get the error message at
> runtime.
>
> "Herm�n de J. Camarena R." <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > What about adding an TODO: entry?
> > Hjcr
> >
> > On 6/20/02 12:35 PM, "Paul Ruane" <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > When you implement or override a method, Idea inserts a default
> implementation
> > > of returning null, 0 etc. depending on the type.
> > >
> > > I would prefer the method to throw an UnsupportedOperation exception
> (with a
> > > "Not implemented.") message or perhaps have
> > > no implementation at all.
> > >
> > > My reasoning is that it is too easy to forget to complete the
> implementation,
> > > especially when you are disturbed, called away etc.
> > >
> > > o By not having any any default implementation, you notice that you
> haven't
> > > completed the method before or at compile time i.e. when Idea
> > > or the compiler alert you to the error.
> > >
> > > o With an implementation that throws a runtime exception you notice that
> you
> > > haven't  implemented the method at runtime when the method is called and
> are
> > > presented with a clear message.
> > >
> > > o With an implementation that returns a null or zero result you may
> experience
> > > unexpected behaviour and will not be presented with any message at all.
> > >
> > > As you can see, the current Idea behaviour is the most dangerous.
> > >
> > > Paul
> > >
> > >
> > > --
> > >
> > > This e-mail may contain confidential and/or privileged information. If
> you are
> > > not the intended recipient (or have received this e-mail in error)
> please
> > > notify the sender immediately and destroy this e-mail. Any unauthorized
> > > copying, disclosure or distribution of the material in this e-mail is
> strictly
> > > forbidden.
> > >
> > >
> > > _______________________________________________
> > > Eap-features mailing list
> > > [EMAIL PROTECTED]
> > > http://lists.jetbrains.com/mailman/listinfo/eap-features
> >

_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features

Reply via email to