Move DexField.holder and DexMethod.holder to DexMember.holder

Change-Id: I40d14b9b856f0b5085ec3f0b9a9f1d7f4fabcd5c
diff --git a/src/main/java/com/android/tools/r8/graph/DexField.java b/src/main/java/com/android/tools/r8/graph/DexField.java
index aafa665..02cb985 100644
--- a/src/main/java/com/android/tools/r8/graph/DexField.java
+++ b/src/main/java/com/android/tools/r8/graph/DexField.java
@@ -9,12 +9,11 @@
 
 public class DexField extends DexMember<DexEncodedField, DexField> {
 
-  public final DexType holder;
   public final DexType type;
   public final DexString name;
 
   DexField(DexType holder, DexType type, DexString name, boolean skipNameValidationForTesting) {
-    this.holder = holder;
+    super(holder);
     this.type = type;
     this.name = name;
     if (!skipNameValidationForTesting && !name.isValidFieldName()) {
diff --git a/src/main/java/com/android/tools/r8/graph/DexMember.java b/src/main/java/com/android/tools/r8/graph/DexMember.java
index 3adf342..c1be814 100644
--- a/src/main/java/com/android/tools/r8/graph/DexMember.java
+++ b/src/main/java/com/android/tools/r8/graph/DexMember.java
@@ -6,6 +6,12 @@
 public abstract class DexMember<T extends DexEncodedMember<T, S>, S extends DexMember<T, S>>
     extends DexReference implements PresortedComparable<S> {
 
+  public final DexType holder;
+
+  public DexMember(DexType holder) {
+    this.holder = holder;
+  }
+
   public abstract boolean match(S entry);
 
   public abstract boolean match(T entry);
diff --git a/src/main/java/com/android/tools/r8/graph/DexMethod.java b/src/main/java/com/android/tools/r8/graph/DexMethod.java
index 9f26c54..a29eb31 100644
--- a/src/main/java/com/android/tools/r8/graph/DexMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexMethod.java
@@ -11,7 +11,6 @@
 
 public class DexMethod extends DexMember<DexEncodedMethod, DexMethod> {
 
-  public final DexType holder;
   public final DexProto proto;
   public final DexString name;
 
@@ -19,7 +18,7 @@
   private Map<DexType, DexEncodedMethod> singleTargetCache;
 
   DexMethod(DexType holder, DexProto proto, DexString name, boolean skipNameValidationForTesting) {
-    this.holder = holder;
+    super(holder);
     this.proto = proto;
     this.name = name;
     if (!skipNameValidationForTesting && !name.isValidMethodName()) {
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index 44b16b1..2bffc6b 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -1411,10 +1411,7 @@
   private void processAnnotation(
       DexProgramClass holder, DexDefinition annotatedItem, DexAnnotation annotation) {
     assert annotatedItem == holder
-        || (annotatedItem.isDexEncodedField()
-            && annotatedItem.asDexEncodedField().field.holder == holder.type)
-        || (annotatedItem.isDexEncodedMethod()
-            && annotatedItem.asDexEncodedMethod().method.holder == holder.type);
+        || annotatedItem.asDexEncodedMember().toReference().holder == holder.type;
     assert !holder.isDexClass() || holder.asDexClass().isProgramClass();
     DexType type = annotation.annotation.type;
     recordTypeReference(type);