These instructions should never be present in a dex file, only in odex/oat
files. However, it's sometimes useful to be able to disassemble an otherwise
valid dex file that happens to contain odex instructions.
This fixes an issue where watches on registers (among other things) don't
work inside a method containing a switch statement, due to a failure
analyzing the method.
In some cases, scope.getProject() may be null. Apparently, IDEA will
automatically pass in the project if you specify one in the constructor.
See, e.g. MigrationElementFinder in the IDEA source.
The newer version has some fixes we need, but we should still ensure
that we can compile against the old version, since that's the version
currently in AOSP.
Previously, we only propagated the conversion if it was a narrowing
conversion, to avoid problems that can occur with member access with
widening conversions.
However, it should be safe to do the conversion for a "sideways"
conversion - one that is neither widening or narrowing.
This can happen if we don't yet have full knowledge of the register types,
or, less likely, if the "true" branch is impossible to reach.
In the first case, we should get better type info as we continue to analyze
the method, and we'll revisit the conversion once we have better type info.
Or, if it really is an impossible conversion, we still want to propagate
the type from the instance-of to the true branch.
This makes sure that all smali files are closed after writing to them by
surrounding the writer code with a try/finally block that closes the output
stream once the writing has completed or when an exception occurs.
When calling isZipFile() in ZipDexContainer, the ZipFile would remain open if
the file was in fact a zip file but the ZipFile object would then go out of
scope thus creating a resource leak. This ensures that the ZipFile is closed
by adding a finally clause containing a close call at the end of the try catch
block.
Also make invoke-polymorphic conditional on this new art version.
This also fixes a bug where the version was being selected incorrectly
due to a parameter name that shadowed a local variable.