Re: IllegalCatch extension.
"Oliver Burn" <[email protected]>
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
Personally I do not recommend using the Suppression comments in Checkstyle for the reasons you list. Instead I use the SuppressionFilter which keeps the suppression information out of the code. It also makes it easy to review what suppressions a project is using. See here<http://checkstyle.svn.sourceforge.net/viewvc/checkstyle/trunk/checkstyle/suppressions.xml?revision=2344&view=markup>for the suppressions Checkstyle uses. With this approach I would not be concerned about performance. My current project is about 1.2 million lines of Java code, and the performance of the SuppressionFilter is fine. On Jan 26, 2008 5:06 AM, Emerson Farrugia <[email protected]> wrote: > Thanks for the reply. > > The number of try blocks that throw Exception is quite small in the > code base, so using the suppression filter comment is not a major > inconvenience. I did have two concerns about using suppression > comments: > > > 1. Coupling the code to Checkstyle. The developer shouldn't need to > concern himself with Checkstyle, and adding comments which make > references to Checkstyle may be seen as polluting the code. I'll > mitigate this by setting generic and meaningful short strings for the > Off and On comments. > > 2. Performance. I didn't know if the FileContentsHolder module would > slow down Checkstyle. It doesn't seem to, judging by some quick and > dirty tests. > > > Thanks for any feedback, regards, > Emerson > > > On 24/01/2008, Oliver Burn <[email protected]> wrote: > > Hi, that information is not available to the check to make this smart > > decision. > > > > In reality the only option is to use the Suppression Filter as you > currently > > doing. > > > > In practice if the use of the API is encapsulated, it should not be a > major > > inconvenience. But, if the API is used all throughout your code > > base................. > > > > Cheers, > > Oliver > > > > > > On Jan 25, 2008 1:26 AM, Emerson Farrugia <[email protected]> > > wrote: > > > > > > Hi, > > > > > > The IllegalCatch check determines if a catch block is trapping generic > > > exceptions, such as Exception, Error, RuntimeException, and Throwable. > > > > > > I'd like to enable this check. However, there are cases when Exception > > > must be caught by the programmer. This often occurs when using > > > third-party libraries whose methods throw Exception, such as the > > > Velocity.mergeTemplate() method. > > > > > > Is it possible for the check to be extended such that an event isn't > > > trigger if the try block throws Exception? I don't know if that > > > information is available to the check. > > > > > > Until then, I'll use a suppression filter. > > > > > > Thanks, > > > Emerson > > > > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by: Microsoft > > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > _______________________________________________ > > > Checkstyle-user mailing list > > > [email protected] > > > > > https://lists.sourceforge.net/lists/listinfo/checkstyle-user > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Checkstyle-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/checkstyle-user > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Checkstyle-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/checkstyle-user > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Checkstyle-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/checkstyle-user