use of net.sourceforge.pmd.lang.ast.QualifiableNode in project pmd by pmd.
the class ClassTypeResolver method visit.
@Override
public Object visit(ASTClassOrInterfaceType node, Object data) {
super.visit(node, data);
String typeName = node.getImage();
if (node.isAnonymousClass()) {
QualifiableNode parent = node.getFirstParentOfAnyType(ASTAllocationExpression.class, ASTEnumConstant.class);
if (parent != null) {
typeName = parent.getQualifiedName().toString();
}
}
populateType(node, typeName, node.getArrayDepth());
ASTTypeArguments typeArguments = node.getFirstChildOfType(ASTTypeArguments.class);
if (typeArguments != null) {
final JavaTypeDefinition[] boundGenerics = new JavaTypeDefinition[typeArguments.jjtGetNumChildren()];
for (int i = 0; i < typeArguments.jjtGetNumChildren(); ++i) {
boundGenerics[i] = ((TypeNode) typeArguments.jjtGetChild(i)).getTypeDefinition();
}
node.setTypeDefinition(JavaTypeDefinition.forClass(node.getType(), boundGenerics));
}
return data;
}
Aggregations