Remove AspectClass.getDefinition

Aspect becomes a triple (AspectClass, AspectDefinition,
AspectParameters) and loses its equals() method.
After this CL, SkylarkAspectClass.getDefintion still exists and is
deprecated.

--
MOS_MIGRATED_REVID=119159653
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
index a740a1f..c87eb14 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
@@ -41,7 +41,6 @@
 import com.google.devtools.build.lib.analysis.util.AnalysisMock;
 import com.google.devtools.build.lib.analysis.util.BuildViewTestBase;
 import com.google.devtools.build.lib.cmdline.Label;
-import com.google.devtools.build.lib.packages.Aspect;
 import com.google.devtools.build.lib.packages.Attribute;
 import com.google.devtools.build.lib.packages.Rule;
 import com.google.devtools.build.lib.pkgcache.LoadingFailedException;
@@ -344,12 +343,12 @@
           Dependency.withTransitionAndAspects(
               Label.parseAbsolute("//package:inner"),
               Attribute.ConfigurationTransition.NONE,
-              ImmutableSet.<Aspect>of());
+              ImmutableSet.<AspectDescriptor>of());
       fileDependency =
           Dependency.withTransitionAndAspects(
               Label.parseAbsolute("//package:file"),
               Attribute.ConfigurationTransition.NONE,
-              ImmutableSet.<Aspect>of());
+              ImmutableSet.<AspectDescriptor>of());
     } else {
       innerDependency =
           Dependency.withConfiguration(
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/DependencyResolverTest.java b/src/test/java/com/google/devtools/build/lib/analysis/DependencyResolverTest.java
index 2179908..13d31cc 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/DependencyResolverTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/DependencyResolverTest.java
@@ -108,7 +108,7 @@
     return dependencyResolver.dependentNodeMap(
         new TargetAndConfiguration(target, getTargetConfiguration()),
         getHostConfiguration(),
-        aspect != null ? new Aspect(new NativeAspectClass<T>(aspect)) : null,
+        aspect != null ? Aspect.forNative(new NativeAspectClass<T>(aspect)) : null,
         ImmutableSet.<ConfigMatchingProvider>of());
   }
 
@@ -117,7 +117,7 @@
       ListMultimap<Attribute, Dependency> dependentNodeMap,
       String attrName,
       String dep,
-      Aspect... aspects) {
+      AspectDescriptor... aspects) {
     Attribute attr = null;
     for (Attribute candidate : dependentNodeMap.keySet()) {
       if (candidate.getName().equals(attrName)) {
@@ -147,7 +147,8 @@
         "aspect(name='b', foo=[])");
     ListMultimap<Attribute, Dependency> map = dependentNodeMap("//a:a", null);
     assertDep(
-        map, "foo", "//a:b", new Aspect(new NativeAspectClass(TestAspects.SimpleAspect.class)));
+        map, "foo", "//a:b",
+        new AspectDescriptor(new NativeAspectClass<>(TestAspects.SimpleAspect.class)));
   }
 
   @Test
@@ -159,7 +160,8 @@
     ListMultimap<Attribute, Dependency> map =
         dependentNodeMap("//a:a", TestAspects.AttributeAspect.class);
     assertDep(
-        map, "foo", "//a:b", new Aspect(new NativeAspectClass(TestAspects.AttributeAspect.class)));
+        map, "foo", "//a:b",
+        new AspectDescriptor(new NativeAspectClass<>(TestAspects.AttributeAspect.class)));
   }
 
   @Test
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/DependencyTest.java b/src/test/java/com/google/devtools/build/lib/analysis/DependencyTest.java
index 4ea7309..0e4908d 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/DependencyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/DependencyTest.java
@@ -23,8 +23,9 @@
 import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
 import com.google.devtools.build.lib.analysis.util.AnalysisTestCase;
 import com.google.devtools.build.lib.analysis.util.TestAspects;
+import com.google.devtools.build.lib.analysis.util.TestAspects.AttributeAspect;
+import com.google.devtools.build.lib.analysis.util.TestAspects.SimpleAspect;
 import com.google.devtools.build.lib.cmdline.Label;
-import com.google.devtools.build.lib.packages.Aspect;
 import com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition;
 import com.google.devtools.build.lib.packages.NativeAspectClass;
 
