Fix for 073-mismatched-field test

ART distinguishes between static and instance field resolution whereas
Java doesn't. Interface static fields bind more closely than those of
superclasses. Implement field resolution code for the verifier so that
it can determine incompatible class change errors when a static field
binds before an instance field.
Also don't search all iftable interfaces, search them in superclass
order (as the specification dictates).

Change-Id: I43b45bada8b9099ad805b244be10833d59bacfe3
diff --git a/src/class_linker.h b/src/class_linker.h
index 5cd72b8..db30936 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -196,6 +196,27 @@
                       const ClassLoader* class_loader,
                       bool is_static);
 
+  Field* ResolveFieldJLS(uint32_t field_idx, const Method* referrer) {
+    Field* resolved_field = referrer->GetDexCacheResolvedFields()->Get(field_idx);
+    if (UNLIKELY(resolved_field == NULL)) {
+      Class* declaring_class = referrer->GetDeclaringClass();
+      DexCache* dex_cache = declaring_class->GetDexCache();
+      const ClassLoader* class_loader = declaring_class->GetClassLoader();
+      const DexFile& dex_file = FindDexFile(dex_cache);
+      resolved_field = ResolveFieldJLS(dex_file, field_idx, dex_cache, class_loader);
+    }
+    return resolved_field;
+  }
+
+  // Resolve a field with a given ID from the DexFile, storing the
+  // result in DexCache. The ClassLinker and ClassLoader are used as
+  // in ResolveType. No is_static argument is provided so that Java
+  // field resolution semantics are followed.
+  Field* ResolveFieldJLS(const DexFile& dex_file,
+                         uint32_t field_idx,
+                         DexCache* dex_cache,
+                         const ClassLoader* class_loader);
+
   // Get shorty from method index without resolution. Used to do handlerization.
   const char* MethodShorty(uint32_t method_idx, Method* referrer);