final JavaType javaType = new JavaType(
((ClassOrInterfaceType) type).getName());
final NameExpr nameToUse = importTypeIfRequired(targetType,
imports, javaType);
if (!(nameToUse instanceof QualifiedNameExpr)) {
return new ClassExpr(new ClassOrInterfaceType(
javaType.getSimpleTypeName()));
}
}
else if (type instanceof ReferenceType
&& ((ReferenceType) type).getType() instanceof ClassOrInterfaceType) {
final ClassOrInterfaceType cit = (ClassOrInterfaceType) ((ReferenceType) type)
.getType();
final JavaType javaType = new JavaType(cit.getName());
final NameExpr nameToUse = importTypeIfRequired(targetType,
imports, javaType);
if (!(nameToUse instanceof QualifiedNameExpr)) {
return new ClassExpr(new ClassOrInterfaceType(
javaType.getSimpleTypeName()));
}
}
}