if (aAST.getType() == TokenTypes.PACKAGE_DEF) {
mPkgName = FullIdent.createFullIdent(
aAST.getLastChild().getPreviousSibling()).getText();
}
else if (aAST.getType() == TokenTypes.IMPORT) {
final FullIdent imp = FullIdent.createFullIdentBelow(aAST);
if (fromPackage(imp.getText(), "java.lang")) {
log(aAST.getLineNo(), aAST.getColumnNo(), "import.lang",
imp.getText());
}
else if (fromPackage(imp.getText(), mPkgName)) {
log(aAST.getLineNo(), aAST.getColumnNo(), "import.same",
imp.getText());
}
// Check for a duplicate import
for (FullIdent full : mImports) {
if (imp.getText().equals(full.getText())) {
log(aAST.getLineNo(), aAST.getColumnNo(),
"import.duplicate", full.getLineNo(),
imp.getText());
}
}
mImports.add(imp);
}
else {
// Check for a duplicate static import
final FullIdent imp =
FullIdent.createFullIdent(
aAST.getLastChild().getPreviousSibling());
for (FullIdent full : mStaticImports) {
if (imp.getText().equals(full.getText())) {
log(aAST.getLineNo(), aAST.getColumnNo(),
"import.duplicate", full.getLineNo(), imp.getText());
}
}
mStaticImports.add(imp);
}