use of com.puppycrawl.tools.checkstyle.api.FullIdent in project checkstyle by checkstyle.
the class IllegalInstantiationCheck method postProcessLiteralNew.
/**
* Processes one of the collected "new" tokens when walking tree
* has finished.
* @param newTokenAst the "new" token.
*/
private void postProcessLiteralNew(DetailAST newTokenAst) {
final DetailAST typeNameAst = newTokenAst.getFirstChild();
final AST nameSibling = typeNameAst.getNextSibling();
if (nameSibling.getType() != TokenTypes.ARRAY_DECLARATOR) {
// ast != "new Boolean[]"
final FullIdent typeIdent = FullIdent.createFullIdent(typeNameAst);
final String typeName = typeIdent.getText();
final int lineNo = newTokenAst.getLineNo();
final int colNo = newTokenAst.getColumnNo();
final String fqClassName = getIllegalInstantiation(typeName);
if (fqClassName != null) {
log(lineNo, colNo, MSG_KEY, fqClassName);
}
}
}
use of com.puppycrawl.tools.checkstyle.api.FullIdent in project checkstyle by checkstyle.
the class IllegalInstantiationCheck method processPackageDef.
/**
* Perform processing for an package token.
* @param ast the package token
*/
private void processPackageDef(DetailAST ast) {
final DetailAST packageNameAST = ast.getLastChild().getPreviousSibling();
final FullIdent packageIdent = FullIdent.createFullIdent(packageNameAST);
pkgName = packageIdent.getText();
}
use of com.puppycrawl.tools.checkstyle.api.FullIdent in project checkstyle by checkstyle.
the class IllegalThrowsCheck method visitToken.
@Override
public void visitToken(DetailAST detailAST) {
final DetailAST methodDef = detailAST.getParent();
DetailAST token = detailAST.getFirstChild();
// Check if the method with the given name should be ignored.
if (!isIgnorableMethod(methodDef)) {
while (token != null) {
if (token.getType() != TokenTypes.COMMA) {
final FullIdent ident = FullIdent.createFullIdent(token);
if (illegalClassNames.contains(ident.getText())) {
log(token, MSG_KEY, ident.getText());
}
}
token = token.getNextSibling();
}
}
}