Rollback of commit 0218320f1316b4d25e35abaaa80206237468824d.
*** Reason for rollback ***
Breaks skylark macros that call skylark rules that declare an 'args'
attribute.
--
MOS_MIGRATED_REVID=101118137
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
index d051892..67cc935 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
@@ -751,19 +751,9 @@
/**
* Adds or overrides the attribute in the rule class. Meant for Skylark usage.
- *
- * @throws IllegalArgumentException if the attribute overrides an existing attribute (will be
- * legal in the future).
*/
public void addOrOverrideAttribute(Attribute attribute) {
- String name = attribute.getName();
- boolean override = attributes.containsKey(name);
- // Attributes may be overridden in the future, thus we keep the code for overriding right
- // now.
- Preconditions.checkArgument(
- !override, "There is already a built-in attribute '%s' which cannot be overridden", name);
-
- if (override) {
+ if (attributes.containsKey(attribute.getName())) {
overrideAttribute(attribute);
} else {
addAttribute(attribute);