Re: Useless code

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Sep 06 2005 - 02:39:55 EDT

  • Next message: Cris Daniluk: "Re: Postgres Adapter"

    I just cleaned up some code (will check it in the morning - CVS is
    acting up)... What I noticed is that while this validation is right
    in most cases, it ignores that sometimes superclass may declare an
    exception, knowing that a subclass may need to throw it... Not the
    best programming style, but still valid, as Java doesn't allow
    subclass to throw more exceptions than the super declared. So keep it
    at "warning" level - we'll have some of those around.

    Andrus

    On Sep 6, 2005, at 2:20 AM, Andrus Adamchik wrote:
    > I see, makes sense. I'll turn on this Eclipse warning and go
    > through the code. No need to send a patch as analyzing it would
    > take me longer than figuring it on my own ;-)
    >
    > Andrus
    >
    >
    > On Sep 6, 2005, at 2:09 AM, Kevin Menard wrote:
    >
    >
    >>
    >> On Sep 6, 2005, at 1:37 AM, Andrus Adamchik wrote:
    >>
    >>
    >>> Often exceptions are declared in an interface, but not thrown in
    >>> some implementations. If you can give some examples, I can
    >>> comment more intelligently.
    >>>
    >>
    >> Sure.
    >>
    >> DataContextCommitAction has a bunch of methods that declare that
    >> they throw CayenneException, but do not. This does not seem to be
    >> interface or superclass related. As a specific example, see
    >> prepareInsertQueries() in this class.
    >>
    >> DefaultResultIterator has a few methods that are declared to throw
    >> CayenneException or SQLException, but never do. Examples again
    >> are: checkNextRow() and readDataRow().
    >>
    >> ConfigLoader has a bunch of methods declared to throw
    >> SAXExceptions but never do.
    >>
    >> There numerous other such cases.
    >>
    >> --
    >> Kevin
    >>
    >>
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Sep 06 2005 - 02:39:55 EDT