Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] suppressing warnings

Adrian Colyer wrote:
> For cases when you really really do want an "empty" catch block the
> following works:
> 
> catch(ExceptionImGoingToSwallow ex) {
>   ; // this catch block deliberately left empty
> }

I have "Unnecessary Semicolon" flagged as error and found several
high-class bugs that way (in other people's code), which I find really
depressing. eclipse can also warn if the block is completely empty and
that's a really good feature too because it helps to find dead code &
leftover branches that someone "forgot".
The problem with empty blovcks is not thatthey are empty, but rather that
they don't say *why* they are. Forcing at least a TODO or ignored note is
the right thing to do.

> You could say the swallowed exception detection code isn't smart enough
> ;), but it doesn't complain at this implementation.

But it should! :)

Holger
"-Wall -Werror"


Back to the top