Do you want to do an extra e.getKind() check that it's actually a type - compilation errors can result in erroneous ASTs which have these matched on the wrong thing, which means this cast will fail, and you'll get a confusing error message above... plus you'll fail out of this rather than processing each in turn.  Better to check assumptions else report and continue.