You are correct, see Check.java:
// oburn on checkstyle-dev: another method should be added
// to specify the tokens that a check must have. For some checks to
// work, they must be registered for some tokens.
//
// The example I could think of is one is a
// check that tracked scope information automatically (for performance
// reasons). It would need to always be notified about class, interface
// definitions.
//
// Lets worry about it when it becomes a problem.
I think you have now found a point where it has become a problem. If
there are more we should add Check.getRequiredTokens() and implement it
by returning the empty array by default and override it in those Checks.
Lars
Rick Giles wrote:
>It seems that there is a missing feature of required tokens for a Check.
>For example, JavadocMethodCheck has default tokens {PACKAGE_DEF, IMPORT,
>METHOD_DEF, CTOR_DEF}. Until today's commit, JavadocMethodCheck had no
>method getAcceptableTokens, which meant that the user could
>"mis-configure" the check. METHOD_DEF, CTOR_DEF are "acceptable tokens"
>in that the user should be able to configure property tokens as a subset
>of these, just like several other Checks. However, if the user does
>that, then the "required tokens" PACKAGE_DEF, IMPORT are not registered,
>and the check can give false results. Should there be "required tokens"
>for such a check, or did I miss something in the logic of registering a
>check and its tokens?
>
>/Rick
>
>
>
|