How to apply Checkstyle check IllegalType only to static fields
I'm trying to use Checkstyle (this check) to raise a warning when a particular class is used as a type for static field. I'm doing it with this configuration and it doesn't work:
<module name="IllegalType">
<property name="format" value="myFullClassName"/>
<property name="tokens" value="LITERAL_STATIC"/>
</module>
The following configuration do work, but for all fields, not only static:
<module name="IllegalType">
<property name="format" value="myFullClassName"/>
<property name="tokens" value="VA开发者_运维技巧RIABLE_DEF"/>
</module>
From the doc, it looks like tokens have to be a subset
of PARAMETER_DEF
, VARIABLE_DEF
and METHOD_DEF
.
精彩评论