For native rule classes, (de)serialize only explicit attrs

Native rule classes can provide default values for rules after they're
deserialized, so there isn't a need to serialize those default values.

This doesn't apply yet to rules with Skylark-defined rule classes, due
to the non-serializablity of Skylark rule classes.

--
MOS_MIGRATED_REVID=112066930
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index ecf1df7..bc78044 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -1001,17 +1001,16 @@
     }
 
     /**
-     * Returns a new Rule belonging to this package instance, and uses the given Label.
+     * Creates a new {@link Rule} {@code r} where {@code r.getPackage()} is the {@link Package}
+     * associated with this {@link Builder}.
      *
-     * <p>Useful for RuleClass instantiation, where the rule name is checked by trying to create a
-     * Label. This label can then be used again here.
+     * <p>The created {@link Rule} will have no attribute values, no output files, and therefore
+     * will be in an invalid state.
      */
-    Rule newRuleWithLabel(Label label, RuleClass ruleClass, Location location) {
-      return newRuleWithLabelAndAttrContainer(label, ruleClass, location,
-          new AttributeContainer(ruleClass));
-    }
-
-    Rule newRuleWithLabelAndAttrContainer(Label label, RuleClass ruleClass, Location location,
+    Rule createRule(
+        Label label,
+        RuleClass ruleClass,
+        Location location,
         AttributeContainer attributeContainer) {
       return new Rule(pkg, label, ruleClass, location, attributeContainer);
     }