Skip to content

Commit f9bedfb

Browse files
committed
Change TypeEnumerator to rely on the default behavior of the TreeScanner rather than checking the kind against an EnumSet.
------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=68838183
1 parent c721f26 commit f9bedfb

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/main/java/com/google/testing/compile/TypeEnumerator.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@
1515
*/
1616
package com.google.testing.compile;
1717

18-
import static com.sun.source.tree.Tree.Kind.ANNOTATION_TYPE;
19-
import static com.sun.source.tree.Tree.Kind.CLASS;
20-
import static com.sun.source.tree.Tree.Kind.COMPILATION_UNIT;
21-
import static com.sun.source.tree.Tree.Kind.ENUM;
22-
import static com.sun.source.tree.Tree.Kind.EXPRESSION_STATEMENT;
23-
import static com.sun.source.tree.Tree.Kind.IDENTIFIER;
24-
import static com.sun.source.tree.Tree.Kind.INTERFACE;
25-
import static com.sun.source.tree.Tree.Kind.MEMBER_SELECT;
26-
2718
import com.google.common.base.Function;
19+
import com.google.common.base.Objects;
2820
import com.google.common.collect.FluentIterable;
2921
import com.google.common.collect.ImmutableSet;
3022
import com.google.common.collect.Sets;
@@ -62,15 +54,9 @@ static ImmutableSet<String> getTopLevelTypes(CompilationUnitTree t) {
6254
*/
6355
@SuppressWarnings("restriction") // Sun APIs usage intended
6456
static final class TypeScanner extends TreeScanner<Set<String>, Void> {
65-
66-
private static final Set<Tree.Kind> RELEVANT_KINDS = Sets.immutableEnumSet(
67-
ANNOTATION_TYPE, CLASS, ENUM, COMPILATION_UNIT, EXPRESSION_STATEMENT, IDENTIFIER, INTERFACE,
68-
MEMBER_SELECT);
69-
7057
@Override
7158
public Set<String> scan(Tree node, Void v) {
72-
return (node != null) && RELEVANT_KINDS.contains(node.getKind()) ?
73-
node.accept(this, v) : ImmutableSet.<String>of();
59+
return Objects.firstNonNull(super.scan(node, v), ImmutableSet.<String>of());
7460
}
7561

7662
@Override

0 commit comments

Comments
 (0)