public boolean typeIsAlsoLegalAsExpression(Node type) {
if (!(type instanceof TypeReference)) return true;
TypeReference tr = (TypeReference)type;
if (tr.astArrayDimensions() > 0) return false;
if (tr.isPrimitive() || tr.isVoid()) return false;
for (Node part : tr.rawParts()) {
if (part instanceof TypeReferencePart) {
if (!((TypeReferencePart)part).rawTypeArguments().isEmpty()) return false;
}
}