|
15 | 15 | */
|
16 | 16 | package com.google.testing.compile;
|
17 | 17 |
|
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 |
| - |
27 | 18 | import com.google.common.base.Function;
|
| 19 | +import com.google.common.base.Objects; |
28 | 20 | import com.google.common.collect.FluentIterable;
|
29 | 21 | import com.google.common.collect.ImmutableSet;
|
30 | 22 | import com.google.common.collect.Sets;
|
@@ -62,15 +54,9 @@ static ImmutableSet<String> getTopLevelTypes(CompilationUnitTree t) {
|
62 | 54 | */
|
63 | 55 | @SuppressWarnings("restriction") // Sun APIs usage intended
|
64 | 56 | 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 |
| - |
70 | 57 | @Override
|
71 | 58 | 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()); |
74 | 60 | }
|
75 | 61 |
|
76 | 62 | @Override
|
|
0 commit comments