@@ -83,11 +84,11 @@
   @Test
   public void withConfigurationAndAspects_BasicAccessors() throws Exception {
     update();
-    Aspect simpleAspect = new Aspect(
-        new NativeAspectClass<TestAspects.SimpleAspect>(TestAspects.SimpleAspect.class));
-    Aspect attributeAspect = new Aspect(
-        new NativeAspectClass<TestAspects.AttributeAspect>(TestAspects.AttributeAspect.class));
-    ImmutableSet<Aspect> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
+    AspectDescriptor simpleAspect = new AspectDescriptor(
+        new NativeAspectClass<SimpleAspect>(SimpleAspect.class));
+    AspectDescriptor attributeAspect = new AspectDescriptor(
+        new NativeAspectClass<AttributeAspect>(AttributeAspect.class));
+    ImmutableSet<AspectDescriptor> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
     Dependency targetDep =
         Dependency.withConfigurationAndAspects(
             Label.parseAbsolute("//a"), getTargetConfiguration(), twoAspects);
@@ -113,7 +114,7 @@
   @Test
   public void withConfigurationAndAspects_RejectsNullAspectsWithNPE() throws Exception {
     update();
-    Set<Aspect> nullSet = new LinkedHashSet<>();
+    Set<AspectDescriptor> nullSet = new LinkedHashSet<>();
     nullSet.add(null);
 
     try {
@@ -129,11 +130,11 @@
   public void withConfigurationAndAspects_RejectsNullConfigWithNPE() throws Exception {
     // Although the NullPointerTester should check this, this test invokes a different code path,
     // because it includes aspects (which the NPT test will not).
-    Aspect simpleAspect = new Aspect(
-        new NativeAspectClass<TestAspects.SimpleAspect>(TestAspects.SimpleAspect.class));
-    Aspect attributeAspect = new Aspect(
-        new NativeAspectClass<TestAspects.AttributeAspect>(TestAspects.AttributeAspect.class));
-    ImmutableSet<Aspect> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
+    AspectDescriptor simpleAspect = new AspectDescriptor(
+        new NativeAspectClass<SimpleAspect>(SimpleAspect.class));
+    AspectDescriptor attributeAspect = new AspectDescriptor(
+        new NativeAspectClass<AttributeAspect>(AttributeAspect.class));
+    ImmutableSet<AspectDescriptor> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
 
     try {
       Dependency.withConfigurationAndAspects(Label.parseAbsolute("//a"), null, twoAspects);
@@ -148,7 +149,9 @@
     update();
     Dependency dep =
         Dependency.withConfigurationAndAspects(
-            Label.parseAbsolute("//a"), getTargetConfiguration(), ImmutableSet.<Aspect>of());
+            Label.parseAbsolute("//a"),
+            getTargetConfiguration(),
+            ImmutableSet.<AspectDescriptor>of());
     // Here we're also checking that this doesn't throw an exception. No boom? OK. Good.
     assertThat(dep.getAspects()).isEmpty();
     assertThat(dep.getAspectConfigurations()).isEmpty();
@@ -157,11 +160,11 @@
   @Test
   public void withConfiguredAspects_BasicAccessors() throws Exception {
     update();
-    Aspect simpleAspect = new Aspect(
+    AspectDescriptor simpleAspect = new AspectDescriptor(
         new NativeAspectClass<TestAspects.SimpleAspect>(TestAspects.SimpleAspect.class));
-    Aspect attributeAspect = new Aspect(
-        new NativeAspectClass<TestAspects.AttributeAspect>(TestAspects.AttributeAspect.class));
-    ImmutableMap<Aspect, BuildConfiguration> twoAspectMap = ImmutableMap.of(
+    AspectDescriptor attributeAspect = new AspectDescriptor(
+        new NativeAspectClass<AttributeAspect>(AttributeAspect.class));
+    ImmutableMap<AspectDescriptor, BuildConfiguration> twoAspectMap = ImmutableMap.of(
         simpleAspect, getTargetConfiguration(), attributeAspect, getHostConfiguration());
     Dependency targetDep =
         Dependency.withConfiguredAspects(
@@ -189,7 +192,7 @@
     Dependency dep =
         Dependency.withConfiguredAspects(
             Label.parseAbsolute("//a"), getTargetConfiguration(),
-            ImmutableMap.<Aspect, BuildConfiguration>of());
+            ImmutableMap.<AspectDescriptor, BuildConfiguration>of());
     // Here we're also checking that this doesn't throw an exception. No boom? OK. Good.
     assertThat(dep.getAspects()).isEmpty();
     assertThat(dep.getAspectConfigurations()).isEmpty();
@@ -197,11 +200,11 @@
 
   @Test
   public void withTransitionAndAspects_BasicAccessors() throws Exception {
-    Aspect simpleAspect = new Aspect(
-        new NativeAspectClass<TestAspects.SimpleAspect>(TestAspects.SimpleAspect.class));
-    Aspect attributeAspect = new Aspect(
-        new NativeAspectClass<TestAspects.AttributeAspect>(TestAspects.AttributeAspect.class));
-    ImmutableSet<Aspect> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
+    AspectDescriptor simpleAspect = new AspectDescriptor(
+        new NativeAspectClass<>(SimpleAspect.class));
+    AspectDescriptor attributeAspect = new AspectDescriptor(
+        new NativeAspectClass<>(AttributeAspect.class));
+    ImmutableSet<AspectDescriptor> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
     Dependency hostDep =
         Dependency.withTransitionAndAspects(
             Label.parseAbsolute("//a"), ConfigurationTransition.HOST, twoAspects);
@@ -232,7 +235,8 @@
     update();
     Dependency dep =
         Dependency.withTransitionAndAspects(
-            Label.parseAbsolute("//a"), ConfigurationTransition.HOST, ImmutableSet.<Aspect>of());
+            Label.parseAbsolute("//a"), ConfigurationTransition.HOST,
+            ImmutableSet.<AspectDescriptor>of());
     // Here we're also checking that this doesn't throw an exception. No boom? OK. Good.
     assertThat(dep.getAspects()).isEmpty();
   }
@@ -258,28 +262,28 @@
     BuildConfiguration host = getHostConfiguration();
     BuildConfiguration target = getTargetConfiguration();
 
-    Aspect simpleAspect = new Aspect(
-        new NativeAspectClass<TestAspects.SimpleAspect>(TestAspects.SimpleAspect.class));
-    Aspect attributeAspect = new Aspect(
-        new NativeAspectClass<TestAspects.AttributeAspect>(TestAspects.AttributeAspect.class));
-    Aspect errorAspect = new Aspect(
-        new NativeAspectClass<TestAspects.ErrorAspect>(TestAspects.ErrorAspect.class));
+    AspectDescriptor simpleAspect = new AspectDescriptor(
+        new NativeAspectClass<>(TestAspects.SimpleAspect.class));
+    AspectDescriptor attributeAspect = new AspectDescriptor(
+        new NativeAspectClass<>(TestAspects.AttributeAspect.class));
+    AspectDescriptor errorAspect = new AspectDescriptor(
+        new NativeAspectClass<>(TestAspects.ErrorAspect.class));
 
-    ImmutableSet<Aspect> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
-    ImmutableSet<Aspect> inverseAspects = ImmutableSet.of(attributeAspect, simpleAspect);
-    ImmutableSet<Aspect> differentAspects = ImmutableSet.of(attributeAspect, errorAspect);
-    ImmutableSet<Aspect> noAspects = ImmutableSet.<Aspect>of();
+    ImmutableSet<AspectDescriptor> twoAspects = ImmutableSet.of(simpleAspect, attributeAspect);
+    ImmutableSet<AspectDescriptor> inverseAspects = ImmutableSet.of(attributeAspect, simpleAspect);
+    ImmutableSet<AspectDescriptor> differentAspects = ImmutableSet.of(attributeAspect, errorAspect);
+    ImmutableSet<AspectDescriptor> noAspects = ImmutableSet.<AspectDescriptor>of();
 
-    ImmutableMap<Aspect, BuildConfiguration> twoAspectsHostMap =
+    ImmutableMap<AspectDescriptor, BuildConfiguration> twoAspectsHostMap =
         ImmutableMap.of(simpleAspect, host, attributeAspect, host);
-    ImmutableMap<Aspect, BuildConfiguration> twoAspectsTargetMap =
+    ImmutableMap<AspectDescriptor, BuildConfiguration> twoAspectsTargetMap =
         ImmutableMap.of(simpleAspect, target, attributeAspect, target);
-    ImmutableMap<Aspect, BuildConfiguration> differentAspectsHostMap =
+    ImmutableMap<AspectDescriptor, BuildConfiguration> differentAspectsHostMap =
         ImmutableMap.of(attributeAspect, host, errorAspect, host);
-    ImmutableMap<Aspect, BuildConfiguration> differentAspectsTargetMap =
+    ImmutableMap<AspectDescriptor, BuildConfiguration> differentAspectsTargetMap =
         ImmutableMap.of(attributeAspect, target, errorAspect, target);
-    ImmutableMap<Aspect, BuildConfiguration> noAspectsMap =
-        ImmutableMap.<Aspect, BuildConfiguration>of();
+    ImmutableMap<AspectDescriptor, BuildConfiguration> noAspectsMap =
+        ImmutableMap.<AspectDescriptor, BuildConfiguration>of();
 
     new EqualsTester()
         .addEqualityGroup(