#388 Turn off checks with SuppressWarnings?

Ian Brown

How about the idea of putting Annotation support into
rules such that, for example, you could disable a
particular check for a section of code with either an
@SuppressWarning or similar?

It would mean, probably, different builds for Java 5, but
it'd be well worth it.

I'd guess that each Check would need to test for its
Annotation in code when assessing it - unless you
could put the test into a base class or configuration.

It's the equivalent of the developer saying "I'm breaking a
rule here - but I have a good reason"


  • Oliver Burn

    Oliver Burn - 2005-09-27

    Logged In: YES

    You know that we already support the
    SuppressionCommentFilter which allows you to achieve this
    functionality now.

  • Ian Brown

    Ian Brown - 2005-09-30

    Logged In: YES

    Cool. Sorry that I hadn't spotted that previously.

    I'm still tempted to suggest an @SuppressWarnings thing
    though - it's prettier, there is no need to encode the 'end' of
    the suppression, and Checkstyle can lead the way for other
    tools to do the same - just like compiler vendors will be doing

    If I happen to write this filter (I'll try), would you be interested
    in having it contributed?

  • Oliver Burn

    Oliver Burn - 2005-10-01

    Logged In: YES

    Naturally we are interested in contributions. Just bear in mind
    that any patches need to:
    - Pass Checkstyle
    - Have unit tests
    - Be documented

  • Roman Ivanov

    Roman Ivanov - 2015-10-24
    • status: open --> closed
    • Group: --> Future

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks