Package org.codenarc.rule
Class AbstractEnhanceableAstVisitorRule
- java.lang.Object
-
- org.codenarc.rule.AbstractRule
-
- org.codenarc.rule.AbstractAstVisitorRule
-
- org.codenarc.rule.AbstractEnhanceableAstVisitorRule
-
- All Implemented Interfaces:
Rule
- Direct Known Subclasses:
CloseWithoutCloseableRule
,CompareToWithoutComparableRule
public abstract class AbstractEnhanceableAstVisitorRule extends AbstractAstVisitorRule
Abstract superclass for Rules that use a Groovy AST Visitor and can optionally run in enhanced mode.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ENHANCED_MODE_SYSTEM_PROPERTY
Holds the name of the system property which allows to control theenhancedMode
property.private boolean
enhancedMode
Controls weather to run in enhanced mode.-
Fields inherited from class org.codenarc.rule.AbstractAstVisitorRule
CLOSURE_TEXT, DEFAULT_CONST_NAME, DEFAULT_FIELD_NAME, DEFAULT_TEST_CLASS_NAMES, DEFAULT_TEST_FILES, DEFAULT_VAR_NAME
-
-
Constructor Summary
Constructors Constructor Description AbstractEnhanceableAstVisitorRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCompilerPhase()
boolean
isEnhancedMode()
void
setEnhancedMode(boolean enhancedMode)
-
Methods inherited from class org.codenarc.rule.AbstractAstVisitorRule
applyTo, getApplyToClassNames, getAstVisitor, getAstVisitorClass, getDoNotApplyToClassNames, setApplyToClassNames, setDoNotApplyToClassNames, shouldApplyThisRuleTo
-
Methods inherited from class org.codenarc.rule.AbstractRule
applyTo, createViolation, createViolation, createViolationForImport, createViolationForImport, getApplyToFileNames, getApplyToFilesMatching, getDescription, getDoNotApplyToFileNames, getDoNotApplyToFilesMatching, getName, getPriority, getViolationMessage, isEnabled, isReady, setApplyToFileNames, setApplyToFilesMatching, setDescription, setDoNotApplyToFileNames, setDoNotApplyToFilesMatching, setEnabled, setName, setPriority, setViolationMessage, toString, validate
-
-
-
-
Field Detail
-
ENHANCED_MODE_SYSTEM_PROPERTY
public static final java.lang.String ENHANCED_MODE_SYSTEM_PROPERTY
Holds the name of the system property which allows to control theenhancedMode
property.- See Also:
- Constant Field Values
-
enhancedMode
private boolean enhancedMode
Controls weather to run in enhanced mode. Note that running in enhanced mode will use a later compilation phase which will require any classes referenced from the analysed code to be available on the classpath. This property is set tofalse
by default and can be also controlled usingorg.codenarc.enhancedMode
system property.
-
-
Method Detail
-
isEnhancedMode
public boolean isEnhancedMode()
-
setEnhancedMode
public void setEnhancedMode(boolean enhancedMode)
-
getCompilerPhase
public int getCompilerPhase()
- Specified by:
getCompilerPhase
in interfaceRule
- Overrides:
getCompilerPhase
in classAbstractRule
- Returns:
- the required compiler phase (as in
Phases
) of the AST of theSourceCode
handed to the rule viaAbstractRule.applyTo(SourceCode sourceCode)
-
-