Canonicalize non default conflicting methods in jni::EncodeArtMethod

jmethodIDs returned by jni::EncodeArtMethod are used by external
interfaces (for ex: jvmti) to match methods. As an example, when single
stepping jvmti returns method id corresponding to the methods on the
stack. To map these method ids to method name / signature the method ids
are matched against the method ids returned by the GetDeclaredMethods of
the class. This generally works but breaks for copied methods. So we
should canonicalize methods before returning the method id. We already
do this when using opaque jni ids.

We shouldn't canonicalize default conflicting methods. Canonicalization
returns one of the interface methods. If this method id is used to call
the method via the CallNonVirtualMethod jni interface, the method
executes the interface method instead of throwing ICCE error.

This CL also fixes this for opaque jni ids to not canonicalize default
conflict methods.This also adds a few comments for the opaque jni ids.

Bug: 244683447
Test: art/testrunner.py -t 2243-step-default-method, 2262*
Change-Id: Ie2e9225fb8ebf5235f08345a079eb73f28f33961
31 files changed