Make JNI work correctly with default methods.

Also adds some tests for JNI and DefaultMethods.

Bug: 27259142
Bug: 24618811

Change-Id: I31222e3e41059d803be1dbb0f40e1144ac4bf457
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index d50528e..3d31309 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -917,7 +917,7 @@
       // Copied methods may be held live by a class which was not an image class but have a
       // declaring class which is an image class. Set it to the resolution method to be safe and
       // prevent dangling pointers.
-      if (method->MightBeCopied() || !KeepClass(declaring_class)) {
+      if (method->IsCopied() || !KeepClass(declaring_class)) {
         mirror::DexCache::SetElementPtrSize(resolved_methods,
                                             i,
                                             resolution_method,