There is no corresponding rule in the naming rules. But you could achieve the desired result using RegExp check ( explanation of regular expression):
<module name="Regexp"> <property name="format" value="\benum\s+\S\S(?<!E[AZ])[a-zA-Z0-9]+"/> <property name="message" value="Enums must start with a capital 'E', eg EMyEnum"/> <property name="illegalPattern" value="true"/> <property name="ignoreComments" value="true"/> </module>
This ignores the matches in the comments (for example, when the enumeration declaration has been commented out), and also works if there is a new line between the enum keyword and the identifier. Since enum is a keyword in Java, there should not be many false positives.
source share