Avoid compile time rewriting of dex code by verifier.

Compile time rewriting of dex code leads to dead code that is causing
issues with the LLVM compiler. Make instantiation and incompatible class
change errors be detected in slow path field and invoke logic so its
safe for the compile time verification just to softly fail the effected
classes.

This change places incompatible class change logic into the class
linkers ResolveMethod and consequently changes a number of APIs.

Change-Id: Ifb25f09accea348d15180f6ff041e38dfe0d536e
diff --git a/src/object.cc b/src/object.cc
index c8da0fa..83994ff 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -304,6 +304,19 @@
 Class* Method::java_lang_reflect_Constructor_ = NULL;
 Class* Method::java_lang_reflect_Method_ = NULL;
 
+InvokeType Method::GetInvokeType() const {
+  // TODO: kSuper?
+  if (GetDeclaringClass()->IsInterface()) {
+    return kInterface;
+  } else if (IsStatic()) {
+    return kStatic;
+  } else if (IsDirect()) {
+    return kDirect;
+  } else {
+    return kVirtual;
+  }
+}
+
 void Method::SetClasses(Class* java_lang_reflect_Constructor, Class* java_lang_reflect_Method) {
   CHECK(java_lang_reflect_Constructor_ == NULL);
   CHECK(java_lang_reflect_Constructor != NULL);