diff options
author | Jon Brandvein <brandjon@google.com> | 2017-01-18 23:32:53 +0000 |
---|---|---|
committer | Vladimir Moskva <vladmos@google.com> | 2017-01-19 12:36:55 +0000 |
commit | 94d7f904f9d0634dde348af0261fc6305682eeed (patch) | |
tree | 150437d44af7139e9676fd659d68a90158432b16 | |
parent | ded4fbb29f6d5fede347d4ac0ba91467bb7b0d2a (diff) |
Refactor a traversal over @SkylarkModule ancestors
--
PiperOrigin-RevId: 144890965
MOS_MIGRATED_REVID=144890965
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java index 387b565e44..83d2b9f3a4 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java @@ -158,27 +158,12 @@ public final class EvalUtils { || c.equals(Integer.class) || c.equals(Boolean.class) // there is a registered Skylark ancestor class (useful e.g. when using AutoValue) - || hasSkylarkAcceptableAncestor(c) + || SkylarkInterfaceUtils.getSkylarkModule(c) != null || ImmutableMap.class.isAssignableFrom(c) // will be converted to SkylarkDict || NestedSet.class.isAssignableFrom(c) // will be converted to SkylarkNestedSet || c.equals(PathFragment.class); // other known class } - private static boolean hasSkylarkAcceptableAncestor(Class<?> c) { - if (c == null) { - return false; - } - if (c.isAnnotationPresent(SkylarkModule.class)) { - return true; - } - for (Class<?> inter : c.getInterfaces()) { - if (hasSkylarkAcceptableAncestor(inter)) { - return true; - } - } - return hasSkylarkAcceptableAncestor(c.getSuperclass()); - } - // TODO(bazel-team): move the following few type-related functions to SkylarkType /** * Return the Skylark-type of {@code c} |