Package com.puppycrawl.tools.checkstyle
Class TreeWalker
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
-
- com.puppycrawl.tools.checkstyle.TreeWalker
-
- All Implemented Interfaces:
Configurable,Contextualizable,ExternalResourceHolder,FileSetCheck
public final class TreeWalker extends AbstractFileSetCheck implements ExternalResourceHolder
Responsible for walking an abstract syntax tree and notifying interested checks at each each node.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions
-
-
Constructor Summary
Constructors Constructor Description TreeWalker()Creates a newTreeWalkerinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Cleans up the object.voidfinishLocalSetup()Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.java.util.Set<java.lang.String>getExternalResourceLocations()Returns a set of external configuration resource locations which are used by the module.protected voidprocessFiltered(java.io.File file, FileText fileText)Called to process a file that matches the specified file extensions.voidsetModuleFactory(ModuleFactory moduleFactory)Sets the module factory for creating child modules (Checks).voidsetupChild(Configuration childConf)Called by configure() for every child of this component's Configuration.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
addMessages, beginProcessing, finishProcessing, fireErrors, getFileContents, getFileExtensions, getMessageDispatcher, getMessages, getTabWidth, init, log, log, process, setFileContents, setFileExtensions, setMessageDispatcher, setTabWidth
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Configurable
configure
-
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable
contextualize
-
-
-
-
Method Detail
-
setModuleFactory
public void setModuleFactory(ModuleFactory moduleFactory)
Sets the module factory for creating child modules (Checks).- Parameters:
moduleFactory- the factory
-
finishLocalSetup
public void finishLocalSetup()
Description copied from class:AutomaticBeanProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Overrides:
finishLocalSetupin classAbstractViolationReporter
-
setupChild
public void setupChild(Configuration childConf) throws CheckstyleException
Called by configure() for every child of this component's Configuration.The default implementation throws
Creates child module.CheckstyleExceptionifchildConfisnullbecause it doesn't support children. It must be overridden to validate and support children that are wanted.- Overrides:
setupChildin classAutomaticBean- Parameters:
childConf- a child of this component's Configuration- Throws:
CheckstyleException- if there is a configuration error.- See Also:
Configuration.getChildren()
-
processFiltered
protected void processFiltered(java.io.File file, FileText fileText) throws CheckstyleExceptionDescription copied from class:AbstractFileSetCheckCalled to process a file that matches the specified file extensions.- Specified by:
processFilteredin classAbstractFileSetCheck- Parameters:
file- the file to be processedfileText- the contents of the file.- Throws:
CheckstyleException- if error condition within Checkstyle occurs.
-
destroy
public void destroy()
Description copied from interface:FileSetCheckCleans up the object.- Specified by:
destroyin interfaceFileSetCheck- Overrides:
destroyin classAbstractFileSetCheck
-
getExternalResourceLocations
public java.util.Set<java.lang.String> getExternalResourceLocations()
Description copied from interface:ExternalResourceHolderReturns a set of external configuration resource locations which are used by the module. ATTENTION! If 'getExternalResourceLocations()' return null, there will beNullPointerExceptioninChecker. Such behaviour will signal that your module (check or filter) is designed incorrectly. It make sense to return an empty set from 'getExternalResourceLocations()' only for composite modules likeTreeWalker.- Specified by:
getExternalResourceLocationsin interfaceExternalResourceHolder- Returns:
- a set of external configuration resource locations which are used by the module.
-
-