From 564940d73ab135f2dd0573623b8934ed1cd7b9d1 Mon Sep 17 00:00:00 2001 From: Greg Estren Date: Tue, 14 Feb 2017 21:30:29 +0000 Subject: Remove type checking requirement from AttributeMap.has. This overrides the traditional has(String name, Type<>T> type) with has(String name) and removes the type check outright from isConfigurable. Ideally we'd remove the old version in this same change. But there are enough uses of it that that's not a risk-free change and is safer as followup changes. -- PiperOrigin-RevId: 147513593 MOS_MIGRATED_REVID=147513593 --- .../lib/analysis/AspectAwareAttributeMapper.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java') diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java index 6d95f55b24..db7d6f0f3c 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java @@ -86,12 +86,8 @@ class AspectAwareAttributeMapper implements AttributeMap { } @Override - public boolean isConfigurable(String attributeName, Type type) { - if (ruleAttributes.has(attributeName, type)) { - return ruleAttributes.isConfigurable(attributeName, type); - } - // Any scenario aside from a "select(...)" in a BUILD file is not configurable. - return false; + public boolean isConfigurable(String attributeName) { + return ruleAttributes.isConfigurable(attributeName); } @Override @@ -154,7 +150,16 @@ class AspectAwareAttributeMapper implements AttributeMap { } @Override - public boolean has(String attrName, Type type) { + public boolean has(String attrName) { + if (ruleAttributes.has(attrName)) { + return true; + } else { + return aspectAttributes.containsKey(attrName); + } + } + + @Override + public boolean has(String attrName, Type type) { if (ruleAttributes.has(attrName, type)) { return true; } else { -- cgit v1.2.3