public class IllegalImportCheck extends AbstractCheck
Checks for imports from a set of illegal packages.
By default, the check rejects all sun.* packages
since programs that contain direct calls to the sun.* packages
are
not 100% Pure Java.
To reject other packages, set property illegalPkgs to a comma-separated list of the illegal packages.
An example of how to configure the check is:
<module name="IllegalImport"/>
An example of how to configure the check so that it rejects packages
java.io.* and java.sql.* is
<module name="IllegalImport">
<property name="illegalPkgs" value="java.io, java.sql"/>
</module>
Compatible with Java 1.5 source.
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static String |
MSG_KEY
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
IllegalImportCheck()
Creates a new
IllegalImportCheck instance. |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
setIllegalClasses(String... from)
Set the list of illegal classes.
|
void |
setIllegalPkgs(String... from)
Set the list of illegal packages.
|
void |
setRegexp(boolean regexp)
Controls whether the packages or class names
should be interpreted as regular expressions.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, clearMessages, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setClassLoader, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final String MSG_KEY
public IllegalImportCheck()
IllegalImportCheck instance.public final void setIllegalPkgs(String... from)
from - array of illegal packagespublic void setIllegalClasses(String... from)
from - array of illegal classespublic void setRegexp(boolean regexp)
regexp - a Boolean valuepublic int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processCopyright © 2001–2018. All rights reserved.