Make ICCE logic common, refactor throws.

There were 2 sets of ICCE logic in ClassLinker::ResolveMethod and
Method::CheckIncompatibleClassChange, merged into just 1 piece of logic
in Method::CheckIncompatibleClassChange.

Move Throw... routines into own file and make adding the dex location to
the detail message more thorough.

Change-Id: I953dbfa3fed3767f35799b2f82b16637c437dbbe
diff --git a/src/object.h b/src/object.h
index 85b1721..6d686f4 100644
--- a/src/object.h
+++ b/src/object.h
@@ -2452,27 +2452,25 @@
 }
 
 inline bool Method::CheckIncompatibleClassChange(InvokeType type) {
-  bool icce = true;
   switch (type) {
     case kStatic:
-      icce = !IsStatic();
-      break;
+      return !IsStatic();
     case kDirect:
-      icce = !IsDirect();
-      break;
-    case kVirtual:
-      icce = IsDirect();
-      break;
+      return !IsDirect() || IsStatic();
+    case kVirtual: {
+      Class* methods_class = GetDeclaringClass();
+      return IsDirect() || (methods_class->IsInterface() && !IsMiranda());
+    }
     case kSuper:
-      icce = false;
-      break;
+      return false;  // TODO: appropriate checks for call to super class.
     case kInterface: {
       Class* methods_class = GetDeclaringClass();
-      icce = IsDirect() || !(methods_class->IsInterface() || methods_class->IsObjectClass());
-      break;
+      return IsDirect() || !(methods_class->IsInterface() || methods_class->IsObjectClass());
     }
+    default:
+      LOG(FATAL) << "UNREACHABLE";
+      return true;
   }
-  return icce;
 }
 
 inline void Method::AssertPcIsWithinCode(uintptr_t pc) const {