aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorbcorso <bcorso@google.com>2019-11-14 12:41:41 -0800
committerChris Povirk <beigetangerine@gmail.com>2019-11-14 17:45:58 -0500
commit389355d065fbe189d8f7a388beeaebeaaf1d13ae (patch)
treea53fcbf55960adbb62647c72c6cfa598f020e5d3 /common
parent7db5511b899278f2f6daa4ea6f3e748bb7b84f64 (diff)
downloadauto-389355d065fbe189d8f7a388beeaebeaaf1d13ae.tar.gz
Automated g4 rollback of changelist 279369564.
*** Reason for rollback *** :-( rolling this back again because it breaks some targets. java.lang.IllegalArgumentException: <nulltype> cannot be represented as a Class<?>. My guess is that isType() is returning true when it should be returning false for null types, but I'll need to do more investigation. *** Original change description *** Use ElementVisitor rather than Element#getKind() in MoreElements#isType() ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=280489034
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/com/google/auto/common/MoreElements.java17
1 files changed, 1 insertions, 16 deletions
diff --git a/common/src/main/java/com/google/auto/common/MoreElements.java b/common/src/main/java/com/google/auto/common/MoreElements.java
index 3a607743..5e8e3541 100644
--- a/common/src/main/java/com/google/auto/common/MoreElements.java
+++ b/common/src/main/java/com/google/auto/common/MoreElements.java
@@ -106,19 +106,6 @@ public final class MoreElements {
}
}
- private static final class IsTypeVisitor extends SimpleElementVisitor8<Boolean, Void> {
- private static final IsTypeVisitor INSTANCE = new IsTypeVisitor();
-
- IsTypeVisitor() {
- super(false);
- }
-
- @Override
- public Boolean visitType(TypeElement e, Void unused) {
- return true;
- }
- }
-
/**
* Returns true if the given {@link Element} instance is a {@link TypeElement}.
*
@@ -128,9 +115,7 @@ public final class MoreElements {
* @throws NullPointerException if {@code element} is {@code null}
*/
public static boolean isType(Element element) {
- // Use a visitor rather than Element#getKind(). Element#getKind() contains more information
- // than is needed here. It also requires symbol completion, which can be slow.
- return element.accept(IsTypeVisitor.INSTANCE, null);
+ return element.getKind().isClass() || element.getKind().isInterface();
}
/**