public ASTName getImportedNameNode() { return (ASTName) jjtGetChild(0); }
/** * Returns the full name of the import. For on-demand imports, this is the name without * the final dot and asterisk. */ public String getImportedName() { return jjtGetChild(0).getImage(); }
@Override public Object visit(ASTImportDeclaration node, Object data) { String img = node.jjtGetChild(0).getImage(); if (img.startsWith("sun.") && !img.startsWith("sun.misc.Signal")) { addViolation(data, node); } return data; }
@Override public Object visit(ASTImportDeclaration node, Object data) { if (node.isStatic()) { return data; } String img = node.jjtGetChild(0).getImage(); if (img.startsWith(IMPORT_JAVA_LANG)) { if (!IMPORT_JAVA_LANG.equals(img)) { if (img.indexOf('.', IMPORT_JAVA_LANG.length() + 1) != -1 || node.isImportOnDemand()) { // Importing from a subpackage / inner class return data; } } addViolation(data, node); } return data; } }
@Override public Object visit(ASTImportDeclaration node, Object data) { if (node.isImportOnDemand()) { ASTName importedType = (ASTName) node.jjtGetChild(0); imports.add(new ImportWrapper(importedType.getImage(), null, node, node.getType(), node.isStatic())); } else { if (!node.isImportOnDemand()) { ASTName importedType = (ASTName) node.jjtGetChild(0); String className; if (isQualifiedName(importedType)) { int lastDot = importedType.getImage().lastIndexOf('.') + 1; className = importedType.getImage().substring(lastDot); } else { className = importedType.getImage(); } imports.add(new ImportWrapper(importedType.getImage(), className, node)); } } return data; }
@Override public Object visit(ASTImportDeclaration node, Object data) { ASTName importedType = (ASTName) node.jjtGetChild(0); if (importedType.getType() != null) { node.setType(importedType.getType()); } else { populateType(node, importedType.getImage()); } if (node.getType() != null) { node.setPackage(node.getType().getPackage()); } // no need to visit children, the only child, ASTName, will have no type return data; }
public ASTName getImportedNameNode() { return (ASTName) jjtGetChild(0); }
/** * Returns the full name of the import. For on-demand imports, this is the name without * the final dot and asterisk. */ public String getImportedName() { return jjtGetChild(0).getImage(); }
@Override public Object visit(ASTImportDeclaration node, Object data) { String img = node.jjtGetChild(0).getImage(); if (img.startsWith("sun.") && !img.startsWith("sun.misc.Signal")) { addViolation(data, node); } return data; }
@Override public Object visit(ASTImportDeclaration node, Object data) { if (node.isStatic()) { return data; } String img = node.jjtGetChild(0).getImage(); if (img.startsWith(IMPORT_JAVA_LANG)) { if (!IMPORT_JAVA_LANG.equals(img)) { if (img.indexOf('.', IMPORT_JAVA_LANG.length() + 1) != -1 || node.isImportOnDemand()) { // Importing from a subpackage / inner class return data; } } addViolation(data, node); } return data; } }
@Override public Object visit(ASTImportDeclaration node, Object data) { if (node.isImportOnDemand()) { ASTName importedType = (ASTName) node.jjtGetChild(0); imports.add(new ImportWrapper(importedType.getImage(), null, node, node.getType(), node.isStatic())); } else { if (!node.isImportOnDemand()) { ASTName importedType = (ASTName) node.jjtGetChild(0); String className; if (isQualifiedName(importedType)) { int lastDot = importedType.getImage().lastIndexOf('.') + 1; className = importedType.getImage().substring(lastDot); } else { className = importedType.getImage(); } imports.add(new ImportWrapper(importedType.getImage(), className, node)); } } return data; }
@Override public Object visit(ASTImportDeclaration node, Object data) { ASTName importedType = (ASTName)node.jjtGetChild(0); if (importedType.getType() != null) { node.setType(importedType.getType()); } else { populateType(node, importedType.getImage()); } if (node.getType() != null) { node.setPackage(node.getType().getPackage()); } return data; }
@Override public Object visit(ASTImportDeclaration node, Object data) { ASTName importedType = (ASTName) node.jjtGetChild(0); if (importedType.getType() != null) { node.setType(importedType.getType()); } else { populateType(node, importedType.getImage()); } if (node.getType() != null) { node.setPackage(node.getType().getPackage()); } // no need to visit children, the only child, ASTName, will have no type return data; }