com.puppycrawl.tools.checkstyle.checks.design
Class MutableExceptionCheck
- Configurable, Contextualizable
public final class MutableExceptionCheck
Ensures that exceptions (defined as any class name conforming
to some regular expression) are immutable. That is, have only final
fields.
Rationale: Exception instances should represent an error
condition. Having non final fields not only allows the state to be
modified by accident and therefore mask the original condition but
also allows developers to accidentally forget to initialise state
thereby leading to code catching the exception to draw incorrect
conclusions based on the state.
beginTree , destroy , finishTree , getAcceptableTokens , getClassLoader , getDefaultTokens , getFileContents , getLines , getRequiredTokens , getTabWidth , getTokenNames , init , leaveToken , log , log , setClassLoader , setFileContents , setMessages , setTabWidth , setTokens , visitToken |
getId , getMessageBundle , getSeverity , getSeverityLevel , log , log , log , log , log , log , log , log , log , log , log , setId , setSeverity |
MutableExceptionCheck
public MutableExceptionCheck()
Creates new instance of the check.